How to test Wifi Connection Speed (Throughput) on LAN with Iperf

By | January 30, 2023

In this article we take a quick look at testing wifi throughput over lan using a simple tool called iperf. Wifi lan speed matters when you are transferring large files across devices.

For example transferring a big video or zip file from ipad or smartphone to desktop pc connected on ethernet. Wifi speed is not as simple as ethernet and there are numerous factors that can cause lower than expected data throughput.

The required setup and steps are as follows:

1. Setup a wired machines on the network with highest speed. This machine will host an iperf server
2. Connect wifi client and keep it near to the router for good signal strength
3. Run Iperf on client on the device for testing upload and download speed.

Required Netword Setup

You would need a wired pc that is connected over ethernet so that it can transfer data at speeds higher than the wifi device. This is important to saturate the bandwidth of the wifi connection.

Make sure your wired pc is capable of 1 gbps throughput using cat6 cables and a powerful enough gateway router.

This wifi device shall connect to this wired device and transfer data back and forth to calculate the transfer speed.

In theory you could test wifi transfer speed between 2 wifi devices like a smartphone and a laptop, but atleast one of the devices would have to support high speed (1gbps or more) on wifi in order to saturate the other and test the speed limits properly.

You would also need to ensure that the router (or access point) connecting both the devices is as fast (or faster) than the device acting as the iperf server. This is often not practical, because even if you have a Wifi 6 laptop, the router might only support wifi5. A wifi5 router cannot match the speed of wifi6 but it can certainly offer faster speeds on wired connection that match or exceed the speed of wifi6.

So its best to have the test server on a wired device like a desktop or ethernet connected laptop. Other benefits of having 1 wired device, is less radio interference, less wifi signal processing load on the routers processor resulting in a better controlled environment for proper speed benchmark.

Wifi device to be tested (phone/tablet/laptop) <---> Router (AP) <---> Wired PC (Iperf Server)

Check signal strength on client device

For testing wifi throughput, the device must be connected at a signal level of -40 dBm or higher. Below -40 dBm the speed would drop drastically, and above it the results are usually diminishing. Above -20 dBm you are unlikely to see much gain in data transfer speed.

So try to get the best signal strength, but must have a minimum of -40 to -35 dBm for proper network speed test.

If the signal strength drops to low levels like -50 to -70 dBm the whole test would be pointless simply because the radio communication link would be just too weak to transfer data properly resulting in use of low speed mcs index and poor transfer speeds.

On Linux machines you can check the signal strength with commands like iw, iwconfig, and wavemon. Wavemon shows a nice realtime graph of wifi signal strength. The signal strength should be strong as well as stable (without too much fluctuation).

What is a good Signal Strength

So here is a rough estimate of what to expect with different levels of signal strengths.

  • -30 to -20 dBm: Very strong signal strength. Within 1 foot distance from access point.
  • -40 to -30 dBm: Strong / Near Highest Speed. Within 1 metre distance from AP
  • -50 to -40 dBm: Excellent signal strength/High Speed
  • -60 to -50 dBm: Good signal strength/Medium Speed
  • -70 to -60 dBm: Average Speed
  • -80 to -70 dBm: Reliable/Low Speed/Workable. Minimum required for a stable connection
  • -90 to -80 dBm: Very Slow/Unstable/Frequent Disconnections

Note: At signal strength higher than -20 dBm you will not see much improvement in speed, so don't go crazy about it and start sleeping next to your router!

At any given distance from the router, 2.4 Ghz band will offer more signal strength than 5Ghz signal. This is why 2.4Ghz has better coverage.

Installing Iperf

On Linux systems you can install both iperf and iperf3 from the default software repositories. Ubuntu users can type in the following:

sudo apt install iperf 
sudo apt install iperf3

You can use either iperf (which is version 2.x) or iperf3 (which is version 3+). You must make sure to use the same version for both server and client. You cannot run server with one version and connect to it with a client of another version.

Windows users can download iperf from the official site at https://iperf.fr/iperf-download.php

Iperf supports many other platforms like android and ios. Go to their respective app stores and get the client app. For android the recommended app is "he.net Network Tools" and it supports "-R" reverse connect option which is necessary for testing download speed.

Start Iperf server on wired machine

Now start a Iperf server on the wired machine. The command is overly simple. Just use the "-s" option to launch iperf in server mode.

iperf -s

You should see something like:

iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size:  128 KByte (default)
------------------------------------------------------------

Now everytime a client connects to this server, a dummy data transfer will take place to test the network throughput. The server terminal will also output the speed of the specific client.

Iperf server can be modified in a number of ways like changing the port number and window size etc. However, for this example we shall be using the default values.

As you run the iperf server on a wired machine, also note down the ip address of the server machine. On Ubuntu you can simply run the ifconfig or ip addr show command note down the ip address of this server machine:

