https://access.redhat.com/solutions/1465433
How to find out if the ethernet cable is plugged into the physical interface without bringing up an interface?
SOLUTION 已验证 - 已更新 2015年十一月26日17:18 -
环境
- Red Hat Enterprise Linux
- 6.x
问题
- How to check if the
ethernetcable is plugged into the physical interface without bringing up an interface?
决议
- For checking the status of the
ethernetcable useip linkcommand.
1) If the ethernet cable is connected, and it is up also then it will show in the ip link command. Check the output of eth0.
# ip link
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 pfifo_fast state UP qlen 5000
link/ether 00:16:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:16:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
In this case, eth0 <BROADCAST,MULTICAST,UP,LOWER_UP> is connected , and the status of the ethernet cable is also Up "state UP qlen 5000".
2) If ethernet cable is connected, but it is down then check below output:
# ip link
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: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 5000
link/ether 00:16:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:16:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
In this case, eth0 <NO-CARRIER,BROADCAST,MULTICAST,UP> is connected, but the status of the ethernet cable is down.
3) If ethernet cable is not connected,then check below output:
In this nothing will come.
# ip link
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
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:16:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff

本文介绍如何在不激活网络接口的情况下,使用'ip link'命令检查以太网线是否连接到物理接口的方法。通过观察命令输出的状态,如UP、DOWN、NO-CARRIER等,可以判断网线的连接情况。
9366

被折叠的 条评论
为什么被折叠?



