Syed Jahanzaib Personal Blog to Share Knowledge !

November 12, 2015

Prioritize SpeedTest.Net Results via Mikrotik Queue

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

speedtest


As implemented it yesterday , an old trick, NOTHING NEW really.

(Although I personally don’t see any reason why to prioritize such speed.test.net results, to fake whom, client or yourself ? lol)

Following is an simple demonstration on howto prioritize speedtest.net speed test.
Scenario: Client is allowed to get 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 showed in the picture above.

ROS CODE, Tested with 5.x and 6.x versions:


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

# Marking SPEEDTEST.NET in mangle section using L7
/ip firewall mangle
add action=mark-connection chain=forward comment=SPEEDTEST 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_pkt 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_pkt passthrough=no

# ADD PCQ so that i can be applied on per ip bases later in simple queue / zaib
/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

# Add simple QUEUE to limit speedtest.net 2mb PER USER
/queue simple
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="Limit every Users at 2mb using PCQ. for speedtest only marked by mangle / zaib" direction=both disabled=no interface=all limit-at=0/0 max-limit=0/0 name=\
    "SpeedTest.Net 2Mb per use via g PCQ / zaib" packet-marks=speedtest_pkt parent=none priority=8 queue=upload-2mb/download-2mb target-addresses=192.168.5.0/24 total-queue=default-small

# Add simple QUEUE to limit user PC individually for rest of traffic, static or dynamic up to your network.
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=all limit-at=512k/512k max-limit=512k/512k name="Zaib Desktop 512k A llowed - 192.168.5.2" packet-marks="" \
    parent=none priority=8 queue=default-small/default-small target-addresses=192.168.5.2/32 total-queue=default-small
 

Move the speedtest.net queue on top! Ordering is very important in mikrotik, as rules are processed order wise , zero to bottom

Note: It can further be adjusted in PCQ, QUEUE TREE, etc etc as per network designed.


client


Regard’s
Jz

Advertisements

13 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


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: