Linux for Network Engineers: iPerf3 Bidirectional Test

By February 26, 2020Linux

We have talked about the differences between iPerf2 and iPerf3 in terms of their reverse options. I recently noticed that the latest iPerf3 version 3.7 released on 06/21/2019 has an additional option to handle reverse testing, and I wanted to talk about it.

Installation

It takes a while for a new version of any software to find its way into standard repositories. So, if you need to play with this new option, you’d have to compile from the source. Here is how to do it on Debian-based Linux:

wget https://downloads.es.net/pub/iperf/iperf-3.7.tar.gz
tar xzf iperf-3.7.tar.gz
cd iperf-3.7
./configure
make

If you don’t see any errors, you can find the new iPerf3 executable in the “src/” directory, and you can confirm that it works by printing the help output with the following:

cd src
./iperf3 --help

Keep in mind, that if you want to use this latest version of iPerf3 your working directory has to be “iperf-3.7/src” and to run the command use “./iperf3” If you just type iperf3 (without the dot and forward slash) you will end up using whatever iPerf3 executable you have installed in your system.

Bidirectional Test

The bidirectional option is “--bidir.” When used the client opens two TCP connections with the server: one is used for the forward test and one for the reverse. Here is how the output looks like from the client:

netbeez$ ./iperf3 -c 172.31.0.121 --bidir -i 10
Connecting to host 172.31.0.121, port 5201
[  5] local 172.31.0.25 port 38607 connected to 172.31.0.121 port 5201
[  7] local 172.31.0.25 port 38608 connected to 172.31.0.121 port 5201
[ ID][Role] Interval           Transfer     Bitrate         Retr  Cwnd
[  5][TX-C]   0.00-10.00  sec  1.08 GBytes   931 Mbits/sec    0   1.04 MBytes
[  7][RX-C]   0.00-10.00  sec  1.09 GBytes   933 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID][Role] Interval           Transfer     Bitrate         Retr
[  5][TX-C]   0.00-10.00  sec  1.08 GBytes   930 Mbits/sec    0             sender
[  5][TX-C]   0.00-10.00  sec  1.08 GBytes   928 Mbits/sec                  receiver
[  7][RX-C]   0.00-10.00  sec  1.09 GBytes   934 Mbits/sec    0             sender
[  7][RX-C]   0.00-10.00  sec  1.09 GBytes   933 Mbits/sec                  receiver

iperf Done.

At the end of the test, the server sends what it measured back to the client. The client reports 930 Mbits/sec transmitted TX-C bandwidth, as measured from its perspective (sender) and 928 Mbits/sec TX-C from the server’s perspective (received). Then it reports 933 Mbits/sec received RX-C bandwidth, as measured from its perspective (received) and 934 Mbits/sec RX-C from the server’s perspective (sender). 

And here is the server’s side output for the same test:

netbeez$ ./iperf3 -s -i 10
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 172.31.0.25, port 38609
[  5] local 172.31.0.121 port 5201 connected to 172.31.0.25 port 38610
[  8] local 172.31.0.121 port 5201 connected to 172.31.0.25 port 38611
[ ID][Role] Interval           Transfer     Bitrate         Retr  Cwnd
[  5][RX-S]   0.00-10.00  sec  1.08 GBytes   928 Mbits/sec
[  8][TX-S]   0.00-10.00  sec  1.09 GBytes   934 Mbits/sec    0    718 KBytes
[  5][RX-S]  10.00-10.00  sec   484 KBytes   889 Mbits/sec
[  8][TX-S]  10.00-10.00  sec   629 KBytes  1.16 Gbits/sec    0    718 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID][Role] Interval           Transfer     Bitrate         Retr
[  5][RX-S]   0.00-10.00  sec  1.08 GBytes   928 Mbits/sec                  receiver
[  8][TX-S]   0.00-10.00  sec  1.09 GBytes   934 Mbits/sec    0             sender

iPerf2 vs. iPerf3

The “--bidir” option is very similar to the “--dualtest” option of iPerf2. The difference is that in iPerf2, one socket is opened from the iPerf client to the server and one from the server to the client. In addition, the server measurements are not sent back to the client to print them in the console output.

iPerf2 dualtest client output:

netbeez $ ./iperf -c 172.31.0.121  --dualtest
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: -1.00 Byte (default)
------------------------------------------------------------
------------------------------------------------------------
Client connecting to 172.31.0.121, TCP port 5001
TCP window size:  255 KByte (default)
------------------------------------------------------------
[  5] local 172.31.0.25 port 39257 connected with 172.31.0.121 port 5001
[  4] local 172.31.0.25 port 5001 connected with 172.31.0.121 port 52532
[ ID] Interval       Transfer     Bandwidth
[  5]  0.0-10.0 sec  1.09 GBytes   932 Mbits/sec
[  4]  0.0-10.0 sec  1.08 GBytes   927 Mbits/sec

iPerf2 dualtest server output:

netbeez$ ./iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 172.31.0.121 port 5001 connected with 172.31.0.25 port 39257
------------------------------------------------------------
Client connecting to 172.31.0.25, TCP port 5001
TCP window size:  544 KByte (default)
------------------------------------------------------------
[  6] local 172.31.0.121 port 52532 connected with 172.31.0.25 port 5001
[ ID] Interval       Transfer     Bandwidth
[  6]  0.0-10.0 sec  1.08 GBytes   928 Mbits/sec
[  4]  0.0-10.0 sec  1.09 GBytes   929 Mbits/sec

All in all, the bidirectional tests between iPerf2 and iPerf3 are very similar. The only advantage of iPerf3 is that it doesn’t require a reverse route or port open to receive the traffic since both sockets are opened from the client to the server. That can be important if the iPerf client is behind a NAT and is not able to accept connections.