Digging into the Physical Layer
When troubleshooting network connectivity issues on a Linux server, system administrators frequently rely on ping or ip a. However, these tools only diagnose Layer 3 (IP) routing issues. What happens when a server is successfully assigned an IP address, but data transfers to the NAS are maxing out at a sluggish 100 Mbps instead of the expected 10 Gbps?
This indicates a Layer 1 (Physical) or Layer 2 (Data Link) failure. Perhaps a technician plugged in a damaged Cat5e cable, or the managed switch port auto-negotiated to a slower duplex mode due to electromagnetic interference. To interrogate the actual physical hardware of the Network Interface Card (NIC) and view its negotiated link speed, you must use the ethtool command.
Installing Ethtool
While ethtool is standard on many enterprise distributions, it might be missing on minimal cloud images.
- Ubuntu/Debian:
sudo apt install ethtool - CentOS/RHEL:
sudo yum install ethtool
Identifying Your Interface Name
Before you can query the hardware, you must know the system name of the network adapter. Run the standard ip link command to list the interfaces.
ip link
You will see the loopback interface (lo) and your primary physical interface (e.g., eth0, ens33, or enp3s0).
Using the ethtool Command
To view the hardware specifications and the currently negotiated link status of the adapter, run ethtool followed by the interface name. Root privileges are highly recommended to ensure you can read all hardware registers.
sudo ethtool eth0
Analyzing the Output
The command will output a detailed technical breakdown of the network card’s capabilities.
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Speed: 100Mb/s
Duplex: Half
Auto-negotiation: on
Link detected: yes
This output instantly reveals the root cause of the slow data transfer:
- Supported link modes: The card hardware is capable of gigabit speeds (
1000baseT/Full). - Speed / Duplex: Despite its capabilities, the card is currently operating at a severely degraded
100Mb/sinHalfduplex mode. This is a classic symptom of a faulty physical cable or a misconfigured switch port on the other end. - Link detected:
yesconfirms that there is physical voltage on the wire (it is plugged in).
Forcefully Setting Speed and Duplex
If you know the cable is good, and you suspect the auto-negotiation protocol has simply failed, you can use ethtool to forcefully override the hardware and lock it into gigabit, full-duplex mode.
Warning: If you force these settings on a server accessed via SSH, and the switch port on the other end does not support them, the link will immediately drop, and you will lose remote access to the server.
sudo ethtool -s eth0 speed 1000 duplex full autoneg off
By executing this command, you disable auto-negotiation (autoneg off) and force the NIC to attempt a 1000 Mbps full-duplex connection. If the link establishes successfully, your data transfer bottleneck will be instantly resolved.