SkillPilotAI

ethtool (1/2)

ethtool talks directly to the network card (NIC) and its driver on Linux: speed, duplex, auto-negotiation, offloads, pause frames, ring buffers, coalescing, counters and Wake-on-LAN. Part 1 covers the core options, tried on a Docker veth where hardware features honestly say Not supported.

185.1 Why is it used?

  • Check what the link actually negotiated: speed, duplex, link detected.
  • Find the driver and firmware of a NIC (-i) when filing a bug or checking compatibility.
  • Turn offloads (TSO, GRO, checksum) on or off while debugging captures or performance.
  • Tune ring buffers and interrupt coalescing when packets are missed under load.
  • Read NIC counters (-S) to separate cable problems from load problems.
  • Linux only (package ethtool). Reading works as a user; changing needs root. Changes are lost on reboot.

185.2 How it works

  • ethtool talks to the kernel over the generic netlink family "ethtool" (CONFIG_ETHTOOL_NETLINK); the driver answers or says Not supported.
  • Auto-negotiation: when the cable goes in, NIC and switch port advertise their modes and both pick the fastest common one.
  • Inside the NIC: packets land in the RX ring buffer, interrupts are raised per batch (coalescing), and pause frames ask the sender to stop when the ring fills.
Auto-negotiation
  1. 1.Cable from the Linux server eth0 goes into switch port 7

  2. 2.Server NIC advertises 100/1000 Full

  3. 3.Switch port advertises its own modes

  4. 4.Both pick the fastest common mode

  5. 5.Link up at 1000 Mb/s Full: ethtool eth0 shows this result

Ring buffer, coalescing and pause frames
  1. 1.Backup server (10G) sends a lot of data through the switch

  2. 2.Linux server NIC puts packets into the RX ring (256 slots)

  3. 3.Interrupt coalescing: one interrupt per batch, not per packet

  4. 4.Ring starts filling up

  5. 5.NIC sends a pause frame; the switch stops sending for a short while

Tuned with -a/-A (pause), -c/-C (coalescing), -g/-G (rings)

185.3 Lab setup: eth0 is a veth

  • Container n185-lab eth0 (192.168.205.10) is a veth: a virtual cable whose other end is on the Docker bridge (192.168.205.1).
  • No PHY or firmware, so many hardware commands say Not supported.
  • ETHTOOL_NETLINK and VETH are built in (=y), so no module is loaded; /proc/modules stayed the same.
Terminal
zcat /proc/config.gz | grep -E \  "^CONFIG_(ETHTOOL_NETLINK|VETH)="ls /sys/class/netip -br addr show eth0
Output
$ ls /sys/class/neteth0lo$ ip -br addr show eth0eth0@if1312      UP             192.168.205.10/24

185.4 General options and --monitor

CommandWhat it does
ethtool eth0Link settings (veth: 10000Mb/s Full, fixed values, no negotiation)
ethtool -h | --helpShort help
ethtool --versionVersion (6.7 in the lab)
ethtool --debug 0x01 -i eth0Parser debug mask
ethtool --json -S eth0JSON output (only some commands; -S gave bad argument in 6.7)
ethtool -I -a eth0Add related statistics
--src aggregate|emac|pmacStats source on NICs with MAC Merge
ethtool --monitor [--all | -s eth0 | -k]Listen to netlink notifications (all, link only, features only)
Terminal
(timeout 4 ethtool --monitor -k eth0 \  > /tmp/mon.txt 2>&1 &)sleep 1; ethtool -K eth0 tx offsleep 1; ethtool -K eth0 tx onsleep 3grep -E \ "^(listening|Features for|tx-checksumming)" \ /tmp/mon.txt
Output
$ grep -E "^(listening|Features for|tx-checksumming)" /tmp/mon.txtlistening...Features for eth0:tx-checksumming: offFeatures for eth0:tx-checksumming: on

185.5 Driver, address and identification

Terminal
ethtool -i eth0ethtool -P eth0ethtool -T eth0ethtool -p eth0 1
Output
$ ethtool -T eth0PTP Hardware Clock: noneHardware Transmit Timestamp Modes: none$ ethtool -p eth0 1Cannot identify NIC: Not supported
OptionShows / doesOn veth
-iDriver, firmware, bus infodriver veth, firmware and bus empty (not PCI)
-PPermanent MACpermanent address not set
-TTimestamping, PTP clocksoftware timestamping only
-p [sec]Blink the port LED (Ctrl+C or N seconds)Not supported
--show-tunnelsUDP ports for VXLAN/GENEVE offload-

185.6 Pause, coalescing and ring buffers

Terminal
ethtool -a eth0ethtool -A eth0 rx onethtool -c eth0ethtool -C eth0 rx-usecs 50ethtool -g eth0ethtool -G eth0 rx 512
Output
$ ethtool -a eth0netlink error: Not supported$ ethtool -A eth0 rx onnetlink error: Not supported$ ethtool -c eth0netlink error: Not supported$ ethtool -C eth0 rx-usecs 50netlink error: Not supported$ ethtool -g eth0netlink error: Not supported$ ethtool -G eth0 rx 512netlink error: Not supported
AreaShow / setKey options
Pause (flow control)-a / -Aautoneg on|off, rx on|off (obey pause), tx on|off (send pause)
Coalescing (28 options)-c / -Crx-usecs, rx-frames, tx-usecs, tx-frames, adaptive-rx|tx on, pkt-rate-low/high, cqe-mode-rx|tx, tx-aggr-*
Ring buffers (13 options)-g / -Grx 4096, tx 4096, rx-mini, rx-jumbo, rx-buf-len, tcp-data-split auto|on|off, cqe-size, tx-push/rx-push
  • -g shows current and maximum ring size; if rx_missed grows, raise the ring with -G.
  • adaptive-rx on lets the driver change coalescing by load itself.

