Community discussions

MikroTik App
 
atuxnull
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Tue Feb 07, 2017 10:02 pm

Prioritize traffic based on app

Thu Nov 12, 2020 11:34 am

Hi. in my home i have a Mikrotik thaat has the pppoe and the dhcp, firewall and time server. In the LAN there are 10 PCs/laptops/tablets/smartphones that run either Windows or Android. The circuit is VDSL at 50Mbps and i have queues that it is based on the needs of the devices (max 15Mbps/device) but the total not to exceed the 50Mbps.
I would like to optimize the prioritization of each device based on the app they use.
For example i have for my device a queue for 10Mpbs and i would like Youtube to get the lowest priority, while Skype, Zoom and generally all conference apps to get 1st priority. No matter what is the traffic in my queue, the conference apps to get to work all the time.
Is there a way to do that please?
 
pe1chl
Forum Guru
Forum Guru
Posts: 10529
Joined: Mon Jun 08, 2015 12:09 pm

Re: Prioritize traffic based on app

Thu Nov 12, 2020 12:27 pm

This is a bit inpractical because apps today tend to all use a single type of connection: https (tcp port 443).
So you cannot easily determine on the router what kind of traffic you are seeing.
In the past, every application used its own portnumber and you could select on that.

However, you can hope that a designer of an application that requires realtime network performance sets the DSCP value of the packets accordingly.
So you can try to use that to determine your priority. It will not be under custom control but it might solve your issues.

E.g. use something like this:
/ip firewall mangle
add action=set-priority chain=postrouting comment="From dscp high 3 bits" \
    new-priority=from-dscp-high-3-bits passthrough=yes
add action=mark-packet chain=postrouting comment="Priority 0" \
    new-packet-mark=prio0 passthrough=no priority=0
add action=mark-packet chain=postrouting comment="Priority 1" \
    new-packet-mark=prio1 passthrough=no priority=1
add action=mark-packet chain=postrouting comment="Priority 2" \
    new-packet-mark=prio2 passthrough=no priority=2
add action=mark-packet chain=postrouting comment="Priority 3" \
    new-packet-mark=prio3 passthrough=no priority=3
add action=mark-packet chain=postrouting comment="Priority 4" \
    new-packet-mark=prio4 passthrough=no priority=4
add action=mark-packet chain=postrouting comment="Priority 5" \
    new-packet-mark=prio5 passthrough=no priority=5
add action=mark-packet chain=postrouting comment="Priority 6" \
    new-packet-mark=prio6 passthrough=no priority=6
add action=mark-packet chain=postrouting comment="Priority 7" \
    new-packet-mark=prio7 passthrough=no priority=7
Then use the packet marks prio0...prio7 to select 8 different sub-queues in a queue tree:
/queue tree
add comment="50 Mbps" limit-at=50M max-limit=50M name=queue-ether1 \
    parent=ether1 queue=default
add limit-at=15M max-limit=45M name=queue-ether1-p1 packet-mark=prio7 parent=\
    queue-ether1 priority=1 queue=default
add limit-at=15M max-limit=45M name=queue-ether1-p2 packet-mark=prio6 parent=\
    queue-ether1 priority=2 queue=default
add limit-at=15M max-limit=45M name=queue-ether1-p3 packet-mark=prio5 parent=\
    queue-ether1 priority=3 queue=default
add limit-at=15M max-limit=45M name=queue-ether1-p4 packet-mark=prio4 parent=\
    queue-ether1 priority=4 queue=default
add limit-at=15M max-limit=45M name=queue-ether1-p5 packet-mark=prio3 parent=\
    queue-ether1 priority=5 queue=pcq-upload-default
add limit-at=15M max-limit=45M name=queue-ether1-p6 packet-mark=prio0 parent=\
    queue-ether1 priority=6 queue=pcq-upload-default
add limit-at=15M max-limit=45M name=queue-ether1-p7 packet-mark=prio2 parent=\
    queue-ether1 priority=7 queue=pcq-upload-default
add limit-at=15M max-limit=45M name=queue-ether1-p8 packet-mark=prio1 parent=\
    queue-ether1 queue=pcq-upload-default
Notice the slightly weird ordering of the lowest 3 priorities due to how TOS/DSCP is defined.
I have reasonably good results with this but I cannot guarantee anything, when all your app
developers are dumb and do not set DSCP it will not do anything.

Who is online

Users browsing this forum: krissg and 78 guests