>_cmd.script

ethtool

Query and change network interface driver and hardware settings

Networking

By CMD Script Team · 4 min read · Last updated

SYNTAX
ethtool [OPTIONS] INTERFACE

Options

Command options and flags
FlagDescription
-iShow driver information: driver name, version, firmware version, bus info
-SShow NIC and driver statistics (packets, errors, drops) reported by the hardware
-sChange settings such as speed, duplex, and autonegotiation (requires root), e.g. -s eth0 speed 1000 duplex full autoneg off
-g / -GShow (-g) or set (-G) ring buffer sizes for RX/TX queues
-k / -KShow (-k) or set (-K) protocol offload features like tso, gso, gro, rx-checksumming
-rRestart autonegotiation on the interface

Distribution compatibility

  • Ubuntu
  • Debian
  • Fedora
  • Arch
  • macOS (not available; use System Information/networksetup instead)

What it does

ethtool queries and modifies low-level settings of a network interface's driver and hardware — link speed, duplex mode, autonegotiation, offload features (checksum offloading, TSO/GSO/GRO), ring buffer sizes, and Wake-on-LAN settings. It also surfaces hardware-reported statistics and error counters that tools like ifconfig/ip don't show. It's a Linux-only tool (built against the kernel's ethtool ioctl interface), so it isn't available on macOS.

Beginner examples

  • ethtool eth0 — show link status, speed, duplex, and autonegotiation state
  • ethtool -i eth0 — show driver name, version, and firmware version
  • ethtool -S eth0 — show hardware statistics (RX/TX packets, errors, drops)
  • ethtool -k eth0 — show which offload features are enabled/disabled
ethtool eth0

Advanced examples

  • Diagnose whether a "slow network" complaint is actually a duplex mismatch: ethtool eth0 | grep -E "Speed|Duplex|Link detected"
  • Force a specific speed/duplex when autonegotiation with an old switch is unreliable: sudo ethtool -s eth0 speed 100 duplex full autoneg off
  • Disable a problematic offload feature (e.g., a buggy TSO implementation causing checksum errors) while debugging: sudo ethtool -K eth0 tso off
  • Increase RX ring buffer size to reduce packet drops on a high-throughput interface: sudo ethtool -G eth0 rx 4096
ethtool -S eth0 | grep -i drop

Common mistakes

  • Forgetting sudo when trying to change settings with -s/-K/-G, and getting a permission-denied error.
  • Force-setting speed/duplex on one end of a link without matching it on the switch — mismatched autonegotiation settings can cause a link to work but perform terribly (classic duplex mismatch symptom: works but extremely slow with high error counts).
  • Assuming ethtool statistics counter names are standardized — they're driver-specific, so -S output varies significantly between NIC vendors/drivers.
  • Disabling offload features (-K) for a "quick fix" without understanding the performance tradeoff — disabling GRO/TSO/GSO can resolve certain bugs but increases CPU usage significantly under load.

Tips

  • Always check ethtool -i first when debugging a NIC issue — knowing the driver and firmware version quickly rules in/out known driver bugs.
  • Use ethtool -S interface | grep -i err or drop to zero in on error/drop counters without scrolling through the full statistics dump.
  • Leave autonegotiation on (the default) unless you have a specific, well-understood reason to force speed/duplex — modern equipment negotiates correctly almost always.

Best practices

  • Prefer leaving speed/duplex/autoneg on "auto" in production; only force settings when you've confirmed a specific hardware/driver incompatibility, and document why.
  • When troubleshooting throughput issues, check ethtool -S error/drop counters before assuming the problem is purely application-layer.
  • Changes made with ethtool -s/-K/-G are typically not persistent across reboots — bake them into a systemd unit, udev rule, or NetworkManager dispatcher script if they need to survive a restart.

Try it yourself

A simulated shell with a sample home directory — experiment freely, nothing leaves your browser. Type help to list supported commands.

Real-world use cases

  • Diagnosing "the network feels slow" complaints by confirming actual negotiated link speed and duplex rather than trusting switch port labels.
  • Investigating packet loss on a high-throughput server by inspecting hardware RX/TX error and drop counters that aren't visible via ifconfig/ip.
  • Tuning NIC offload features and ring buffer sizes on a database or storage server to reduce CPU overhead or packet drops under heavy load.

Common interview questions

  • What layer does ethtool operate at compared to ifconfig/ip? ethtool works at the driver/hardware level (link speed, duplex, offload features, hardware stats), while ifconfig/ip operate at the IP/link-configuration layer (addresses, routes, up/down).
  • What's a classic symptom of a duplex mismatch, and how would you check for it? A link that appears "up" but has poor throughput and high error/collision counts; check with ethtool eth0 (Speed/Duplex fields) and ethtool -S eth0 (error counters) on both ends of the link.
  • How would you check what driver and firmware version a NIC is using? ethtool -i eth0.

Frequently Asked Questions

Why does ethtool show 'Speed: Unknown!' or 'Link detected: no'?

This usually means the cable is unplugged, the switch port is down, or the interface hasn't completed autonegotiation. It's one of the first things to check when a server suddenly loses network connectivity — before assuming a software/routing problem.

Do I need root to use ethtool?

Read-only queries (-i driver info, viewing link status/speed) generally work as a non-root user. Changing settings — speed, duplex, ring buffer sizes, offload features — requires root/sudo.

What's the difference between ethtool and ifconfig/ip?

ifconfig/ip manage IP-layer configuration (addresses, routes, up/down state). ethtool operates one layer lower, at the driver/hardware level — link speed, duplex mode, offload features, and hardware statistics that ifconfig/ip don't expose.

How do I check if a NIC is actually running at the speed I expect?

`ethtool eth0` (or the interface name) prints 'Speed:' and 'Duplex:' fields directly from the driver, which is the authoritative way to confirm a link is actually negotiating 1000Mb/Full instead of falling back to 100Mb/Half due to a bad cable or mismatched switch config.

Cheat sheet

Download a quick-reference cheat sheet for ethtool.