HomeHowTo › Testing A Network Connection with Iperf

Testing A Network Connection with Iperf

Iperf is a nice little tool to measure networking performance/bandwidth. You need two computers for this. One is acting as the server listening for incoming connections. The other one is the client that connects to the server. If the connection is established, data is transferred between those two computers and the speed is logged.

As a first step it is advisable to connect those two computers directly to find out the actual max bandwidth. Then you can test your real network with switches and/or routers in between to detect a possible bandwidth loss.



Linux (using apt-get)

If Iperf is available in your distribution’s package manager, you can install it with only one command and you’re ready to go. This is the case if you use Ubuntu:

sudo apt-get install iperf


Linux (manual)

Alternatively you can downloaded the sources and compile/install the tool manually.
Sourceforge page: http://sourceforge.net/projects/iperf/files/

# install necessary packages to compile the sourcecode
sudo apt-get install g++ make

# extract the downloaded archive and cd to the extracted folder
tar -xvzf iperf-2.0.5.tar.gz
cd iperf-2.0.5

# compile and install
sudo make install


Mac OS (using macports)

If you have Macports installed, you can easily get Iperf by typing:

sudo port install iperf


Mac OS (manual)

You can also compile and install the tool yourself. You’ll need XCode and the command-line extensions for that.
Sourceforge page: http://sourceforge.net/projects/iperf/files/

sudo make install



I have no idea how to compile the sources for Windows, so I just googled for some ready-to-use binary. Found and used this one: http://sourceforge.net/tracker/?func=detail&aid=3470334&group_id=128336&atid=711373

The iperf.exe has to be placed in the Windows System32 directory.



Start the server on machine A

For a basic test you only need to start Iperf in server mode (make sure that your firewall doesn’t block the port):

iperf -s

Check the manpage for additional parameters. I like to use the following command:

iperf -s -f M -w 1M

This will change the format of the bandwidth report from MBit/s to MByte/s and increase the TCP window size to 1 MByte which might increase the speed a little bit. On slow networks however, the window size should not be increased.


Start the client on machine B

For a basic test you can just run Iperf in client mode specifying the server’s IP address:

iperf -c <IP>

I like to use the following command:

iperf -c <IP> -i 1 -t 30 -f M -w 1M

This will print the current bandwidth every second, run the test for a total of 30 seconds and — just as with the server — change the format and window size.


95.5 MByte/s is not a bad result for a Gigabit connection between two notebooks.

Leave a Comment