How to Prioritize the SpeedTest.Net in Mikrotik.

By | April 11, 2023

Step-1=Create a regular expression.

Use the following script to create a layer 7 Regular expression with the name of Speed-test .

/ip firewall layer7-protocol
add name=speedtest regexp="^.+(speedtest).*\\\$"

Step-2= Create a firewall Mangle rule for matching the traffic of regular expression.

Step-2

/ip firewall mangle
add action=mark-connection chain=forward comment=SPEEDTEST.NET layer7-protocol=speedtest new-connection-mark=speedtest_conn
add action=mark-connection chain=prerouting new-connection-mark=speedtest_conn protocol=tcp src-port=8080
add action=mark-packet chain=prerouting connection-mark=speedtest_conn new-packet-mark=speedtest passthrough=no
add action=mark-connection chain=postrouting dst-port=8080 new-connection-mark=speedtest_conn protocol=tcp
add action=mark-packet chain=postrouting connection-mark=speedtest_conn new-packet-mark=speedtest passthrough=no

Step=3= Create the PCQ., Here I want all users must get the 2Mbps while their actual bandwidth is 1 Mbps, which means when they will visit the speedtest.net and do the speed test they will get 2 Mbps, but their actual bandwidth is 1 Mbps.

/queue type
add kind=pcq name=download-2mb pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-classifier=dst-address pcq-dst-address-mask=32 pcq-dst-address6-mask=64 pcq-limit=50 pcq-rate=2048k \
    pcq-src-address-mask=32 pcq-src-address6-mask=64 pcq-total-limit=2000
add kind=pcq name=upload-2mb pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-classifier=src-address pcq-dst-address-mask=32 pcq-dst-address6-mask=64 pcq-limit=50 pcq-rate=2048k \
    pcq-src-address-mask=32 pcq-src-address6-mask=64 pcq-total-limit=2000

Step-4= Create the global Queue by using the matching traffic .

/queue simple
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment=For all users  direction=both disabled=no interface=all limit-at=0/0 max-limit=0/0 name=\
    Speedtest_net\ packet-marks=speedtest parent=none priority=8 queue=upload-2mb/download-2mb total-queue=default-small

Leave a Reply

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