LinuxCommandLibrary

ethtool

Display or change Ethernet card settings

TLDR

Display the current settings for an interface

$ ethtool [eth0]
copy

Display the driver information for an interface
$ ethtool [[-i|--driver]] [eth0]
copy

Display all supported features for an interface
$ ethtool [[-k|--show-features]] [eth0]
copy

Display the network usage statistics for an interface
$ ethtool [[-S|--statistics]] [eth0]
copy

Blink one or more LEDs on an interface for 10 seconds
$ ethtool [[-p|--identify]] [eth0] [10]
copy

Set the link speed, duplex mode, and parameter auto-negotiation for a given interface
$ ethtool [[-s|--change]] [eth0] speed [10|100|1000] duplex [half|full] autoneg [on|off]
copy

SYNOPSIS

ethtool [ -h | --help | -v | --version ]
ethtool <device_name>
ethtool [ -a | -c | -g | -i | -k | -p | -S | -t | -r ] <device_name>
ethtool -s <device_name> [ speed N ] [ duplex D ] [ autoneg A ] [ ... ]
ethtool --show-priv-flags <device_name>
ethtool --set-priv-flags <device_name> <flag> on|off

PARAMETERS


    The name of the network interface (e.g., eth0, enp0s3) to query or modify.

-a, --show-all
    Displays auto-negotiation information and currently advertised/link modes.

-c, --show-coalesce
    Shows the coalesce parameters, which control interrupt moderation.

-g, --show-ring
    Displays the sizes of the receive (RX) and transmit (TX) ring buffers.

-i, --driver
    Provides information about the network device driver, firmware version, and bus info.

-k, --show-offload
    Shows the current offload settings for features like checksum, TSO, GSO, and LRO.

-p, --identify
    Initiates port identification by making the network adapter's LED blink for a specified duration (default 2 seconds).

-r, --reset
    Resets the device, typically flushing internal state and potentially reinitializing the hardware.

-S, --statistics
    Reports network device statistics (e.g., packet counts, error rates) as provided by the driver.

-s, --change
    Modifies specific parameters of the network device. Common sub-options include:
speed N: Sets the network speed (e.g., 10, 100, 1000).
duplex half|full: Sets the duplex mode (half or full).
autoneg on|off: Enables or disables auto-negotiation.
advertise N: Specifies the speeds and modes to advertise during auto-negotiation.

-t, --test
    Executes a set of self-tests on the network adapter, useful for diagnosing hardware issues.

--show-priv-flags
    Displays private flags, which are specific to the network device driver and hardware.

--set-priv-flags on|off
    Sets a specific private flag to on or off, controlling driver-specific behaviors.

DESCRIPTION

ethtool is a powerful Linux command-line utility used for querying and controlling parameters of network interface cards (NICs) and their associated device drivers. It provides a standardized interface to inspect and modify various low-level settings that are often specific to the hardware and its kernel driver. With ethtool, administrators can view crucial information such as link speed, duplex mode, auto-negotiation status, and link state. Beyond mere inspection, it enables modification of these parameters, as well as configuration of advanced features like checksum offloading, TCP segmentation offloading (TSO), generic segmentation offloading (GSO), and ring buffer sizes. It can also be used to query driver and firmware versions, run self-tests on the hardware, or even make the NIC's LEDs blink for physical identification. By interacting with the kernel's network device subsystem primarily through ioctl system calls, ethtool is an indispensable tool for network troubleshooting, performance tuning, and optimizing network configurations in Linux environments.

CAVEATS

Most operations that modify network device settings with ethtool require root privileges. Without appropriate permissions, many commands will fail or only show limited information.

Changes made using ethtool -s are typically not persistent across system reboots or network service restarts. For permanent configuration, settings should be integrated into network configuration files (e.g., /etc/network/interfaces, NetworkManager profiles, systemd-networkd configurations) or executed via startup scripts.

DRIVER AND HARDWARE DEPENDENCY

The functionality and available options within ethtool are highly dependent on the specific network interface card (NIC) hardware and its corresponding Linux kernel driver. Not all drivers support all ethtool features, and certain options may not be available or may behave differently across various hardware platforms.

NETWORKING DAEMONS INTEGRATION

When using network management daemons like NetworkManager or systemd-networkd, it's generally recommended to configure network settings through their respective mechanisms rather than direct ethtool commands to ensure consistency and persistence. ethtool is best suited for real-time diagnostics and temporary adjustments.

HISTORY

ethtool emerged as a modern and standardized utility for controlling Ethernet devices, largely superseding older, more limited tools like mii-tool. Its development was driven by the increasing sophistication of network interface cards and the need for a unified interface to manage diverse hardware features, including advanced offloading capabilities and power management. While some parts of the kernel's network stack moved to Netlink, ethtool historically and predominantly communicates with network device drivers using the ioctl system call interface, allowing direct interaction with driver-specific functions. It has been a standard and essential component of Linux distributions for many years, evolving alongside kernel network subsystem changes to provide comprehensive network configuration and diagnostic capabilities.

SEE ALSO

ip(8), ifconfig(8), netstat(8), ss(8), mii-tool(8), lshw(1), lspci(8)

Copied to clipboard