ethtool NIC Config

ethtool cheatsheet — check NIC speed, duplex, link status, driver info, offloads. ethtool eth0, ethtool -S eth0, ethtool -k eth0. Linux network interface diagnostics.

7 min read

What it is

ethtool is a command-line utility for configuring and displaying information about network interface controllers (NICs) on Linux systems. You reach for it when you need to inspect or modify low-level network adapter settings like speed, duplex, or offloads.

Installation

Linux: ethtool is typically pre-installed on most Linux distributions. If not, you can install it using your distribution’s package manager:

  • Debian/Ubuntu:
    sudo apt update
    sudo apt install ethtool
    
  • Fedora/CentOS/RHEL:
    sudo yum install ethtool
    # or
    sudo dnf install ethtool
    
  • Arch Linux:
    sudo pacman -S ethtool
    

macOS: ethtool is not available on macOS. Use ifconfig and networksetup for similar tasks.

Windows: ethtool is not available on Windows. Use the Network Connections control panel or PowerShell cmdlets like Get-NetAdapter and Set-NetAdapter.

Core Concepts

  • NIC (Network Interface Controller): The hardware component that connects your computer to a network. ethtool interacts directly with the driver for this hardware.
  • Driver: Software that allows the operating system to communicate with the NIC hardware. ethtool settings are often dictated by what the NIC’s driver supports.
  • Link State: Refers to whether a physical connection exists between the NIC and another network device (e.g., a switch port).
  • Speed: The data transfer rate of the network connection (e.g., 1000Mb/s, 10Gb/s).
  • Duplex: Refers to whether the connection can send and receive data simultaneously (Full-duplex) or only one at a time (Half-duplex).
  • Offloads: Hardware capabilities where the NIC performs tasks that would otherwise be handled by the CPU, such as checksum calculation or packet segmentation.

Commands / Usage

Inspecting NIC Information

  • Display general settings for eth0:

    sudo ethtool eth0
    

    Shows speed, duplex, link status, and supported/advertised modes.

  • Check if the network link is up:

    sudo ethtool eth0 | grep "Link status"
    

    Output like Link status: yes indicates a physical connection.

  • Display supported and advertised link modes for eth0:

    sudo ethtool eth0 | grep Speed
    

    Shows what speeds the NIC supports and what it’s currently trying to negotiate.

  • Display Wake-on-LAN (WoL) settings for eth0:

    sudo ethtool eth0 | grep Wake-on
    

    Shows if WoL is enabled and on which events.

  • Display all offload settings for eth0:

    sudo ethtool -k eth0
    

    Lists all configurable offload features and their current status (on/off).

  • Display specific offload settings (e.g., checksumming) for eth0:

    sudo ethtool -k eth0 | grep checksum
    

    Filters the output for lines containing "checksum".

  • Display driver information for eth0:

    sudo ethtool -i eth0
    

    Shows driver name, version, firmware version, and bus info.

  • Display EEPROM (or ROM) data for eth0:

    sudo ethtool -e eth0
    

    Reads raw data from the NIC’s non-volatile memory. Useful for deep hardware inspection.

  • Display statistics for eth0:

    sudo ethtool -S eth0
    

    Shows detailed hardware and driver statistics, including packet counts, errors, and drops.

Configuring NIC Settings

  • Set eth0 to 1000Mb/s, Full-duplex, and auto-negotiation:

    sudo ethtool -s eth0 speed 1000 duplex full autoneg on
    

    This command attempts to set the specified speed and duplex mode. autoneg on tells the NIC to negotiate with the other end of the link.

  • Force eth0 to 100Mb/s, Half-duplex (disable auto-negotiation):

    sudo ethtool -s eth0 speed 100 duplex half autoneg off
    

    Forces a specific link setting, disabling negotiation.

  • Enable auto-negotiation for eth0:

    sudo ethtool -s eth0 autoneg on
    

    Re-enables automatic negotiation of speed and duplex.

  • Enable Wake-on-LAN (WoL) for eth0 (e.g., wake on magic packet):

    sudo ethtool -s eth0 wol g
    

    The g flag enables Wake-on-LAN for MagicPacket. Other flags exist for different wake events.

  • Disable Wake-on-LAN (WoL) for eth0:

    sudo ethtool -s eth0 wol 0
    

    Disables all Wake-on-LAN features.

  • Enable a specific offload feature (e.g., tx-checksumming) for eth0:

    sudo ethtool -K eth0 tx-checksumming on
    

    Turns on a specific hardware offload feature.

  • Disable a specific offload feature (e.g., rx-checksumming) for eth0:

    sudo ethtool -K eth0 rx-checksumming off
    

    Turns off a specific hardware offload feature.

  • Enable all offload features for eth0:

    sudo ethtool -K eth0 tso on gso on gro on rx on tx on
    

    Enables common TCP/IP offload features.

  • Disable all offload features for eth0:

    sudo ethtool -K eth0 tso off gso off gro off rx off tx off
    

    Disables common TCP/IP offload features.

  • Reset eth0’s offload settings to driver defaults:

    sudo ethtool -K eth0 rx on tx on sg on tso on gso on gro off lro off
    

    (Note: This is an example of common defaults; actual defaults may vary.)

  • Load EEPROM/ROM data from a file into eth0 (use with extreme caution):

    sudo ethtool -E eth0 -f /path/to/eeprom_backup.bin
    

    WARNING: This is a destructive operation and can brick your NIC if done incorrectly. Always back up first.

