Linux性能检查(三)网络
Linux性能检查(三)网络
我们可以通过 ethtool 工具来查看网卡的配置和工作模式:
>/sbin/ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Current message level: 0x000000ff (255)
Link detected: yes
说明网卡有 10baseT,100baseT 和 1000baseT 三种选择,目前正自适应为 100baseT(Speed: 100Mb/s)。
iptraf
iptraf 就是一个很好的查看本机网络吞吐量的好工具
[root@cd5 ~]# iptraf -d eth
-bash: iptraf: command not found
安装该工具
>yum install iptraf
netperf
略过
iperf
略过
tcpdump 和 tcptrace
先用 tcpdump 按要求捕获数据包把结果输出到某一文件,然后再用 tcptrace 分析其文件格式。
>/usr/sbin/tcpdump -w network.dmp
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
安装tcptrace工具
首页:http://www.tcptrace.org/download.html
解开压缩
>tar zxvf tcptrace-6.6.7.tar.gz
>mv tcptrace-6.6.7 /opt/
>cd /opt/tcptrace-6.6.7/
>./configure
>make
出错提示:
tcpdump.c:66:18: error: pcap.h: No such file or directory
tcpdump.c:72: error: expected declaration specifiers or ‘...’ before ‘pcap_handler’
tcpdump.c:75: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
tcpdump.c: In function ‘callback’:
tcpdump.c:100: error: dereferencing pointer to incomplete type
tcpdump.c:104: error: ‘pcap’ undeclared (first use in this function)
tcpdump.c:104: error: (Each undeclared identifier is reported only once
tcpdump.c:104: error: for each function it appears in.)
tcpdump.c: In function ‘pread_tcpdump’:
tcpdump.c:251: error: ‘pcap’ undeclared (first use in this function)
tcpdump.c:251: error: ‘pcap_handler’ undeclared (first use in this function)
tcpdump.c:251: error: expected ‘)’ before ‘callback’
解决方案,安装libpcap
下载文件:
http://www.tcpdump.org/release/
>tar zxvf libpcap-1.1.1.tar.gz
>mv libpcap-1.1.1 /opt/
>./configure
>make
>make instal