Chinaunix首页 | 论坛 | 博客
  • 博客访问: 108736
  • 博文数量: 19
  • 博客积分: 780
  • 博客等级: 军士长
  • 技术积分: 205
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-18 17:33
文章分类

全部博文(19)

文章存档

2011年(2)

2008年(1)

2006年(16)

分类: 系统运维

2006-11-23 19:28:34

Iperf: 一个优秀的网络性能测量工具


Iperf 是一个 TCP/IP UDP/IP 的性能测量工具,能够提供网络吞吐率信息,以及震动、
丢包率、最大段和最大传输单元大小等统计信息;从而能够帮助我们测试网络性能,定位
网络瓶颈。其设计从根本上克服了原来的一些工具,如 ttcp nettest 等,的固有的缺陷。

为了方便使用,Iperf 还提供了一个 Java 前端。如下图所示:




 
这个前端仅仅是让用户以图形化的方式配置选项,实际上最终还是要(另外打开一个窗口)
运行 Iperf 程序。其启动方式为运行 jperf,实际上jperf 只是shell脚本,后台运行的
java -classpath jperf.jar Interface

Iperf 的命令行选项与jperf界面展示的基本一样。下面我们结合例子进行介绍其主要用法。

使用 iperf -s 命令将 Iperf 启动为 server 模式,在客户机上使用 iperf -c启动client模式。

[wfchair@wfchair]$ iperf -c bfp1 -i1

命令的输出如下:

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

Client connecting to bfp1, TCP port 5001
TCP window size: 64.0 KByte (default)

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

[ 3] local 152.16.3.132 port 1026 connected with 152.3.2.110 port 5001

[ ID] Interval Transfer Bandwidth

[ 3] 0.0- 1.0 sec 720 KBytes 5.5 Mbits/sec
[ 3] 1.0- 2.3 sec 704 KBytes 4.3 Mbits/sec
[ 3] 2.3- 3.0 sec 448 KBytes 5.0 Mbits/sec
[ 3] 3.0- 4.1 sec 504 KBytes 3.6 Mbits/sec
[ 3] 4.1- 5.4 sec 656 KBytes 3.9 Mbits/sec
[ 3] 5.4- 6.1 sec 360 KBytes 4.1 Mbits/sec
[ 3] 6.1- 7.2 sec 584 KBytes 4.1 Mbits/sec
[ 3] 7.2- 8.1 sec 600 KBytes 5.1 Mbits/sec
[ 3] 8.1- 9.2 sec 472 KBytes 3.4 Mbits/sec
[ 3] 9.2-10.1 sec 480 KBytes 4.3 Mbits/sec

bfp1 为启动了 Iperf server 模式的一台机器。其中 -i 参数的含义是周期性报告的时间间隔
interval),单位为秒;在上面的例子中,表示每隔一秒报告一次(带宽等信息)。

另外还有其它一些选项,您可以参看手册里的说明。
 


How to use iperf

 作者changys 


       IperfTtcpw相比较有几个区别:Iperf服务器端起来以后,不会因为客户端每次测试完毕而自动退出;而Ttcpw服务器端起来后会随着客户端 每次测试的完毕而自动退出。Ttcpw被集成到了CISCO路由器的IOS中,所以可以对路由器直接进行测试,这项功能是Iperf所不能支持的。其他的 区别可以在学习和使用中慢慢发掘。以下是一个简单的使用文档,请参考:

1.       where to download iperf ?

   

2.       how to use iperf ?

server side:

#iperf -s  

  client side:

   #iperf -c -i < interval time> -t

3.       how to use iperf  as a Service under Win32

-o outputfilename

output the messages into the specified file

-s -D

install Iperf as a service and run it

-s -R

uninstall the Iperf service

4.       usage

    Usage: iperf [-s|-c host] [-p port] [-t secs] [-w bytes] ...

       iperf [-h|--help] [-v|--version]

 

Client/Server:

  -f, --format    [kmKM]   format to report: Kbits, Mbits, KBytes, MBytes

  -i, --interval  #        seconds between periodic bandwidth reports

  -l, --len       #[KM]    length of buffer to read or write (default 8 KB)

  -m, --print_mss          print TCP maximum segment size (MTU - TCP/IP header)

  -p, --port      #        server port to listen on/connect to

  -u, --udp                use UDP rather than TCP

  -w, --window    #[KM]    TCP window size (socket buffer size)

  -B, --bind         bind to , an interface or multicast address

  -M, --mss       #        set TCP maximum segment size (MTU - 40 bytes)

  -N, --nodelay            set TCP no delay, disabling Nagle's Algorithm

 

Server specific:

  -s, --server             run in server mode

  -D, --daemon             run the server as a daemon

 

Client specific:

  -b, --bandwidth #[KM]    for UDP, bandwidth to send at in bits/sec

                           (default 1 Mbit/sec, implies -u)

  -c, --client       run in client mode, connecting to

  -n, --num       #[KM]    number of bytes to transmit (instead of -t)

  -t, --time      #        time in seconds to transmit for (default 10 secs)

  -F, --fileinput    input the data to be transmitted from a file

  -I, --stdin              input the data to be transmitted from stdin

  -P, --parallel  #        number of parallel client threads to run

  -T, --ttl       #        time-to-live, for multicast (default 1)

  -W, --windowSizeSuggest  Run the client so as to suggest a suitable window size (default off)

 

Miscellaneous:

  -h, --help               print this message and quit

  -v, --version            print version information and quit

阅读(3629) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~