jperf linux运行,Linux网络性能评估工具iperf
Iperf介绍
iperf是一个基于TCP/IP和UDP/IP的网络性能测试工具,用于检测网络带宽使用率和网络质量,能测试最大TCP和UDP带宽性能,可以报告带宽、网络延迟抖动、数据包丢失率和最大传输单元等统计信息等。如测试服务器和网络设备如路由器,交换机,防火墙等的网络性能。
Iperf的主要功能
1、TCP方面测试网络带宽
支持多线程,在客户端与服务端支持多重连接
报告MSS/MTU值大小
支持TCP窗口值自定义并可通过套接字缓冲
2、UDP方面可以设置指定带宽的UDP数据流
可以测试网络抖动值、丢包数
支持多播测试
支持多线程,在客户端与服务器端支持多重连接
Iperf的安装
1、下载源码包,官方地址:https://iperf.fr/iperf-download.php
2、安装[root@web1 ~]# tar zxf iperf-3.1.2-source.tar.gz
[root@web1 ~]# cd iperf-3.1.2
[root@web1 iperf-3.1.2]# ./configure
[root@web1 iperf-3.1.2]# make && make install
3、参数(iperf3 -h)[root@web1 ~]# iperf3 -h
Usage: iperf [-s|-c host] [options]
iperf [-h|--help] [-v|--version]
Server or Client:
-p, --port # server port to listen on/connect to
-f, --format [kmgKMG] format to report: Kbits, Mbits, KBytes, MBytes
-i, --interval # seconds between periodic bandwidth reports
-F, --file name xmit/recv the specified file
-A, --affinity n/n,m set CPU affinity
-B, --bind bind to a specific interface
-V, --verbose more detailed output
-J, --json output in JSON format
--logfile f send output to a log file
-d, --debug emit debugging output
-v, --version show version information and quit
-h, --help show this message and quit
Server specific:
-s, --server run in server mode
-D, --daemon run the server as a daemon
-I, --pidfile file write PID file
-1, --one-off handle one client connection then exit
Client specific:
-c, --client run in client mode, connecting to
-u, --udp use UDP rather than TCP
-b, --bandwidth #[KMG][/#] target bandwidth in bits/sec (0 for unlimited)
(default 1 Mbit/sec for UDP, unlimited for TCP)
(optional slash and packet count for burst mode)
-t, --time # time in seconds to transmit for (default 10 secs)
-n, --bytes #[KMG] number of bytes to transmit (instead of -t)
-k, --blockcount #[KMG] number of blocks (packets) to transmit (instead of -t or -n)
-l, --len #[KMG] length of buffer to read or write
(default 128 KB for TCP, 8 KB for UDP)
--cport bind to a specific client port (TCP and UDP, default: ephemeral port)
-P, --parallel # number of parallel client streams to run
-R, --reverse run in reverse mode (server sends, client receives)
-w, --window #[KMG] set window size / socket buffer size
-C, --congestion set TCP congestion control algorithm (Linux and FreeBSD only)
-M, --set-mss # set TCP/SCTP maximum segment size (MTU - 40 bytes)
-N, --no-delay set TCP/SCTP no delay, disabling Nagle's Algorithm
-4, --version4 only use IPv4
-6, --version6 only use IPv6
-S, --tos N set the IP 'type of service'
-L, --flowlabel N set the IPv6 flow label (only supported on Linux)
-Z, --zerocopy use a 'zero copy' method of sending data
-O, --omit N omit the first n seconds
-T, --title str prefix every output line with this string
--get-server-output get results from server
--udp-counters-64bit use 64-bit counters in UDP test packets
[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-
iperf3 homepage at: http://software.es.net/iperf/
Report bugs to: https://github.com/esnet/iperf
Iperf应用实例
iperf是以C/S模式工作,运行于服务端和客户端下。服务端主要用于监听到达的测试请求,而客户端主要用于发起连接会话。因此要使用iperf,需要两台服务器,一台运行在服务器模式下,一台运行在客户端模式下。
1、测试TCP吞吐量
启动一个服务器端,使用iperf -s命令,默认监听5201端口,在客户端使用iperf -c +服务端ip,运行测试(这里使用web1作为服务端,web2作为客户端)
服务端自动接收客户端的连接请求
由输出结果看出,iperf默认输出10s的状态,Transfer列输出每秒的数量量在370MB左右,Bandwidth列显示网卡的速率
2、指定iperf的运行时间(-t参数)和输出速率(-i参数)##指定20秒内每隔5秒输出一次结果
[root@web2 ~]# iperf3 -c 192.168.1.250 -t 20 -i 5
Connecting to host 192.168.1.250, port 5201
[ 4] local 192.168.1.209 port 55780 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-5.00 sec 1.79 GBytes 3.07 Gbits/sec 0 1.07 MBytes
[ 4] 5.00-10.00 sec 1.85 GBytes 3.18 Gbits/sec 0 1.16 MBytes
[ 4] 10.00-15.00 sec 1.83 GBytes 3.14 Gbits/sec 0 1.20 MBytes
[ 4] 15.00-20.00 sec 1.78 GBytes 3.06 Gbits/sec 0 1.24 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-20.00 sec 7.25 GBytes 3.11 Gbits/sec 0 sender
[ 4] 0.00-20.00 sec 7.24 GBytes 3.11 Gbits/sec receiver
iperf Done.
3、指定发送数据量(-n参数)#指定发送一个5GB左右的数据包,并且每隔2秒输出状态结果
[root@web2 ~]# iperf3 -c 192.168.1.250 -i 2 -n 5000000000
Connecting to host 192.168.1.250, port 5201
[ 4] local 192.168.1.209 port 56432 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-2.00 sec 758 MBytes 3.18 Gbits/sec 0 952 KBytes
[ 4] 2.00-4.00 sec 769 MBytes 3.23 Gbits/sec 0 984 KBytes
[ 4] 4.00-6.00 sec 757 MBytes 3.17 Gbits/sec 0 1.01 MBytes
[ 4] 6.00-8.00 sec 684 MBytes 2.87 Gbits/sec 0 1.05 MBytes
[ 4] 8.00-10.00 sec 734 MBytes 3.08 Gbits/sec 0 1.08 MBytes
[ 4] 10.00-12.00 sec 754 MBytes 3.16 Gbits/sec 0 1.11 MBytes
[ 4] 12.00-12.88 sec 313 MBytes 2.99 Gbits/sec 0 1.12 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-12.88 sec 4.66 GBytes 3.11 Gbits/sec 0 sender
[ 4] 0.00-12.88 sec 4.65 GBytes 3.10 Gbits/sec receiver
iperf Done.
##指定一个文件传输(-F)
[root@web2 ~]# du -sh ntopng-2.2.tar.gz
88Mntopng-2.2.tar.gz
[root@web2 ~]# iperf3 -c 192.168.1.250 -F ntopng-2.2.tar.gz -t 20-i 2
Connecting to host 192.168.1.250, port 5201
[ 4] local 192.168.1.209 port 56948 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-0.12 sec 36.7 MBytes 2.47 Gbits/sec 0 420 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-0.12 sec 36.7 MBytes 2.47 Gbits/sec 0 sender
Sent 36.7 MByte / 87.1 MByte (42%) of ntopng-2.2.tar.gz
[ 4] 0.00-0.12 sec 34.9 MBytes 2.36 Gbits/sec receiver
iperf Done.
4、指定多线程网络传输测试(-P),同时可以使用-f M参数将结果通过MBytes/sec来显示#使用单线程传输,传输10GB的数据一共消耗了27.36秒,平均速率为350 MBytes/sec
[root@web2 ~]# iperf3 -c 192.168.1.250 -n 10000000000 -i 5 -f M
Connecting to host 192.168.1.250, port 5201
[ 4] local 192.168.1.209 port 57348 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-5.00 sec 1.58 GBytes 324 MBytes/sec 0 1.11 MBytes
[ 4] 5.00-10.00 sec 1.62 GBytes 333 MBytes/sec 0 1.21 MBytes
[ 4] 10.00-15.00 sec 1.65 GBytes 339 MBytes/sec 0 1.27 MBytes
[ 4] 15.00-20.00 sec 1.76 GBytes 361 MBytes/sec 0 1.31 MBytes
[ 4] 20.00-25.00 sec 1.82 GBytes 373 MBytes/sec 37 1.32 MBytes
[ 4] 25.00-27.36 sec 886 MBytes 376 MBytes/sec 0 1.35 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-27.36 sec 9.31 GBytes 349 MBytes/sec 37 sender
[ 4] 0.00-27.36 sec 9.31 GBytes 348 MBytes/sec receiver
iperf Done.[root@web2 ~]# iperf3 -c 192.168.1.250 -n 10000000000 -i 5
Connecting to host 192.168.1.250, port 5201
[ 4] local 192.168.1.209 port 57585 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-5.00 sec 1.87 GBytes 3.21 Gbits/sec 0 990 KBytes
[ 4] 5.00-10.00 sec 1.87 GBytes 3.22 Gbits/sec 0 1.04 MBytes
[ 4] 10.00-15.00 sec 1.81 GBytes 3.12 Gbits/sec 0 1.12 MBytes
[ 4] 15.00-20.00 sec 1.75 GBytes 3.01 Gbits/sec 0 1.20 MBytes
[ 4] 20.00-25.00 sec 1.76 GBytes 3.03 Gbits/sec 14 1.37 MBytes
[ 4] 25.00-25.81 sec 245 MBytes 2.53 Gbits/sec 0 1.38 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-25.81 sec 9.31 GBytes 3.10 Gbits/sec 14 sender
[ 4] 0.00-25.81 sec 9.31 GBytes 3.10 Gbits/sec receiver
iperf Done.
5、指定多线程传输[root@web2 ~]# iperf3 -c 192.168.1.250 -n 10000000000 -i 5 -P 2 -f M
Connecting to host 192.168.1.250, port 5201
[ 4] local 192.168.1.209 port 57751 connected to 192.168.1.250 port 5201
[ 6] local 192.168.1.209 port 57752 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-5.00 sec 905 MBytes 181 MBytes/sec 0 585 KBytes
[ 6] 0.00-5.00 sec 903 MBytes 181 MBytes/sec 0 602 KBytes
[SUM] 0.00-5.00 sec 1.77 GBytes 362 MBytes/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 5.00-10.00 sec 917 MBytes 183 MBytes/sec 0 687 KBytes
[ 6] 5.00-10.00 sec 917 MBytes 183 MBytes/sec 0 704 KBytes
[SUM] 5.00-10.00 sec 1.79 GBytes 367 MBytes/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 10.00-15.00 sec 929 MBytes 186 MBytes/sec 0 723 KBytes
[ 6] 10.00-15.00 sec 929 MBytes 186 MBytes/sec 0 735 KBytes
[SUM] 10.00-15.00 sec 1.81 GBytes 372 MBytes/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 15.00-20.00 sec 921 MBytes 184 MBytes/sec 0 745 KBytes
[ 6] 15.00-20.00 sec 920 MBytes 184 MBytes/sec 0 759 KBytes
[SUM] 15.00-20.00 sec 1.80 GBytes 368 MBytes/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 20.00-25.00 sec 919 MBytes 184 MBytes/sec 0 782 KBytes
[ 6] 20.00-25.00 sec 919 MBytes 184 MBytes/sec 0 802 KBytes
[SUM] 20.00-25.00 sec 1.79 GBytes 368 MBytes/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 25.00-25.97 sec 179 MBytes 184 MBytes/sec 0 785 KBytes
[ 6] 25.00-25.97 sec 180 MBytes 185 MBytes/sec 0 803 KBytes
[SUM] 25.00-25.97 sec 359 MBytes 369 MBytes/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-25.97 sec 4.66 GBytes 184 MBytes/sec 0 sender
[ 4] 0.00-25.97 sec 4.65 GBytes 183 MBytes/sec receiver
[ 6] 0.00-25.97 sec 4.66 GBytes 184 MBytes/sec 0 sender
[ 6] 0.00-25.97 sec 4.65 GBytes 183 MBytes/sec receiver
[SUM] 0.00-25.97 sec 9.31 GBytes 367 MBytes/sec 0 sender
[SUM] 0.00-25.97 sec 9.30 GBytes 367 MBytes/sec receiver
iperf Done.
6、测试UDP丢包和延迟,使用-u参数指定UDP协议,-b(K|M|G)参数指定UD式使用的带宽模式[root@web2 ~]# iperf3 -c 192.168.1.250 -u -b 1G -f M -i 2
Connecting to host 192.168.1.250, port 5201
[ 4] local 192.168.1.209 port 45424 connected to 192.168.1.250 port 5201
[ ID] Interval Transfer Bandwidth Total Datagrams
[ 4] 0.00-2.00 sec 81.1 MBytes 40.5 MBytes/sec 10377
[ 4] 2.00-4.00 sec 94.5 MBytes 47.3 MBytes/sec 12102
[ 4] 4.00-6.00 sec 94.6 MBytes 47.3 MBytes/sec 12107
[ 4] 6.00-8.00 sec 103 MBytes 51.5 MBytes/sec 13192
[ 4] 8.00-10.00 sec 93.6 MBytes 46.8 MBytes/sec 11983
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 4] 0.00-10.00 sec 467 MBytes 46.7 MBytes/sec 0.037 ms 435/59760 (0.73%)
[ 4] Sent 59760 datagrams
iperf Done.
由输出结果显示,Jitter表示抖动时间,或者称为传输延迟,Lost/Total表示丢失的数据包和总的数据包数量,Datagrams表示总共传输数据包的数量
#在服务端的输出
Accepted connection from 192.168.1.209, port 58179
[ 5] local 192.168.1.250 port 5201 connected to 192.168.1.209 port 45424
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-1.00 sec 35.6 MBytes 299 Mbits/sec 0.054 ms 29/4590 (0.63%)
[ 5] 1.00-2.00 sec 43.0 MBytes 361 Mbits/sec 0.071 ms 30/5533 (0.54%)
[ 5] 2.00-3.00 sec 48.4 MBytes 406 Mbits/sec 0.154 ms 29/6225 (0.47%)
[ 5] 3.00-4.00 sec 45.6 MBytes 382 Mbits/sec 0.026 ms 6/5837 (0.1%)
[ 5] 4.00-5.00 sec 47.3 MBytes 397 Mbits/sec 0.168 ms 124/6183 (2%)
[ 5] 5.00-6.00 sec 46.1 MBytes 387 Mbits/sec 0.023 ms 40/5941 (0.67%)
[ 5] 6.00-7.00 sec 49.0 MBytes 411 Mbits/sec 0.022 ms 48/6322 (0.76%)
[ 5] 7.00-8.00 sec 53.1 MBytes 446 Mbits/sec 0.037 ms 67/6867 (0.98%)
[ 5] 8.00-9.00 sec 44.9 MBytes 376 Mbits/sec 0.163 ms 26/5769 (0.45%)
[ 5] 9.00-10.00 sec 48.4 MBytes 406 Mbits/sec 0.015 ms 36/6232 (0.58%)
[ 5] 10.00-10.04 sec 2.04 MBytes 426 Mbits/sec 0.037 ms 0/261 (0%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 5] 0.00-10.04 sec 0.00 Bytes 0.00 bits/sec 0.037 ms 435/59760 (0.73%)
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
jperf linux运行,Linux网络性能评估工具iperf相关推荐
- 网络性能评估工具Iperf详解(可测丢包率)
原文链接:安全运维之:网络性能评估工具Iperf详解:技术成就梦想51CTO-中国领先的IT技术网站 参考博文:Install Iperf and Test Network Throughput,Sp ...
- 【iperf】网络性能评估工具iperf的安装使用
评估网络质量因素及指标:带宽.延时.抖动.丢包 1.带宽(throughput):网络的吞吐率,端到端之间可以传输的最大速率,这个指标一般都会有所限制,带宽当然是越大越好,一般超过限制带宽的 50% ...
- Linux网络性能评估工具iperf 、CHARIOT测试网络吞吐量
目录 一. Iperf能做什么 1.TCP方面 2.UDP方面 二. Iperf的安装与使用 1.安装iperf 2.iperf参数介绍 三. Iperf应用实例 1.测试TCP吞吐量 2 . 测试U ...
- Linux网络安全运维:网络性能评估工具iperf 测试带宽
带宽 在计算机网络中,网络带宽是指在单位时间(一般指的是1秒钟)内能传输的数据量,比如说你家的电信网络是100兆比特,意思是,一秒内最大的传输速率是100兆比特. 在计算机网络中,带宽用来表示网络中某 ...
- Linux网络性能评估工具iperf
Iperf介绍 iperf是一个基于TCP/IP和UDP/IP的网络性能测试工具,用于检测网络带宽使用率和网络质量,能测试最大TCP和UDP带宽性能,可以报告带宽.网络延迟抖动.数据包丢失率和最大传输 ...
- ipref网络性能评估工具
ipref网络性能评估工具 基本介绍 网络的主要性能参数包括带宽,时延,抖动和丢包率,用一个名词就是QOS(服务质量).Iperf(可测丢包率)可以用来测量网络带宽和网络质量,还可以提供网络延迟抖动. ...
- linux编程性能,Linux性能评估工具
Linux性能评估工具 2019-03-11 编程之家 https://www.jb51.cc 编程之家收集整理的这篇文章主要介绍了Linux性能评估工具,编程之家小编觉得挺不错的,现在分享给大家,也 ...
- linux 内存性能评估,内存性能评估工具vmstat/free/smem使用与解读
本课程从基础入手,再进行深入研究,同时结合实际的应用案例进行有点到线及面.由浅入深的讲述.始终秉承了实战.实用.通俗.易懂的特点,在内容上十分注重实战化,从运维的多个方面以真实的生产环境介绍运维工作中 ...
- 性能之巅:Linux网络性能分析工具-netstat,ifconfig,nicstat,traceroute,tcpdump
原文地址:http://www.infoq.com/cn/articles/linux-networking-performance-analytics 本文介绍基于Linux操作系统的网络性能分析工 ...
最新文章
- 华为鸿蒙4月推送名单,华为鸿蒙升级名单已确认,首批将有44款机型升级,其中有你吗?...
- “GANs之父”Ian Goodfellow被爆已从Google离职
- 那些有用但不为大家所熟知的 Java 特性
- php 配置文件加密工具类,SpringBoot集成Jasypt安全框架以及配置文件内容加密(代码示例)...
- 开发日记-20190425 关键词 gradle基础学习 7年之约 启动篇
- SAP CRM和SAP Hybris的action profile
- SQL Server 登录更换【Windows身份验证】为【SQL Server 身份验证】
- java xy x y_为什么该语句在Java中不起作用x ^ = y ^ = x ^ = y;
- Linux 双网卡绑定
- [GCJ] Qualification Round 2017
- BDFZOI 数论小结1(筛法、欧拉phi函数)
- linux 生成excel格式的文件怎么打开乱码,导出的文件乱码怎么办(各位,汉字在excel表格中显示乱码,怎么办)...
- 年度盘点和预测:数说汽车互联网市场
- 信息安全工程师自学笔记(1)
- matlab误码率理论,PSK理论误码率与实际误码率MATLAB仿真程序
- 【调剂】福建师范大学海峡创新实验室覃弦接收调剂研究生
- 网上流量卡这么便宜,线上申请的流量卡有虚标吗
- 【干货】超强整理19个辅助制作H5的工具/网站
- android平板更新系统,终于跟上安卓!iPad Pro新功能曝光:系统升级方便了
- 当前时间与GMT时间转换
热门文章
- Android开发——底部导航栏设计
- 知识图谱推理问题总结
- 什么是spring?spring组成模块、spring优缺点、应用场景、bean的生命周期、线程并发问题
- gdb-peda安装
- {}如何进行博客推广
- 网络营销高人的八点心得/搜索引擎推广方法
- hive on spark 配置时报错:Job failed with java.lang.ClassNotFoundException: org.apache.spark.AccumulatorPa
- paddle学习笔记(1)--clear_grad()函数
- 自制USB wifi信号放大天线
- 使用ESP-8266模块做一个便携式WIFI杀手