溫馨提示×

linux如何查網(wǎng)卡速率

小億
85
2024-09-05 06:49:59
欄目: 智能運維

在Linux中,您可以使用ethtool命令來查詢網(wǎng)卡的速率

  1. 首先,確保您已經(jīng)安裝了ethtool。在大多數(shù)發(fā)行版中,它應(yīng)該已經(jīng)預(yù)裝。如果沒有,請使用以下命令安裝:

    對于Debian/Ubuntu系統(tǒng):

    sudo apt-get install ethtool
    

    對于RHEL/CentOS系統(tǒng):

    sudo yum install ethtool
    
  2. 然后,找到您要查詢速率的網(wǎng)卡名稱。使用ipifconfig命令查看網(wǎng)卡列表。例如:

    ip link show
    

    或者

    ifconfig -a
    
  3. 現(xiàn)在,使用ethtool命令查詢網(wǎng)卡速率。將<network_interface>替換為您在上一步中找到的網(wǎng)卡名稱(例如,eth0、ens33等):

    ethtool<network_interface>
    

    在輸出中,您將看到網(wǎng)卡的詳細(xì)信息,包括速率。例如:

    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
    

    在這個例子中,網(wǎng)卡速率為1000Mb/s(1Gbps)。

0