iPerf3测试局域网两台机器的之间的最大带宽

测试局域网两台机器的之间的最大带宽

1. 介绍

工具使用的是iPerf3,官网地址是https://iperf.fr/

Ubuntu,Mac,Windows都可以支持使用,需要在测试的两台机器上都安装上该软件。

iPerf3也是C/S(客户端/服务器端)架构模式,在使用iperf3测试时,要同时在server端与client端都各执行一个程序,让它们互相传送报文进行测试。

2. 安装iPerf3

可以选择使用docker安装,或者根据系统来安装

2.1 Ubuntu安装

执行命令sudo apt-get install iperf3

2.2 MacOS X安装

访问页面https://iperf.fr/iperf-download.php,选择
iPerf3测试局域网两台机器的之间的最大带宽_第1张图片

中的iPerf 3.1.3,点击链接下载为iperf-3.1.3-macos-x86_64.zip,解压之后就是一个脚本文件

3. 带宽测试

我们把另外一台服务器作为服务端,本地机器作为客户端

3.1 远程服务器作为服务端

远程服务器IP是192.168.3.151,通过步骤2安装好之后,执行命令启动server端程序如下,开始监听

➜  ~ iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

3.2 本地服务器作为客户端

当远程服务器开始监听之后,本地服务器执行命令开始测试,远程机器和本地机器都会有日志打印出来

本地机器日志

yangliu@ylmac iperf3 % ./iperf3 -c 192.168.3.151
Connecting to host 192.168.3.151, port 5201
[  4] local 192.168.3.184 port 62357 connected to 192.168.3.151 port 5201
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec  4.37 MBytes  36.7 Mbits/sec                  
[  4]   1.00-2.00   sec  3.00 MBytes  25.1 Mbits/sec                  
[  4]   2.00-3.00   sec  3.05 MBytes  25.6 Mbits/sec                  
[  4]   3.00-4.00   sec  1.99 MBytes  16.6 Mbits/sec                  
[  4]   4.00-5.00   sec  1.67 MBytes  14.0 Mbits/sec                  
[  4]   5.00-6.00   sec  1.87 MBytes  15.7 Mbits/sec                  
[  4]   6.00-7.00   sec   700 KBytes  5.73 Mbits/sec                  
[  4]   7.00-8.00   sec   443 KBytes  3.63 Mbits/sec                  
[  4]   8.00-9.00   sec   375 KBytes  3.07 Mbits/sec                  
[  4]   9.00-10.00  sec   426 KBytes  3.49 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-10.00  sec  17.8 MBytes  15.0 Mbits/sec                  sender
[  4]   0.00-10.00  sec  17.8 MBytes  14.9 Mbits/sec                  receiver

iperf Done.

远程机器日志

➜  ~ iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.3.184, port 62356
[  5] local 192.168.3.151 port 5201 connected to 192.168.3.184 port 62357
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec  4.00 MBytes  33.6 Mbits/sec                  
[  5]   1.00-2.00   sec  2.66 MBytes  22.3 Mbits/sec                  
[  5]   2.00-3.00   sec  3.53 MBytes  29.6 Mbits/sec                  
[  5]   3.00-4.00   sec  1.97 MBytes  16.6 Mbits/sec                  
[  5]   4.00-5.00   sec  1.80 MBytes  15.1 Mbits/sec                  
[  5]   5.00-6.00   sec  1.80 MBytes  15.1 Mbits/sec                  
[  5]   6.00-7.00   sec   676 KBytes  5.54 Mbits/sec                  
[  5]   7.00-8.00   sec   475 KBytes  3.89 Mbits/sec                  
[  5]   8.00-9.00   sec   400 KBytes  3.28 Mbits/sec                  
[  5]   9.00-10.00  sec   448 KBytes  3.67 Mbits/sec                  
[  5]  10.00-10.07  sec  45.2 KBytes  5.15 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-10.07  sec  0.00 Bytes  0.00 bits/sec                  sender
[  5]   0.00-10.07  sec  17.8 MBytes  14.8 Mbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

那么,简单地说,你可以认为带宽就是14.8Mbits/sec

你可能感兴趣的:(Linux日常简单操作)