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

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.