network

Ethtool is great

Ethtool is a great tool you can use to adjust several settings at your NIC.
It’s especially great to detect if a cable is connected or not. Say you’ve got 3 NIC’s at your server, your hooking up one to the switch and wondering did I hook up eth0, eth1 or eth2 now (?)

# ethtool eth1
Settings for eth1:
	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: 0
	Transceiver: internal
	Auto-negotiation: on
	Supports Wake-on: umbg
	Wake-on: d
	Current message level: 0x00000007 (7)
	Link detected: yes

As we can see ‘Link detected: yes, we’ve got a winner.
Note: you have to bring up the interface with :

>
# ifconfig eth1 up

or else ethtool will say the link is not detected even if a cable is attached.