iperf3 测试linux服务器之间带宽
Posted kuroniko
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iperf3 测试linux服务器之间带宽相关的知识,希望对你有一定的参考价值。
一、安装方式
1,从官网下载相应版本。用 rpm包安装
https://iperf.fr/iperf-download.php
centos7 安装
rpm -i iperf3-3.1.3-1.fc24.x86_64.rpm
2,执行yum install -y iperf3 安装
二、测试方式
网络带宽测试
在使用iperf3测试时,要同时在server端与client端都各执行一个程序,让它们互相传送报文进行测试。下面的例子是在CentOS7上进行的测试。
首先在10.23.5.66机器启动server端的程序:
iperf3 -s
接着在10.23.5.65服务器上执行client 端的程序:
iperf3 -c 10.23.5.66
在测试时server端与client端都会出现测试的数据,client端以下是测试的结果:
[jinguang1@localhost ~]$ iperf3 -c 10.23.5.66
Connecting to host 10.23.5.66, port 5201
[ 4] local 10.23.5.65 port 10412 connected to 10.23.5.66 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 114 MBytes 953 Mbits/sec 0 95.5 KBytes
[ 4] 1.00-2.00 sec 113 MBytes 948 Mbits/sec 0 95.5 KBytes
[ 4] 2.00-3.00 sec 113 MBytes 950 Mbits/sec 0 95.5 KBytes
[ 4] 3.00-4.00 sec 113 MBytes 948 Mbits/sec 0 95.5 KBytes
[ 4] 4.00-5.00 sec 113 MBytes 950 Mbits/sec 0 95.5 KBytes
[ 4] 5.00-6.00 sec 113 MBytes 948 Mbits/sec 0 95.5 KBytes
[ 4] 6.00-7.00 sec 113 MBytes 948 Mbits/sec 0 95.5 KBytes
[ 4] 7.00-8.00 sec 113 MBytes 950 Mbits/sec 0 95.5 KBytes
[ 4] 8.00-9.00 sec 113 MBytes 948 Mbits/sec 0 95.5 KBytes
[ 4] 9.00-10.00 sec 113 MBytes 950 Mbits/sec 0 95.5 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 1.10 GBytes 949 Mbits/sec 0 sender
[ 4] 0.00-10.00 sec 1.10 GBytes 949 Mbits/sec receiver
iperf Done.
从打印的内容看,缺省参数下,Client将连接Server端的5201端口,持续向Server端发送数据,并统计出每秒传输的字节数、带宽、出现报文重传的次数、拥塞窗口(Congestion Window)大小,整个测试将持续10秒钟;最后将汇总10秒的平均数据,并给出发送和接收端的统计。
接下来分析一下Server的测试输出结果:
[jinguang1@localhost ~]$ iperf3 -s
warning: this system does not seem to support IPv6 - trying IPv4
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 10.23.5.65, port 10410
[ 5] local 10.23.5.66 port 5201 connected to 10.23.5.65 port 10412
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 109 MBytes 913 Mbits/sec
[ 5] 1.00-2.00 sec 113 MBytes 948 Mbits/sec
[ 5] 2.00-3.00 sec 113 MBytes 949 Mbits/sec
[ 5] 3.00-4.00 sec 113 MBytes 949 Mbits/sec
[ 5] 4.00-5.00 sec 113 MBytes 949 Mbits/sec
[ 5] 5.00-6.00 sec 113 MBytes 949 Mbits/sec
[ 5] 6.00-7.00 sec 113 MBytes 949 Mbits/sec
[ 5] 7.00-8.00 sec 113 MBytes 949 Mbits/sec
[ 5] 8.00-9.00 sec 113 MBytes 949 Mbits/sec
[ 5] 9.00-10.00 sec 113 MBytes 949 Mbits/sec
[ 5] 10.00-10.04 sec 4.29 MBytes 947 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.04 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-10.04 sec 1.10 GBytes 945 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Server端缺省监听IPv6地址和端口,如果未配置IPv6,会尝试IPv4。日志显示接收了来自10.23.5.65,源端口未10410的测试请求。Client端连续进行了10秒的测试,并显示了每秒传输的字节数,带宽信息;测试结束后会汇总发送和接收的统计信息。在Client连接关闭之后会继续侦听5201端口。
以上是关于iperf3 测试linux服务器之间带宽的主要内容,如果未能解决你的问题,请参考以下文章