# Add Speedtest to Web GUI

**URL:** <https://community.ipfire.org/t/add-speedtest-to-web-gui/12965>\
**Category:** Add-Ons\
**Created:** [2 October 2024 21:36 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965 "2024-10-02T21:36:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephen](https://community.ipfire.org/user_avatar/community.ipfire.org/stephen/32/16711_2.png) [@stephen](https://community.ipfire.org/u/stephen)\
**Post date:** [2 October 2024 21:36 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/1 "2024-10-02T21:36:45Z")

</div>

I think that it would be useful to be able to run speedtest-cli from the Web GUI and was able to do this by hacking the mdstat.cgi script.

 ![image](https://community.ipfire.org/uploads/default/original/2X/3/3aff446adb7859e0e23863c47e19b4627924f3bd.png)

 ![image](https://community.ipfire.org/uploads/default/original/2X/3/3719ba7d1e7c40f22ea0b0dc4bd9fca109147760.png)

As you can see creating a speedtest.cgi script would be easy. I don’t know what’s involved with adding a menu entry.

If users and devs think that this is a good idea, I could write a patch to add a speedtest.cgi page with some assistance (and patience since I’m kinda new to this 🙂 ) on how to add the entry to the Web GUI menu system as I have no clue there.

Edit: I dug into the menu entry and it turns out I was looking in the wrong places. Actually was able to add the menu entry.

 ![image](https://community.ipfire.org/uploads/default/original/2X/2/27b950266774b0fb7f1b1c1cac978a05551902e2.png)

---

<div class="post-metadata">

**Author:** ![stephen](https://community.ipfire.org/user_avatar/community.ipfire.org/stephen/32/16711_2.png) [@stephen](https://community.ipfire.org/u/stephen)\
**Post date:** [2 October 2024 23:08 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/2 "2024-10-02T23:08:26Z")

</div>

Ok, after all that, it just occurred to me that speedtest-cli is an addon and not installed by default on all systems. Hmmm…

Maybe something like this would be acceptable in that case? Is there a reason that speedtest-cli isn’t installed by default? License issue?

 ![image](https://community.ipfire.org/uploads/default/original/2X/3/375e18f705bf658bc9b9c000e2a0f158b7f46a3b.png)

---

<div class="post-metadata">

**Author:** ![jon](https://community.ipfire.org/user_avatar/community.ipfire.org/jon/32/15363_2.png) [@jon](https://community.ipfire.org/u/jon)\
**Post date:** [3 October 2024 02:41 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/3 "2024-10-03T02:41:21Z")

</div>

> [@stephen](#):
>
> was able to do this by hacking the mdstat.cgi script.

nice!

> [@stephen](#):
>
> Maybe something like this would be acceptable in that case?

It should be acceptable… But someone would need to build it up and submit it for approval.

> [@stephen](#):
>
> Is there a reason that speedtest-cli isn’t installed by default?

It wasn’t felt to be needed as a “core” package. I do not believe every one needs or uses it. So it lives as an add-on.

> [@stephen](#):
>
> License issue?

If there was a license issue, it would not have been added/accepted to IPFire.

---

<div class="post-metadata">

**Author:** ![porkyle](https://community.ipfire.org/user_avatar/community.ipfire.org/porkyle/32/9183_2.png) [@porkyle](https://community.ipfire.org/u/porkyle)\
**Post date:** [3 October 2024 05:22 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/4 "2024-10-03T05:22:22Z")

</div>

Maybe GUI could be added directly to speedtest-cli addon?

---

<div class="post-metadata">

**Author:** ![stephen](https://community.ipfire.org/user_avatar/community.ipfire.org/stephen/32/16711_2.png) [@stephen](https://community.ipfire.org/u/stephen)\
**Post date:** [3 October 2024 06:58 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/5 "2024-10-03T06:58:24Z")

</div>

Hello,

@porkyle I think that would make a lot of sense. 🙂

Here’s a demo package if you want to give it a try. It just adds the speedtest.cgi and the menu entry and installs speedtest-cli if it’s not there. It doesn’t include any language localizations or link to doc page which doesn’t exist anyway.

If you want to give it a try, upload the zip to your ipfire and extract it. Then go to the speedtestwebgui directory and run install.sh. The only error check that the install script does is to make sure that it’s only run once since it appends to the end of 20-status.menu and doing that multiple times would probably not be good.

[speedtestwebgui.zip](https://community.ipfire.org/uploads/short-url/bZyQZ0qA36EpXKskH96QVGnfhxV.zip) (2.7 KB)

This works on my system, but from a “my system is not your system” perspective, let me know if you have any issue and feedback would be appreciated.

Let me know what you think.

---

<div class="post-metadata">

**Author:** ![bonnietwin](https://community.ipfire.org/user_avatar/community.ipfire.org/bonnietwin/32/12350_2.png) [@bonnietwin](https://community.ipfire.org/u/bonnietwin)\
**Post date:** [3 October 2024 09:46 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/6 "2024-10-03T09:46:01Z")

</div>

I think adding a menu item for speedtest that just runs the command line command and then prints the same output as would be seen on the command line doesn’t seem to add much value.

More useful would be if a WUI page was created that enabled you to run it to show the result on the screen or to allow you to select the output going to a csv or json file with a choice of how often to run it, and for how long (for ever or just for a certain number of times) would be much more useful. Name and path of file could be user selectable.

There could also be a table to provide the list of servers that speedtest would select from and the option to exclude some of the servers or to only run the test from one server.

Incidentally I would always run the command with --secure applied so that https is used and not http.

---

<div class="post-metadata">

**Author:** ![nickh](https://community.ipfire.org/user_avatar/community.ipfire.org/nickh/32/9845_2.png) [@nickh](https://community.ipfire.org/u/nickh)\
**Post date:** [3 October 2024 11:06 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/7 "2024-10-03T11:06:03Z")

</div>

I don’t think speedtest-cli is any good. Whenever I’ve used it, it has been unable to get anywhere near the right line speed reading much too low on an 800/80 internet connection. If I used the Ookla app in windows straight before or afterwards, I got a good reading in Windows…

---

<div class="post-metadata">

**Author:** ![ummeegge](https://community.ipfire.org/user_avatar/community.ipfire.org/ummeegge/32/16602_2.png) [@ummeegge](https://community.ipfire.org/u/ummeegge)\
**Post date:** [3 October 2024 17:11 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/8 "2024-10-03T17:11:02Z")

</div>

Hi all,  
@stephen , i think this idea might be a nice one if there are some more historical data for speedtests, displayed may with RRD or such ? Also some more informations might be great. I think IPFire uses the sivel package → [GitHub - sivel/speedtest-cli: Command line interface for testing internet bandwidth using speedtest.net](https://github.com/sivel/speedtest-cli) where it seems that the last commit is meanwhile three years ago ? Did someone tried the speedtest-cli package from librespeed → [GitHub - librespeed/speedtest-cli: Command line client for LibreSpeed](https://github.com/librespeed/speedtest-cli) ?

Best,

Erik

---

<div class="post-metadata">

**Author:** ![vincero](https://community.ipfire.org/user_avatar/community.ipfire.org/vincero/32/11579_2.png) [@vincero](https://community.ipfire.org/u/vincero)\
**Post date:** [3 October 2024 18:24 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/9 "2024-10-03T18:24:37Z")

</div>

It’s probably also worth noting the outgoing connection information for those who have multiple configured, i.e. interface/connection name & IP address, especially if looking to keep historical data.  
Would make it obvious if using fallback / alternate connection.

---

<div class="post-metadata">

**Author:** ![stephen](https://community.ipfire.org/user_avatar/community.ipfire.org/stephen/32/16711_2.png) [@stephen](https://community.ipfire.org/u/stephen)\
**Post date:** [4 October 2024 07:56 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/10 "2024-10-04T07:56:42Z")

</div>

Hello All,

Thanks for the input. Lots of good ideas.

I’m thinking of this in phases.

Initially, the ability to run speedtest-cli from the Web GUI which is pretty much done with the exception of language localizations and documentation.

Then add the ability to run speedtest-cli at intervals and log that data. I’m working on a page in the Time Settings style with settings on top and “run now” on the bottom for this. The data would be the CSV or JSON produced by speedtest-cli with logrotate according to Log Settings value. It would be up to the user to decide/code how to consume the data. For the intervals, I’m limiting them to number of hours factors of 24 as in “how many times do you want to run speedtest-cli today” and plan to use fcron to drive that.

And finally add something to the Web GUI to be able to display some graphs modeled after existing graph.pl or produce some other useful output from the data that can be displayed. I haven’t spent a lot of time thinking about this.

I think that the first phase could be done with the installation of the speedtest-cli addon but I thought about it and am not comfortable with the idea or maybe the precedent of having an addon package modify the Web GUI i.e. IPFire Core. So I’m not going that route.

So that’s my plan for the time being.

Again thanks for the input and ideas. Feedback is welcome.

Regards,  
Stephen

---

<div class="post-metadata">

**Author:** ![siosios](https://community.ipfire.org/user_avatar/community.ipfire.org/siosios/32/16622_2.png) [@siosios](https://community.ipfire.org/u/siosios)\
**Post date:** [4 October 2024 13:57 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/11 "2024-10-04T13:57:41Z")

</div>

I

 ![speedtest](https://community.ipfire.org/uploads/default/original/2X/a/a1bdfa45e2d06b423df63181537d3bbbb51818a0.jpeg)  
like the idea of a page for speed test. i added a start button and back button for the page i have.

---

<div class="post-metadata">

**Author:** ![ummeegge](https://community.ipfire.org/user_avatar/community.ipfire.org/ummeegge/32/16602_2.png) [@ummeegge](https://community.ipfire.org/u/ummeegge)\
**Post date:** [4 October 2024 14:37 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/12 "2024-10-04T14:37:28Z")

</div>

Hi Stephan,

> [@stephen](#):
>
> I think that the first phase could be done with the installation of the speedtest-cli addon but I thought about it and am not comfortable with the idea or maybe the precedent of having an addon package modify the Web GUI i.e. IPFire Core. So I’m not going that route.

i think you don´t have to worry about this since a lot of Addons do use the WUI. Spoken from the possibility how to implement software which are only sorted in the additionals or Addons and which are not part of the Core system you can use the DEPS line → [git.ipfire.org Git - ipfire-2.x.git/blob - lfs/wio](https://git.ipfire.org/?p=ipfire-2.x.git;a=blob;f=lfs/wio;h=b173b935a46afb9a6a0c7c307b522b7022b16b95;hb=refs/heads/core188#l37) so software needed to get a new feature to run will be installed automatically via Pakfire. Also, the posted LFS is also an Addon (WIO), like Hostapd, Tor and what not else.

But as @nickh mentioned, did you checked the consistence of speedtest-cli ? Or @nickh what measure did you do on your line which brings speedtest-cli to your evalution “don´t think is any good” ?

Best,

Erik

---

<div class="post-metadata">

**Author:** ![nickh](https://community.ipfire.org/user_avatar/community.ipfire.org/nickh/32/9845_2.png) [@nickh](https://community.ipfire.org/u/nickh)\
**Post date:** [4 October 2024 14:46 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/13 "2024-10-04T14:46:11Z")

</div>

I compared speedtest-cli with the Ookla speed test in Windows. The Windows version gave very similar speeds to my ISP speeds - 800/80. The Linux version was way down on download. I’ve just tried again and in Linux (Centos 7 equivalent) I am seeing 291/67. The 67 is possibly understandable. The 291 is not. This is all on a wired 1000Mb/s LAN… Ubuntu 24.04 shows 309/72.

---

<div class="post-metadata">

**Author:** ![siosios](https://community.ipfire.org/user_avatar/community.ipfire.org/siosios/32/16622_2.png) [@siosios](https://community.ipfire.org/u/siosios)\
**Post date:** [5 October 2024 02:47 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/14 "2024-10-05T02:47:34Z")

</div>

I tested librespeed-cli, ookla’s cli speedtest, and speedtest-cli and after multiple tests on two different Ipfire systems gave pretty much the same results on 100Mbit line.

---

<div class="post-metadata">

**Author:** ![nickh](https://community.ipfire.org/user_avatar/community.ipfire.org/nickh/32/9845_2.png) [@nickh](https://community.ipfire.org/u/nickh)\
**Post date:** [5 October 2024 10:06 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/15 "2024-10-05T10:06:25Z")

</div>

I think it is OK on slower connections. Can someone try testing on another fast link?

---

<div class="post-metadata">

**Author:** ![siosios](https://community.ipfire.org/user_avatar/community.ipfire.org/siosios/32/16622_2.png) [@siosios](https://community.ipfire.org/u/siosios)\
**Post date:** [5 October 2024 11:59 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/16 "2024-10-05T11:59:29Z")

</div>

I was at work when I tested, from home is a different story:

```auto
[root@ipsio ~]# speedtest-cli
Retrieving speedtest.net configuration...
Testing from Provider (IP)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by - Fiber (city, state) [364.65 km]: 33.569 ms
Testing download speed................................................................................
Download: 477.38 Mbit/s
Testing upload speed......................................................................................................
Upload: 41.67 Mbit/s
[root@ipsio ~]# ./librespeed-cli
Retrieving server list from https://librespeed.org/backend-servers/servers.php
Selecting the fastest server based on ping
Selected server: , United States (Clouvider) [speedtest.clouvider.net]
Sponsored by: Clouvider @ https://www.clouvider.co.uk/
You're testing from: IP - Unknown ISP
Ping: 28.36 ms Jitter: 2.68 ms
Download rate: 878.89 Mbps
Upload rate: 39.52 Mbps
[root@ipsio ~]# ./speedtest

   Speedtest by Ookla

      Server: - city, state (id: x)
         ISP: 
Idle Latency: 25.18 ms (jitter: 12.18ms, low: 20.20ms, high: 45.99ms)
    Download: 955.04 Mbps (data used: 1.1 GB)                                                   
                 34.58 ms (jitter: 14.04ms, low: 13.39ms, high: 314.43ms)
      Upload: 40.88 Mbps (data used: 19.9 MB)                                                   
                 91.39 ms (jitter: 20.59ms, low: 24.54ms, high: 137.00ms)
 Packet Loss: 0.0%

```

---

<div class="post-metadata">

**Author:** ![nickh](https://community.ipfire.org/user_avatar/community.ipfire.org/nickh/32/9845_2.png) [@nickh](https://community.ipfire.org/u/nickh)\
**Post date:** [5 October 2024 12:38 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/17 "2024-10-05T12:38:02Z")

</div>

How does that compare to your contracted ISP speed?

---

<div class="post-metadata">

**Author:** ![siosios](https://community.ipfire.org/user_avatar/community.ipfire.org/siosios/32/16622_2.png) [@siosios](https://community.ipfire.org/u/siosios)\
**Post date:** [5 October 2024 12:46 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/18 "2024-10-05T12:46:07Z")

</div>

speedtest-cli fails the speed test compared to what i should get, the other 2 are spot on

 ![ookla](https://community.ipfire.org/uploads/default/original/2X/6/61a79750a7f354b03642d2dda1f501874e81c6c5.jpeg)

---

<div class="post-metadata">

**Author:** ![tphz](https://community.ipfire.org/user_avatar/community.ipfire.org/tphz/32/16551_2.png) [@tphz](https://community.ipfire.org/u/tphz)\
**Post date:** [5 October 2024 12:57 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/19 "2024-10-05T12:57:47Z")

</div>

I think speedtest/librespeed cannot be a fully authoritative tool 😉

 ![obraz](https://community.ipfire.org/uploads/default/original/2X/7/7356510cfca704063259302edcf2e6cb98358b9a.png)

edit

 ![obraz](https://community.ipfire.org/uploads/default/original/2X/a/ab5cd3f4741351b4a8495c05f9410d58c12ab580.png)  
edit

Next tests on windows 10 computer in the green zone

 ![obraz](https://community.ipfire.org/uploads/default/original/2X/3/3df399819833e5e53fb4296343a6830384344b81.png)

 ![obraz](https://community.ipfire.org/uploads/default/original/2X/d/d17e574f78d45e68a4057da02251d45d9199ead2.png)

 ![obraz](https://community.ipfire.org/uploads/default/original/2X/7/7eaeb279700c493aace882d89b0be044cfa399ce.png)

 ![obraz](https://community.ipfire.org/uploads/default/original/2X/7/7afab487695347c58fd614275e1d1143eaf2a4aa.png)

 ![obraz](https://community.ipfire.org/uploads/default/original/2X/1/147f7f1e058d5d0acf274be54963fb3c1187c5f3.png)

![obraz](https://community.ipfire.org/uploads/default/original/2X/4/457c00e317ca9f5884261d3e5b29aaea75aaf826.png)

 ![obraz](https://community.ipfire.org/uploads/default/original/2X/6/64c99585634a01b33b539509e0b8cf95e2568b04.png)

Regards

---

<div class="post-metadata">

**Author:** ![siosios](https://community.ipfire.org/user_avatar/community.ipfire.org/siosios/32/16622_2.png) [@siosios](https://community.ipfire.org/u/siosios)\
**Post date:** [5 October 2024 21:05 UTC](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965/20 "2024-10-05T21:05:31Z")

</div>

here is the contents of my modified speedtest.cgi with the start button and a back button for anyone that wants it:

```auto
#!/usr/bin/perl
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2011 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################

use strict;

# enable only the following on debugging purpose
#use warnings;
#use CGI::Carp 'fatalsToBrowser';

require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";

my %color = ();
my %mainsettings = ();
my %speedparams=();

$speedparams{'ACTION'} = '';

&General::readhash("${General::swroot}/main/settings", \%mainsettings);
&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);

&Header::showhttpheaders();
&Header::openpage($Lang::tr{'status information'}, 1, '');
&Header::openbigbox('100%', 'left');
&Header::getcgihash(\%speedparams);

&Header::openbox('100%', 'left',"Speedtest");

print <<END 
<table width="100%">
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<tr>
	<td align="center"><input type='submit' name='ACTION' value="$Lang::tr{'start'}"></td>
</tr>
</table>
END
;
print '<br><textarea style="width:100%" rows=15 name="text" readonly="readonly">';
if ( $speedparams{'ACTION'} eq "$Lang::tr{'start'}" )
{
# Run speedtest-cli.
if ( -e "/usr/bin/speedtest-cli" ) {
	my @speedtest = `speedtest-cli -secure`;
	print "@speedtest";
}
else {
	my @speedtest = "Error: The speedtest-cli addon is not installed. Use pakfire to install the speedtest-cli addon before running speedtest.";
	print "@speedtest";
}
}
print '</textarea>';

print"<table width='100%'><tr><td align='center'><a href='/cgi-bin/speedtest.cgi'><img src='/images/back.png' alt='$Lang::tr{'back'}' title='$Lang::tr{'back'}' /></a></td></tr></table>";
&Header::closebox();

&Header::closebigbox();
&Header::closepage();

```

[Next page](https://community.ipfire.org/t/add-speedtest-to-web-gui/12965.md?page=2)
