ethtool(8) - Display or change ethernet card settings
This command is found on newer versions of linux. It lets you query and set various network interface (NIC) parameters like speed, duplex and autonegotiation.
Here is an example of querying the eth0 parameters.
jetson:~> sudo ethtool eth0 Settings for eth0: Supported ports: [ MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: Not reported Advertised auto-negotiation: No Speed: 100Mb/s Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: off Supports Wake-on: g Wake-on: d Current message level: 0x000000ff (255) Link detected: yes
Here is an example showing how to set a NIC to 100baseT/Full - turning autonegotiate off also.
jetson:~> sudo ethtool -s eth0 speed 100 duplex full autoneg off
The examples shown above were used on an Ubuntu box. Red Hat and it's variants can take ethtool arguments passed in via the ifcfg files. For instance, the following line could appear in /etc/sysconfig/network-scripts/ifcfg-eth0. This would ensure the values are set persistently.
ETHTOOL_OPTS="speed 100 duplex full autoneg off"
ethtool can be used to query the NIC for version and driver info!
mdf@sushi ~ $ sudo ethtool -i eth0 driver: e1000e version: 1.0.2-k4 firmware-version: 0.5-1 bus-info: 0000:02:00.0