Blog

Checking a NIC's Physical State with ethtool: Link Speed, Duplex, Auto-Negotiation and Wake-on-LAN

Use ethtool to see what ifconfig and ip addr cannot: the speed in Mb/s a NIC has actually linked at, and whether it is full or half duplex. Covers reading the output, suspecting the cable when a link drops to 100Mb/s, duplex mismatches, isolating Link detected: no, configuring Wake-on-LAN, the -i/-S/-k/-p options, caveats in virtual machines, and when to use ip link or /sys instead.

Illustration of a LAN cable running from a server's network card to a switch port, with the port's link lamp lit green and a speedometer gauge above
Contents

Everyone knows ifconfig (or ip addr these days) for checking an IP address. Ask for the command that shows an interface’s physical state, though, and a surprising number of people draw a blank. That command is ethtool.

# ethtool eth0

The output looks like this.

Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: umbg
        Wake-on: g
        Current message level: 0x00000003 (3)
        Link detected: yes

“Hang on, is this NIC even Gigabit Ethernet? Was it?” Basic facts like that have a way of slipping your mind right in the middle of a build or an outage. Staring at ifconfig or /etc/sysconfig/network-scripts/ifcfg-eth0 won’t tell you what the NIC supports or what speed it is actually linked at right now. For those occasional moments when you need that level of detail, ethtool is worth remembering.

This article covers which parts of the output to look at, the situations where it helps, and a few extra options that pay off if you know them.

Getting started: installation and permissions

Most distributions ship it, but a minimal install may not include it.

sudo dnf install ethtool    # RHEL / Rocky / AlmaLinux / Fedora
sudo apt install ethtool    # Debian / Ubuntu

A regular user can run it, but some items such as the Wake-on-LAN settings cannot be read, and you get messages like Cannot get wake-on-lan settings: Operation not permitted. Add sudo if you want to see everything. On older RHEL-family systems /usr/sbin is not in a regular user’s PATH, so you may also get command not found; in that case, too, try sudo first.

One more thing: on recent systems there is often no interface called eth0 at all. Since systemd, interfaces get names based on the NIC’s physical location, such as enp0s3, eno1 or ens192. If you don’t know the name, list the interfaces first.

$ ip -br link
lo               UNKNOWN        00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
enp0s3           UP             08:00:27:6a:1f:c2 <BROADCAST,MULTICAST,UP,LOWER_UP>

The examples below use eth0; substitute the name on your own system.

Which lines of the output matter

You don’t need to memorise every line. These are the ones you will normally look at.

Field Meaning What to check
Supported link modes Speeds and duplex modes the NIC supports If 1000baseT/Full is listed, it supports Gigabit
Advertised link modes What the NIC tells its link partner “I can do” during auto-negotiation If a supported mode is missing from the advertisement, someone has restricted it
Speed / Duplex The speed and full/half duplex the link is actually running at right now Is it what you expect? This is the main point
Auto-negotiation Whether speed and duplex are agreed automatically with the partner Normally on
Link detected Whether the link is physically up If no, suspect the cable or the port on the other side
Supports Wake-on / Wake-on Wake-on-LAN support and current setting See below

Port tells you whether it is copper (Twisted Pair) or fibre (FIBRE), and PHYAD and Transceiver give the PHY chip’s address and whether it is internal or external; you rarely need to care about them. Current message level sets how verbose the driver is in the kernel log, and you won’t touch it either unless you are investigating the driver.

Newer versions of ethtool may also show MDI-X (automatic straight/crossover detection) and Link partner advertised link modes. The latter is what the other side (the switch) advertised, and if the driver supports it, it is directly useful for investigating a duplex mismatch.

When ethtool earns its keep

This is the one you’ll run into most often. The NIC supports Gigabit, the switch supports Gigabit, yet file copies top out at around 11 MB/s for no obvious reason. Run ethtool and it says Speed: 100Mb/s.

1000BASE-T uses all four pairs (eight wires) in a LAN cable, but 100BASE-TX uses only two pairs. So if one of the unused wires is broken or a connector is poorly crimped, the link still comes up, just at 100Mb/s. Old Cat5 cables, home-made cables and cables that have been stepped on inside a rack are the usual suspects. If swapping the cable brings it back to Speed: 1000Mb/s, you’ve found it.

When the speed drops to a tenth, transfer time grows almost tenfold. A 10 GB backup takes just under two minutes at 1000Mb/s but over 13 minutes at 100Mb/s, and people often only notice once the nightly batch stops finishing on time. To get a feel for the actual times, plug different speeds into the File Transfer Time Calculator.

Speed looks fine but it’s slow or stalls now and then (duplex mismatch)

Here the link shows Speed: 100Mb/s and one side is at Duplex: Half. Ping works normally and light traffic is fine, but pushing a large file becomes extremely slow.

