用ifconfig看网卡信息,有些信息查看不了,比如网卡上连线物理状态等信息。下边几个命令可以简单查看link信息:
1)
# ip link show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether d4:85:64:45:28:54 brd ff:ff:ff:ff:ff:ff 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether d4:85:64:45:28:55 brd ff:ff:ff:ff:ff:ff
2)
# ethtool eth0 | grep Link Link detected: yes ethtool eth0是可以显示出所有跟eth0网卡相关的信息,比如速率等信息, 此处单独搜索Link状态
3)
# dmesg | grep eth igb: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX igb: eth1 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX 此处显示信息过多,单独抽取这两行说明
4)
# cat /sys/class/net/eth0/operstate up
5)
# mii-tool -h mii-tool: invalid option -- 'h' usage: mii-tool [-VvRrwl] [-A media,... | -F media] <interface> ... -V, --version display version information -v, --verbose more verbose output -R, --reset reset MII to poweron state -r, --restart restart autonegotiation -w, --watch monitor for link status changes -l, --log with -w, write events to syslog -A, --advertise=media,... advertise only specified media -F, --force=media force specified media technology media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD, (to advertise both HD and FD) 100baseTx, 10baseT mii-tool参数就这几个,自己添加使用就行。如:mii-tool -w eth0