Iperf: Testing End-to-End Bandwidth
Iperf
Iperf is a computer software tool for measuring various variables of an IP network connection. Iperf is developed by the National Laboratory for Applied Network Research (NLANR). Based on a client/server architecture and available on different operating systems, Iperf is an important tool for network administrators.
How to Get It
Iperf is included in most Linux distributions by default. However, you can follow this link to download the version that corresponds to your operating system (Windows and MacOS X versions are also available).
For Debian / Ubuntu:
|
|
For Fedora:
|
|
How Does Iperf Work?
Iperf must be run on two machines located at opposite ends of the network to be tested. The first machine runs Iperf in “server mode” (with the -s option), the second in “client mode” (with the -c option). By default, the network test is done using the TCP protocol (but it is also possible to use UDP mode with the -u option).
How to Use It
Let’s take the example of a network test between machine A and machine B.
On machine A, run the following command:
|
|
Then on machine B, run the command:
|
|
The following result will be displayed:
|
|
This gives us the actual throughput between machine A and machine B. Using the -i option, we can get other types of information such as transit delay or network jitter.
It is possible to evaluate your Internet connection via a public Iperf server located on the Internet:
Here are 3 suggested command lines for the server on Linux:
- TCP 5001: $ iperf -s -m -w 500K -i 5
- TCP 4662: $ iperf -s -m -w 500K -i 5 -p 4662
- UDP 5001: $ iperf -s -i 5 -u
Here are 5 suggested command lines for the client on Linux:
- Upload only: $ iperf -c 212.27.33.25 -m -w 500K -i 5 -t 30
- Upload + download: $ iperf -c 212.27.33.25 -m -w 500K -i 5 -t 30 -r
- Simultaneous upload + download: $ iperf -c 212.27.33.25 -m -w 500K -i 5 -t 30 -d -P 2
- Upload + download on port 4662: $ iperf -c 212.27.33.25 -m -w 500K -i 5 -t 30 -p 4662 -r
- Upload + download in UDP at 80 Mb/s: $ iperf -c 212.27.33.25 -i 5 -t 30 -r -u -b 80M
The -w parameter is very important; it specifies the “TCP window size” as the default value is too small. The window size value cannot exceed that of the operating system’s TCP/IP stack.
IPERF in Multicast
Iperf can work in multicast mode (-B). Launch it as follows:
On the server:
- $ iperf -s -u -B 225.0.1.2
On the client:
- $ iperf -c 225.0.1.2 -u -b 3M
This generates a UDP multicast stream (on address 225.0.1.2) of 3 Mb/sec.
IPERF with Linux 2.6.21 and Later
Starting with kernel 2.6.21, “The new high resolution timer option in the kernel causes usleep(0) to be a nop so the thread keeps running (until its quanta is exhausted).” => IPERF consumes much more CPU for the same throughput.
On a Pentium IV 2.8 GHz HT (bogomips = 5600):
- Kernel 2.6.20:
|
|
- Kernel 2.6.22:
|
|
A patch exists: http://dast.nlanr.net/Projects/Iperf2.0/patch-iperf-linux-2.6.21.txt
A patched i686 binary is available: http://lafibre.info/images/iperf/iperf
Resources
- Official website (in English)
- User manual and batch files for simple use under Windows (in French)
Last updated 04 Feb 2008, 10:44 +0200.