linux如何查网卡速率

611
2024/9/5 9:32:28
栏目: 智能运维
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

在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)。

辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读: 免费linux服务器能做什么项目