网络测试工具—— iperf2详细使用方法
简介
很多公司都在将自己的无线网络升级到802.11n,以实现更大的吞吐量、更广的覆盖范围和更高的可靠性,然而保证无线LAN(WLAN)的性能对于确保足够的网络容量和覆盖率尤为重要。下面,我们将探讨如何通过iPerf来测定网络性能,这是一个简单易用测量TCP/UDP的吞吐量、损耗和延迟的工具。
软件安装
# ubuntu系统
sudo apt install iperf
说明:不同的系统安装方式不同,这里只介绍ubuntu系统
使用介绍
案例一:工具检验测试
启动一个串口,输入指令
iperf -s
# 开启iperf服务端
效果如下:
启动另一个窗口,输入指令
iperf -c 127.0.0.1
# 作为客户端运行,测试10s回环通信数据
测试结果如下:
上面的例子只是简单测试了回环通信的吞吐量,如果显示正常,说明iperf安装和运行均正常。
案例二:TCP通信测试
先关闭上面的测试窗口,或结束上面的服务程序,我们这里还是以127.0.0.1作回环测试,时间应用场景中只需要把IP地址替换为对应服务端的IP地址即可
启动服务端,输入指令
iperf -s -b 7M -i 5
# 作为服务端运行,带宽7M,报告回显间隔时间5s
效果如下
打开新的terminal,启动客户端,输入指令
iperf -c 127.0.0.1 -b 7M -i 5 -t 30
#作为客户端,连接服务端ip地址127.0.0.1,带宽7M,与服务端保持一致,报告回显间隔5s,测试时间30s
测试效果如下:
我们这里测试吞吐量的结果为7.34M左右,是因为我们限制了测试数据的带宽就是7M,我们做的回环测试,实际回环的吞吐量应该是G为单位,测试过程中,如果发现测试的带宽与限制带宽接近,说明限制设置的太小了,需要适当调整-b参数,或者参考硬件厂家给的指标测试。
案例三:UDP测试
先关闭上面的测试窗口,或结束上面的服务程序,我们这里还是以127.0.0.1作回环测试,时间应用场景中只需要把IP地址替换为对应服务端的IP地址即可
启动服务端,输入指令
iperf -s -u -b 7M -i 5
# 作为UDP服务端启动iperf,限制带宽7M,报告回显时间间隔5s
效果如下:
启动客户端,输入指令
iperf -u -c 127.0.0.1 -b 7M -i 5 -t 30
测试效果如下:
我们这里测试吞吐量的结果为7.34M左右,是因为我们限制了测试数据的带宽就是7M,我们做的回环测试,实际回环的吞吐量应该是G为单位,测试过程中,如果发现测试的带宽与限制带宽接近,说明限制设置的太小了,需要适当调整-b参数,或者参考硬件厂家给的指标测试。
此时服务端显示内容如下:
我们可以看到服务端还可以显示通信延时Jitter(在连续传输中的平滑平均值差)和丢包率:Lost/Total Data
详细解读
我们可以直接参考系统自带的帮助文档,如下:
iperf -h
Usage: iperf [-s|-c host] [options]
iperf [-h|--help] [-v|--version]
Client/Server: -b, --bandwidth #[kmgKMG | pps] bandwidth to send at in bits/sec or packets per second -e, --enhancedreports use enhanced reporting giving more tcp/udp and traffic information -f, --format [kmgKMG] format to report: Kbits, Mbits, KBytes, MBytes -i, --interval # seconds between periodic bandwidth reports -l, --len #[kmKM] length of buffer in bytes to read or write (Defaults: TCP=128K, v4 UDP=1470, v6 UDP=1450) -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 --udp-counters-64bit use 64 bit sequence numbers with UDP -w, --window #[KM] TCP window size (socket buffer size) -z, --realtime request realtime scheduler -B, --bind <host>[:<port>][%<dev>] bind to <host>, ip addr (including multicast address) and optional port and device -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 -S, --tos # set the socket's IP_TOS (byte) field
Server specific: -s, --server run in server mode -t, --time # time in seconds to listen for new connections as well as to receive traffic (default not set) --udp-histogram #,# enable UDP latency histogram(s) with bin width and count, e.g. 1,1000=1(ms),1000(bins) -B, --bind <ip>[%<dev>] bind to multicast address and optional device -H, --ssm-host <ip> set the SSM source, use with -B for (S,G) -U, --single_udp run in single threaded UDP mode -D, --daemon run the server as a daemon -V, --ipv6_domain Enable IPv6 reception by setting the domain and socket to AF_INET6 (Can receive on both IPv4 and IPv6)
Client specific: -c, --client <host> run in client mode, connecting to <host> -d, --dualtest Do a bidirectional test simultaneously --ipg set the the interpacket gap (milliseconds) for packets within an isochronous frame --isochronous <frames-per-second>:<mean>,<stddev> send traffic in bursts (frames - emulate video traffic) -n, --num #[kmgKMG] 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) -B, --bind [<ip> | <ip:port>] bind ip (and optional port) from which to source traffic -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 receive bidirectional tests back on -P, --parallel # number of parallel client threads to run -R, --reverse reverse the test (client receives, server sends) -T, --ttl # time-to-live, for multicast (default 1) -V, --ipv6_domain Set the domain to IPv6 (send packets over IPv6) -X, --peer-detect perform server version detection and version exchange -Z, --linux-congestion <algo> set TCP congestion control algorithm (Linux only)
Miscellaneous: -x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports -y, --reportstyle C report as a Comma-Separated Values -h, --help print this message and quit -v, --version print version information and quit [kmgKMG] Indicates options that support a k,m,g,K,M or G suffix
Lowercase format characters are 10^3 based and uppercase are 2^n based
(e.g. 1k = 1000, 1K = 1024, 1m = 1,000,000 and 1M = 1,048,576) 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. Source at <http://sourceforge.net/projects/iperf2/>
Report bugs to <iperf-users@lists.sourceforge.net>
我们抽取我在测试过程中用到的一些参数做一些翻译和解读
Client/Server: # 客户端和服务端公有的参数
带宽参数,单位:字节每秒:kmg或者KMG,小写为10的3次方,大写为2的n次方,比如1k=1000,1K=1024,;单位包数量每秒:pps(packets per second) -b, --bandwidth #[kmgKMG | pps] bandwidth to send at in bits/sec or packets per second
回显报告的间隔时间 -i, --interval # seconds between periodic bandwidth reports
指定端口号,默认为5001 -p, --port # server port to listen on/connect to
udp模式,不带-u默认为tcp模式-u, --udp use UDP rather than TCP
tcp窗口大小,默认无上限,可以不设此参数,作为udp模式测试时也不需要此参数 ,单位:KM,1K=1024 -w, --window #[KM] TCP window size (socket buffer size) Server specific: #服务端私有参数
指定以服务端运行 -s, --server run in server mode
指定测试时间,服务端一般一直开着,不设此参数 -t, --time # time in seconds to listen for new connections as well as to receive traffic (default not set) Client specific: #客户端私有参数
指定以客户端运行,后面要带服务端的IP地址 -c, --client <host> run in client mode, connecting to <host>
指定测试时间,不带参数默认测试10s -t, --time # time in seconds to transmit for (default 10 secs)
翻转测试,iperf2并不支持此功能,无法使用,可以推荐使用iperf3 -R, --reverse reverse the test (client receives, server sends) Miscellaneous: #混合参数,指既不是服务端也不是客户端的时候使用
显示帮助菜单 -h, --help print this message and quit
显示版本-v, --version print version information and quit
·
·
·
欢迎各位老铁一键三连,本号后续会不断更新树莓派、人工智能、STM32、ROS小车相关文章和知识。
大家对感兴趣的知识点可以在文章下面留言,我可以优先帮大家讲解哦
欢迎大家光临我的淘宝小店【玩转智能机器人】,会定期推出教程中使用的物美价优的硬件,你的光临就是对我的支持
原创不易,转载请说明出处。
网络测试工具—— iperf2详细使用方法相关推荐
- 网络测试工具——iperf3详细使用说明
iperf3使用方法详解 iperf3是一款带宽测试工具,它支持调节各种参数,比如通信协议,数据包个数,发送持续时间,测试完会报告网络带宽,丢包率和其他参数. 一.安装 操作系统:Ubuntu20.0 ...
- Android反编译工具jadx详细使用方法以及混淆和加固的对比
反编译也不是什么新鲜的东西了.但是为了保护我们自己项目的代码,我们还是要通过反编译工具来检测一下我们的代码是否安全. 本文我们来使用一个开源的工具jadx来实现对apk文件的反编译. 1.下载安装ja ...
- Android反编译工具jadx详细使用方法
反编译也不是什么新鲜的东西了.但是有时候为了保护我们自己项目的代码,我们还是要通过反编译工具来检测一下我们的代码是否是安全的. 本文我们来使用一个开源的工具jadx来实现对apk文件的反编译. 1.下 ...
- 计算机网络-实验一:windows网络测试工具
一.实验目的 理解上述知识点所涉及的基本概念并学会使用这些工具测试网络的状态及从网上获取信息. 二.实验环境 安装了TCP/IP协议的Windows系统,包含实用的网络工具. 三.实验内容 完成下列要 ...
- Auto CAD:CAD软件之设计中心、右栏工具选项板使用方法简介之详细攻略
Auto CAD:CAD软件之设计中心.右栏工具选项板使用方法简介之详细攻略 目录 CAD软件之设计中心 CAD软件之右栏工具选项板 (1).利用工具选项板填充图案
- [转]NUnit详细使用方法
本文转自:http://www.cnblogs.com/confach/archive/2005/06/20/177817.html 原文如下: ---------- NUnit2.0详细使用方法 注 ...
- Android Framework常用工具及LOG调试方法
概述 Framework开发是一项非常繁琐复杂的工作,需要阅读大量的源代码,分析及其多的LOG信息来定位错误位置.这个时候如果使用一些工具或者知道如何定位重要LOG信息,就可以使一些复杂的工作变的简单 ...
- tortoise清理本地分支_TortoiseGit操作本地仓库的详细使用方法
TortoiseGit 操作本地仓库的详细使用方法 Git 的使用越来越广泛, 不过默认使用命令行进行操作, 这就对那些习惯使用图形化界面的人造成了一定的困难, TortoiseGit 是 Git 在 ...
- Linux性能分析工具与图形化方法
欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~. 作者:赵坤|腾讯魔王工作室后台开发工程师 在项目开发中,经常会遇到程序启动时间过长.CPU使用率过高等问题,这个时候需要依靠性能分析工具来 ...
- 磁盘及网络测试工具(iperf hdparm dd)
我的博客已迁移到xdoujiang.com请去那边和我交流 一. 网络测试工具iperf 1.安装包 apt-get -y install iperf2.参数说明 -s, --server run i ...
最新文章
- matlab messagebox函数,[MATLAB]在C#中引用MATLAB函数
- 华为笔记本matebook13_为什么我不推荐华为Matebook 13给职场新人/小白?
- .NET chart 毫秒级坐标轴
- 开源大数据周刊-第76期
- 【PC工具】好用的搜索引擎DogeDoge替代百度搜索,中国的duckduckgo
- rog live service是什么_王者荣耀五周年好礼送不停,玩游戏还能白嫖ROG游戏手机3?...
- 经典网页设计:18个示例展示图片在网页中的使用
- 手动实现apply、call、bind
- 吴恩达《深度学习》 学习笔记1
- Java接口四个类四则运算_java 实现四则运算小程序
- windows 下使用 virtualenv 创建虚拟环境
- 打开和关闭Hadoop,Hbase 命令
- TTL电路和CMOS电路的区别和…
- 笔记本桌面计算机图标不显示不出来,电脑桌面一片空白不显示图标的处理方法...
- ARM探索之旅 | 二、ARM Cortex-M 用什么指令集?
- 计算机d盘可以格式化吗,能将电脑的D盘直接格式化了吗
- 精心挑选12款优秀 jQuery 手风琴效果插件和教程
- 如何录制屏幕视频?有哪些录制技巧?
- 《大魔术师》:给内地闹剧变个“魔术”
- console.log 用法