Unix: Cozying up to ethtool

If you'd like to know a lot more about your ethernet interfaces than ifconfig will ever tell you, it's time you take a look at ethtool.

Want to get even more familiar with your network adapters? The ifconfig command is not the only tool for examining your interfaces. Since 1998 or so, a tool called ethtool has been

available for displaying and modifying your ethernet adapter settings.

Using ethtool, you can:

  • Display identification and diagnostic information
  • Look at extended device statistics
  • Control the speed, duplex, autonegotiation and flow control settings
  • Control checksum offload and other offload features
  • Control the DMA ring sizes and interrupt moderation
  • Control receive queue selection for multiqueue devices
  • Upgrade firmware in flash memory

You can get a lot of basic information on one of your network interfaces with the command ethtool followed by the name of the interface you want to examine.

$ 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
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Link detected: yes

To get firmware information on a physical interface, use the -i option:

# ethtool -i eth0
driver: bnx2
version: 1.7.9-1
firmware-version: 5.2.3 NCSI 2.0.11
bus-info: 0000:01:00.0

Not much information is available for bonded interfaces, but ethtool will identify them as

such, using the term "bonding". There are no statistics available for non-physical interfaces as you can see from the output below.

# ethtool -i bond0
driver: bonding
version: 3.2.4
firmware-version: 2
bus-info:
# ethtool -S bond0
no stats available

To see the pause settings and whether an interface is set up to auto-negotiate, use the -a option:

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

To view statistics for your ethernet interface, use the -S option:

# ethtool -S eth0
NIC statistics:
     rx_bytes: 125850431219
     rx_error_bytes: 0
     tx_bytes: 139140209311
     tx_error_bytes: 0
     rx_ucast_packets: 96912478
     rx_mcast_packets: 12054491
     rx_bcast_packets: 52901669
     tx_ucast_packets: 155871625
     tx_mcast_packets: 2466
     tx_bcast_packets: 94454
     tx_mac_errors: 0
     tx_carrier_errors: 0
     rx_crc_errors: 0
     rx_align_errors: 0
     tx_single_collisions: 0
     tx_multi_collisions: 0
     tx_deferred: 0
     tx_excess_collisions: 0
     tx_late_collisions: 0
     tx_total_collisions: 0
     rx_fragments: 0
     rx_jabbers: 0
     rx_undersize_packets: 0
     rx_oversize_packets: 0
     rx_64_byte_packets: 55466306
     rx_65_to_127_byte_packets: 19003700
     rx_128_to_255_byte_packets: 8308294
     rx_256_to_511_byte_packets: 836880
     rx_512_to_1023_byte_packets: 141854
     rx_1024_to_1522_byte_packets: 78145842
     rx_1523_to_9022_byte_packets: 0
     tx_64_byte_packets: 305460
     tx_65_to_127_byte_packets: 66853240
     tx_128_to_255_byte_packets: 353026
     tx_256_to_511_byte_packets: 49608
     tx_512_to_1023_byte_packets: 17149
     tx_1024_to_1522_byte_packets: 88390062
     tx_1523_to_9022_byte_packets: 0
     rx_xon_frames: 17119
     rx_xoff_frames: 17119
     tx_xon_frames: 0
     tx_xoff_frames: 0
     rx_mac_ctrl_frames: 0
     rx_filtered_packets: 58432177
     rx_discards: 0
     rx_fw_discards: 165994

That's a lot of statistics! Notice how the packet count output is broken down by packet size.

There's even a command that you can use to get the interface to blink. Why would you do that? When you're not sure which interface is which by looking at them -- which is eth0, which is eth1, etc.

ethtool --identify eth0 10

This command would cause the eth0 interface to blink for ten seconds. Of course, if you're staring at your screen, this will seem no more illuminating than sleeping for ten seconds, but if you're looking at the back of your system, you'll see a modest little light show and you'll know which interface is eth0.

You can also use ethtool to test one of your network interfaces with the -t or --test option. Note that some of these will interrupt service. If you use the offline command as shown below, a comprehensive set of tests will be done, but service will be interrupted.

# ethtool -t offline eth0

If you select online instead, fewer tests will be run, but service will not be interrupted.

There's also a fairly nice man page for the ethtool command and you can get a synopsis of the

commands by asking for help with the ethtool -h command.

The ethtool command can certainly tell you a lot more about your network interfaces than ifconfig and can provide very interesting information on your network traffic as well.

From CIO: 8 Free Online Courses to Grow Your Tech Skills
Join the discussion
Be the first to comment on this article. Our Commenting Policies