Community discussions

MikroTik App

Did you find this image useful?

Yes
3 (43%)
No
4 (57%)
 
Total votes: 7
 
cdhtlr
newbie
Topic Author
Posts: 26
Joined: Fri Jan 27, 2023 10:23 pm

Ookla Speedtest Container

Fri Jan 27, 2023 11:01 pm

Before MikroTik released version 7, it was difficult to do a speedtest from the router to Ookla servers, whereas in Indonesia no one provided a Btest server for free.

Now MikroTik supports container installation. So I modified a Golang-based speedtest app on GitHub and made it a Docker image.

Image

With this image, we can speedtest various servers provided free of charge by Ookla, Netflix, etc., just like when we speedtest using a PC.

I did a speedtest based failover using this image and made a demo in https://youtube.com/playlist?list=PLyx1 ... 3HwaJSULEn

These application and image are easy to monitor from a web browser and compatible with Netwatch http-get mode. If you are interested, you can download it at https://hub.docker.com/r/cdhtlr/mikrotik-speedtest

Image

Hope you will like it.
 
Alevx94
just joined
Posts: 7
Joined: Mon Feb 13, 2023 4:21 pm

Re: Ookla Speedtest Container

Thu Aug 03, 2023 10:20 am

Hi,

first of all thanks for supplying this image.
I managed to pull the docker and I successfully run it, but a couple things are not clear to me :
  • How should I start the speedtest?
  • How can I configure a different server for the test? (maybe how to retrieve the url from ookla or similar)

Thanks for your work!
 
cdhtlr
newbie
Topic Author
Posts: 26
Joined: Fri Jan 27, 2023 10:23 pm

Re: Ookla Speedtest Container

Fri Aug 04, 2023 1:30 am

Hi,

first of all thanks for supplying this image.
I managed to pull the docker and I successfully run it, but a couple things are not clear to me :
  • How should I start the speedtest?
  • How can I configure a different server for the test? (maybe how to retrieve the url from ookla or similar)

Thanks for your work!
Hi,

Thank you too for using this image.
I'm glad to hear you have successfully run it. Let me make it clear.

How should I start the speedtest?
You can start speedtest by:
  • Access the main page of this container at http://192.168.1.2:8080 (depending on the IP and port you give to this container). You will automatically do a speedtest to the server that you have set. Then you can check the results on the chart page (http://192.168.1.2:8080/chart ).


    If you wish, you can also access http://192.168.1.2:8080/condition to see the speedtest comparison results based on the MIN_THRESHOLD variable, the default is 1Mbps. The speedtest results will tell whether your download speed is below or above MIN_THRESHOLD.
  • Using the fetch facility in MikroTik RouterOS to call the speedtest program like:
    :local result [tool fetch mode=http url="http://192.168.1.2:8080" output=user as-value]
    :local result [:put ($result->"data")]
    :log info "Your actual download bandwidth is $result Mbps"
    You are free to do any scripting based on the results of the speedtest performed by the router, such as failover and so on. You are free to do scripting with your creativity.

How can I configure a different server for the test? (maybe how to retrieve the url from ookla or similar)
You are free to use any server as a speedtest server. It doesn't actually have to be an ookla server.

For example you can use this ubuntu download url as the URL to download:
https://releases.ubuntu.com/22.04.2/ubu ... -amd64.iso

But if you want the best Ookla server from your internet then you can look for it at:
https://c.speedtest.net/speedtest-servers-static.php

You will find many "server url". Use one of them in this container configuration.


Thank you.
Last edited by cdhtlr on Fri Aug 04, 2023 5:29 am, edited 1 time in total.
 
cdhtlr
newbie
Topic Author
Posts: 26
Joined: Fri Jan 27, 2023 10:23 pm

Re: Ookla Speedtest Container

Fri Aug 04, 2023 1:34 am

Hi,

first of all thanks for supplying this image.
I managed to pull the docker and I successfully run it, but a couple things are not clear to me :
  • How should I start the speedtest?
  • How can I configure a different server for the test? (maybe how to retrieve the url from ookla or similar)

