Skip to main content

Measuring internet speed directly from the OpenWrt router

Contents

Have you ever struggled to measure the true speed of your internet?

Each router is different, and additionally, WiFi wireless networks come in different standards, on different frequencies and offering different speeds depending on external factors.

If our computer has a card that only supports 2.4GHz at a speed of 54Mbps, we can have 100, 200 or more Mbps, and we will not go faster than 54Mbps.

Some 2.4GHz networks can even offer 300Mbps. In the case of 5GHz and speeds go up significantly. This does not mean that we are always able to achieve the offered speed.

If we have 3 devices that actively use the WiFi network, the network capacity, i.e. the maximum speeds we can achieve, is also divided by three.

Therefore, to properly measure the internet speed, you would need to connect directly, preferably by cable, to the router and be the only user for whom the entire bandwidth would be available.

If you have a router with OpenWrt software, you can measure the connection speed directly from the router, bypassing all users.

This test is much more reliable because it involves direct communication between our device and our Internet service provider.

Ignoring the limitations of international connections, the method described below can give us the closest result to reality.

The best way to check the network speed is by using iperf3, which we install on our router with the following command:

opkg update
opkg install iperf3

It is the iperf3 tool that is most often used to check the speed in a local network between one computer and another.

We run the server on one of them and the client from which the measurement is performed on the other.

The same method can be used to check your internet speed.

However, we will not be setting up a server on the other side of the world. For this purpose, we will use publicly available servers for this purpose (Public iPerf3 servers).

Command

Here is my command to check download speed (Download):

iperf3 -c iperf.par2.as49434.net -4 -R -p 9223 -t 20

Here is my command to check upload speed:

iperf3 -c iperf.par2.as49434.net -4 -p 9223 -t 20

Command description

By default, when we run iperf3 it tests the upload speed. By adding the -R parameter we can reverse the testing method from upload to download.

Using the -c command we run the program in client mode, and the address iperf.par2.as49434.net is our server.

You can choose the server from Public iPerf3 servers

If our internet supports only IPv4 by default, then we specify it with the parameter -4. In the case of IPv6 it will be similarly -6.

Each of the servers on the list can work on a different port. Some servers offer a range of ports. To specify the port, we use the -p parameter. In the above example, the port is 9223

The -t parameter specifies how long the speed measurement should take. The default is 10 seconds, but I usually prefer to extend it to 20 seconds, hence -t 20.

Results

Each server offers different bandwidth, so it’s worth trying a few during testing.

Sometimes we may encounter a response that the server is too busy (Busy), or that our attempt has been blocked (Connection refused). In such cases, we should try another server.

In my case, with a 200Mbps download speed (Download) I got:

Result - Download speed measurement using iperf3 directly on the OpenWrt router

Whereas at 20Mbps upload speed (Upload):

Result - Upload speed measurement using iperf3 directly on the OpenWrt router

Sounds good.

I say “sounds” because if I compare these results, for example with the test on speed.cloudflare.com, I can see fluctuations and differences, depending on what connection method I use and how many active users I have in the network.


To make testing easier, it is worth creating a file on the router that we can run without having to remember the entire iperf3 command.

echo "iperf3 -c iperf.par2.as49434.net -4 -R -p 9223 -t 20" > speedtest4
chmod +x speedtest4

To run:

./speedtest4

Regards.

Share on Threads
Share on Bluesky
Share on Linkedin
Share via WhatsApp
Share via Email

Comments & Reactions

Categories