ifconfig 命令主要用于配置和显示网络接口的参数,如 IP 地址、子网掩码、广播地址等。它并不能直接显示网络带宽。但是,你可以使用 ethtool 命令来查看网络接口的带宽信息。
以下是如何使用 ethtool 查看网络带宽的步骤:
打开终端(Terminal)。
输入以下命令,将 eth0 替换为你想要查看的网络接口名称:
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: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: off (auto)
    Supports Wake-on: g
    Wake-on: d
    Current message level: 0x00000007 (7)
               drv probe link
    Link detected: yes
在这个例子中,网络接口 eth0 的速度为 1000Mb/s(即 1 Gbps),双工模式为全双工(Full)。