之前介绍的ping和traceroute能够测量网络的延迟以及节点间的跳数。
iperf能够提供更多的网络性能指标。系统中默认并没有安装该命令,可以通过发行版的包管理器自行安装。
实战演练
iperf必须安装在链路的两端(服务器端和客户端)。安装好之后,启动服务器端:
$ yum install iperf3 -y$ iperf3 -s
然后运行客户端,生成吞吐量统计:
$ iperf3 -c 192.168.1.36Client connecting to 192.168.1.36, TCP port 5001TCP window size: 19.3 KByte (default)[ 3] local 192.168.1.44 port 46526 connected with 192.168.1.36 port 5001[ ID] Interval Transfer Bandwidth[ 3] 0.0-10.0 sec 113 MBytes 94.7 Mbits/sec
选项-m会使得iperf找出最大传输单元(Maximum Transfer Size,MTU):
$ iperf3 -mc 192.168.1.36Client connecting to 192.168.1.36, TCP port 5001TCP window size: 19.3 KByte (default)[ 3] local 192.168.1.44 port 46558 connected with 192.168.1.36 port 5001[ ID] Interval Transfer Bandwidth[ 3] 0.0-10.0 sec 113 MBytes 94.7 Mbits/sec[ 3] MSS size 1448 bytes (MTU 1500 bytes, ethernet)
