What is the "ethtool" command and how can I use it to obtain information about my network devices and interfaces?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Virtualization

Issue

  • When looking for a tool to obtain data about default options and packet statistics on a networking interface, ethtool can be used with its various functions to create a complete profile of an interface.

Resolution

  • The ethtool facility, with no commands run, prints basic information about the Ethernet card for the interface in which it is run:
# ethtool eth0
Settings for eth0:
	Supported ports: [ TP ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
[...]
  • If packet loss is suspected or if the output of a utility such as # ifconfig shows drops, overruns, or errors, ethtool has the ability to directly poll the card for packet statistics. Please keep in mind that this data is only current since the last functioning operational state of the Ethernet controller, typically cleared at the reboot of a system.
# ethtool -S eth0
NIC statistics:
     rx_packets: 2251518
     tx_packets: 1410087
     rx_bytes: 1295872987
     tx_bytes: 288388610
     rx_broadcast: 409192
     tx_broadcast: 11
     rx_multicast: 34163
     tx_multicast: 123
     rx_errors: 0
     tx_errors: 0
     tx_dropped: 0
     multicast: 34163
[...]
  • Note: keep in mind these parameters are defined by the Ethernet controller, firmware, and driver that is specific to the installed Ethernet card, and the values contained in such may be calculated radically differently on alternative hardware. For assistance with this, please contact Red Hat Support or the driver vendor for an analysis.

  • Some other various data collection functions of ethtool consist of:

# ethtool -a eth*
*shows pause parameters for interface listed*

# ethtool -g eth*
*shows ring buffer parameters for interface listed*

# ethtool -i eth*
*shows driver and firmware versions, as well as physical bus address for interface listed*

# ethtool -k eth*
*shows offload information for functions such as tcp checksumming for interface listed*
  • The ethtool utility can also be used to make non-persistant operational changes to the working interface, typically replacing the data-collection flag with the capital letter flag of the same type. For example, to change the ring buffer on an active interface without the need to bring the interface down. First, view the available options for the buffer:
# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX:		4096  <--Maximum size for the RX(receive) ring buffer
RX Mini:	0
RX Jumbo:	0
TX:		4096
Current hardware settings:
RX:		256  <--Current value, which can be set to the maximum.
RX Mini:	0
RX Jumbo:	0
TX:		256
  • And then use the ethtool command to make the change immediately, without the need to take down the interface:
# ethtool -G eth0 rx 4096
  • WARNING: For the e1000 and e1000e drivers this will cause a link down/up event, which may disrupt connectivity briefly.
  • The interface should then be set to maximum value on the ring buffer. Please note this is a low level change on the interface, and as such, will not persist across a reboot. To ensure any changes remain persistent, either specify them in the /etc/rc.local script which is run every time the system reboots, or in the /etc/sysconfig/network-scripts/ifcfg-eth* file specify the function desired to be performed with the "ETHTOOL_OPTS" tag:
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="00:00:00:00:00"
NM_CONTROLLED="no"
ONBOOT="yes"
ETHTOOL_OPTS="speed 100 duplex full autoneg off"

Root Cause

  • The ethtool command is a low-level interface manipulation tool with the power to directly effect firmware and driver behavior and functionality on the active interface. Before performing any tasks it is recommend to review the network topology involved to ensure all hardware directly supports any task that is being enabled, such as is the case with auto-negotiation or jumbo frames. Please note that each driver will behave differently and have different supported operations while in use, however the ethtool generic commands should be fully compatible across different driver varieties.

  • Most functions with ethtool can be performed live. Data collection has little to no impact on the running system, and direct manipulation of functions such as the ring buffer or the enabling or disabling of checksumming can typically be done live without any interrupt in service.

Diagnostic Steps

  • Should packet loss be experienced it is recommended to contact Red Hat Global Support Services or the driver vendor for an accurate definition and analysis of the situation. If possible, examine the network topology and prepare to provide topology documentation beforehand in order to aid the troubleshooting process, noting the Ethernet card brand and switch configuration.
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.