Data Centers

Handy iperf commands for quick network testing

The free network tool iperf is among the more easy-to-use on the Internet today. Rick Vanover shows some frequently used commands in iperf that you can use for quick network testing.

In last week's blog, I mentioned how iperf can be used for quick and easy network tests through the Java front-end applet, Jperf. In this week's blog, I want to go through a few handy use cases for iperf via the command line. Before we get too far into these examples, a quick tip to use for future reference is that if you can build your command in the Jperf gui to get the command syntax built instead of command-line iteration trial and error.

Start an iperf server process

The first command line that would be a keeper is used to start an iperf server listener process for client connection. This is shown with the command below:

iperf.exe -s -P 2 -i 5 -p 5999 -f k

This will start an iperf listener on port 5999 (the default is port 5001, however), limit the iperf process to providing two connections, and finally report on the connections every 5 seconds. The two connections (-P value) is important, because after the second connection the server process will exit. Placing in a value of zero (0) will allow the iperf process to listen continually and without limit to the number of connections until closed. On a Windows host, when this is run, the listener process runs as shown in Figure A. Figure A Figure A
Click to enlarge.
Start an iperf client connection

The other half of iperf is the client that will make the connection to a listener. To launch a client connection to a server named s-network1.amcs.tld using port 5999 (the non-default used in the previous example) for 60 seconds with a 5-second display interval, enter the following command:

iperf.exe -c s-network1.amcs.tld -P 1 -i 5 -p 5999 -f B -t 60 -T 1

When this command is run, the s-network1 host is tested for network performance. Unlike the Jperf GUI with the pretty graphs, iperf will simply report the bandwidth in the unit of measure specified, in this case it is bytes (-f value). Figure B shows the bandwidth performance on the remote client to the s-network1 host. Figure B

Figure B

Click to enlarge.

You can see where this is going, simply make a .bat file of your standard preferred test and fill in the server name for frequent tests. Iperf can be downloaded from the SourceForge Web site.

About

Rick Vanover is a software strategy specialist for Veeam Software, based in Columbus, Ohio. Rick has years of IT experience and focuses on virtualization, Windows-based server administration, and system hardware.

8 comments
kramu
kramu

What is the iperf switch to transfer a stream of zero's as data payload. Say i want to transfer 1MB of 0's as payload.

johann
johann

I too am interested in other open source software for seeing the network bandwidth usage.

alik
alik

Do you have any other open source software recommendations for seeing the network bandwidth usage? I'd love to hear them if you do. Thanks!

b4real
b4real

I should get more of these tools up, they are incredibly useful and free is good!

michel
michel

I have been using netcps for this since always.. is there any difference? it seems much easier to use..

Jebz240
Jebz240

I know its not open source but I use a Sonicwall pro 4060 and get detailed historical reports on bandwidth usage by nodes on the all of the LANs connected to the firewall

Sitizn Wille
Sitizn Wille

Look into prtg- it is free for I think 10 nodes. Also, look at Zenoss Cheers- Sitizn Wille

b4real
b4real

It is 10 years old, though it works just as fine. It gives the port selection, specify number of bytes.