linux

如何用ifconfig查看网络带宽

小樊
47
2025-07-24 04:06:10
栏目: 编程语言

ifconfig 命令主要用于配置和显示网络接口的参数,如 IP 地址、子网掩码、广播地址等。它并不能直接显示网络带宽。但是,你可以使用 ethtool 命令来查看网络接口的带宽信息。

以下是如何使用 ethtool 查看网络带宽的步骤:

  1. 打开终端(Terminal)。

  2. 输入以下命令,将 eth0 替换为你想要查看的网络接口名称:

ethtool eth0
  1. 按 Enter 键运行命令。你将看到关于该网络接口的详细信息,包括速度(Speed)和双工模式(Duplex)等。

例如,输出可能类似于以下内容:

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

0
看了该问题的人还看了