Commands / Interfaces and addresses

Interfaces and addresses

ethtool

Also speed, duplex, auto-negotiation, NIC statistics, driver counters

Shows and sets a card's physical link (speed, duplex, auto-negotiation) and prints its driver's own counters.

ethtool CARD prints what the card and the other end agreed: speed, duplex, whether it auto-negotiated, and whether a link is detected. ethtool -s forces them (as speed and duplex under an IOS interface). ethtool -S prints the driver's statistics, beyond the standard counters of ip -s link: on real hardware CRC errors, oversize frames, pause frames and per-queue drops; on a virtual card only what software can count.

ethtool command usage

ethtool CARD
ethtool -S CARD
ethtool -s CARD speed MBPS duplex half|full autoneg on|off

Options

-S
the driver's statistics
-s
set speed, duplex or auto-negotiation
-i
the driver and firmware versions

ethtool examples

ethtool eth0
Shows the link's speed, duplex and whether a link is detected.
ethtool -S eth0 | grep -i err
Shows the driver's error counters.

Pitfalls

  • A virtual card (veth, a container's card) reports a fixed speed and full duplex and answers Not supported to -s: there is no physical link to negotiate.

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Start free