如何检查linux系统中网卡的物理连接状态?使用ethtool命令查看链路状态是最常用的方法。首先执行ethtool eth0(接口名根据实际情况替换),在输出中重点关注“link detected”字段,若为yes表示物理连接正常,若为no则可能网线未插好、交换机端口故障或网卡问题。此外可结合其他字段如speed、duplex和auto-negotiation进一步判断配置是否正确。快速检查时可用命令ethtool eth0 | grep "link detected"过滤关键信息,批量检查多个网卡时也可用shell循环实现。若在虚拟机中运行,需注意链路状态反映的是虚拟网络配置,部分老旧网卡或驱动可能不支持完整功能,必要时安装ethtool工具以确保可用性。

网卡物理连接状态的检查在Linux系统维护中非常常见,尤其是在网络不通的情况下,第一步往往就是确认物理层是否正常。
ethtool

ethtool
安装好
ethtool

ethtool eth0
这里的
eth0
enp0s3
ens33
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Link detected: yes重点关注 Link detected 这一项,如果是
yes
no

如果你发现 Link detected 是 no,可以尝试以下操作:
ip link show
有时候即使网线插着,也可能因为交换机未供电或端口 down 掉导致链路无法建立。
如果你只是想快速判断某个网卡有没有链路,可以加上一点 shell 技巧:
ethtool eth0 | grep "Link detected"
这样就能只显示你关心的那一行结果,适合写脚本或远程排查时使用。
另外,一些服务器可能有多个网卡,比如
eth0
eth1
for intf in $(ls /sys/class/net | grep -v lo); do
echo "=== $intf ==="
ethtool $intf | grep "Link detected"
done这会列出所有非回环网卡的链路状态,方便批量检查。
ethtool
ethtool
ethtool
apt install ethtool
yum install ethtool
基本上就这些。掌握
ethtool
以上就是如何检查Linux网卡物理连接状态 ethtool查询链路信息详解的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号