Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1764255
  • 博文数量: 306
  • 博客积分: 3133
  • 博客等级: 中校
  • 技术积分: 3932
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-19 16:50
文章分类

全部博文(306)

文章存档

2018年(7)

2017年(18)

2016年(39)

2015年(35)

2014年(52)

2013年(39)

2012年(22)

2011年(29)

2010年(53)

2009年(12)

分类: 系统运维

2016-12-22 15:39:10

本文译至:


如果要测量的带宽,iperf是一个非常有用的工具。

系统中netperf比较有名,的测量我觉得使用iperf更容易

indows各种都可以使用。

NLANR / DAST:iperf - The / Bandwidth Measurement Tool

用法

下面是命令的用法

单播模式
  • 的情况
$ iperf -s 
$ iperf -c <接收端主机名><接收端的IP地址> 
    • 例1)测试通信的最大速率
$ iperf -c 192.168.1.100 
    • 例2)使用TCP发送100兆字节的数据
$ iperf -c <目标地址> -l 100M 
  • 的情况
$ iperf -s -u 
$ iperf -c 192.168.1.100 -u -b <传输带宽> -t <测量时间[秒] > -i <间隔> 
    • 例1)以方式向192.168.1.100传送60秒的10M的数据

间隔两秒钟输出报告结果。

$ iperf -c 192.168.1.100 -u -b 10M -t 60 -i 2 
    • 例2)方式向192.168.1.100传送60秒的10M的双向数据
$ iperf -c 192.168.1.100 -u -b 10M -t 60 -i 2 -d 
    • 例3)方式向192.168.1.100传送60秒的10M的3路双向数据
$ iperf -c 192.168.1.100 -u -b 10M -t 60 -i 2 -P 3 
模式
 $ iperf -s -u -B <多播地址> -i <结果显示间隔> EX)$ iperf -s -u -B 224.0.55.55 -i 1 
 $ iperf -c <多播地址> -u -T < TTL > -t <测量时间[秒] > -i <间隔> -b <传输带宽>   EX)$ iperf -c 224.0.55.55 -u -T 32 -t 10 -i 1 -b 1M 
模式
 $ iperf -s -V 
 $ iperf -c <服务器的IPv6地址> -V 

查看结果

 
node2> iperf -s -u -i 1 ------------------------------------------------------------ 
Server listening on UDP port 5001 Receiving 1470 byte datagrams 
UDP buffer size: 60.0 KByte (default) 
------------------------------------------------------------ 
[ 4] local <IP Addr node2> port 5001 connected with <IP Addr node1> port 9726 [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams 
[ 4] 0.0- 1.0 sec 1.3 MBytes 10.0 Mbits/sec 0.209 ms 1/ 894 (0.11%) 
[ 4] 1.0- 2.0 sec 1.3 MBytes 10.0 Mbits/sec 0.221 ms 0/ 892 (0%) ←中间结果
[ 4] 2.0- 3.0 sec 1.3 MBytes 10.0 Mbits/sec 0.277 ms 0/ 892 (0%) 
[ 4] 3.0- 4.0 sec 1.3 MBytes 10.0 Mbits/sec 0.359 ms 0/ 893 (0%) 
[ 4] 4.0- 5.0 sec 1.3 MBytes 10.0 Mbits/sec 0.251 ms 0/ 892 (0%) 
[ 4] 5.0- 6.0 sec 1.3 MBytes 10.0 Mbits/sec 0.215 ms 0/ 892 (0%) 
[ 4] 6.0- 7.0 sec 1.3 MBytes 10.0 Mbits/sec 0.325 ms 0/ 892 (0%) 
[ 4] 7.0- 8.0 sec 1.3 MBytes 10.0 Mbits/sec 0.254 ms 0/ 892 (0%) 
[ 4] 8.0- 9.0 sec 1.3 MBytes 10.0 Mbits/sec 0.282 ms 0/ 892 (0%) 
[ 4] 0.0-10.0 sec 12.5 MBytes 10.0 Mbits/sec 0.243 ms 1/ 8922 (0.011%) ←最终结果
从左至右,测量时间,接收到的数据,bps,单向延迟,丢包数/接收数量(丢包率)
 
node1> iperf -c node2 -u -b 10m 
------------------------------------------------------------ 

Client connecting to node2, UDP port 5001 Sending 1470 byte datagrams 
UDP buffer size: 60.0 KByte (default) 

------------------------------------------------------------ 

[ 3] local <IP Addr node1> port 9726 connected with <IP Addr node2> port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 12.5 MBytes 10.0 Mbits/sec 
[ 3] Sent 8922 datagrams 

-s 启动
-c <服务器地址> 启动模式启动
-B <绑定地址> 加入指定的,只在情况下使用
-u 发送(-b 情况下可选)
-b <编号> [  ] 指定带宽(缺省为1 Mbps)仅用于UDP
-T <数>
-t <秒> 测量时间
-i <秒> 报告显示间隔
-l <字节> 大小
-d 发送接收模式
阅读(14162) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~