mii-tool

一般使用mii-tool可以设置以太网设备,使用它还可以显示当前的设置信息。

1mii-tool -v em1
2em1: negotiated 1000baseT-FD flow-control, link ok
3  product info: vendor 00:d8:97, model 54 rev 0
4  basic mode:   autonegotiation enabled
5  basic status: autonegotiation complete, link ok
6  capabilities: 1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
7  advertising:  1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
8  link partner: 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control

ethtool

ethtool与mii-tool类似,可以提供更多的配置选线和设备统计信息显示。

 1ethtool em1
 2Settings for em1:
 3        Supported ports: [ TP ]
 4        Supported link modes:   10baseT/Half 10baseT/Full
 5                                100baseT/Half 100baseT/Full
 6                                1000baseT/Half 1000baseT/Full
 7        Supported pause frame use: No
 8        Supports auto-negotiation: Yes
 9        Advertised link modes:  10baseT/Half 10baseT/Full
10                                100baseT/Half 100baseT/Full
11                                1000baseT/Half 1000baseT/Full
12        Advertised pause frame use: Symmetric
13        Advertised auto-negotiation: Yes
14        Link partner advertised link modes:  10baseT/Half 10baseT/Full
15                                             100baseT/Half 100baseT/Full
16                                             1000baseT/Full
17        Link partner advertised pause frame use: Symmetric Receive-only
18        Link partner advertised auto-negotiation: Yes
19        Speed: 1000Mb/s
20        Duplex: Full
21        Port: Twisted Pair
22        PHYAD: 1
23        Transceiver: internal
24        Auto-negotiation: on
25        MDI-X: off
26        Supports Wake-on: g
27        Wake-on: d
28        Current message level: 0x000000ff (255)
29                               drv probe link timer ifdown ifup rx_err tx_err
30        Link detected: yes

ifconfig

ifconfig用来安装和配置网络接口,同时提供系统中网络设备的基本性能统计信息,基于这些统计信息可以基本确定每个网络设备的健康状况和性能情况。 ifconfig提供的数据是自系统启动开始的累计值。

 1ifconfig
 2eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
 3        inet 10.10.200.31  netmask 255.255.255.0  broadcast 10.10.200.255
 4        inet6 fe80::3c41:204f:bb6a:32cf  prefixlen 64  scopeid 0x20<link>
 5        inet6 fe80::1212:5fb1:ad46:6dc0  prefixlen 64  scopeid 0x20<link>
 6        inet6 fe80::899d:dd4d:bcf5:af9f  prefixlen 64  scopeid 0x20<link>
 7        ether 52:54:00:f6:20:04  txqueuelen 1000  (Ethernet)
 8        RX packets 37181529  bytes 60072792766 (55.9 GiB)
 9        RX errors 0  dropped 0  overruns 0  frame 0
10        TX packets 29861642  bytes 11325730097 (10.5 GiB)
11        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
12
13lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
14        inet 127.0.0.1  netmask 255.0.0.0
15        inet6 ::1  prefixlen 128  scopeid 0x10<host>
16        loop  txqueuelen 1  (Local Loopback)
17        RX packets 5023286  bytes 4597022868 (4.2 GiB)
18        RX errors 0  dropped 0  overruns 0  frame 0
19        TX packets 5023286  bytes 4597022868 (4.2 GiB)
20        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • RX packets: 设备已经接受的数据大小
  • RX errors: 接收时的错误数
  • dropped: 发送或接收时丢弃的数据包数
  • overruns: 当网络设备没有足够的缓冲区来发送或接收数据包的次数
  • frame: 底层以太网桢错误的数量
  • TX packkes: 设备已经发送的数据大小
  • TX errors: 发送时的错误数

ip

ip是用来取代ifconfig的新命令,可以对Linux网络进行多方面的配置,同时也可以显示网络设备的性能统计信息。

例如ip linkip -s link显示所有网络设备更加详细的统计信息,也是从系统启动开始的总的统计数据。