Other Useful Options

  • List all available network interfaces:

    ip link show
    # or
    ls /sys/class/net/
    

    ethtool requires the interface name (e.g., eth0, enp3s0, wlan0).

  • Test link integrity for eth0:

    sudo ethtool --test eth0
    

    Performs a series of tests on the NIC, including loopback tests.

  • Set the NIC’s MAC address for eth0 (requires interface down):

    sudo ip link set eth0 down
    sudo ip link set eth0 address 00:11:22:33:44:55
    sudo ip link set eth0 up
    

    Note: This requires root privileges and the interface to be down. ethtool itself doesn’t directly set the MAC address but ip link does.

Common Patterns

  • Check link status and speed for all interfaces:

    for iface in $(ls /sys/class/net/ | grep -v lo); do echo -n "$iface: "; sudo ethtool $iface | grep -E 'Speed:|Link status:'; done
    

    Iterates through non-loopback interfaces and shows their speed and link status.

  • Disable offloads to troubleshoot network issues:

    sudo ethtool -K eth0 tso off gso off gro off rx off tx off
    

    If you suspect hardware offloads are causing problems (e.g., dropped packets, slow transfers), disabling them is a common troubleshooting step. Remember to re-enable them if they don’t solve the issue.

  • Enable Wake-on-LAN globally (if supported):

    for iface in $(ls /sys/class/net/ | grep -v lo); do sudo ethtool -s $iface wol g; done
    

    Attempts to enable WoL on all non-loopback interfaces.

  • Check for specific errors in NIC statistics:

    sudo ethtool -S eth0 | grep -E 'error|drop|fail'
    

    Filters NIC statistics for lines indicating potential problems.

  • Permanently configure settings (distro dependent): ethtool settings are often lost on reboot. To make them persistent:

    • Debian/Ubuntu: Edit /etc/network/interfaces and add ethtool-opts directives or use /etc/network/if-up.d/ scripts.
    • RHEL/CentOS/Fedora: Use NetworkManager configuration files (/etc/NetworkManager/system-connections/) or scripts in /etc/sysconfig/network-scripts/ifcfg-<interface>.
    • systemd-networkd: Use .network files in /etc/systemd/network/ with [Link] options like WakeOnLan=magic.

    Example for /etc/network/interfaces (Debian/Ubuntu):

    auto eth0
    iface eth0 inet dhcp
        pre-up ethtool -s eth0 wol g
        pre-up ethtool -s eth0 autoneg off speed 1000 duplex full
    

Gotchas

  • Settings are not persistent: Most ethtool settings are temporary and will be lost upon reboot or network service restart. You need to configure your distribution’s network management system to apply them persistently.
  • Driver limitations: Not all NICs or drivers support all ethtool options. If a command fails or a setting doesn’t seem to apply, check the NIC’s documentation and driver capabilities.
  • sudo required: Modifying NIC settings requires root privileges.
  • Interface names: Ensure you are using the correct interface name (e.g., eth0, enp3s0, wlp2s0). Use ip link or ls /sys/class/net/ to find them.
  • Auto-negotiation: Forcing speed and duplex (autoneg off) can cause link failures if the settings don’t match the connected device (e.g., switch port). It’s generally best to leave autoneg on unless you have a specific reason not to.
  • Offload implications: Disabling offloads can increase CPU usage as the system takes over tasks previously handled by the NIC. While useful for troubleshooting, it may impact performance.
  • ethtool -e and ethtool -E dangers: Reading EEPROM data (-e) is generally safe, but writing (-E) is extremely dangerous and can render your NIC unusable. Always back up your EEPROM data before attempting any writes.