查看Linux下網卡狀態或是否鏈接
1、經過mii-tool指令
[root@linuxzgf ~]# mii-tool
eth0: negotiated 100baseTx-FD, link ok
eth1: no link
[root@linuxzgf ~]#
或
[root@linuxzgf ~]# mii-tool -v
eth0: negotiated 100baseTx-FD, link ok
product info: vendor 00:50:43, model 10 rev 2
basic mode: autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
link partner: 100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
eth1: no link
product info: vendor 00:50:43, model 10 rev 2
basic mode: autonegotiation enabled
basic status: no link
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
[root@linuxzgf ~]#
或
[root@linuxzgf ~]# mii-tool -w
14:52:45 eth0: negotiated 100baseTx-FD, link ok
14:52:45 eth1: no link
//mii-tool主要是用於配置網卡工做模式的指令,同時也能夠進行查詢、監控等工做! linux
2、ethtoolide
[root@linuxzgf ~]# 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 auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: yes
[root@linuxzgf ~]#oop
[root@linuxzgf ~]# 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: Unknown! (65535)
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: umbg
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: no
[root@linuxzgf ~]#ci
從上面能夠看出eth0 處於鏈接狀態,eth1沒有鏈接
3、
[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
[root@linuxzgf ~]#
等同於
[root@linuxzgf root]# service --status-all
............
............
Configured devices:
lo eth0 eth1
Currently active devices:
lo eth0
............
............
4、ifconfig -a
[root@linuxzgf ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:E0:81:80:D8:96
inet6 addr: fe80::2e0:81ff:fe80:d896/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:626032 errors:0 dropped:0 overruns:0 frame:0
TX packets:415035 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:123631002 (117.9 MiB) TX bytes:297575498 (283.7 MiB)
Base address:0x2000 Memory:df300000-df320000it
eth1 Link encap:Ethernet HWaddr 00:E0:81:80:D8:97
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Base address:0x2020 Memory:df320000-df340000io
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:147 errors:0 dropped:0 overruns:0 frame:0
TX packets:147 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:27895 (27.2 KiB) TX bytes:27895 (27.2 KiB)class
5、lspci也能夠看到網卡的信息監控