Showing posts with label network. Show all posts
Showing posts with label network. Show all posts

Thursday, February 16, 2012

Measuring network throughput with iperf

The iperf tool has been around for ages and yeah, I've been late to the game :)

To install iperf in Ubuntu, it's a simple apt-get away:
$ sudo apt-get install iperf
To run the test, you'll need 2 machines.  One to act as the server and the other as the client.  Start by starting the server:
$ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
If there are no errors, we can then start the test by executing iperf in the client machine:
$ iperf -c server -t 10
------------------------------------------------------------
Client connecting to server, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.0.100 port 40913 connected with 192.168.0.101 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec    164 MBytes    138 Mbits/sec
The argument -t 10 states that we want the test to run for only 10 seconds. 

There are other options which you can play with like:

    -d ==> Do a bidirectional test simultaneously
    -u ==> use UDP rather than TCP
   
View the list of options by executing:
$ iperf --help
There's also a GUI wrapper written in Java for iperf available at http://code.google.com/p/xjperf/.  It offers a nice GUI which allows you to choose different options to run iperf with and also displays output from iperf in a nice graph: