Iperf是一个网络性能测试工具。可以测试TCP和UDP带宽质量,可以测量最大TCP带宽,具有多种参数和UDP特性,可以报告带宽,延迟抖动和数据包丢失。Iperf在linux和windows平台均有二进制版本供自由使用。

Iperf was developed by NLANRDAST as a modern alternative for measuring maximum TCP and UDP bandwidth performance. Iperf allows the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, datagram loss.

Iperf使用方法与参数说明

参数说明

-s 以server模式启动,eg:iperf -s

-c host以client模式启动,host是server端地址,eg:iperf -c 222.35.11.23

通用参数

-f [kmKM] 分别表示以Kbits, Mbits, KBytes, MBytes显示报告,默认以Mbits为单位,eg:iperf -c 222.35.11.23 -f K

-i sec 以秒为单位显示报告间隔,eg:iperf -c 222.35.11.23 -i 2

-l 缓冲区大小,默认是8KB,eg:iperf -c 222.35.11.23 -l 16

-m 显示tcp最大mtu值

-o 将报告和错误信息输出到文件eg:iperf -c 222.35.11.23 -o ciperflog.txt

-p 指定服务器端使用的端口或客户端所连接的端口eg:iperf -s -p 9999;iperf -c 222.35.11.23 -p 9999

-u 使用udp协议

-w 指定TCP窗口大小,默认是8KB

-B 绑定一个主机地址或接口(当主机有多个地址或接口时使用该参数)

-C 兼容旧版本(当server端和client端版本不一样时使用)

-M 设定TCP数据包的最大mtu值

-N 设定TCP不延时

-V 传输ipv6数据包

server专用参数

-D 以服务方式运行iperf,eg:iperf -s -D

-R 停止iperf服务,针对-D,eg:iperf -s -R

client端专用参数

-d 同时进行双向传输测试

-n 指定传输的字节数,eg:iperf -c 222.35.11.23 -n 100000

-r 单独进行双向传输测试

-t 测试时间,默认10秒,eg:iperf -c 222.35.11.23 -t 5

-F 指定需要传输的文件

-T 指定ttl值

应用实例

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

iperf –s

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

Server listening on TCP port 5001

TCP window size: 8.00 KByte (default)

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

iperf -c 59.128.103.56

上面使用服务端和客户端的默认设置进行测试

iperf -s -w 300K

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

Server listening on TCP port 5001

TCP window size:  300 KByte

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

iperf -c 59.128.103.56 -f K -i 2 -w 300K

设定报告间隔为2秒,服务器端和客户端的TCP窗口都开到300KB

iperf -c 59.128.103.56 -f K -i 2 -w 300K –n 1000000

测试传输约1MB数据

iperf -c 59.128.103.56 -f K -i 2 -w 300K –t 36

测试持续36秒

iperf -c 59.128.103.56 -f K -i 2 -w 300K -n 10400000 –d

测试双向的传输

iperf -c 59.128.103.56 -f K -i 2 -w 300K –u

UDP测试

其中 -i 参数的含义是周期性报告的时间间隔(interval),单位为秒;在上面的例子中,表示每隔2秒报告一次带宽等信息。

启动一个iperf服务器进程

  首先要介绍的命令用来启动iperf服务器监听进程以便监听客户端连接的。命令如下:

  iperf.exe -s -P 2 -i 5 -p 5999 -f k

  这个命令会启动iperf,后续参数用来设定监听5999 端口(默认端口是5001), 限定iperf只允许两个连接,每5秒汇报一次连接情况。连接限制参数(-P参数)非常重要,当两个连接建立后,服务器进程就会退出。如果这个参数设定为0,那么iperf 进程将持续监听端口,并且不限制连接数量。在 Windows主机上键入该命令,会显示出如图A所示界面

  图 A

  

  启动一个iperf 客户端连接

  iperf 的另一半就是客户端,用来连接到服务器监听端口。比如我们要连接到一台叫做 s-network1.amcs.tld 的服务器,端口为5999,连接60 秒并且每5秒显示一次状态,命令行如下:

  iperf.exe -c s-network1.amcs.tld -P 1 -i 5 -p 5999 -f B -t 60 -T 1

  命令启动后,s-network1 主机被用来进行网络性能检测。与Jperf GUI 界面提供的漂亮图形不同, iperf只会根据测量参数简单的报告网络带宽状况,在本例中是以 比特为单位(-f 参数)进行带宽表示的。图B显示了远程客户端与s-network1主机间的带宽性能。

  图 B

  

  为了应对日常便捷应用的需求,我们可以建立一个 .bat批处理文件,届时填入服务器名称即可实现快速检测。以下为实际使用的拷屏:

