您的位置:首页 > 理论基础 > 计算机网络

使用 iperf 测试网络性能

2014-03-12 22:08 549 查看
iperf 是一个 TCP/IP 性能测试工具,能够提供网络吞吐量信息,分析网络通信性能、定位网络瓶颈。
wget http://iperf.fr/download/iperf_2.0.5/iperf_2.0.5-2_amd64
chmod +x
iperf_2.0.5-2_amd64
mv iperf_2.0.5-2_amd64 /usr/bin/iperf

测试模型是以 C/S方式完成
服务端启动

# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
# iperf -sD
------------------------------------------------------------
Server listening on TCP port 5001
Running Iperf Server as a daemon
The Iperf daemon process ID : 7570
# netstat -nltp | grep iperf
tcp 0 0 0.0.0.0:5001 0.0.0.0:* LISTEN 7570/iperf

客户端链接测试

# iperf -c 172.16.180.8 -t 60
------------------------------------------------------------
Client connecting to 172.16.180.8, TCP port 5001
TCP window size: 169 KByte (default)
------------------------------------------------------------
[ 3] local 172.16.180.8 port 57486 connected with 172.16.180.8 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-60.0 sec 187 GBytes 26.7 Gbits/sec

参数小解

参数
含义
-c
以客户端模式运行,链接hhh主机的默认端口
-t
测试时间(秒),默认10秒
-p
指定端口监听、连接(小写)
-P
并行测试线程数量(大写)
-w
tcp窗口大小值(eg:-w 300k)
-i
间隔多少秒报告一次
-u
使用 UDP 协议
-T
ttl 值,存活时间;多播包默认是 1
-m
enable support Path MTU Discovery
# iperf -t 5 -i 2 -c localhost -P 3
------------------------------------------------------------
Client connecting to localhost, TCP port 5001
TCP window size: 169 KByte (default)
------------------------------------------------------------
[ 4] local 127.0.0.1 port 42458 connected with 127.0.0.1 port 5001
[ 5] local 127.0.0.1 port 42457 connected with 127.0.0.1 port 5001
[ 3] local 127.0.0.1 port 42456 connected with 127.0.0.1 port 5001
[ ID] Interval Transfer Bandwidth
[ 4] 0.0- 2.0 sec 924 MBytes 3.87 Gbits/sec
[ 5] 0.0- 2.0 sec 1.29 GBytes 5.54 Gbits/sec
[ 3] 0.0- 2.0 sec 1.58 GBytes 6.79 Gbits/sec
[SUM] 0.0- 2.0 sec 3.77 GBytes 16.2 Gbits/sec
[ 4] 2.0- 4.0 sec 976 MBytes 4.09 Gbits/sec
[ 5] 2.0- 4.0 sec 1.32 GBytes 5.65 Gbits/sec
[ 3] 2.0- 4.0 sec 1.54 GBytes 6.62 Gbits/sec
[SUM] 2.0- 4.0 sec 3.81 GBytes 16.4 Gbits/sec
[ 3] 0.0- 5.0 sec 3.83 GBytes 6.59 Gbits/sec
[ 4] 0.0- 5.0 sec 2.40 GBytes 4.13 Gbits/sec
[ 5] 0.0- 5.0 sec 3.24 GBytes 5.56 Gbits/sec
[SUM] 0.0- 5.0 sec 9.48 GBytes 16.3 Gbits/sec

# iperf -m -c localhost -t 3 -P 2
------------------------------------------------------------
Client connecting to localhost, TCP port 5001
TCP window size: 169 KByte (default)
------------------------------------------------------------
[ 4] local 127.0.0.1 port 42965 connected with 127.0.0.1 port 5001
[ 3] local 127.0.0.1 port 42966 connected with 127.0.0.1 port 5001
[ ID] Interval Transfer Bandwidth
[ 4] 0.0- 3.0 sec 1.70 GBytes 4.86 Gbits/sec
[ 4] MSS size 16384 bytes (MTU 16424 bytes, unknown interface)
[ 3] 0.0- 3.0 sec 1.84 GBytes 5.24 Gbits/sec
[ 3] MSS size 16384 bytes (MTU 16424 bytes, unknown interface)
[SUM] 0.0- 3.0 sec 3.53 GBytes 10.1 Gbits/sec

本文出自 “小崔的实验笔记” 博客,谢绝转载!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: