Sometime we need to know maximum bandwidth that could attain between two machines within network,So we have many tools for it. In Linux we have simple and effective command to know bandwidth between two machines.

This is small post just to know maximum bandwidth between two machines through iperf command.

We are using ubuntu machines to test bandwidth, but iperf could install on various Linux/Unix machine like RHEL/CentOS/Ubuntu/Debian Machines.

Installation of iperf

Iperf command could install through various package manager used in various Linux/Unix distribution like below.

Ubuntu machine
apt install iperf

RHEL/CentOS Machine
yum install iperf

Iperf command bandwidth test

This command has various options to use, but to test bandwidth between two machine act as Server/Client, in which we need to run Server mode on one machine and Client on another.

Iperf Server mode

To run server mode for iperf command, we have to run with -s option like below.

iperf -s

Output for above command is like below

root@srv33:~# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size:  128 KByte (default)
------------------------------------------------------------

With this machine is start listening to connection from another machine on 5001 port (default port of iperf). Now we can start Client mode on another machine like below

Iperf Client Mode

Client mode need to run on another machine that need to test bandwidth between above server and below client machine like below.

root@srv36:~# iperf -c 192.168.0.33
------------------------------------------------------------
Client connecting to 192.168.0.33, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.0.36 port 36612 connected with 192.168.0.33 port 5001

So as we started iperf on Client machine, it make connection to Server on same port and start sending some data to test bandwidth and will respond like below.
With this we get Server and Client side output like below.

Server side Output
root@srv33:~# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size:  128 KByte (default)
------------------------------------------------------------
[  4] local 192.168.0.33 port 5001 connected with 192.168.0.36 port 36612
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  75.4 GBytes  64.7 Gbits/sec

Client Side Output
root@srv36:~# iperf -c 192.168.0.33
------------------------------------------------------------
Client connecting to 192.168.0.33, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.0.36 port 36612 connected with 192.168.0.33 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  75.4 GBytes  64.7 Gbits/sec