Iperf for Test Network Throughput,Speed/Other Statistics

GIT – 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 CentOSLinux, FreeBSD and MacOS X, but works well on other Linux distributions as well.

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:

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:

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 192.168.1.1 -P 5

and the output will look like this:

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 192.168.1.1 -u

and the output should look like this:

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.