15 lines
513 B
Markdown
15 lines
513 B
Markdown
# 查看指定网卡信息
|
||
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` 等模式 |