iperf is a tool for performing network throughput measurements. It can test either TCP or UDP throughput. To perform an iperf test the user must establish both a server (to discard traffic) and a client (to generate traffic).
Install Iperf
Ubuntu/Debian
apt-get install iperf
CentOS
yum install iperf3
Arch Linux
pacman -S iperf
Use Iperf
Iperf needs to be installed on the two servers you want to test the connection to.
TCP Clients & Servers
Iperf needs to play client and server roles on the two machines. Client to connect to the server you want to test internet speed.
- Start server mode on the server you want to test:
iperf -s
- On your other machine, connect to one machine and replace it with the server machine IP

-
You will see the following output on the server:

UDP Clients & Servers
With Iperf, you can also test the maximum throughput of UDP connections
-
Start UDP Iperf server

- On your other machine, connect to one machine and replace it with the server machine IP.
The -u option tells Iperf to use a UDP connection. The output is as follows:

- You will see the following output on the server:
