运维部落

首页 > 解决方案 > 查看网线是否接上及mii-tool使用(转)

查看网线是否接上及mii-tool使用(转)

2019年3月26日

==================================Debian=======================================
1、发行版本
cat /etc/debian_version
5.0.2

2、内核
uname -r
2.6.18-6-amd64

3、机型
dmidecode -s system-product-name
PowerEdge R710

4、安装软件包
apt-get -y install net-tools

5、使用ip命令查看网络接口状态
1)ip a
1: lo: mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
2: eth0: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 84:2b:2b:48:ab:12 brd ff:ff:ff:ff:ff:ff
3: eth1: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 84:2b:2b:48:ab:14 brd ff:ff:ff:ff:ff:ff
inet 192.168.35.133/24 brd 192.168.35.255 scope global eth1
4: eth2: mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 84:2b:2b:48:ab:16 brd ff:ff:ff:ff:ff:ff
5: eth3: mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 84:2b:2b:48:ab:18 brd ff:ff:ff:ff:ff:ff
查看结果是eth1已经有ip 但eth0还没有ip及网络接口也没有打开

2)参数说明
qdisc pfifo_fast #Priority queueing
qlen #默认接口传输队列的默认长度
mtu #最大传输单元
qdisc noop #表示网络接口还没有up状态
up #设备处于运行状态,能接收和发送数据包
down #设备处于关闭状态,不能接收和发送数据包
qdisc mq #Multiqueue

6、如果没打开eth0网络接口的话使用mii-tool命令后结果是这样的
mii-tool
SIOCGMIIPHY on ‘eth0′ failed: Resource temporarily unavailable
eth1: negotiated 1000baseT-FD flow-control, link ok
SIOCGMIIPHY on ‘eth2′ failed: Resource temporarily unavailable
SIOCGMIIPHY on ‘eth3′ failed: Resource temporarily unavailable

7、使用ifconfig命令打开eth0网络接口
ifconfig eth0 up

8、再次使用mii-tool命令查看网线是否连接,这次看到显示eth0是no link状态 判定网线没接上
eth0: no link
eth1: negotiated 1000baseT-FD flow-control, link ok
eth2: no link
eth3: no link

9、找idc工程师让他们接上网线

==================================Centos=======================================
1、发行版本
cat /etc/redhat-release
CentOS release 6.5 (Final)

2、内核
uname -r
2.6.32-431.el6.x86_64

3、机型
dmidecode -s system-product-name
PowerEdge R610

4、安装软件包
yum -y install net-tools

5、使用ip命令查看网络接口状态
ip a
1: lo: mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:22:19:63:97:5e brd ff:ff:ff:ff:ff:ff
inet 111.222.333.444/24 brd 111.222.333.444 scope global eth0
inet6 fe80::222:19ff:fe63:975e/64 scope link
valid_lft forever preferred_lft forever
3: eth1: mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:22:19:63:97:60 brd ff:ff:ff:ff:ff:ff
inet 10.18.22.190/24 brd 10.18.22.255 scope global eth1
inet6 fe80::222:19ff:fe63:9760/64 scope link
valid_lft forever preferred_lft forever
4: eth2: mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:22:19:63:97:62 brd ff:ff:ff:ff:ff:ff
inet 111.222.333.444/25 brd 111.222.333.444 scope global eth2
inet6 fe80::222:19ff:fe63:9762/64 scope link
valid_lft forever preferred_lft forever
5: em4: mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:22:19:63:97:64 brd ff:ff:ff:ff:ff:ff

6、如果没打开em4网络接口的话使用mii-tool命令后结果是这样的
mii-tool em4
SIOCGMIIPHY on ‘em4′ failed: Resource temporarily unavailable

7、使用ifconfig命令打开eth0网络接口
ifconfig em4 up

8、找idc工程师让他们接上网线后查看
mii-tool em4
em4: negotiated 100baseTx-FD flow-control, link ok

参考文章

http://events.linuxfoundation.org/sites/events/files/slides/Linux_traffic_control.pdf

分类: 解决方案 标签: ,
本文的评论功能被关闭了.