Sometimes you plug in a server or workstation that should run at e.g 1 Gbit/s, but monitoring or
$ cat /sys/class/net/IFACE/speed
only shows 100 Mbit/s. The cables look fine, the switch port is fine, yet the link negotiates at the wrong speed. This usually happens because of autonegotiation mismatches or misconfigured switch ports.
In these cases, you can use ethtool to check the current link parameters and force your network interface card (NIC) to renegotiate at the correct speed. This is useful when:
- A server negotiates 100 Mbit/s instead of 1 or 10 Gbit/s but all layer 1 (Physical) connections work at the desired speed.
- You suspect a mismatch in duplex settings between NIC and switch.
- You need to quickly verify or reset link parameters without rebooting.
For this, you need to have ethtool installed on your system:
$ sudo apt install ethtool -y
The commands below show you how to inspect and adjust the NIC speed and duplex settings directly from your shell.
To check the current link speed, you can use the following command. Replace "IFACE" with the name of the interface.
$ cat /sys/class/net/IFACE/speed
This command forces a renegotiation at 1 Gbit/s:
$ sudo ethtool -s IFACE speed 1000 duplex full autoneg on
Now check /sys/class/net/IFACE/speed again to see if the interface has the desired speed.