Measure network speed with Iperf package

Iperf is a Linux package for measuring network speed. To use Iperf it is required to have at least 2 servers where one of them is the host and another one is the client. The host listens for the connections from the client and transfers data during the speed test to the client-server. Iperf package needs to be installed in both host and client servers.

Connect to the host and client servers and install the Iperf package.

CentOS:

[root@iperf-host ~]# yum -y install iperf
[root@iperf-client ~]# yum -y install iperf

Ubuntu/Debian:

[root@iperf-host ~]# apt-get -y install iperf
[root@iperf-client ~]# apt-get -y install iperf

Launch Iperf in the host:

[root@iperf-host ~]# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------

Launch Iperf in the client and wait for the test to complete:

[root@iperf-client ~]# iperf -c 2.58.28.45
------------------------------------------------------------
Client connecting to 2.58.28.45, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 181.215.247.22 port 43420 connected with 2.58.28.45 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.1 sec   103 MBytes  85.5 Mbits/sec

In the test above the client has connected to the host via TCP port 5001 which resulted in 103 Mbytes transferred during 10 seconds intervals. The test shows a network throughput of 85.5 Mbits/sec.

To run the test for a longer time use additional parameters on the client-side as follows:

[root@iperf-client ~]# iperf -t 20 -c 2.58.28.45
------------------------------------------------------------
Client connecting to 2.58.28.45, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 181.215.247.22 port 43422 connected with 2.58.28.45 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-20.0 sec   211 MBytes  88.4 Mbits/sec

The -t parameter defines how long in seconds the test should be running. In this case, it was running for 20 seconds. For more advanced testing it’s also possible to split the time into intervals by using parameter -i in both host and client servers.

[root@iperf-host ~]# iperf -s -i 10
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------

[root@iperf-client ~]# iperf -t 20 -i 10 -c 2.58.28.45
------------------------------------------------------------
Client connecting to 2.58.28.45, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 181.215.247.22 port 43424 connected with 2.58.28.45 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec   104 MBytes  87.2 Mbits/sec
[  3] 10.0-20.0 sec   111 MBytes  93.1 Mbits/sec
[  3]  0.0-20.1 sec   215 MBytes  89.9 Mbits/sec

Related articles:

Was this article helpful?

Need support?

If you need any further help, don't hesitate to send a support request to our support team.