Ethtool - Network Interface Configuration & Statistics

Configure and view network interface statistics with ethtool. Learn to set speed, autonegotiation, and retrieve error counts for your network interfaces.

Ethtool

Ethtool: Network Interface Statistics and Configuration

The ethtool command is a vital utility for Linux systems, providing extensive capabilities to query and configure network interface parameters. It allows administrators to view detailed statistics, manage link settings, and diagnose network issues directly from the command line. Understanding and utilizing ethtool is crucial for optimizing network performance and troubleshooting connectivity problems.

Viewing Network Interface Statistics

To display detailed statistics for a specific network interface, use the -S option followed by the interface name. This output includes a wide array of counters, such as packet reception and transmission counts, errors, drops, and more, which are invaluable for performance monitoring and identifying potential bottlenecks or hardware issues.

# To show statistics for the selected interface:
ethtool -S <interface>

Retrieving Permanent Interface Address

The -P option is used to retrieve the permanent hardware address (MAC address) of a network interface. This is useful for verifying the physical address of a network card, especially in environments where multiple interfaces are present or when troubleshooting MAC address-related issues.

# To show interface permanent address:
ethtool -P <interface>

Configuring Interface Speed

ethtool enables dynamic configuration of network interface settings, including the link speed. You can set a specific speed for an interface using the -s option, followed by the interface name and the speed parameter. This is particularly useful for forcing a specific link speed when auto-negotiation is not behaving as expected or to test network performance at different speeds.

# To set interface speed:
ethtool -s <interface> [ speed %d ]

Managing Interface Autonegotiation

Autonegotiation is a process where network devices automatically determine the best common link speed and duplex mode. ethtool allows you to enable or disable this feature using the autoneg on|off parameter with the -s option. Disabling autonegotiation might be necessary in specific network configurations or for troubleshooting.

# To set interface autonegotiation:
ethtool -s <interface> [ autoneg on|off ]

Diagnosing Network Errors

Identifying and diagnosing network errors is a critical part of network maintenance. By combining ethtool -S with grep, you can easily filter the statistics output to pinpoint specific error counters, such as CRC errors, alignment errors, or dropped packets, which can indicate physical layer problems, cable issues, or duplex mismatches.

# To get interface errors:
ethtool -S <interface> | grep error

For more advanced configurations and a comprehensive understanding of ethtool options, consult the official ethtool man page. Understanding these commands is fundamental for effective network administration on Linux systems.