November 06, 2022

Speedtest LAN and Internet/WAN, iperf3

Updated 2022-11-06 !

Sometimes I'm a little confused if it's the local network that is the bottleneck or if the ISP, Internet Service Provider, is slow.

In a former post I used 2 applikations to get the information, from both the local LAN and Internet, but on the other hand it maybe hade been nice with a more lightweight approach. 

From this post I got inspiration and discovered a nice little application "iperf3" which is available for several OS.

Intro
There is also a free iOS app, client, which uses the same application, check picture and there seems to be some Google Play apps as well.

Install and first test
On a Raspberry Pi(RPi), you just install "iperf3" with 

$ sudo apt update && sudo apt install iperf3 

The basic use is that you start a server with the CLI option "-s",  on one computer 

$ iperf3 -s

and a client, or using the iOS app, on another device with the CLI option "-c" with 

$ iperf3 -c raspberrypi

where "raspberrypi" is the the host name, for the server, which can be changed to the IP adress. You will see something like

$ iperf3 -c raspberrypi

Connecting to host raspberrypi, port 5201

[  5] local 192.168.1.75 port 50206 connected to 192.168.1.71 port 5201

[ ID] Interval           Transfer     Bitrate         Retr  Cwnd

[  5]   0.00-1.00   sec  11.5 MBytes  96.1 Mbits/sec    0    116 KBytes       

[  5]   1.00-2.00   sec  11.2 MBytes  94.4 Mbits/sec    0    116 KBytes       

[  5]   2.00-3.00   sec  11.2 MBytes  93.8 Mbits/sec    0    116 KBytes       

[  5]   3.00-4.00   sec  11.2 MBytes  94.4 Mbits/sec    0    116 KBytes       

[  5]   4.00-5.00   sec  11.2 MBytes  93.8 Mbits/sec    0    124 KBytes       

[  5]   5.00-6.00   sec  11.2 MBytes  93.8 Mbits/sec    0    124 KBytes       

[  5]   6.00-7.00   sec  11.2 MBytes  93.8 Mbits/sec    0    124 KBytes       

[  5]   7.00-8.00   sec  11.4 MBytes  95.9 Mbits/sec    0    177 KBytes       

[  5]   8.00-9.00   sec  11.2 MBytes  93.8 Mbits/sec    0    177 KBytes       

[  5]   9.00-10.00  sec  11.2 MBytes  93.8 Mbits/sec    0    177 KBytes       

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate         Retr

[  5]   0.00-10.00  sec   113 MBytes  94.4 Mbits/sec       sender

[  5]   0.00-10.01  sec   112 MBytes  94.0 Mbits/sec         receiver


Despite I'm using ethernet on the RPi the low speed is due to that the client is an old RPi 2 which is still up and running. So it's important that the server has good prestanda.

There are other options for the CLI which can be checked here.

Public servers
If you want to check your internet speed just use another host than your own from this list with public iperf servers. Test with, for example,

$ iperf3 -c paris.testdebit.info -p 9200


Please note that these servers can just have one client at the time.

Autostart server with systemd 
Always having a "ipref3"  server up and runing ? 

Autostart with systemd will make the "ipref3" software start, as a server, at boot and restart if it fails. Create a file with

$ sudo nano /etc/systemd/system/ipref3.service

and add the following configuration

[Unit]
Description=iperf3 Speedtest
After=syslog.target network-online.target

[Service]
Type=simple
User=root
ExecStart=/usr/bin/iperf3 -s
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target

And then the following commands to get it up and running

$ sudo systemctl daemon-reload
$ sudo systemctl enable iperf3 
Created symlink /etc/systemd/system/multi-user.target.wants/iperf3.service → /etc/systemd/system/iperf3.service. 
$ sudo systemctl start iperf3

Check with the following command 

$ sudo systemctl status iperf3

And now you have a server that you can run tests against.

Additional info
Some hints and servers is found here.

No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !