Yesterday we had some fun at the first UK Wi-Co Community event in London. I wanted to run some throughput tests of OFDM and OFDMA and don’t have enough devices to do it myself at home, so I stepped up in front of a live studio audience for some community participation.
As often happens with live testing in front of an audience I had what the kids call an Epic Fail. The setup and testing worked fine at home with the 1 device I tried with… but what this iPerf newbie did not realise about iPerf3 is that it only allows 1 client connection per port. So 1 person got going and 9 others started shouting back to me that ‘the computer said no’.
Thankfully the amazing Jiri Brejcha was in the audience and, during a break, gave me the commands needed to set multiple iPerf instances running and logging on the WLAN Pi ready for a repeat attempt at lunch. I’m documenting this here before I forget it, for my benefit more than anyone elses. But perhaps you are onsite having made the same assumption I did and this can save your bacon. Be warned, its console commands, you can’t do this in the UI, so you’ll need SSH access to the WLAN Pi.
The WLAN Pi is an amazing cheap community built tool for any network engineer. It is a fork of the RaspberryPi OS with LOADS of useful functions for auditing, exploring and troubleshooting both Wired and Wireless networks – LLDP/CDP, Speedtests, Reachability Tests, iPerf, Kismet, Grafana, Packet Capture, DHCP Server, Air Console and loads more.
For my test I wanted to use it as an iPerf server for a throughput test of multiple clients. iPerf3 service is running by default, just power it up and plug it in to the network. Ace! But its only a single service running on the default port of 5201. And as I found out in front of 40 odd people that isn’t going to work for multiple concurrent clients. So time to scramble.
First up, the firewall is enabled by default and is only configured to allow port 5201 in. So if you’re going to spin up more iPerf services on other ports then you’ll want to disable the firewall. To stop the firewall service running until you reboot the unit use this command:
sudo systemctl stop ufw
I decided to disable it permanently because I don’t tend to use my WLAN Pi at customers sites and even if I did, its so easy to reimage that I’m not concerned about its safety. To disable permanently use:
sudo systemctl disable ufw
The default iPerf service log on the WLAN Pi can be accessed using this command:
journalctl -u iperf3.service
If you want to dump that entire log to a text document then just modify like this:
journalctl -u iperf3.service > iperf3.txt
The above will dump the log for the default instance (ONLY) to a file called iperf3.txt in your home directory.
Starting additional iPerf services will give you more ports but it won’t put the log into the default iPerf3 log. If you don’t care about the logs and just want the service running then simply do:
iperf3 -s -p 5202
This will create another iPerf3 server running in server mode (-s) on port (-p) 5202. Now you can connect a client to 5201 and a different client to 5202.
If you do want to save the logs then simply add to the command so it looks like this:
iperf3 -s -p 5202 > iperf3-5202.txt
You can probably guess it by now but this is going to dump the log data to a file in your home directory called iperf3-5202.txt.
Now, when you run the service with either of the two above commands your console is going to be locked into the iPerf3 service. If you want to be able to start multiple extra services, or just generally do other things in the console then you’ll want to tell the service to run in the background (I’m not sure this is exactly the correct language but it is how I am considering it). To do this you want to add an ampersand to the end of the command like this:
iperf3 -s -p 5202 > iperf3-5202.txt &
That simple extra character on the end will start the service running “in the background” and let you keep using the console. It doesn’t look like it at first because you don’t immediately get the console prompt back, but after you run that command if you hit enter a second time you’ll get your console prompt back and can get on with other stuff.
For simplicity (at the suggestion of Jiri again!) I decided to start 10 new services that would all automatically log to similar file names and into the same place, rather than use the default service and have to remember to dump the journalctl log to a text file. So this is what I did:
iperf3 -s -p 5202 > iperf3-5202.txt & iperf3 -s -p 5203 > iperf3-5203.txt & iperf3 -s -p 5204 > iperf3-5204.txt & iperf3 -s -p 5205 > iperf3-5205.txt & iperf3 -s -p 5206 > iperf3-5206.txt & iperf3 -s -p 5207 > iperf3-5207.txt & iperf3 -s -p 5208 > iperf3-5208.txt & iperf3 -s -p 5209 > iperf3-5209.txt & iperf3 -s -p 5210 > iperf3-5210.txt & iperf3 -s -p 5211 > iperf3-5211.txt &
To stop all the iPerf services if you make a mistake you can reboot or just use this command (but it will also kill the default 5201 service):
sudo killall iperf3
I plan to re-do the testing from yesterday so hopefully this blog will be a useful reminder when I come to do that. And maybe it’ll help you too.