You are probably familiar with internet speed tests such as Speedtest by Ookla and Fast.com. These tests are great and easy to use, but they have two limitations if you are primarily interested in your local network bandwidth. First, your internet connection will likely be slower than the real potential of your home network. For example, if your ISP is only providing you with a 100 Mbps line, you won’t be able to push your home Wi-Fi speed test to the full potential (likely 500+ Mbps). Second, if you are on a very fast internet connection (10 Gbps+), the speed test server will likely become the limiting factor. Most of these servers are not designed to provide bandwidth higher than 1-2 Gbps.
Well, there is an easier solution – a simple self-hosted application named iPerf. This application lets you create a server and a client and test the maximum throughput between these nodes. The test does not use any third-party remote servers, so you are measuring only the speed of the direct link. The part that is great about iPerf is that it is available for any operating system and even has native iOS and Android apps.
I like to use iPerf to run my home Wi-Fi speed test and identify spots with a weak signal. While the test is running, you can move around with your wireless device and see speeds change in real-time. Your speed will depend on many factors such as Wifi protocol, proximity to the access point, and the number of other devices on the same spectrum. In general, based on real-world tests, you should expect the following (assuming close proximity):
- 2.4 GHz – Up to 200 Mbps
- 5 GHz – Up to 800 Mbps
- 6 GHz – Up to 1000 Mbps
Setting up iPerf3 server
iPerf provides a number of easy-to-use server images, but I personally prefer to run it in a Docker container. This way I can fairly easily isolate it from the host machine and run it only when needed. You can use a docker image from networkstatic with the following docker run command:
docker run -it --rm --name=iperf3-server -p 5201:5201 networkstatic/iperf3 -s
This will start iPerf3 server instance (command -s) on port 5201.
Next, you will need a client that connects to this server. The iOS app is great, but you can also use any of the official images. For iPerf, the same application can act as a server as well as a client.
You can also use the same docker container as a client with the following docker run command (replace SERVER IP with the IP of the machine where you have iPerf server currently running). This command will immediately launch the test.
docker run -it --rm networkstatic/iperf3 -c [SERVER IP]
Running the iPerf speed test
Besides one of the available applications (e.g., iOS – see screenshot above), the most common way to run iPerf3 test is using the command line:
iperf3 -c 1.1.1.1 -p 5201 -i 1 -t 30
This tells your iPerf3 client to connect to a server at IP 1.1.1.1 (replace this with your actual server IP) at port 5201 (-p), with 1-second interval (-i), and transmit for 30 seconds (-t).
The output in command line will be similar to this:
Connecting to host 172.17.0.163, port 5201
[ 4] local 172.17.0.191 port 51148 connected to 172.17.0.163 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 4.16 GBytes 35.7 Gbits/sec 0 468 KBytes
[ 4] 1.00-2.00 sec 4.10 GBytes 35.2 Gbits/sec 0 632 KBytes
[ 4] 2.00-3.00 sec 4.28 GBytes 36.8 Gbits/sec 0 1.02 MBytes
[ 4] 3.00-4.00 sec 4.25 GBytes 36.5 Gbits/sec 0 1.28 MBytes
[ 4] 4.00-5.00 sec 4.20 GBytes 36.0 Gbits/sec 0 1.37 MBytes
[ 4] 5.00-6.00 sec 4.23 GBytes 36.3 Gbits/sec 0 1.40 MBytes
[ 4] 6.00-7.00 sec 4.17 GBytes 35.8 Gbits/sec 0 1.40 MBytes
[ 4] 7.00-8.00 sec 4.14 GBytes 35.6 Gbits/sec 0 1.40 MBytes
[ 4] 8.00-9.00 sec 4.29 GBytes 36.8 Gbits/sec 0 1.64 MBytes
[ 4] 9.00-10.00 sec 4.15 GBytes 35.7 Gbits/sec 0 1.68 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 42.0 GBytes 36.1 Gbits/sec 0 sender
[ 4] 0.00-10.00 sec 42.0 GBytes 36.0 Gbits/sec receiver
iperf Done.
Testing internet connection speed with iPerf
While iPerf’s primary mission is to test your home network bandwidth, there are public servers running iPerf that are great for internet bandwidth testing. You can find the latest list on iPerf website. Pick your desired server and run the following command:
iperf3 -c iperf.scottlinux.com -p 5201 -i 1 -t 30
Please note that you will only be able to run a test if the server is idle. If someone else is currently running a test, you will have to try again in a minute.