185.7 Registers, EEPROM and firmware dumps

Terminal
ethtool -d eth0ethtool -e eth0ethtool -w eth0
Output
$ ethtool -d eth0Cannot get register dump: Not supported$ ethtool -e eth0Cannot get EEPROM data: Not supported$ ethtool -w eth0Can not get dump level: Not supported
  • -d register dump (raw on > regs.bin, hex on, file regs.bin to decode later); -e EEPROM (offset/length for a part).
  • -w / -W firmware dump flag and level, data fwdump.bin to save it for vendor support.
  • -E writes the EEPROM and -f flashes firmware: only on vendor instructions.

185.8 Offloads and features: -k / -K

Terminal
ethtool -k eth0
Output
$ ethtool -k eth0Features for eth0:rx-checksumming: ontx-checksumming: onscatter-gather: ontcp-segmentation-offload: ongeneric-segmentation-offload: ongeneric-receive-offload: offlarge-receive-offload: off [fixed]rx-vlan-offload: ontx-vlan-offload: onntuple-filters: off [fixed]receive-hashing: off [fixed]
Short name (-K)Feature
rx | txChecksum offload
sgScatter-gather
tso | ufo | gsoSegmentation offload (TCP/UDP/generic)
gro | lroReceive offload
rxvlan | txvlanVLAN acceleration
ntuplentuple filters
rxhashReceive hashing
  • TSO/GSO on = splitting big TCP segments is taken off the CPU.
  • [fixed] features (like LRO here) cannot be changed on this driver.
  • One command can change many: ethtool -K eth0 gro off lro off; any -k name works (rx-gro-hw).

185.9 Link control and statistics

Terminal
ping -c 3 -q 192.168.205.1ethtool -S eth0ethtool -S eth0 --all-groupsethtool -r eth0ethtool -t eth0
Output
$ ethtool -S eth0 --all-groupsStandard stats for eth0:$ ethtool -r eth0Cannot restart autonegotiation: Not supported$ ethtool -t eth0Cannot test: Not supported
  • -S shows driver counters; on veth: peer_ifindex 1312 (host end) and per-queue XDP counters.
  • --groups eth-phy | eth-mac | eth-ctrl | rmon for standard counters; --phy-statistics for PHY stats.
  • -r restarts autoneg; -t self-test: offline (full, interrupts traffic), online, external_lb (needs a loopback plug).

185.10 Link settings, Wake-on-LAN and msglvl: -s

Real NIC example from the kernel docs (10G Aquantia card), since the lab has no real NIC:

Output
  Advertised pause frame use: Symmetric  Advertised auto-negotiation: Yes  Speed: 10000Mb/s  Duplex: Full  Port: Twisted Pair  Auto-negotiation: on  Supports Wake-on: g  Wake-on: d  Link detected: yes
Terminal
ethtool -s eth0 speed 1000 \  duplex full autoneg offethtool -s eth0 wol gethtool -s eth0 msglvl drv onethtool eth0 | grep -E "Speed|Duplex|Auto-neg"
Output
$ ethtool -s eth0 msglvl drv onnetlink error: Not supported$ ethtool eth0 | grep -E "Speed|Duplex|Auto-neg"    Speed: 10000Mb/s    Duplex: Full    Auto-negotiation: off
-s settingExample / values
speed, duplex, lanesspeed 1000 duplex full; lanes 4
autonegon | off (force only if the switch port matches)
port, mdixtp | aui | bnc | mii; mdix auto | on | off
master-slavepreferred-master | forced-slave ...
advertise0x020 (bit 5 = 1000baseT/Full) or 1000baseT/Full on
wolp u m b a g s f d (g = MagicPacket, d = disable), combine like ubg
sopass01:23:45:67:89:ab (SecureOn WoL password)
msglvldrv 0x0001, probe, link 0x0004, ifup/ifdown, rx_err 0x0040, tx_err 0x0080 ...
  • advertise takes link-mode bits: bit N = hex 1<<N. 89 modes from 10baseT to 800000base (T = copper, SR/LR = fiber, number after = lanes, e.g. CR4).
  • Examples: 1000baseT/Full 5, 10000baseT/Full 12, 25000baseSR 33, 100000baseSR4 37.

185.11 Common mistakes

  • Forcing speed on the server while the switch is on autoneg: the switch falls back to half duplex, collisions go up (duplex mismatch).
  • Forgetting ethtool changes reset on reboot: persist them in NetworkManager/systemd-networkd.
  • A gigabit port showing 100Mb/s Half: check the cable (gigabit needs 4 pairs) and switch port, keep autoneg on both sides.
  • Reading Not supported as a bug: it means the driver (like veth) has no such hardware.

185.12 Interview tips

  • rx_crc_errors growing = physical layer: cable, SFP, switch port.
  • rx_missed / no_buffer growing = load: increase ring buffer (-G) or tune coalescing (-C).
  • -i driver, -k offloads, -S counters, -s change settings, -a/-c/-g pause/coalescing/rings.
  • Keep autoneg on at both ends rather than forcing speed.