Testing network throughput with iperf

When you need to measure network throughput and capacity, I haven't found a simpler solution than iperf. There isn't much to say about the operation of iperf -- it's a very simple application.

In short, iperf can be installed on two machines within your network. You'll run one as a server, and one as a client. On the server side, simply run:

iperf -s

On the client side, run:

iperf -c [server_ip]

The client side will try to shove TCP packets through the network interface as quickly as possible for a period of 10 seconds by default. Once that's complete, you'll see a report on the server and client that will look like this:

$ iperf -c 192.168.10.10
------------------------------------------------------------
Client connecting to 192.168.10.10, TCP port 5001
TCP window size: 65.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.10.30 port 53345 connected with 192.168.10.10 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  37.9 MBytes  31.8 Mbits/sec

The previous test was run over an 802.11n network between a wired and wireless device. The typical downlink for an 802.11n network is about 40Mbit/s, so it's obvious that my home network could use an adjustment.

You can also run bidirectional tests from the client either at the same time (-d flag) or one after the other (-r flag). The server side will keep running until you stop it, so you can leave it running and run tests from multiple locations over time. You can daemonize the server end if that makes things easier.

For the full list of options, refer to iperf's man page.

Printed from: http://rackerhacker.com/2010/03/20/testing-network-throughput-with-iperf/ .
© Major Hayden 2012.

7 Comments   »

  • Ever used iptraf(8)? I find it quite useful for looking at actual application network activity.

  • JMarler says:

    root@dante:~# iperf -s -p 9090
    ------------------------------------------------------------
    Server listening on TCP port 9090
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    [ 4] local 192.168.1.15 port 9090 connected with 192.168.1.109 port 54790
    [ ID] Interval Transfer Bandwidth
    [ 4] 0.0-10.0 sec 1.01 GBytes 864 Mbits/sec
    [ 5] local 192.168.1.15 port 9090 connected with 192.168.1.109 port 54793
    [ 5] 0.0-10.0 sec 1.04 GBytes 893 Mbits/sec
    [ 6] local 192.168.1.15 port 9090 connected with 192.168.1.109 port 54794

    Can you guess what kind of link those systems are on? That's between my MBP and my NAS.

  • Josh says:

    iperf is a great utility. I've used it on occasion to test throughput when turning up circuits with a new ISP. The trouble that I've found recently is finding a remote site with enough bandwidth to support my iperf testing. I turned up a 300Mbps ethernet circuit at our primary site a few months ago and couldn't find someplace with enough bandwidth to perform a reliable test.

  • Major Hayden says:

    Richard - iptraf and bwm-ng are really handy to see what your server is currently doing, but it's hard to estimate the raw capacity of the network that way.

  • Ahmad says:

    Hey guys,

    I'm trying to use iperf to measure the TCP bandwidth but when i type the command iperf -c , nothing happens ! ... it just measures the UDP bandwidth... any ideas what is going wrong ?

  • Moses says:

    Does iperf provide quality data when measuring bandwidth input/output over a Satellite link

  • Major Hayden says:

    Moses - I think it would be reasonable to measure bandwidth over any link with iperf.

RSS feed for comments on this post

Leave a Reply

 

  • Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you find the information useful. If you spot something that's incorrect or confusing, please write a comment and let me know. Drop me a line if there's something you want to know more about and I'll do my best to write a post on the topic.
    -- Major Hayden

    Flattr this