Linux ethtool Tutorial with Usage Examples – POFTUT

Linux ethtool Tutorial with Usage Examples


ethtool  is useful utility used for Network Interface Card configuration. It provides simple and fast way to get and set configuration about IP address, interface speed, interface duplex or half duplex etc.

List and Printer Interface Properties

We will start with simply listing given network interface properties. We will see that there is a lot of network interface properties which is outputted by ethtool . For this operation we do not need to provide any option. We will just provide the interface name which is ens33 in this case.

$ ethtool ens33
List and Printer Interface Properties
List and Printer Interface Properties

We listed following properties of network interface

  • Supported link modes shows supported network speed and duplex modes.
  • Supports auto-negotition shows whether interface supports auto set link mode.
  • Speed shows currently set network interface speed.
  • Duplex shows currently set duplex status
  • Auto-negotiation shows current auto-negotiate mode.

List and Print Network Interface Driver Settings

Network Interfaces are managed and used with drivers. Drivers are operating system level modules which is the same for network interface cards with same chipset. We can list currently used driver of  given network interface card with the -i option and the interface name.

$ ethtool -i ens33
List and Print Network Interface Driver Settings
List and Print Network Interface Driver Settings

List and Print Auto-negotiation of Network Interface Driver

As stated previously auto-negotiation is used to determine link speed of the network interface transmitter. The other end of the link is another factor for link speed. We can enable auto-negotiation for talk the link speed with the remote host and set the best speed for the link. We can print current auto-negotiation setting with the -a and network interface name.

$ ethtool -a ens33
List and Print Auto-negotiation of Network Interface Driver
List and Print Auto-negotiation of Network Interface Driver

Display Statistics of The Network Interface

Network statistics provides useful information about network utilization of the system. Statistics provides information like rx_packets, tx_packets,rx_bytes,tx_bytes etc. We can list network interfaces statistics with -S option and the interface name.

$ ethtool -S ens33
Display Statistics of The Network Interface
Display Statistics of The Network Interface

Set Auto-Negotiation of Network Interface

We can change auto-negotiation of the given network interface card. We will use -s option with autoneg off parameter to disable or autoneg on to enable. We need root privileges becauase of system level chages.

$ sudo ethtool -s ens33 autoneg on

OR

$ sudo ethtool -s ens33 autoneg off

Set Speed of Network Interface

We can change the speed of the network interface card. This can be useful if remote interface do not supports auto-negotiation or there are link speed related problems. We will use -s option with speed 100 to set speed to 100Mbps. Also disabling auto-negotiation is good practice.

$ sudo ethtool -s ens33 speed 100 autoneg off

Blink Specified Network Interface Led

As we know network interface cards have some leds to give information about traffic and link. We can blink these leds by using ethtool. This may be useful if we need to blink leds to specify network interface card. We will use -p for this operation.

$ sudo ethtool -p ens33

Make Changes and Configurations Permanent

After a system reboot all configurations will be reset. But we can make these configuration permanent in order to save configuration time. Just add following lines to the related operation system configuration file.

LEARN MORE  10 Things To Do After Fedora Installation

Ubuntu, Debian, Mint, Kali

#File /etc/network/interfaces
post-up /sbin/ethtool -s duplex full speed 100

Fedora, CentOS, RHEL

# File /etc/sysconfig/network/scripts/ens33
/sbin/ethtool -s duplex full speed 100

Leave a Comment