温馨提示×

linux如何查网卡速率

小亿
83
2024-09-05 06:49:59
栏目: 智能运维

在Linux中,您可以使用ethtool命令来查询网卡的速率

  1. 首先,确保您已经安装了ethtool。在大多数发行版中,它应该已经预装。如果没有,请使用以下命令安装:

    对于Debian/Ubuntu系统:

    sudo apt-get install ethtool
    

    对于RHEL/CentOS系统:

    sudo yum install ethtool
    
  2. 然后,找到您要查询速率的网卡名称。使用ipifconfig命令查看网卡列表。例如:

    ip link show
    

    或者

    ifconfig -a
    
  3. 现在,使用ethtool命令查询网卡速率。将<network_interface>替换为您在上一步中找到的网卡名称(例如,eth0、ens33等):

    ethtool<network_interface>
    

    在输出中,您将看到网卡的详细信息,包括速率。例如:

    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: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: on (auto)
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00000033 (51)
        Link detected: yes
    

    在这个例子中,网卡速率为1000Mb/s(1Gbps)。

0