Thanks for your work!

I want to know, what MikroTik router device are you using and what version of RouterOS is it?
 
gmanfredax
just joined
Posts: 3
Joined: Sat Oct 09, 2021 5:01 pm

Re: Ookla Speedtest Container

Sat Aug 12, 2023 10:21 am

Hi, I followed the guide on docker to configure a container on mikrotik but every time I open the speedtest link I always get 0.0
I also tried changing the URL env but the result doesn't change

This is my router configuration:
# 2023-08-12 08:37:45 by RouterOS 7.10.2
# model = RB5009UG+S+
/interface bridge
add admin-mac= auto-mac=no comment=defconf igmp-snooping=yes multicast-querier=yes name=bridge vlan-filtering=yes
add name=bridge-docker
/interface veth
add address=192.168.1.2/24 gateway=192.168.1.1 name=veth1-speedtest
/interface vlan
add interface=bridge name=vlan100-iot vlan-id=100
add interface=bridge name=vlan110-vs vlan-id=110
add interface=bridge name=vlan120-hdmi-extender vlan-id=120
add comment="VLAN FTTH" interface=ether1 name=vlan835_ftth vlan-id=835
/interface pppoe-client
add add-default-route=yes comment=FTTH-OUT disabled=no interface=vlan835_ftth name=pppoe-out1 user=
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp_pool0 ranges=192.168.10.10-192.168.10.100
add name=dhcp_pool50 ranges=192.168.100.10-192.168.100.100
add name=dhcp_pool60 ranges=192.168.110.10-192.168.110.100
add name=dhcp_pool70 ranges=192.168.120.10-192.168.120.100
/ip dhcp-server
add address-pool=dhcp_pool0 interface=bridge lease-time=10m name=dhcp1
add address-pool=dhcp_pool100 interface=vlan100-iot lease-time=10m name=dhcp100
add address-pool=dhcp_pool110 interface=vlan110-vs lease-time=10m name=dhcp110
add address-pool=dhcp_pool120 interface=vlan120-hdmi-extender lease-time=10m name=dhcp120
/zerotier
set zt1 comment="ZeroTier Central controller - https://my.zerotier.com/" name=zt1 port=9993
/zerotier interface
add allow-default=no allow-global=no allow-managed=no disabled=no instance=zt1 name=zerotier1 network=
/container
add envlist=speedtest hostname=speedtest interface=veth1-speedtest logging=yes root-dir=disk1/speedtest workdir=/
/container config
set registry-url=https://registry-1.docker.io tmpdir=disk1/pull
/container envs
add key=URL name=speedtest value="https://jakarta.speedtest.telkom.net.id:8080/download?size=25000000"
add key=MAX_DLSIZE name=speedtest value=1.0
add key=MIN_THRESHOLD name=speedtest value=1.0
add key=CONCURENT_CONNECTION name=speedtest value=4
add key=ALLOW_MEMORY_BUFFER name=speedtest value=YES
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5 pvid=100
add bridge=bridge comment=defconf interface=ether6 pvid=110
add bridge=bridge comment=defconf interface=ether7 pvid=120
add bridge=bridge comment=defconf interface=ether8
add bridge=bridge comment=defconf interface=sfp-sfpplus1
add bridge=bridge-docker interface=veth1-speedtest
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface bridge vlan
add bridge=bridge tagged=bridge,sfp-sfpplus1 vlan-ids=100
add bridge=bridge tagged=bridge,sfp-sfpplus1 vlan-ids=110
add bridge=bridge tagged=bridge,ether8,sfp-sfpplus1 untagged=ether7 vlan-ids=120
add bridge=bridge comment=ont untagged=bridge,sfp-sfpplus1,ether8,ether4 vlan-ids=835
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=pppoe-out1 list=WAN
add interface=vlan100-iot list=LAN
add interface=vlan110-vs list=LAN
add interface=vlan120-hdmi-extender list=LAN
/ip address
add address=192.168.10.254/24 comment=defconf interface=bridge network=192.168.10.0
add address=192.168.100.254/24 interface=vlan100-iot network=192.168.100.0
add address=192.168.110.254/24 interface=vlan110-vs network=192.168.110.0
add address=192.168.120.254/24 interface=vlan120-hdmi-extender network=192.168.120.0
add address= interface=zerotier1 network=
add address=192.168.1.1/24 interface=bridge-docker network=192.168.1.0
/ip cloud
set ddns-enabled=yes ddns-update-interval=1m
/ip dhcp-client
add comment=defconf disabled=yes interface=vlan835_ftth use-peer-dns=no
/ip dhcp-server network
add address=192.168.10.0/24 comment=defconf dns-server=8.8.8.8,8.8.4.4,192.168.10.254 gateway=192.168.10.254
add address=192.168.100.0/24 dns-server=8.8.8.8,8.8.4.4,192.168.100.254 gateway=192.168.100.254
add address=192.168.110.0/24 dns-server=8.8.8.8,8.8.4.4,192.168.110.254 gateway=192.168.110.254
add address=192.168.120.0/24 dns-server=8.8.8.8,8.8.4.4,192.168.120.254 gateway=192.168.120.254
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip dns static
add address=192.168.10.254 comment=defconf name=router.lan
/ip firewall address-list
add address= list=WAN
add address=192.168.10.0/24 comment="Home Lan" list=LANs
add address=192.168.100.0/24 comment="IoT Lan" list=LANs
add address=192.168.110.0/24 comment="VS Lan" list=LANs
add address= list=WAN
/ip firewall filter
add action=accept chain=forward in-interface=zerotier1
add action=accept chain=input in-interface=zerotier1
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related hw-offload=yes
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN
/ip firewall mangle
add action=mark-connection chain=prerouting comment="Mark connections for hairpin NAT" dst-address-list=WAN new-connection-mark="Hairpin NAT" passthrough=yes src-address-list=LANs
/ip firewall nat
add action=masquerade chain=srcnat comment="Hairpin NAT" connection-mark="Hairpin NAT"
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN
add action=masquerade chain=srcnat src-address=192.168.1.0/24
add action=dst-nat chain=dstnat dst-port=8080 protocol=tcp to-addresses=192.168.1.2 to-ports=80
/ip route
add disabled=no dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-table=main suppress-hw-offload=no
/system clock
set time-zone-name=Europe/Rome
/system identity
set name=MikroTik_RB5009
/system note
set show-at-login=no
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
/tool netwatch
add disabled=yes down-script="" host=192.168.1.2 http-codes=200 port=8080 test-script="" type=http-get up-script=""
 
mftitalia
just joined
Posts: 3
Joined: Wed Nov 17, 2021 6:43 pm

Re: Ookla Speedtest Container

Fri Nov 10, 2023 12:28 am

Hello, is it possibile to run this on a Hap_AC 2 ?
 
holvoetn
Forum Guru
Forum Guru
Posts: 5327
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Ookla Speedtest Container

Fri Nov 10, 2023 7:02 am

Might be a problem.

Hap AC2 architecture is arm and has USB port for external storage, so far so good.
But ... it only has 16Mb of internal storage (where the extraction etc will be done), only 128Mb RAM (some rare units have 256) which is also used for RAM allocation for your container, ....
I guess there you might hit a wall.
 
mftitalia
just joined
Posts: 3
Joined: Wed Nov 17, 2021 6:43 pm

Re: Ookla Speedtest Container

Fri Nov 10, 2023 10:10 am

Thanks for info =)
 
holvoetn
Forum Guru
Forum Guru
Posts: 5327
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Ookla Speedtest Container

Fri Nov 10, 2023 10:19 am

User tangent made an iperf container which is less then 1Mb.
Might be worthwhile to investigate ?

viewtopic.php?t=195062

Who is online

Users browsing this forum: baragoon, Scoox and 3 guests