ethtool Commands and Examples

The “ethtool” command refers to the network command line tool configuring the ethernet devices in Linux. It is pre-installed in most Linux distributions. In addition, It provides ethernet device information and allows Linux users to modify its parameters. 

This post illustrates the main objective and working of the “ethtool” command with the help of practical examples. 

How to Use the “ethtool” Command?

The “ethtool” command depends on its basic syntax that is typed below:

Syntax:

$ ethtool [options] [device-name]

The above syntax contains the following parameters:

  • ethtool: Mian keyword that denotes the “ethtool” command.
  • options: Associated options of the “ethtool” command
  • device-name: Specifies the ethernet device name.

Execute the “man” command associated with the “ethtool” utility to get its brief details, i.e., supported options:

$ man ethtool

Scroll down the page for more options. Now move on to the various examples of the “ethtool” command.

Example 1: List Ethernet Device Settings

The user should know about the available ethernet device of the Linux system before getting its settings. To perform this task use the “ip(internet protocol)” command followed by the “-a(address)” flag:

$ ip a

The ethernet device of our Linux system is “ens33”.

Now, execute the “ethtool” command to list down the information of ethernet device “ens33”:

$ ethtool ens33

The output highlights the “Settings for ens33” ethernet device.

Example 2: Access the Driver Settings of Ethernet Device

The “-i or –driver flag of the ethtool command provides the driver settings of the “Network Interface Card(NIC)”/”Ethernet device”. Here, the “–driver” argument is used with the “ethtool” to get the driver settings of the “ens33”:

$ ethtool --driver ens33

The output shows that the “ens33” device is using the “e100” driver having “5.15.0” version.

Example 3: List Network Interface Features

Every ethernet device supports various properties/features as per requirements. To get the specified ethernet device features with the “ethtool” command, use the “–show-features” flag in this way:

$ ethtool --show-features ens33

The above command displays all the supported features of the “ens33” ethernet device.

Example 4: Network Statistics of a Particular Ethernet Device

The user can also find out the network usage statistics with the “-S or –statistics” option as we did here for interface “ens33”: 

$ ethtool --statistics ens33

The output of the above command displays the “sent tx(transmitted)”, “received rx(Received)”, “collided” and “errors” packets of the interface “ens33”.

Example 5: Customize the Specific NIC Parameters

The ethernet devices/network interface contains the “speed”, “duplex”, and “Auto-negotiation” parameters that can be easily customized through  the “ethtool” command.

Suppose the “ens33” is currently working on “1000Mb/s” speed with “Full” duplex mode and “Auto-negotiation” is on:

$ ethtool ens33

The “ethtool” command offers the “-s(settings)” argument. In this example, it is used to set the “ens33” device speed to “10Mb/s”, duplex “half”, and the auto-negotiation “off”.

$ sudo ethtool -s ens33 speed 10 duplex half autoneg off

The highlighted parameters of the “ens33” network interface have been modified.

Conclusion

Linux and most of its distributions support the network command line utility “ethtool” to display and manage the network interface devices. It comes with a list of supported flags that provides the desired output per requirements and modifies its parameters. This post has briefly illustrated the “ethtool” command with the help of practical examples.