iperf 是一个基于C/S模型的纯带宽测试软件,可以测试网卡的吞吐量。
iperf的好处是纯粹发包和接收,防止硬盘拖后腿,影响测试结果。
本文以千兆网卡Bcom 5720 进行测试,环境CentOS 6.4 x64
在两台机器上分别安装iperf
1
|
yum
install
iperf --enablerepo=epel
|
在其中一台以服务端方式启动,并开放防火墙5001端口
1
|
iperf -s -i 1 -w 448k
|
启动结果如下:
1
2
|
Server listening on TCP port 5001
TCP window size: 448 KByte
|
在另一台上,以客户端方式连接到服务端,测试10分钟
1
|
iperf -c 10.10.10.22 -i 1 -w 448k -t 600
|
此时,服务端会显示如下信息
1
2
3
4
5
6
7
8
9
10
|
[ 4]
local
10.10.10.22 port 5001 connected with 10.10.10.11 port 56251
[ ID] Interval Transfer Bandwidth
[ 4] 0.0- 1.0 sec 112 MBytes 941 Mbits
/sec
[ 4] 1.0- 2.0 sec 112 MBytes 941 Mbits
/sec
[ 4] 2.0- 3.0 sec 112 MBytes 941 Mbits
/sec
[ 4] 3.0- 4.0 sec 112 MBytes 941 Mbits
/sec
[ 4] 4.0- 5.0 sec 112 MBytes 941 Mbits
/sec
[ 4] 5.0- 6.0 sec 112 MBytes 941 Mbits
/sec
[ 4] 6.0- 7.0 sec 112 MBytes 941 Mbits
/sec
[ 4] 7.0- 8.0 sec 112 MBytes 941 Mbits
/sec
|
客户端信息则是
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
3] 46.0-47.0 sec 112 MBytes 942 Mbits
/sec
[ ID] Interval Transfer Bandwidth
[ 3] 47.0-48.0 sec 112 MBytes 941 Mbits
/sec
[ ID] Interval Transfer Bandwidth
[ 3] 48.0-49.0 sec 112 MBytes 942 Mbits
/sec
[ ID] Interval Transfer Bandwidth
[ 3] 49.0-50.0 sec 112 MBytes 941 Mbits
/sec
[ ID] Interval Transfer Bandwidth
[ 3] 50.0-51.0 sec 112 MBytes 942 Mbits
/sec
[ ID] Interval Transfer Bandwidth
[ 3] 51.0-52.0 sec 112 MBytes 941 Mbits
/sec
[ ID] Interval Transfer Bandwidth
[ 3] 52.0-53.0 sec 112 MBytes 941 Mbits
/sec
[ ID] Interval Transfer Bandwidth
[ 3] 53.0-54.0 sec 112 MBytes 942 Mbits
/sec
[ ID] Interval Transfer Bandwidth
[ 3] 54.0-55.0 sec 112 MBytes 941 Mbits
/sec
|
以上信息显示,当前网卡传输速度约为940Mbit/s,接近理论速度1G/s,下载速度112M/s,也接近理论速度125M/s,通过cacti 带宽监控,也显示上述统计结果。
至此,千兆网卡验明正身。
补充说明,影响带宽的可能原因有很多:
1、交换机是百兆的,通信枢纽
2、千兆网卡工作在百兆模式,参与测试的机器任意一台工作在百兆都不行
3、用真实的硬盘文件进行测试,硬盘速度拖后腿
本文转自 紫色葡萄 51CTO博客,原文链接:http://blog.51cto.com/purplegrape/1248660,如需转载请自行联系原作者