Files
Knowledge/1 使用/Linux/查看网卡是光口还是双绞线.md

15 lines
513 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 查看指定网卡信息
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` 等模式