如何查找unix eth端口链路速度

sjw*_*ong -1 unix ethernet openwrt network-speed

我的 openwrt 路由器有一个小问题。我想知道格式为 10M、100M、1000M 等或 10BaseT 的链接速度..但我无法在 /proc 中找到它或使用“ip”命令也“dmesg”不提供此数据。

你有什么想法我可以在哪里找到它吗?如果数据是十六进制格式,那对我来说就足够了。谢谢。

Mug*_*rel 6

你可以使用ethtool命令

http://linux.die.net/man/8/ethtool

编辑:

您需要检查“速度”部分。检查如下:

root ~ ethtool eth0
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: No
    Advertised auto-negotiation: Yes
    Speed: 100Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: off (auto)
    Supports Wake-on: pumbg
    Wake-on: g
    Current message level: 0x00000007 (7)
                   drv probe link
    Link detected: yes
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我的卡支持 10/100/1000,但是“速度”部分显示了它当前运行的速度:

Speed: 100Mb/s