linux下查看网线是否正确连接到网卡

输入mii-tool可以查看网线是否连接到网卡

//mii-tool主要是用于配置网卡工作模式的指令,同时也可以进行查询、监控等工作!


#mii-tool

 
  
  1. eth0: negotiated 100baseTx-FD, link ok  

有时驱动可能不支持会出错下列错误
#mii-tool

 
  
  1. SIOCGMIIPHY on 'eth0' failed: Operation not supported  
  2. no MII interfaces found  

可以使用ethtool查看
#ethtool eth0

 
  
  1. Settings for eth0:  
  2.           Supported ports: [ TP ]  
  3.           Supported link modes:   10baseT/Half 10baseT/Full   
  4.                                  100baseT/Half 100baseT/Full   
  5.                                  1000baseT/Full   
  6.          Supports auto-negotiation: Yes  
  7.          Advertised link modes:  10baseT/Half 10baseT/Full   
  8.                                  100baseT/Half 100baseT/Full   
  9.                                  1000baseT/Full   
  10.            Advertised auto-negotiation: Yes  
  11.            Speed: 100Mb/s  
  12.            Duplex: Full  
  13.            Port: Twisted Pair  
  14.            PHYAD: 0  
  15.            Transceiver: internal  
  16.            Auto-negotiation: on  
  17.            Supports Wake-on: pumbg  
  18.            Wake-on: g  
  19.            Current message level: 0x00000033 (51)  
  20.            Link detected: yes  

Link detected: yes为正常no为失败

三.[root@linuxzgf ~]# /etc/init.d/network status
配置设备:
lo eth0 eth0.10 eth0.2 eth0.3 eth0.4 eth0.5 eth0.7 eth0.8 eth1
当前的活跃设备:
lo eth0 eth0.10

Linux 下查看網卡工作速度

# dmesg |grep eth0

divert: allocating divert_blk for eth0
eth0:
RealTek RTL8139 at 0xd800, 00:80:48:34:c2:84, IRQ 9
eth0:  Identified 8139 chip type 'RTL-8100B/8139D'
divert: freeing divert_blk for eth0
divert: allocating divert_blk for eth0
eth0: RealTek RTL8139 at 0xd800, 00:90:44:34:a5:33, IRQ 9
eth0:  Identified 8139 chip type 'RTL-8100B/8139D'
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
eth0: no IPv6 routers present
...

# mii-tool -v eth0

eth0: negotiated 100baseTx-FD, link ok
product info: vendor 00:00:00, model 0 rev 0
basic mode:   autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD
            10baseT-HD
...

# 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: Yes
 Speed: 100Mb/s
 Duplex: Full
 Port: MII
 PHYAD: 32
 Transceiver: internal
 Auto-negotiation: on
 Supports Wake-on: pumbg
 Wake-on: p
 Current message level: 0x00000007 (7)
 Link detected: yes