The typical cause is a setup where speed and duplex are fixed on one side only and the other side is left on auto-negotiation. The auto-negotiating side receives no advertisement from its partner, so although it can work out the speed from the signal, it cannot tell the duplex, and as the standard requires, it falls back to half duplex. The result is a mismatch: “fixed side at full duplex, auto-negotiating side at half duplex”. Collisions (especially late collisions) pile up on the half-duplex side and CRC errors on the full-duplex side.

There used to be a common practice of “fixing the speed on network equipment is safer”, and people hit this when only the server side gets replaced. The quickest check is to confirm your own duplex with ethtool and compare it with the switch port’s settings (on Cisco, for example, Full-duplex, 100Mb/s in show interfaces). To fix it, either set both sides to auto-negotiation or fix both sides to the same values.

The cable is plugged in but the link won’t come up. In this case, roughly this order works.

  1. Is the cable actually seated, and is the link lamp on the switch port lit?
  2. Has the switch port been shut down, or is it stuck in err-disabled?
  3. Is the interface itself down on the OS side?

The third is easy to overlook. With some drivers, taking the interface down with ip link set eth0 down also stops the PHY, and ethtool reports Speed: Unknown!, Duplex: Unknown! (255) and Link detected: no. It can look like a cable problem when the OS simply hasn’t brought the interface up, so check state with ip link before heading to the site.

When four or six identical ports sit side by side on the back of a server, you can’t tell which one is eth2. In that case -p makes that port’s LED blink.

sudo ethtool -p eth2 30

The port’s lamp flashes for 30 seconds (omit the number and it keeps going until you press Ctrl+C). It is a quiet lifesaver when you are on the phone with someone in a data centre and can say “plug the cable into the port that’s blinking now”. On NICs whose driver doesn’t support it, you get Operation not supported.

You want to use Wake-on-LAN

Supports Wake-on shows the wake conditions the NIC supports, and Wake-on shows the ones currently enabled. Each letter has a meaning.

Letter Wake condition
p PHY activity (e.g. the link coming up)
u Unicast addressed to this host
m Multicast
b Broadcast
a ARP
g Magic packet
s Magic packet with password (SecureOn)
d Disabled

The example at the top shows Supports Wake-on: umbg and Wake-on: g, so waking by magic packet is enabled. With Wake-on: d it is disabled, and sending a magic packet won’t wake the machine. To enable it:

sudo ethtool -s eth0 wol g

However, this setting often reverts after a reboot. On systems using NetworkManager, it is more reliable to write it into the connection profile (check the connection name with nmcli connection show).

sudo nmcli connection modify "Wired connection 1" 802-3-ethernet.wake-on-lan magic

Wake-on-LAN also has to be enabled in the BIOS/UEFI settings, before the OS ever gets involved. If the OS side says g and the machine still won’t wake, look for BIOS items such as “Wake on LAN” or “Power On By PCI-E”. From the waking side, send a magic packet to the target’s MAC address with a command such as wakeonlan or etherwake.

Changing settings with -s, and what to watch out for

ethtool -s lets you change speed and duplex.

# Fix at 100Mb/s full duplex (turn off auto-negotiation)
sudo ethtool -s eth0 speed 100 duplex full autoneg off

# Go back to auto-negotiation
sudo ethtool -s eth0 autoneg on

# Restart auto-negotiation (similar to re-plugging the cable)
sudo ethtool -r eth0

There are three things to be careful about here.

First, changing it remotely may cut you off. Changing the speed takes the link down once and triggers renegotiation, and if it doesn’t match the other side, you lose connectivity altogether. If you are touching the very interface you are SSHed in on, secure a console or another path first.

Second, 1000BASE-T is a standard that assumes auto-negotiation. Things like master/slave selection are decided through auto-negotiation, so speed 1000 duplex full autoneg off may be rejected or may not behave as expected, depending on the NIC and driver. If you really want to pin the link at Gigabit, leave auto-negotiation on and restrict the advertised modes to 1000baseT/Full only.

sudo ethtool -s eth0 advertise 0x020

0x020 is the bit for 1000baseT/Full; 0x008 is 100baseT/Full and 0x002 is 10baseT/Full. Newer versions of ethtool also accept names, as in advertise 1000baseT/Full.

Finally, changes made with ethtool -s are lost on reboot. To keep them, write them into whatever network management system you use.

# NetworkManager
sudo nmcli connection modify "Wired connection 1" \
  802-3-ethernet.auto-negotiate no 802-3-ethernet.speed 100 802-3-ethernet.duplex full

With the old RHEL-style ifcfg-eth0, use ETHTOOL_OPTS="speed 100 duplex full autoneg off"; with systemd-networkd, put BitsPerSecond=100M, Duplex=full and AutoNegotiation=no under [Link] in a .link file. Note that from RHEL 9 onward, network-scripts/ifcfg-* itself is deprecated in favour of NetworkManager’s keyfile format.

