Today I am starting a new series of blog posts: “Tools for Linux sysadmins”
The first blog post will cover ethtool, one of the most useful tools to handle network cards since it gives you full control about the cards’ settings and other stuff.
I mainly use it for two things:
- Reading out the firmware and driver version of the network card
- Modify the settings of an interface, e.g. the speed or duplex mode
Reading out the firmware and driver version
mintbox ~ # ethtool -i eth0 driver: e1000 version: 7.3.21-k8-NAPI firmware-version: N/A bus-info: 0000:00:03.0 supports-statistics: yes supports-test: yes supports-eeprom-access: yes supports-register-dump: yes
In this example the firmware version is not available since the tool was used in a virtual box VM.
Modify the interface settings
At first let’s view the current settings:
mintbox ~ # 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 pause frame use: No Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on MDI-X: Unknown Supports Wake-on: umbg Wake-on: d Current message level: 0x00000007 (7) drv probe link Link detected: yes
I often set the speed and duplex mode with one command:
ethtool -s eth0 speed 1000 duplex full
In this case, nothing would be changed. But this is just a simple example to show you how to modify the settings of a network interface.
Other useful possibilities
ethtool offers also the possibility to flash the firmware (-f file) or show the offload parameters (-k interface). Simply have a look at the man page. Image may be NSFW.
Clik here to view.