$ ifconfig
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.215  netmask 255.255.0.0  broadcast 192.168.255.255
        ether 1c:1b:0d:c8:82:4d  txqueuelen 1000  (Ethernet)
        RX packets 57488555  bytes 75493358778 (75.4 GB)
        RX errors 0  dropped 32  overruns 0  frame 0
        TX packets 32449136  bytes 23545259152 (23.5 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 91563  bytes 9255698 (9.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 91563  bytes 9255698 (9.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$

The server ip address here is 192.168.1.215
Now we shall make the client device connect to this ip address using iperf client command.

I am running the iperf server on a desktop machine with GA-H110M-H motherboard which has a Realtek 1 Gbit/100 Mbit ethernet nic. Wired connections are using CAT6 cables and the router is capable of 1000 mbps/1 gbps.

Here are some results in a table:

Device Wifi Chipset Wifi4 MCS Bitrate Wifi4 Speed Wifi5 MCS Bitrate Wifi5 Speed
Acer Swift 3 Intel Wifi 6 AX201 144 98.6/91.6 866.7 595/635

Run Iperf on client device

Running the iperf client is equally simple. Here is the command:

iperf -c 192.168.1.215

Use the "-c" option and specify the ip address.

By default it will run for about 10 seconds and try to transfer the maximum amount of data in this time span and then calculate the data transfer speed.

The first client device we are testing is the Acer Swift 3 with Intel Wi-Fi 6 AX201.

Wifi4 Speed

Wifi4 connection is on 2.4ghz band and 20Hz channel width.

$ iw wlp0s20f3 link
Connected to 98:35:ed:d4:e1:48 (on wlp0s20f3)
        SSID: AirtelFiber
        freq: 2422
        RX: 1651053262 bytes (1249921 packets)
        TX: 567833266 bytes (262967 packets)
        signal: -40 dBm
        rx bitrate: 144.4 MBit/s MCS 15 short GI
        tx bitrate: 144.4 MBit/s MCS 15 short GI

        bss flags:      short-slot-time
        dtim period:    1
        beacon int:     100
$
$ iperf -c 192.168.1.215 -t30 -P8 -R
------------------------------------------------------------
Client connecting to 192.168.1.215, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  7] local 192.168.1.44 port 60454 connected with 192.168.1.215 port 5001 (reverse) (icwnd/mss/irtt=14/1448/2811)
[  3] local 192.168.1.44 port 60462 connected with 192.168.1.215 port 5001 (reverse) (icwnd/mss/irtt=14/1448/3034)
[  4] local 192.168.1.44 port 60498 connected with 192.168.1.215 port 5001 (reverse) (icwnd/mss/irtt=14/1448/3591)
[  1] local 192.168.1.44 port 60476 connected with 192.168.1.215 port 5001 (reverse) (icwnd/mss/irtt=14/1448/3617)
[  6] local 192.168.1.44 port 60500 connected with 192.168.1.215 port 5001 (reverse) (icwnd/mss/irtt=14/1448/3560)
[  5] local 192.168.1.44 port 60506 connected with 192.168.1.215 port 5001 (reverse) (icwnd/mss/irtt=14/1448/3580)
[  8] local 192.168.1.44 port 60464 connected with 192.168.1.215 port 5001 (reverse) (icwnd/mss/irtt=14/1448/3611)
[  2] local 192.168.1.44 port 60492 connected with 192.168.1.215 port 5001 (reverse) (icwnd/mss/irtt=14/1448/3656)
[ ID] Interval       Transfer     Bandwidth
[ *5] 0.0000-30.8503 sec  60.2 MBytes  16.4 Mbits/sec
[ *6] 0.0000-31.1553 sec  29.6 MBytes  7.98 Mbits/sec
[ *4] 0.0000-31.2000 sec  67.1 MBytes  18.0 Mbits/sec
[ *1] 0.0000-31.3378 sec  35.0 MBytes  9.37 Mbits/sec
[ *2] 0.0000-31.4114 sec  42.1 MBytes  11.2 Mbits/sec
[ *8] 0.0000-31.4246 sec  46.0 MBytes  12.3 Mbits/sec
[ *3] 0.0000-31.4113 sec  35.1 MBytes  9.38 Mbits/sec
[ *7] 0.0000-31.5396 sec  55.6 MBytes  14.8 Mbits/sec
[SUM] 0.0000-31.5396 sec   371 MBytes  98.6 Mbits/sec
[ CT] final connect times (min/avg/max/stdev) = 2.952/3.505/3.726/301.992 ms (tot/err) = 8/0
$

Download throughput: 98.6 mbps

On a wifi4 connection we can double the download speed by forcing use of 40Mhz channel width, but it is not a recommended practice, because the 2.4ghz band has few channels and more interference due to longer range. Using 40Mhz would cause troubles if there are other 2.4Ghz bands in the neighbourhood.

Upload speed test

Now lets test the upload speed. By default without the "-R" option, iperf shall perform an upload test.

$ iperf -c 192.168.1.215 -t30 -P8
------------------------------------------------------------
Client connecting to 192.168.1.215, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  2] local 192.168.1.44 port 55654 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/12349)
[  3] local 192.168.1.44 port 55634 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/13050)
[  7] local 192.168.1.44 port 55692 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/14920)
[  5] local 192.168.1.44 port 55652 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/15021)
[  8] local 192.168.1.44 port 55676 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/15079)
[  1] local 192.168.1.44 port 55704 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/15109)
[  4] local 192.168.1.44 port 55636 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/15113)
[  6] local 192.168.1.44 port 55702 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/15094)
[ ID] Interval       Transfer     Bandwidth
[  1] 0.0000-31.2379 sec  37.0 MBytes  9.94 Mbits/sec
[  7] 0.0000-32.0659 sec  40.0 MBytes  10.5 Mbits/sec
[  4] 0.0000-32.0715 sec  43.5 MBytes  11.4 Mbits/sec
[  2] 0.0000-32.2920 sec  44.3 MBytes  11.5 Mbits/sec
[  3] 0.0000-32.3228 sec  43.8 MBytes  11.4 Mbits/sec
[  5] 0.0000-32.4143 sec  42.6 MBytes  11.0 Mbits/sec
[  6] 0.0000-32.4610 sec  44.9 MBytes  11.6 Mbits/sec
[  8] 0.0000-32.4608 sec  43.8 MBytes  11.3 Mbits/sec
[SUM] 0.0000-31.1129 sec   340 MBytes  91.6 Mbits/sec
[ CT] final connect times (min/avg/max/stdev) = 12.439/14.529/15.161/1098.585 ms (tot/err) = 8/0
$

