Linux如何查看网卡工作模式
Linux如何查看网卡工作模式详细介绍
在 Linux 系统中,有多种方法可查看网卡的工作模式,下面为你介绍一些常用的方式:
1. 使用
ethtool命令
ethtool是一个功能强大的工具,能查询及设置网卡设备的参数,包括工作模式。要使用该命令,你需先确保系统已安装ethtool。
查看特定网卡(例如eth0)的工作模式,可执行以下命令:
bash
eth0
该命令的输出里会有类似如下的信息:
plaintext
Settings for eth0:Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: on (auto)
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
其中,Speed表明网卡当前的速率(如 1000Mb/s),Duplex显示双工模式(如 Full 表示全双工)。
2. 查看
/sys文件系统
/sys文件系统存有系统硬件的相关信息,你可以通过读取相应文件来查看网卡的工作模式。
查看网卡速率:
bash
/sys/class/net/eth0/speed
查看网卡双工模式:
bash
/sys/class/net/eth0/duplex
这里的eth0需替换成你实际要查看的网卡名称。
3. 使用
ip命令结合
ethtool
你还能结合ip命令与ethtool来查看网卡信息:
bash
show eth0eth0
9123ip link show eth0ethtool eth0
ip -s link show可显示网卡的统计信息,ethtool -S则能展示更详细的网卡统计数据。