Simple Network Troubleshooting

From The World according to Vissie
Jump to navigation Jump to search

Testing Link Status from the Command Line

Both the mii-tool and ethtool commands command will provide reports on the link status and duplex settings for supported NICs.

When used without any switches, the mii-tool gives a very brief report. Use it with the -v switch because it provides more information on the supported autonegotiation speeds of the NIC and this can be useful in troubleshooting speed and duplex issues.

The ethtool command provides much more information than mii-tool and should be your command of choice, especially because mii-tool will be soon deprecated in Linux. In both of the following examples the NICs are operating at 100Mbps, full duplex and the link is ok.

Link Status Output from mii-tool

[root@bigboy tmp]# mii-tool -v
eth0: 100 Mbit, full duplex, link ok
 product info: Intel 82555 rev 4
 basic mode:   100 Mbit, full duplex
 basic status: link ok
 capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
 advertising:  100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
 link partner: 100baseTx-HD
[root@bigboy tmp]#

Link Status Output from ethtool

[root@bigboy tmp]# ethtool eth0
Settings for eth0:
       Supported ports: [ TP MII ]
       Supported link modes:   10baseT/Half 10baseT/Full
                               100baseT/Half 100baseT/Full
       Supports auto-negotiation: Yes
       Advertised link modes:  10baseT/Half 10baseT/Full
                               100baseT/Half 100baseT/Full
       Advertised auto-negotiation: No
       Speed: 100Mb/s
       Duplex: Full
       Port: MII
       PHYAD: 1
       Transceiver: internal
       Auto-negotiation: off
       Supports Wake-on: g
       Wake-on: g
       Current message level: 0x00000007 (7)
       Link detected: yes
[root@bigboy tmp]#

netstat Error Output

The netstat command is very versatile and can provide a limited report when used with the -i switch. This is useful for systems where mii-tool or ethtool are not available.

[root@bigboy tmp]# netstat -i
Kernel Interface table
eth0       1500   0 18976655      2      0      0 21343152    142      0      3 BMRU
eth1       1500   0   855154      0      0      0 15196620      0      0      0 BMRU
lo        16436   0  1784272      0      0      0  1784272      0      0      0 LRU
[root@bigboy tmp]#