Upload throughput: 91.6 mbps

Wifi 5 (802.11ac) Speed

$ iw wlp0s20f3 link
Connected to 98:35:ed:d4:e1:4c (on wlp0s20f3)
        SSID: AirtelFiber_5GHz
        freq: 5745
        RX: 2609908890 bytes (4479756 packets)
        TX: 17544895 bytes (203262 packets)
        signal: -28 dBm
        rx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
        tx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2

        bss flags:      short-preamble short-slot-time
        dtim period:    1
        beacon int:     100
$
$ iperf -c 192.168.1.215 -t30 -R
------------------------------------------------------------
Client connecting to 192.168.1.215, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.44 port 49752 connected with 192.168.1.215 port 5001 (reverse) (icwnd/mss/irtt=14/1448/4104)
[ ID] Interval       Transfer     Bandwidth
[ *1] 0.0000-30.0629 sec  2.08 GBytes   595 Mbits/sec
$

Download speed: 595 mbps

Upload speed

Now lets test the upload speed

$ iperf -c 192.168.1.215 -t30 -P8
------------------------------------------------------------
Client connecting to 192.168.1.215, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.44 port 41340 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/2904)
[  2] local 192.168.1.44 port 41354 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/3908)
[  6] local 192.168.1.44 port 41410 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/3990)
[  7] local 192.168.1.44 port 41378 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/4142)
[  5] local 192.168.1.44 port 41398 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/4121)
[  4] local 192.168.1.44 port 41356 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/4176)
[  8] local 192.168.1.44 port 41344 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/4236)
[  3] local 192.168.1.44 port 41342 connected with 192.168.1.215 port 5001 (icwnd/mss/irtt=14/1448/5229)
[ ID] Interval       Transfer     Bandwidth
[  3] 0.0000-30.1727 sec   309 MBytes  85.8 Mbits/sec
[  4] 0.0000-30.1722 sec   300 MBytes  83.3 Mbits/sec
[  7] 0.0000-30.1719 sec   272 MBytes  75.7 Mbits/sec
[  1] 0.0000-30.1774 sec   315 MBytes  87.5 Mbits/sec
[  6] 0.0000-30.1773 sec   250 MBytes  69.5 Mbits/sec
[  8] 0.0000-30.1896 sec   252 MBytes  70.0 Mbits/sec
[  2] 0.0000-30.1892 sec   264 MBytes  73.4 Mbits/sec
[  5] 0.0000-31.2619 sec   319 MBytes  85.6 Mbits/sec
[SUM] 0.0000-30.1412 sec  2.23 GBytes   635 Mbits/sec
[ CT] final connect times (min/avg/max/stdev) = 2.962/4.138/5.323/640.150 ms (tot/err) = 8/0
$

The upload throughput = 635 mbps

Conclusion

The wifi speed depends on numerous factors like the distance between device and access point, wifi standard, frequency band being used etc.

The speed depends even on the wifi chipset. On laptops Intel wifi chipsets usually perform the best when it comes to laptop wifi, whereas the Mediatek wifi chipsets are the worst performers.

If you are getting lower then expected data transfer speeds check all the factors and make sure that you have configured everything right. For example for faster speed you can do the following:

1. Choose Wifi5 instead of Wifi4.
2. Use the 5Ghz band instead of 2.4Ghz band
3. Keep the device close to the access point while you transfer some large file or data. Make sure signal strength is -50 dBm or higher.
4. Check router settings and make sure that high channel width (80 Mhz or more) is being used
5. Switch to a more powerful router if the current one does not support newer wifi standards
6. Check device settings. Sometimes device tend to switch to a slower connection due to configuration issues.
7. Install a second AP device in areas that are farther away from main router.

So those were some tips on measuring and increasing you wifi connection speed on the local network. Check your wifi network and fix the speed now.

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

One Comment

How to test Wifi Connection Speed (Throughput) on LAN with Iperf

Leave a Reply

Your email address will not be published. Required fields are marked *