Syed Jahanzaib – Personal Blog to Share Knowledge !

November 12, 2015

Prioritize SpeedTest.Net Results via Mikrotik Queue

Filed under: Mikrotik Related — Tags: , , , — Syed Jahanzaib / Pinochio~:) @ 9:48 AM

speedtest-logo-white

First Published : November, 2015
Last Updated    : January, 2021


Although IMO, There is no reason why to prioritize such speed.test.net results, to fake whom, Client or Yourself ? I asked this question from multiple vendors, & there reply was that dueto to competitive market, they are forced to opt for this method because user gets satisfied when he sees the speedtest result that he is getting the assigned package or even getting more.

Following is an simple demonstration on how to prioritize speedtest.net speed test by assigning separate queues for speedtest packets. You can also do the queues priority by Queue tree as well. Up to you !

Scenario: Client internet package is 512k , but when he will access speedtest.net to check the speed, he will able to see 2mb , (every user will be able to check it on 2mb limit , individually per ip basis) while his normal download/browsing will remain under 512k queue limit as shown in the picture above.

ROS Version: Tested with CCR 6.46.x versions

client

speedtest

 



Updated January 2021

Port based Speedtest Control

I used following method at few networks with 99% success rate. Benefit of using using Port base speedtest was that unnecessary speedtest bandwidth leakage issue got sorted because in address list base approach we had to add whole /24 subnet (being lazy it was easy to add whole /24 subnet rather then picking IP address for each speedtest server). This port base method works good only if you have straight forward setup with no proxies. In this method, I used marking method for TCP 8080 which is commonly used by Speedtest Server Hosting. However there are few very specific speedtest services which are using TCP 443 SSL port [Example FAST] so for those we used traditional IP Address list methods.

We are marking port 8080 for/to address list. then based on these marked packets we are assigning speedtest separate bandwidth by moving the queues rules on TOP under queues section. This way it get priority over user dynamic queues which would be created below it.


# ::: ADDING IP ADDRESS BASED LIST FOR FAST SPEEDTEST SERVER, YOU CAN ADD OTHERS IN THIS LIST AS WELL
/ip firewall address-list
add address=110.93.192.0/24 comment=FAST list=speedtest_servers_list
add address=23.246.54.0/24 comment=FAST list=speedtest_servers_list

# Local users list - in general we used dynamic list created by radius attribute 'Mikrotik-Address-List :='
add address=192.168.10.0/24 list=1mb
add address=192.168.11.0/24 list=2mb

# :::SPEEDTEST SERVER PKT MARKING STARTS HERE, move them on TOP under mangle section

/ip firewall mangle
add action=mark-packet chain=forward dst-port=8080 new-packet-mark=speedtest_1mb_up passthrough=yes protocol=tcp src-address-list=1mb
add action=mark-packet chain=forward dst-address-list=1mb new-packet-mark=speedtest_1mb_down passthrough=yes protocol=tcp src-port=8080
add action=mark-packet chain=forward dst-port=8080 new-packet-mark=speedtest_2mb_up passthrough=no protocol=tcp src-address-list=2mb
add action=mark-packet chain=forward dst-address-list=2mb new-packet-mark=speedtest_2mb_down passthrough=no protocol=tcp src-port=8080

# :::SPEEDTEST SERVER PACKET MARKING for IP ADDRESS LIST BASED STARTS HERE [example for FAST or other ip address list base servers]

/ip firewall mangle
add action=mark-packet chain=forward dst-address-list=speedtest_servers_list new-packet-mark=speedtest_1mb_up passthrough=yes protocol=tcp src-address-list=1mb
add action=mark-packet chain=forward dst-address-list=1mb new-packet-mark=speedtest_1mb_down passthrough=yes protocol=tcp src-address-list=speedtest_servers_list
add action=mark-packet chain=forward dst-address-list=speedtest_servers_list new-packet-mark=speedtest_2mb_up passthrough=no protocol=tcp src-address-list=2mb
add action=mark-packet chain=forward dst-address-list=2mb new-packet-mark=speedtest_2mb_down passthrough=no protocol=tcp src-address-list=speedtest_servers_list

