Linux Ethtool Command Examples

Ethtool - NIC Utility

Ethtool is a Network Interface Card (NIC) utility/configuration tool. Ethtool allows you to query and change your NIC settings such as the Speed, Port, auto-negotiation and many other parameters. In the examples below, we will show you how to install the "Ethtool" utility and demonstrate some basic functions that the tool can be used for. In the examples below we are using RHEL 8, SLES and Ubuntu/Mint.

Installing Ethtool on Ubuntu/Mint

If you need to install Ethtool, you can use the following commands:

$ sudo apt update
$ sudo apt install ethtool

If you want to check to see if "Ethtool" is already installed, you may issue the command:

sudo apt show ethtool

This command will display any installed versions of "Ethtool" found.

Installing Ethtool on RHEL or CentOS

To install ethtool on a RHEL/CentOS system, issue the following command: dnf install ethtool -y

# dnf install ethtool -y

On most RHEL/CentOS systems "Ethtool" will probably be installed already. If you want to check to see if "ethtool" is installed, then you can issue the command "dnf list ethtool"

# dnf list ethtool
Last metadata expiration check: 0:01:32 ago on Thu 20 May 2021 20:05:59 BST.
Installed Packages
ethtool.x86_64                                             2:5.0-2.el8                                              @baseos

Installing Ethtool on SLES

To install "ethtool on an openSUSE Linux system or SLES (SUSE Linux Enterprise Server), simply issue the following command: zypper install ethtool

On most openSUSE systems "Ethtool" will already be installed. You can check this by issuing the command zypper se ethtool. If "ethtool" is installed a small "i" will be displayed in the first column of output.

# zypper install ethtool

# zypper se ethtool
Refreshing service 'Basesystem_Module_15_SP2_x86_64'.
Refreshing service 'SUSE_Linux_Enterprise_Server_15_SP2_x86_64'.
Refreshing service 'Server_Applications_Module_15_SP2_x86_64'.
Loading repository data...
Reading installed packages...

S | Name    | Summary                                                            | Type
i | ethtool | Utility for examining and tuning Ethernet-based network interfaces | package

Basic Command Structure for Ethtool

The basic structure of the ethtool command is as follows.

ethtool [Option...] devname

Where "Option" can be none or more options. "devname" is the name of your interface card. For example "eth0", "em1" or "enp0s3". If you are unsure of the name of the interface on your system, you may issue the following command "ip a s". This command will display your systems interfaces.

ip a s

# ip a s 
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:72:7a:19 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic noprefixroute enp1s0
       valid_lft 3538sec preferred_lft 3538sec
    inet6 fe80::5054:ff:fe72:7a19/64 scope link 
       valid_lft forever preferred_lft forever

From the above we can see that there is only one interface on our system called "enp1s0

Display Version of Ethtool

To display the version of Ethtool that is installed on your system, issue the command: "ethtool --version".

# ethtool --version
ethtool version 5.0

Display NIC settings

If you issue the ethtool command with only the device name of your interface, then a list of the current settings will be displayed to your screen. To see all available parameters/settings, it is best to issue the command as the "root" user.

On RHEL/CentOS systems, you can issue the command: nmcli con to display your interfaces also.

ethtool device_name

# nmcli con
NAME    UUID                                  TYPE      DEVICE 
enp1s0  c0ab6b8c-0eac-a1b4-1c47-efe4b2d1191f  ethernet  enp1s0 

# ethtool enp1s0
Settings for enp1s0:
	Supported ports: [ TP ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Port: Twisted Pair
	Transceiver: internal
	Auto-negotiation: on
	MDI-X: off (auto)
	Supports Wake-on: pumbg
	Wake-on: g
	Current message level: 0x00000007 (7)
			       drv probe link
	Link detected: yes

From the above output we are able to see important settings such as Speed, Auto Negotiation, Duplex settings and link detection status.

Display Interface Device Driver

Using the "ethtool" utility you can display the name of the device driver that is in use for the specified device:

ethtool -i device_name

# ethtool -i enp1s0
driver: e1000e
version: 3.2.6-k
firmware-version: 2.1-0
bus-info: 0000:01:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

In the example above, the device name is "enp1s0" and the driver in use is "e1000e". Additional firmware information will also be displayed.

Display Interface Statistics

Using the "ethtool" utility you can display network statistics for your specified interface by using the option "--statistics" or "-S".

ethtool --statistics device_name

# ethtool --statistics enp1s0
NIC statistics:
     rx_packets: 39483
     tx_packets: 464
     rx_bytes: 4090264
     tx_bytes: 3297992
     rx_broadcast: 0
     tx_broadcast: 2
     rx_multicast: 0
     tx_multicast: 13
     rx_errors: 513
     tx_errors: 0
     tx_dropped: 0
     multicast: 0
     collisions: 0

The above example output has been reduced for clarity. More parameters/statistics will be displayed by default.

Changing Interface Settings

The "ethtool" utility gives you the ability to quickly change various settings on your interface. Below are some examples using the "--change" option. The "-s" option may also be used as the short-form version of the command.

ethtool --change device_name parameter

# ethtool --change enp1s0 speed 100 duplex full autoneg off

In the above example we specified a value for "speed", "duplex" and "autoneg". For a full list of these values, it is worth consulting the man pages by issuing the commands:
"man ethtool" or "ethtool --help".

Display Autonegotiate, RX and TX settings

To display the Autonegotiate, RX and TX settings, you can issue the command.

ethtool -a device_name

# ethtool -a enp1s0
Pause parameters for enp1s0:
Autonegotiate:	on
RX:		on
TX:		on

Blink Network Port Light

It is possible to identify a given port on an interface by issuing the "--identify" or "-p" option. This option will typically blink the LED light of your interface.

ethtool --identify device_name integer

# ethtool --identify enp1s0 20

In the above example the LED light will be illuminated for a period of 20 seconds on the specified interface. (Please note, this option is dependant on the type of interface and hardware)

Persistent Changes

If you have made any change using the "Ethtool", it is important to understand that by default, these changes will be lost after a system re-boot. However, it is possible to specify a script or command that can be run by adding entries into your start up scripts. On most systems this will be "/etc/rc.local". However, on many systems it is also possible to specify options directly within the interface configuration file.