C:\jperf\jperf\bin>iperf
Usage: iperf [-s|-c host] [options]
Try `iperf --help' for more information.

C:\jperf\jperf\bin>iperf --help
Usage: iperf [-s|-c host] [options]
       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)
  -o, --output    <filename> output the report or error message to this specified file
  -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      <host>   bind to <host>, an interface or multicast address
  -C, --compatibility      for use with older versions does not sent extra msgs
  -M, --mss       #        set TCP maximum segment size (MTU - 40 bytes)
  -N, --nodelay            set TCP no delay, disabling Nagle's Algorithm
  -V, --IPv6Version        Set the domain to IPv6

Server specific:
  -s, --server             run in server mode
  -D, --daemon             run the server as a daemon
  -R, --remove             remove service in win32

Client specific:
  -b, --bandwidth #[KM]    for UDP, bandwidth to send at in bits/sec
                           (default 1 Mbit/sec, implies -u)
  -c, --client    <host>   run in client mode, connecting to <host>
  -d, --dualtest           Do a bidirectional test simultaneously
  -n, --num       #[KM]    number of bytes to transmit (instead of -t)
  -r, --tradeoff           Do a bidirectional test individually
  -t, --time      #        time in seconds to transmit for (default 10 secs)
  -F, --fileinput <name>   input the data to be transmitted from a file
  -I, --stdin              input the data to be transmitted from stdin
  -L, --listenport #       port to recieve bidirectional tests back on
  -P, --parallel  #        number of parallel client threads to run
  -T, --ttl       #        time-to-live, for multicast (default 1)

Miscellaneous:
  -h, --help               print this message and quit
  -v, --version            print version information and quit

[KM] Indicates options that support a K or M suffix for kilo- or mega-

The TCP window size option can be set by the environment variable
TCP_WINDOW_SIZE. Most other options can be set by an environment variable
IPERF_<long option name>, such as IPERF_BANDWIDTH.

Iperf使用参数详解相关推荐

  1. CI流水线配置文件参数详解(一)

    文章目录 4. 参数详解(一) 4.1 ``script`` 4.2 ``image`` 指定使用Docker镜像.如 ``iamge:name`` ,暂时忽略. 4.3 ``before_scrip ...

  2. 内存性能参数详解(转载)

    内存性能参数详解 先说说最有效提高你机器内存性能的几个参数:CL,TRP,TRCD CAS Latency "列地址选通脉冲潜伏期" BIOS中可能的其他描述为:tCL.CAS L ...

  3. spring boot 实战 / 可执行war启动参数详解

    概述   上一篇文章<spring boot 实战 / mvn spring-boot:run 参数详解>主要讲解了spring boot 项目基于maven插件启动过程中借助profil ...

  4. 调包侠福音!机器学习经典算法开源教程(附参数详解及代码实现)

    Datawhale 作者:赵楠.杨开漠.谢文昕.张雨 寄语:本文针对5大机器学习经典算法,梳理了其模型.策略和求解等方面的内容,同时给出了其对应sklearn的参数详解和代码实现,帮助学习者入门和巩固 ...

  5. plot参数详解python_30行Python代码实现3D数据可视化

    作者:潮汐 来源:Python技术 欢迎来到编程教室~ 我们之前的文章中有讲解过不少 Matplotlib 的用法,比如: 完成这50个Matplotlib代码,你也能画出优秀的图表 25个常用Mat ...

  6. Ehcache配置参数详解

    ehcache配置参数详解 <?xml version="1.0" encoding="UTF-8"?><ehcache><dis ...

  7. PHP date函数参数详解

    PHP date函数参数详解 作者: 字体:[增加 减小] 类型:转载 time()在PHP中是得到一个数字,这个数字表示从1970-01-01到现在共走了多少秒,很奇怪吧  不过这样方便计算, 要找 ...

  8. ping ip 端口_学生会私房菜【20200305期】——Ping命令及其常用参数详解

    一命令原理 Ping是ICMP的一个典型应用.Ping是检测网络连通的常用工具,同时也能收集其他相关信息.用户可以在Ping命令中指定不同参数,如ICMP报文长度.发送的ICMP报文个数.等待回复响应 ...

  9. python箱线图_Python 箱线图 plt.boxplot() 参数详解

    Python 绘制箱线图主要用 matplotlib 库里 pyplot 模块里的 boxplot() 函数. plt.boxplot() 参数详解 plt.boxplot(x, # 指定要绘制箱线图 ...

最新文章

  1. 为什么需要 外键 呢?
  2. lucene反向索引——倒排表无论是文档号及词频,还是位置信息,都是以跳跃表的结构存在的...
  3. 中国移动、联通、电信、第三方平台IDC市场机房布局之争
  4. 新年图书整理和相关的产品
  5. emwin之错误使用控件函数导致死机现象
  6. 图片下载中文传输转义问题
  7. Javascript對表格的操作[知識積累帖]
  8. java web 手机验证_JAVA-WEB,好知网,登录注册,手机验证
  9. 归心似箭,IT达人分享抢票攻略
  10. alidata 手动挂载数据盘
  11. Linux基础 权限与用户管理命令
  12. mongodb 导出一条数据_MongoDB数据库中数据的导出
  13. Adobe Photoshop CS6 仅需要两个步骤快速去除图片中的文字
  14. LZY最喜欢的思维题
  15. 通过 blast 结果查看 测序数据fastq是否被污染,以及污染reads所属物种、所占比例
  16. linux环境开启kettle Carte
  17. 取字符串拼音首字母(js)
  18. 二手房买卖必须弄懂的七件事
  19. C#中改变工具条ToolStrip的位置/宽度/高度?
  20. 回溯算法:从电影《蝴蝶效应》中学习回溯算法的核心思想

热门文章

  1. 语音怎么在线转文字,语音转文字的小技巧
  2. H5项目常见问题汇总及解决方案 1
  3. 微信小程序如何转云开发
  4. 50条经典(学生,课程,成绩,教师)表SQL语句~~值得一看!
  5. 【地理信息系统GIS专业的10个发展方向:】
  6. 台式机笔记本电脑平板电脑属于什么计算机,pc机属于什么计算机
  7. Java Web项目开发流程
  8. 在Linux中重启Tomcat服务器
  9. ubuntu下重启tomcat
  10. Android网络开发技术实战详解