When diagnosing network performance issues on Linux servers, two fundamental tools often come into play: mii-tool
and ethtool
. In my recent troubleshooting session with a GbE interface (eth2
), I encountered conflicting information:
# mii-tool eth2
eth2: negotiated 100baseTx-FD flow-control, link ok
# ethtool eth2
Settings for eth2:
Speed: 1000Mb/s
Duplex: Full
mii-tool primarily works with older MII (Media Independent Interface) hardware and typically reports speeds up to 100Mbps. It's being phased out in favor of ethtool, which supports modern NICs including GbE and 10GbE interfaces.
The key distinction lies in their underlying mechanisms:
- mii-tool uses deprecated MII/PHY registers
- ethtool utilizes the modern ethtool API
To get definitive proof of the current link speed, we can check kernel messages:
# dmesg | grep -i eth2
[ 12.345678] eth2: link up (1000Mbps/Full)
Alternatively, check the speed file in sysfs:
# cat /sys/class/net/eth2/speed
1000
When dealing with modern NICs, always trust ethtool over mii-tool. Here's a reliable way to check and configure your interface:
# Force 1Gbps full duplex (temporarily)
ethtool -s eth2 speed 1000 duplex full autoneg off
# Make changes persistent (on Ubuntu)
echo "post-up ethtool -s eth2 speed 1000 duplex full autoneg off" >> /etc/network/interfaces.d/eth2.cfg
- Verify physical connection quality
ethtool --show-eee eth2 ethtool --show-fec eth2
- Check for errors that might cause fallback
ethtool -S eth2 | grep -i error
- Test with different auto-negotiation settings
for speed in 10 100 1000; do ethtool -s eth2 speed $speed duplex full autoneg on sleep 5 ethtool eth2 | grep -E "Speed|Duplex" done
In my case, the hosting provider's switch port was misconfigured to advertise only 100Mbps capabilities despite supporting 1Gbps. The resolution required coordination with their network team to:
- Update switch port configuration
- Clear error counters
- Verify end-to-end negotiation
When diagnosing network interface configurations on Linux systems, administrators often encounter conflicting information between mii-tool
and ethtool
. The core issue stems from their different approaches to interface querying:
# Traditional mii-tool output (legacy)
$ mii-tool eth2
eth2: negotiated 100baseTx-FD flow-control, link ok
# Modern ethtool output
$ ethtool eth2 | grep -E "Speed|Duplex"
Speed: 1000Mb/s
Duplex: Full
ethtool
interacts directly with network driver through ethtool_ops structure, while mii-tool
uses deprecated MII interface which doesn't properly support modern PHY features. Here's how to verify the actual link status:
# Check kernel messages for link negotiation
$ dmesg | grep eth2
[ 5.232100] igb 0000:03:00.0 eth2: igb: eth2 NIC Link is Up 1000 Mbps Full Duplex
# Alternative verification via sysfs
$ cat /sys/class/net/eth2/speed
1000
To conclusively determine the actual link speed, implement these verification steps:
#!/bin/bash
# Comprehensive network speed check script
INTERFACE="eth2"
echo "=== Driver Information ==="
ethtool -i $INTERFACE | grep -E "driver|version"
echo "\n=== Current Settings ==="
ethtool $INTERFACE | grep -E "Speed|Duplex|Auto-negotiation"
echo "\n=== Hardware Detection ==="
lspci -v | grep -A 10 -i "ethernet"
echo "\n=== Traffic Test ==="
iperf3 -c testserver.example.com -t 20 -P 4
When facing speed mismatches, consider these technical factors:
- Switch port configuration mismatches (especially with auto-negotiation disabled)
- Cable quality issues (Cat5e minimum for GbE, check for CRC errors)
- Driver/firmware incompatibilities (check
ethtool -i
output) - Power saving features affecting negotiated speed
For modern Linux systems (kernel 2.6.23+), always prefer ethtool
as it:
- Supports newer PHY standards (including 2.5G/5G/10G)
- Provides more detailed link partner information
- Offers better error reporting capabilities
- Includes advanced statistics (
ethtool -S
)