Options worth knowing

Beyond ethtool eth0, a few options come up often when troubleshooting.

-i: check the driver and firmware

$ ethtool -i eth0
driver: e1000e
version: 6.8.0-49-generic
firmware-version: 0.13-4
expansion-rom-version:
bus-info: 0000:00:1f.6
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: yes

This shows which driver is in use and the firmware version. It is what you compare against vendor known issues such as “the link becomes unstable with a particular firmware”, and the first thing a support desk will ask for. bus-info is the PCI address; match it against lspci output to work out which physical card it is.

-S: look at the NIC’s statistics counters

sudo ethtool -S eth0 | grep -iE 'err|drop|miss|coll|crc'

This prints the detailed counters the NIC keeps. Counter names differ by driver, but on Intel NICs you’ll see names like rx_crc_errors (CRC errors), rx_missed_errors (frames dropped because reception couldn’t keep up) and tx_abort_late_coll (late collisions). If CRC errors keep rising, suspect the cable or connector, or a duplex mismatch; if missed frames keep rising, suspect insufficient receive capacity.

The key point is that a single look tells you little. The counters are cumulative since boot, so wait a few tens of seconds, look again, and see whether they are increasing. If missed frames are increasing, check the size of the receive ring buffer with ethtool -g eth0; if there is headroom up to the maximum, raising it with something like ethtool -G eth0 rx 4096 can help.

-k: check offload features

$ ethtool -k eth0 | head
Features for eth0:
rx-checksumming: on
tx-checksumming: on
        tx-checksum-ipv4: off [fixed]
        tx-checksum-ip-generic: on
scatter-gather: on
tcp-segmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on
large-receive-offload: off [fixed]

This shows the state of offloads, features that let the NIC do work such as checksum calculation and TCP segmentation instead of the CPU. Items marked [fixed] cannot be changed.

Knowing this helps when you watch traffic with tcpdump. You may be startled to see every outgoing packet’s checksum shown as incorrect, or packets of nearly 64 KB, far larger than the 1500-byte MTU. That is because at the moment of capture the NIC hasn’t yet calculated the checksum or split the packet; the packets that actually go out on the wire are fine. If you really need to see them as they appear on the wire, temporarily turn the offloads off with something like sudo ethtool -K eth0 tso off gso off gro off (uppercase -K changes settings). Performance drops, so turn them back on when you’re done.

-m: read optical module (SFP) information

On a NIC with Port: FIBRE, if the driver and module support it, sudo ethtool -m eth0 reads the SFP module’s part number, wavelength, received optical power and so on. When a fibre link drops or is unstable, use it to confirm that the received power is within spec.

If all you need is whether the link is up, ip link will tell you.

$ ip link show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff

UP means the interface is enabled on the OS side, and LOWER_UP means the link is physically up. If the cable is unplugged, NO-CARRIER appears and the state becomes state DOWN. ip -s link show eth0 also shows send/receive error and drop counts.

Speed and duplex can also be read from /sys.

$ cat /sys/class/net/eth0/speed /sys/class/net/eth0/duplex /sys/class/net/eth0/carrier
1000
full
1

In a container or a minimal machine without ethtool, this is enough when you just want the speed. Information such as the speeds the NIC supports, what it advertises to its partner, Wake-on-LAN and driver statistics, however, is only available through ethtool. A sensible split is to use ip day to day and reach for ethtool when you suspect the physical layer.

Don’t take the numbers in a virtual machine at face value

Run ethtool inside a virtual machine and you get different results from a physical server.

  • KVM’s virtio-net often reports Speed: Unknown! and Duplex: Unknown! (255) (some environments set an arbitrary value).
  • VMware’s vmxnet3 reports Speed: 10000Mb/s regardless of the actual line.
  • Emulated NICs such as e1000 may show 1000Mb/s, but it is only a virtual value.

In every case, this is the value the virtual NIC claims, not the speed of the host’s physical NIC or the line beyond it. When a virtual machine is slow, what you should look at is ethtool output for the physical NIC on the host. Likewise, running ethtool on a Wi-Fi interface tells you very little; check the wireless link rate with iw dev wlan0 link.

The first line to type when the network misbehaves

When someone says the network is slow or won’t connect, it’s tempting to start with IP addresses, routing or the firewall. But if the physical layer underneath has fallen back to 100Mb/s half duplex, no amount of staring at the upper layers will give you the answer.

Typing ethtool eth0 and reading just three lines, Speed, Duplex and Link detected, takes a few seconds. Whenever you find yourself wondering “is this NIC Gigabit?”, type this one line first and you’ll save yourself a detour.

Conversely, once you’ve confirmed the physical layer is healthy and want to test “how does the app behave over a distant site or a slow line?”, you can deliberately add delay with Linux’s tc. I’ve written that up in Simulating WAN Latency with Linux tc.