Linux Network

Network tuning and assessment with iperf test

One of the best  way to ensure network stability is through iperf testing. For network tuning and assessment iperf is a flexible choice. It estimates the total throughput of your network so you can tweak certain network parameters accordingly. Iperf test is a great way to ensure that your network is up and running the way you want it to.

The environment that we are going to use for iperf test is shown below in the picture. You can see it is a very simple topology. We have one switch/router and multiple computers are hooked up to that switch to form a working network.

Iperf Testing on Network
iperf Testing on Network

The way iperf works is that you install iperf executable on all the machines that you want to test and you run one machine as a server and rest as a client.

Setting up a server is pretty straight forward. Base command for setting up for iperf server is

#iperf -s

Base command for iperf client is

#iperf -c <IP Address>

For Example:

#iperf -c 10.0.0.4
Iperf Testing
iperf Testing

This is the minimum amount of setup that you need. There are also a lots of other customization options available for network benchmarking. You can specify different network options on client end for testing network for different scenarios. iperf can be set up on a routed and switched network.

You can use the following command to change the window size with -w option.

iperf -c 10.0.0.4 -w 8000
Iperf Testing with window size
iperf Testing with window size

In the command above we changed the window size to 8000, which is a lot less than default value. As you can see transmission speed is reduced to 278 Mbits/sec in the image above. So changing the windows size changes the performance of your connection.

Why you might need to optimize the window size?

If you have a limited network capacity or you are trying to optimize your network. Then you might need to change the window size that is optimal for handling a lot of traffic. As you can see in the image above window size is changed to 7.61 KB and speed is reduced from 664 Megabits to 278 Megabits per second. That’s because widow is closed on to the user and you reduce the ability of that node to send a lot of data.

There are a lot of other parameters that you can define in iperf to tune your network.

iperf Testing on UDP

To test your network using UDP, first stop your already running iperf server. The UDP test with the -u argument will give invaluable information about the jitters and the packet loss. If you don’t specify the -u argument, iperf uses TCP.
To keep a good link quality, the packet loss should not go over 1 %.  A high packet loss rate will generate a lot of TCP segment re-transmissions which will affect the bandwidth.

Run the following command on server machine

#iperf -s -u -i 1

Now from a client machine run the following command

#iperf -c 10.0.0.4 -u

Since we are using UDP we don’t really need to specify the window size because UDP doesn’t use the windows.

Iperf Testing with UDP
iperf Testing with UDP

 

About the author

Ajay Verma

A Computer Science Graduate, who works extensively on open source projects. His Areas Of interest are: Network Security, Linux Administration, FOSS, Python, and C programming.

Add Comment

Click here to post a comment

Follow us here!