We moved this page to our Documentation Portal. You can find the latest updates here. |
Question
How to run tests with iperf?
Environment
All OnApp versions
Linux virtual machines
Answer
This article is written for Linux virtual machines
[ ] = optional
| = or
Here is the general information for what we're going to do in this article:
iperf -s [-N] [-B <host>] [-p <port>] #This is generally what a server command may look like
iperf -c <host> [-B <host>] [-t <seconds>] [-r|-d] #This is generally what the client command may look like
Only server options:
-s, --server run in server mode
-N, --nodelay disable Nagle's Algorithm (no delay)
Usable under both:
-B, --bind <host> bind to interface or multicast address
Only client options:
-c, --client <host> run as client, connecting to host.
-t, --time <seconds> time in seconds to test
-r, --tradeoff bidirectional one after the other
-d, --dualtest bidirectional simultaneously
Installing iperf
iperf is generally not installed by default and will need to be installed. It is available from the rpmforge as an rpm download, or you can add the rpmforge repo to yum/apt and install it that way. Install this on both of the machines you're testing. Instructions can be found online.
Running the test
First, we will need to set up the iperf server on one of the machines that we're testing. On the command line of that one, run the server command:
iperf -s -N
It is generally how it will work. We disable Nagle's algorithm to get a more true bandwidth test. If we need to test for a specific interface, we can also do that. For example, if the computer we're running the server on has two interfaces, one with 12.34.56.78 and the other one with 10.0.0.1, and we want to test the 10.0.0.1 network even though the other is the default one, we can run the following:
iperf -s -N -B 10.0.0.1
This will cause iperf to bind to 10.0.0.1 instead of the default one.
Once we have that set up, you'll see something like this:
------------------------------------------------------------
Server listening on TCP port 5001
Binding to local address 10.0.0.1
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
Then, we can go and start the client which will administer the test. On the command line of the client machine, run something like this:
iperf -c 10.0.0.1 -r
That will run a test connecting to 10.0.0.1, which is what the server is bound to, and also since -r is there, we will run a bidirectional test to verify that both directions have the same speed. This should produce something similar to this:
[root@iperf2 ~]# iperf -c 10.0.0.1 -d
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
------------------------------------------------------------
Client connecting to 109.123.125.105, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[ 5] local 109.123.125.106 port 43581 connected with 109.123.125.105 port 5001
[ 4] local 109.123.125.106 port 5001 connected with 109.123.125.105 port 39454
[ ID] Interval Transfer Bandwidth
[ 5] 0.0-10.1 sec 13.2 MBytes 11.0 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.2 sec 13.0 MBytes 10.7 Mbits/sec
And on the server machine, you will see:
[root@iperf1 ~]# iperf -s -N
------------------------------------------------------------
Client connecting to 10.0.0.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[ 6] local 109.123.125.105 port 39454 connected with 109.123.125.106 port 5001
Waiting for server threads to complete. Interrupt again to force quit.
[ ID] Interval Transfer Bandwidth
[ 6] 0.0-10.1 sec 13.0 MBytes 10.7 Mbits/sec
[ ID] Interval Transfer Bandwidth
[ 5] 0.0-10.3 sec 13.2 MBytes 10.7 Mbits/sec
This shows that the transfer both ways was about 10.7Mbps going both directions simultaneously, equaling to about 21.4Mbps, and this test was run between two machines, each with a 20Mbps interface.
Please make sure to replace the IP addresses with the ones that are specific to the environment that you're testing.