How to measure bandwidth between computers with iperf

August 5, 2012 by

To test bandwidth between computers, iperf is a great CLI tool to use. There’s also a graphical front-end to iperf, written in Java, called jperf, which works on Linux, Mac OS and Windows.

On most Linux distributions, iperf can easily be installed from CLI using the distribution’s package manager. In Debian/Ubuntu you would install it using:

apt-get install iperf

Once installed, iperf can run in server or client modes. To tell iperf which one to run in, you just add the -s flag for server mode and -c for client mode. For the most part it’s enough to start the server with the -s flag. The client, however, needs a few more parameters.

First, start the server:

iperf -s

You should see something similar to:

------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 64.0 KByte (default)
------------------------------------------------------------

Then, start the client:

iperf -c 192.168.1.10 -P 1 -i 10 -p 5001 -f m -t 60

This will run an iperf test against the server (on IP 192.168.1.10) with the following parameters:

  • 192.168.1.10: iperf server IP address
  • -P 1: 1 parallel stream
  • -i 10: 10 second report interval
  • -p 5001: running on port 5001 (default)
  • -f m: format Mbits (k = Kbits, m = Mbits, K = KBytes, M = MBytes)
  • -t 60: transmit for 60 seconds

You should see results similar to:

------------------------------------------------------------
Client connecting to 192.168.1.10, TCP port 5001
TCP window size: 0.02 MByte (default)
------------------------------------------------------------
[  3] local 192.168.1.20 port 50810 connected with 192.168.1.10 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec    113 MBytes  94.5 Mbits/sec
[  3] 10.0-20.0 sec    112 MBytes  94.1 Mbits/sec
[  3] 20.0-30.0 sec    112 MBytes  94.2 Mbits/sec
[  3] 30.0-40.0 sec    112 MBytes  94.1 Mbits/sec
[  3] 40.0-50.0 sec    112 MBytes  94.1 Mbits/sec
[  3] 50.0-60.0 sec    112 MBytes  94.1 Mbits/sec
[  3]  0.0-60.0 sec    674 MBytes  94.2 Mbits/sec

This iperf test was run against a server with a 100 Mbps NIC.

Leave a Reply