Everyone knows how to use speedtest.net to test your internet connection speed, but how do you test your LAN bandwidth?

 

When you want to troubleshoot speed issues on your LAN, what can you use? Luckily, some clever software call iperf3 can help us out.  You can find the tool at the main website for iperf and iperf3  here. This tool is available for Windows, Linux, Mac, Android, and iOS, so you’ve got options.

There are two parts to testing your network with iperf3. First you need to set up the server. The server will listen on a particular port for client connections and will host a “control” connection with a client once the test begins. In today’s example, I will be testing the network between my laptop and my router (the Linux box I built in the previous series BYORpt1 and BYORpt2).

I’ll be using the Linux router as the server and my laptop as the client. Later I’ll show an option which will reverse the directions of traffic flow without any extra work.

Setting up the Server

root@calvert-home:/home/jacob# iperf3 -s -p 8384
-----------------------------------------------------------
Server listening on 8384
-----------------------------------------------------------

These commands instruct iperf3 to act as (s)erver on (p)ort 8384. That’s it for the basic tests.

Setting up the Client

jacob@jacob-laptop ~ $ iperf3 -c 172.16.0.1 -p 8384

Once you execute this command, testing will begin. The default parameters will run the test as fast as possible for 10 seconds.

Your output will look something like:

Connecting to host 172.16.0.1, port 8384
[ 4] local 172.16.2.21 port 35950 connected to 172.16.0.1 port 8384
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 4.94 MBytes 41.4 Mbits/sec 0 311 KBytes 
[ 4] 1.00-2.00 sec 5.22 MBytes 43.8 Mbits/sec 0 553 KBytes 
[ 4] 2.00-3.00 sec 4.81 MBytes 40.3 Mbits/sec 0 803 KBytes 
[ 4] 3.00-4.00 sec 5.06 MBytes 42.4 Mbits/sec 0 1.03 MBytes 
[ 4] 4.00-5.00 sec 5.05 MBytes 42.4 Mbits/sec 0 1.22 MBytes 
[ 4] 5.00-6.00 sec 5.08 MBytes 42.6 Mbits/sec 0 1.24 MBytes 
[ 4] 6.00-7.00 sec 5.02 MBytes 42.1 Mbits/sec 0 1.24 MBytes 
[ 4] 7.00-8.00 sec 5.06 MBytes 42.5 Mbits/sec 0 1.24 MBytes 
[ 4] 8.00-9.00 sec 5.56 MBytes 46.7 Mbits/sec 0 1.24 MBytes 
[ 4] 9.00-10.00 sec 4.59 MBytes 38.5 Mbits/sec 0 1.24 MBytes 
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 50.4 MBytes 42.3 Mbits/sec 0 sender
[ 4] 0.00-10.00 sec 50.4 MBytes 42.3 Mbits/sec receiver

Notice, I have pretty bad performance for a GbE capable machine. Unfortunately, I have to link up to the switch through a PowerLine adapter, which causes some slowdown.

Reversing the Direction

To reverse the direction of “server” and “client” responsibilities, we simply append the flag -R

Output on the Server Side

On the server side you will also see output that should mirror your client.

-----------------------------------------------------------
Server listening on 8384
-----------------------------------------------------------
Accepted connection from 172.16.2.21, port 35948
[ 5] local 172.16.0.1 port 8384 connected to 172.16.2.21 port 35950
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 4.30 MBytes 36.1 Mbits/sec 
[ 5] 1.00-2.00 sec 4.73 MBytes 39.6 Mbits/sec 
[ 5] 2.00-3.00 sec 4.86 MBytes 40.8 Mbits/sec 
[ 5] 3.00-4.00 sec 5.04 MBytes 42.3 Mbits/sec 
[ 5] 4.00-5.00 sec 5.06 MBytes 42.4 Mbits/sec 
[ 5] 5.00-6.00 sec 4.96 MBytes 41.6 Mbits/sec 
[ 5] 6.00-7.00 sec 5.06 MBytes 42.4 Mbits/sec 
[ 5] 7.00-8.00 sec 5.08 MBytes 42.6 Mbits/sec 
[ 5] 8.00-9.00 sec 5.26 MBytes 44.2 Mbits/sec 
[ 5] 9.00-10.00 sec 4.95 MBytes 41.6 Mbits/sec 
[ 5] 10.00-10.21 sec 1.08 MBytes 44.3 Mbits/sec 
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 5] 0.00-10.21 sec 50.4 MBytes 41.4 Mbits/sec 0 sender
[ 5] 0.00-10.21 sec 50.4 MBytes 41.4 Mbits/sec receiver

Going Further

iperf3 supports multiple processes (but not multiple threads!! beware!!) with the -P option. That can have some interesting results.

Thanks for reading!