# ::: SPEEDTEST QUEUES STARTS HERE FOR USERS 

# Creating PCQ base queues which will be used in Simple queue section later

/queue type
add kind=pcq name=1mb-speedtest-upload pcq-classifier=src-address pcq-rate=1M
add kind=pcq name=1mb-speedtest-download pcq-classifier=dst-address pcq-rate=1M
add kind=pcq name=2mb-speedtest-upload pcq-classifier=src-address pcq-rate=2M
add kind=pcq name=2mb-speedtest-download pcq-classifier=dst-address pcq-rate=2M

# Actual queues to control speedtest traffic as per requirements [Make Sure to move them on TOP under mangle section]

/queue simple
add name=speedtest_1mb_up packet-marks=speedtest_1mb_up queue=1mb-speedtest-upload/1mb-speedtest-download target=""
add name=speedtest_1mb_down packet-marks=speedtest_1mb_down queue=1mb-speedtest-upload/1mb-speedtest-download target=""
add name=speedtest_2mb_up packet-marks=speedtest_2mb_up queue=2mb-speedtest-upload/2mb-speedtest-download target=""
add name=speedtest_2mb_down packet-marks=speedtest_2mb_down queue=2mb-speedtest-upload/2mb-speedtest-download target=""

 


Updated August 2020 

IP Address List based Speedtest Control

Following is just a sample code to allow separate bandwidth if user is doing speedtest on his PC. In this example, when user is connected to mikrotik via pppoe dialer , his queue is created dynamically based on radius profile & he will be limited to this speed for all traffic. What OP wants is that when user test speedtest, he should get full 1mb (even if he is using internet at full speed on other traffic). To accomplish this task, you can create address list of speedtest servers located nearby your region. & then mark packets. Based on these marked packets you can create separate queues for speedtest. This way when user will be using internet , he will get separate bandwidth just for speedtest.

Code Example:

/ip firewall address-list

add address=192.168.0.1-192.168.0.255 list=1mb-ip-pool-address-list
add address=192.168.1.1-192.168.1.255 list=2mb-ip-pool-address-list
# Servers for RWP/Pindi Region, you may look for your local isps speedtest by running speedtest on client and run torch to see the ip addresses
add address=103.103.42.0/24 list=speedtest_servers_list
add address=103.125.178.0/24 list=speedtest_servers_list
add address=42.201.253.0/24 list=speedtest_servers_list
add address=103.135.44.0/24 list=speedtest_servers_list
add address=118.107.138.0/24 list=speedtest_servers_list
add address=103.113.100.0/24 list=speedtest_servers_list
add address=203.135.29.0/24 list=speedtest_servers_list
add address=115.167.73.0/24 list=speedtest_servers_list
add address=202.69.12.0/24 list=speedtest_servers_list
add address=58.65.177.0/24 list=speedtest_servers_list
add address=103.55.68.0/24 list=speedtest_servers_list
add address=58.65.171.0/24 list=speedtest_servers_list
add address=103.12.198.98 list=speedtest_servers_list
add address=182.176.176.0/24 list=speedtest_servers_list
add address=119.30.107.0/24 list=speedtest_servers_list
add address=115.186.185.0/24 list=speedtest_servers_list
/ip firewall mangle

add action=mark-packet chain=forward dst-address-list=speedtest_servers_list new-packet-mark=speedtest_1mb_up passthrough=no src-address-list=1mb-ip-pool-address-list
add action=mark-packet chain=forward dst-address-list=1mb-ip-pool-address-list new-packet-mark=speedtest_1mb_down passthrough=no src-address-list=speedtest_servers_list
add action=mark-packet chain=forward dst-address-list=speedtest_servers_list new-packet-mark=speedtest_2mb_up passthrough=no src-address-list=2mb-ip-pool-address-list
add action=mark-packet chain=forward dst-address-list=2mb-ip-pool-address-list new-packet-mark=speedtest_2mb_down passthrough=no src-address-list=speedtest_servers_list

