iperf in CentOS

Introduction

Installation

yum install -y iperf

Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile epel/x86_64/metalink | 29 kB 00:00 * base: ftp.funet.fi * epel: mirror.netsite.dk * extras: ftp.funet.fi * updates: ftp.funet.fi base | 3.6 kB 00:00 epel | 4.7 kB 00:00 extras | 2.9 kB 00:00 pgdg-common/7/x86_64/signature | 198 B 00:00 pgdg-common/7/x86_64/signature | 2.9 kB 00:00 !!! pgdg10/7/x86_64/signature | 198 B 00:00 pgdg10/7/x86_64/signature | 3.6 kB 00:00 !!! pgdg11/7/x86_64/signature | 198 B 00:00 pgdg11/7/x86_64/signature | 3.6 kB 00:00 !!! pgdg12/7/x86_64/signature | 198 B 00:00 pgdg12/7/x86_64/signature | 3.6 kB 00:00 !!! pgdg13/7/x86_64/signature | 198 B 00:00 pgdg13/7/x86_64/signature | 3.6 kB 00:00 !!! pgdg96/7/x86_64/signature | 198 B 00:00 pgdg96/7/x86_64/signature | 3.6 kB 00:00 !!! updates | 2.9 kB 00:00 (1/2): epel/x86_64/updateinfo | 1.0 MB 00:00 (2/2): epel/x86_64/primary_db | 6.9 MB 00:00 Resolving Dependencies --> Running transaction check ---> Package iperf.x86_64 0:2.0.13-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: iperf x86_64 2.0.13-1.el7 epel 86 k Transaction Summary ================================================================================ Install 1 Package Total download size: 86 k Installed size: 185 k Downloading packages: iperf-2.0.13-1.el7.x86_64.rpm | 86 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : iperf-2.0.13-1.el7.x86_64 1/1 Verifying : iperf-2.0.13-1.el7.x86_64 1/1 Installed: iperf.x86_64 0:2.0.13-1.el7 Complete!

Installing iperf3

sudo yum install -y iperf3

Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: ftp.funet.fi * epel: mirror.netsite.dk * extras: ftp.funet.fi * updates: ftp.funet.fi Resolving Dependencies --> Running transaction check ---> Package iperf3.x86_64 0:3.1.7-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ====================================================================== Package Arch Version Repository Size ====================================================================== Installing: iperf3 x86_64 3.1.7-2.el7 base 79 k Transaction Summary ====================================================================== Install 1 Package Total download size: 79 k Installed size: 197 k Downloading packages: iperf3-3.1.7-2.el7.x86_64.rpm | 79 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : iperf3-3.1.7-2.el7.x86_64 1/1 Verifying : iperf3-3.1.7-2.el7.x86_64 1/1 Installed: iperf3.x86_64 0:3.1.7-2.el7 Complete!

Measure the speed between two hosts

Suppose we have two hosts with IP addresses 192.168.56.1 and 192.168.56.117

The first one will be used as the client and the second as the server

Open a free port on the server

sudo firewall-cmd --zone=public --add-port=9150/tcp --permanent

sucess

Then you need to restart Firewall

sudo firewall-cmd --reload

sucess

Run iperf3 on this host as a server

iperf3 -s -p 9150

----------------------------------------------------------- Server listening on 9150 -----------------------------------------------------------

On the second host run iperf3 as a client

We will measure the speed for 5 seconds

iperf3 -c 192.168.56.117 -p 9150 -t 5

On the client

Connecting to host 192.168.56.117, port 9150 [ 5] local 192.168.56.1 port 44488 connected to 192.168.56.117 port 9150 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 369 MBytes 3.10 Gbits/sec 628 204 KBytes [ 5] 1.00-2.00 sec 256 MBytes 2.14 Gbits/sec 192 352 KBytes [ 5] 2.00-3.00 sec 162 MBytes 1.36 Gbits/sec 65 351 KBytes [ 5] 3.00-4.00 sec 130 MBytes 1.09 Gbits/sec 40 277 KBytes [ 5] 4.00-5.00 sec 118 MBytes 988 Mbits/sec 41 307 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.00 sec 1.01 GBytes 1.74 Gbits/sec 966 sender [ 5] 0.00-5.00 sec 1.01 GBytes 1.73 Gbits/sec receiver iperf Done.

On the server

Accepted connection from 192.168.56.1, port 44486 [ 5] local 192.168.56.117 port 9150 connected to 192.168.56.1 port 44488 [ ID] Interval Transfer Bandwidth [ 5] 0.00-1.00 sec 366 MBytes 3.07 Gbits/sec [ 5] 1.00-2.00 sec 256 MBytes 2.14 Gbits/sec [ 5] 2.00-3.00 sec 163 MBytes 1.37 Gbits/sec [ 5] 3.00-4.00 sec 130 MBytes 1.09 Gbits/sec [ 5] 4.00-5.00 sec 118 MBytes 987 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth [ 5] 0.00-5.00 sec 0.00 Bytes 0.00 bits/sec sender [ 5] 0.00-5.00 sec 1.01 GBytes 1.73 Gbits/sec receiver

Article author: Andrei Olegovich