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.
Ever used
iptraf(8)? I find it quite useful for looking at actual application network activity.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.
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.
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.
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 ?
Does iperf provide quality data when measuring bandwidth input/output over a Satellite link
Moses – I think it would be reasonable to measure bandwidth over any link with iperf.
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.
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.
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