1、查看Linux系统有几块网卡
ifconfig -a
或者使用如下命令:
cat /proc/net/dev
lspci | grep -i eth
2、查看网卡的宽带
ethtool命令用于获取以太网卡的配置信息,或者修改这些配置(这个命令比较复杂,功能特别多回头写一个命令解释)
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 //自动协商开启 对应关闭配置为:No
Speed: 1000Mb/s //速度 1000Mb
Duplex: Full //全双工 对应配置还有Half
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: g
Wake-on: d
Link detected: yes //eth0已经激活
先不用关注每一项的具体含义,先看Advertised link modes、Auto-negotiation、Duplex。首先连接模式、自动协商是否开启(在这里是开启的)、全双工
3、根据使用的模式计算支持的最大带宽
网卡传输的计算单位是bit,所以当统计为Byte为单位时就需要转换 1byte=8bit
100Mbits=12.5MB
4、使用工具查看目前网卡上传和下载的使用量比如这里用dstat
dstat
You did not select any stats, using -cdngy by default.
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
0 0 100 0 0 0|1621B 2272k| 0 0 | 0 0 | 216 226
0 0 100 0 0 0| 0 0 |2143B 4545B| 0 0 | 668 981
0 0 100 0 0 0| 0 0 |2871B 4538B| 0 0 | 404 615
0 0 100 0 0 0| 0 96k|2500B 2460B| 0 0 | 317 453
0 0 100 0 0 0| 0 0 | 233B 2316B| 0 0 | 326 512
0 0 100 0 0 0| 0 0 | 233B 2242B| 0 0 | 295 465
0 0 100 0 0 0| 0 0 |2476B 2521B| 0 0 | 250 428
对比网络带宽来判断网卡是否打满