513 B
513 B
查看指定网卡信息
sudo ethtool eth0
查看所有网卡的接口类型
for iface in $(ip link show | awk -F: '/^[0-9]+:/ {print $2}' | tr -d ' '); do echo -n "$iface: " sudo ethtool $iface 2>/dev/null | grep -E "Supported link modes|Port|Speed" done
关键判断点:
-
电口(RJ45):显示
Port: Twisted Pair或支持1000baseT/Full、10GBASE-T等模式 -
光口(Fiber):显示
Port: FIBRE或支持1000baseX/Full、10GBASE-SR/LR等模式