/queue type
add kind=pcq name=1mb-upload pcq-classifier=src-address pcq-dst-address6-mask=64 pcq-rate=1024k pcq-src-address6-mask=64
add kind=pcq name=1mb-download pcq-classifier=dst-address pcq-dst-address6-mask=64 pcq-rate=1024k pcq-src-address6-mask=64
add kind=pcq name=2mb-upload pcq-classifier=src-address pcq-dst-address6-mask=64 pcq-rate=2048k pcq-src-address6-mask=64
add kind=pcq name=2mb-download pcq-classifier=dst-address pcq-dst-address6-mask=64 pcq-rate=2048k pcq-src-address6-mask=64

/queue simple
add name="additional 1mb queue for speedtest" packet-marks=speedtest_1mb_up queue=1mb-upload/1mb-download target=""
add name="additional 1mb queue for speedtest" packet-marks=speedtest_1mb_down queue=1mb-upload/1mb-download target=""
add name="additional 2mb queue for speedtest" packet-marks=speedtest_2mb_up queue=2mb-upload/2mb-download target=""
add name="additional 2mb queue for speedtest" packet-marks=speedtest_2mb_down queue=2mb-upload/2mb-download target=""

TIP:

To detect speedtest server IP, first open mikrotik and run torch on your user interface (example I am connected with pppoe user test , so in interfaces click on <pppoe-test> interface and click TORCH, select all options and START.

Now open speedtest.net and select any server and click on GO to initiate Test run. Example

now look at TORCH window, you will single or few ip’s which will be taking the full bandwidth

In above example its 45.249.11.16 . Just to confirm if this IP belongs to the selected speedtest.net server , Goto https://whatismyipaddress.com/ip/ and enete the IP 45.249.11.16 & it will show its details like below

Now you have all details, , just add these IP or range in the speedtest address list in Mikrotik.

 


 


 


Regard’s
Syed.Jahanzaib

14 Comments »

  1. can its worked with Radius login user

    Like

    Comment by Deep Patel — November 13, 2015 @ 11:34 AM

  2. AoA, Bhai can we use this same method for other urls , Like if we want users to have a better experience browsing FB.

    Like

    Comment by Nabeel — November 19, 2015 @ 12:26 PM

  3. How to make a priority for PPoE users to the IPTV server (Example: 192.168.3.1:8081)
    Thank you

    Like

    Comment by mojbuk (@mojbuk) — November 26, 2015 @ 7:13 PM

  4. How to make a priority for PPoE customers (radius) to the IPTV server (Example: 192.168.3.1:8081)
    Thank you.

    Like

    Comment by mojbuk (@mojbuk) — November 26, 2015 @ 7:17 PM

  5. Seems to me this layer 7 not working any more for speed test.
    Any one have working layer 7 regexp for speedtest servers ?

    Like

    Comment by PeRo — December 25, 2015 @ 1:59 PM

  6. dear zaib 6.35 rc8 not working this code i wish good day

    Like

    Comment by figde — February 13, 2016 @ 10:54 PM

  7. dear zaib 6.38 rc 8 version not working this code ?? i wish you good day..

    Like

    Comment by figde — February 13, 2016 @ 11:28 PM

  8. This works on 6.35 just fine, however, i have obviously made a mistake. Both upload and download tests get seen and queued as Download in the Queue. Any ideas where I went wrong?

    Thanks.

    Like

    Comment by Al — April 25, 2016 @ 12:58 AM

  9. Works with radius and usermanager!!

    Like

    Comment by Chris Gachibi — September 27, 2016 @ 9:45 AM

  10. When I tried to execute your /queue type, I got error messages from Mikrotik. I am using 6.xx.

    Like

    Comment by trashcan bin — March 16, 2017 @ 7:38 AM

  11. […] Fuente : AACable […]

    Like

    Pingback by Priorizar resultados de SpeedTest.Net a través de Mikrotik Queue – MikrotikTools.Com — August 22, 2017 @ 8:36 AM

  12. Let me see if I understood, so my cliente will have his simple queue created by pppoe server conection and a second exclusively queue just to manage the traffic that goes to the speed teste servers, right ?

    Like

    Comment by Ikarus Telecom Internet — October 5, 2018 @ 10:10 PM


RSS feed for comments on this post. TrackBack URI

Leave a comment