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.

Comments

  1. 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.

  2. 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.

  3. 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.

  4. 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 ?

  5. Sudarshan says

    Hi Major,

    Thanks for a wonderful blog it was indeed very helpful,but I have one doubt,please help me.
    I wanted to know how much time is required for this testing to be performed ? as in how many days or how much time this testing takes place.
    Thanks.

  6. says

    Sudarshan –

    You’re welcome. You can usually get results from iperf in as little as 10 seconds by default, but you always have the option of running it for a longer time period.

  7. Ed Lane says

    We are using iperf in attempt to flood our 100Mps moe mpls circuits. The window size always defaults to 64k even after adjusting it with the command. We can never get it to adjust up past 20-30 M using tcp. Puzzled why not?

    Ed

  8. rose says

    You are all using throughput and bandwidth as if this is one same thing. As far as I know they are different values and have different meaning … Any thoughts?

  9. says

    I have a problem using iperf, I wanted to set the payload sizes from 100, 500 and 1000 with concurrency of 1, 10, 20 an 50.

    How will i set this one below in TCP and UDP to have a report on Interval, Transfer and Bandwidth? What would the proper parameter to be executed in iperf? example: iperf -c ip address and -P for concurrency, what about in PAYLOAD SIZES….. Please help me….

    PAYLOAD
    100
    500
    1000

    CONCURRENCY of 1

    Thanks in advance….

Leave a Reply

Your email address will not be published. Required fields are marked *