Install Iperf and Test Network Throughput,Speed/Other Statistics

September 19, 2014 | By
| 1 Reply More

Iperf is a network testing tool that can create TCP and UDP data connections and measure the throughput of a network that is carrying them. It supports tuning of various parameters related to timing, protocols, and buffers. For each test it reports the bandwidth, loss, and other parameters.

The current version, sometimes referred to as iperf3, is a redesign of an original version developed at NLANR/DAST. iperf3 is a new implementation from scratch, with the goal of a smaller, simpler code base, and a library version of the functionality that can be used in other programs. It is mainly developed on CentOS Linux, FreeBSD and MacOS X, but works well on other Linux distributions as well.

Install Iperf

You can get the latest version of iperf3 from using wget and extract it with tar.

# wget
# tar zxvf iperf-3.0.6.tar.gz

Then you just need to configure it and compile it like this:

# cd iperf-3.0.6
# ./configure
# make
# make install

Now you should have iperf3 installed on your system.

How to Use iperf3

To test the performance of a network with iperf you will need 2 computers, one that will act as a server and one that will act as a client, this will help you test the network segment between the 2 host computers.

In the most simple form you can run iperf3 as root with the -s on one of the computers that will act as a server, it will open a port and wait for connections from a client. Please check your firewall or iptables and be sure that the port iperf3 server opens on is not blocked in any way. The output should look like this:

iperf server run

Then on the second computer that is connected to the same network as the server we can perform a basic test by running the -c switch and the IP address of the server. The output will look like this:

iperf client

From this output we can see that we have a 80MBits/sec speed over TCP.

Using the client you can use different flags to test various network scenarios, you can use the -P flag to test a few parallel connections to the server like this:

# iperf3 -c -P 5

and the output will look like this:

iperf parallel

This will show you what happens when more applications from the client connects to the the server.

You can test the performance of the UDP protocol using the -u flag like this:

# iperf3 -c -u

and the output should look like this:

iperf udp

As you can see 2 new fields have appeared in the output, jitter witch shows the latency of the packets that have been send and Lost/Total Diagram witch shows the total number of packets lost from the number of packets send.

Other useful flags:

-b, --bandwidth n[KM] - set target bandwidth to n bits/sec (default 1 Mbit/sec for UDP, unlimited for TCP).
-t, --time n - time in seconds to transmit for (default 10 secs)
-n, --bytes n[KM] - number of bytes to transmit (instead of -t)
-k, --blockcount n[KM] - number of blocks (packets) to transmit (instead of -t or -n)
-l, --length n[KM] - length of buffer to read or write (default 128 KB for TCP, 8KB for UDP)
-R, --reverse - run in reverse mode (server sends, client receives)

This flags are mainly useful when you want to test a particular scenario between the client and the server.

iperf3 is a small but useful tool, that can be quickly installed on the client and the server to test various network aspects and applications.


Free Linux Ebook to Download

Comments (1)

Trackback URL | Comments RSS Feed

  1. sabrina says:

    hello, thanks for this article. I'm using a Kali Linux Live CD, and after the installation, without problem, i don't have iperf3 for start the tool. How i can do for to solve the problem?

Leave a Reply

All comments are subject to moderation.