
ethtool Command in Linux
Linux provides a useful command line tool ethtool to manage and troubleshoot the network interfaces. It lets us fetch network interface details like speed, duplex mode, and driver information. Also, it allows adjustments to parameters such as auto-negotiation, speed settings, and offload options.
System administrators frequently use the ethtool for network diagnostics and performance optimization.
Table of Contents
Here is a comprehensive guide to the options available with the ethtool command in linux −
- Prerequisites to Use ethtool
- How to use ethtool in Linux?
- Manage Ethernet Flow Control with ethtool
- Modify PAUSE Parameters Using ethtool
- Test Network Interface Devices Using ethtool
- Configure Network Interface Device Settings Using ethtool
Prerequisites to Use ethtool
ethtool must be pre-installed on your Linux system. You can verify its existence by running the following command −
sudo ethtool --version
The output shows ethtool version 6.7 is installed on our machine −

If this command shows an error, ethtool is not installed on our system. In that case, you can use apt, yum, or dnf package manager to install it on Ubuntu, CentOS, or Fedora, respectively.
How to use ethtool in Linux?
To use this tool in Linux write ethtool followed by the interface name to show and modify the settings of your network interface card −
ethtool interfaceName
Here, interfaceName refers to a network interface whose information you want to query. For better understanding, you can visit the manual page of the ethtool by running the following command −
man ethtool

Now lets learn how the ethtool works in Linux using different use cases.
How to Get Network Interface Device Properties?
We can get the basic properties of a network interface device by executing the ethtool command followed by the device's name, as shown below −
sudo ethtool enp0s3
In the command above, we use ethtool followed by the enp0s3 network interface to retrieve its properties. The following output shows the network interface details like the devices speed, duplex settings, and supported link modes −

How to Get Device Driver Properties?
You can run the ethtool command with the --driver option to get the device drivers properties. Here is an example case −
sudo ethtool --driver enp0s3
In the above command, we run the ethtool to check the information about the driver associated with the enp0s3 network interface. As a result, this command retrieves the driver name and device version. It also indicates whether the device supports features like statistics collection, tests, etc −

Alternatively, you can run the ethtool with the -i option to get the supported features of a network interface −
sudo ethtool -i enp0s3

How to Get Device Statistics?
You also collect statistics of a Network interface device using the ethtool, such as the number of packets sent and received, and track metrics like errors and dropped packets. The specific statistics you get from the ethtool -S command depend on the device and its driver. For this purpose, you must run the ethtool command with the --statistics (or -S) option to access these details −
sudo ethtool --statistics enp0s3
The output shows the statistics of the Network interface device enp0s3. The statistics include basic metrics like the number of packets and bytes received and transmitted, dropped packets, etc −

Manage Ethernet Flow Control with ethtool
In Ethernet networks, the PAUSE frame mechanism manages traffic congestion. If one end of the connection becomes overloaded, it can send a PAUSE frame to the other end. This frame temporarily halts data transmission, allowing the receiver to catch up. You can use the ethtool command to view and manage settings related to PAUSE frames and flow control. Lets learn how to use the ethtool to query and configure the parameters associated with the PAUSE frame mechanism.
How to Get PAUSE Parameters?
You can run the ethtool command with the -show-pause option to get the details about the pause parameters of the specified device −
sudo ethtool --show-pause enp0s3
We observe that the Ethernet device enp0s3 has RX and Autonegotiate parameters enabled, while TX is disabled −

Next, let's explore how to adjust these settings.
Modify PAUSE Parameters Using ethtool
You can modify the PAUSE parameters by running the ethtool command with the --pause option followed by the parameter name and its desired state (on or off). For instance, to configure the auto-negotiation parameter for PAUSE, specify autoneg as follows −
sudo ethtool --pause enp0s3 autoneg off
The above command will disable the autonegotiate parameter −

Lets verify if the auto negotiate parameter is disabled or not by running the following command −
sudo ethtool --show-pause enp0s3

Similarly, you can re-enable the autonegotiate parameter using the following command −
sudo ethtool --pause enp0s3 autoneg on
Also, you can enable or disable the RX and TX parameters by executing the following commands −
sudo ethtool --pause enp0s3 rx off sudo ethtool --pause enp0s3 rx on sudo ethtool --pause enp0s3 tx off sudo ethtool --pause enp0s3 tx on
Test Network Interface Devices Using ethtool
You can run the ethtool command with the --test option to test network interface devices that support testing features. This command allows you to run various diagnostics, including register, EEPROM, interrupts, loopback, and link tests.
You can use offline or online modes to perform these tests. The tests with offline mode might be more thorough and could temporarily disrupt the device. The online mode makes sure of the non-intrusive testing but typically only runs the link test.
For instance, to perform offline tests on the enp0s3 device, you can use the ethtool --test command −
sudo ethtool --test enp0s3 offline

Similarly, you can run the online test on enp0s3 device using the ethtool like this −
sudo ethtool --test enp0s3 online

Configure Network Interface Device Settings Using ethtool
You can execute the ethtool with the -s option followed by the argument key-value pairs to change settings like speed, duplexity, and toggling auto-negotiation. Here is an example −
sudo ethtool -s enp0s3 speed 8 duplex half
The command above configures the enp0s3 device to a speed of 8 Mbit/s and sets its duplex mode to half. However, keep in mind that you can only set the speed according to the device's supported link modes. For instance, trying to set the speed to 50 Mbit/s with this command would result in an error. In the same way, you can configure the auto-negotiation state of this network interface using the autoneg argument, as follows −
sudo ethtool -s enp0s3 autoneg off sudo ethtool -s enp0s3 autoneg on
Thats all about the use of the ethtool command in Linux.
Conclusion
The ethtool command is a versatile tool for managing and troubleshooting network interfaces in Linux. It lets you view and adjust various network interface settings, such as speed, duplex mode, auto-negotiation, and PAUSE frame parameters.
Additionally, ethtool provides options for testing and diagnosing network devices to ensure optimal performance. By following the examples provided, you can effectively use ethtool to maintain and optimize your network interfaces.