Need help on prioritizing bandwith with game port

i have Mikrotik RB941-2nD-TC hAP Lite that i use for home. my problem is how to configure it so it give bandwith priority to game online. on google i found a way with port prioritizing. from what i read, i need to prioritize incoming and outgoing packet that the game use. my game is blizzard overwatch and i found the tcp port is 1119, 3724, 6113, 80 and udp port 6052, 5062, 5060, 12000-32000, 3478, 3479..

i am still beginner in here, the dhcp setting is automatically set by mikrotik. i only know how to set simple queues. can someone give me pointer what i must do first and what must i do last?? there are so many ways in google i confuse what is the right one..

and i have another question, what is difference in max-limit and burst-limit??

If you clear out your simple queues and your queue tree, and also clear your mangle rules… You can run this script and it will do exactly what you need.

You will need to copy and paste this into a new script. Update the WAN interface name to match yours, and update the WAN upload speed to match yours.
If is important that you get these two things right.. Once you update those, save the script. Then you can run it once. It will create the mangle rules needed
and then create your queue tree for your WAN.

After that you will have your ACK’s and ports for the game prioritized. Except for port 80, because that’s not actually used in game play, and you really don’t want all the web traffic being as high as the game.


#Set interface here
:local outboundInterface "wan0"

#Set bandwidth of the interface (remember, this is for OUTGOING)
:local interfaceBandwidth 4M

#Set where in the chain the packets should be mangled
:local mangleChain postrouting

#Don't mess with these. They set the parameters for what is to follow
:local queueName ("QoS_" . $outboundInterface)
:local qosClasses [:toarray "Network Control,Internetwork Control,Critical,Flash Override,Flash,Immedate,Priority,Routine"]

/ip firewall mangle add action=set-priority chain=postrouting dst-port=1119,3724,6113 new-priority=3 passthrough=yes protocol=tcp
/ip firewall mangle add action=set-priority chain=postrouting dst-port=6052,5062,5060,12000-32000,3478,3479 new-priority=3 passthrough=yes protocol=udp
/ip firewall mangle add action=set-priority chain=postrouting new-priority=from-dscp-high-3-bits passthrough=yes comment="Respect DSCP tagging"
/ip firewall mangle add action=set-priority chain=postrouting new-priority=2 packet-size=0-123 passthrough=yes protocol=tcp tcp-flags=ack comment="Prioritize ACKs"
/ip firewall mangle add action=set-priority chain=postrouting priority=0 dscp=0 new-priority=8  passthrough=yes comment="Set Pri 0 on packets with no tag at all"


:for indexA from 0 to 7 do={
    /ip firewall mangle add action=mark-packet chain=$mangleChain comment=("pri_" . $indexA+1) \
         disabled=no priority=($indexA+1) new-packet-mark=("priority_" . $indexA+1) passthrough=no
}

/queue tree add max-limit=$interfaceBandwidth name=$queueName parent=$outboundInterface priority=1
:for indexA from=0 to=7 do={
	:local subClass ([:pick $qosClasses $indexA] )
	/queue tree add \ 
		name=($indexA+1 . ". " . $subClass . " - " . $outboundInterface ) \
		parent=$queueName \
		priority=($indexA+1) \
		queue=ethernet-default \
                          packet-mark=("priority_" . $indexA+1) \
                          comment=("Priority " . $indexA+1 . " traffic")
}

I have same proble, and I use your script. actually it said “failure: no chain specified” and “invalid value for max-limit, an integer required”. what is this ? I really need some help here please

[admin@MikroTik] >
[admin@MikroTik] > :local outboundInterface “bridgegabung”
[admin@MikroTik] >
[admin@MikroTik] > :local interfaceBandwidth 2M
[admin@MikroTik] >
[admin@MikroTik] > :local mangleChain postrouting
[admin@MikroTik] >
[admin@MikroTik] > :local queueName (“QoS_” . $outboundInterface)
[admin@MikroTik] > :local qosClasses [:toarray “Network Control,Internetwork Control,Critical,Flas
h Override,Flash,Immedate,Priority,Routine”]
[admin@MikroTik] >
[admin@MikroTik] > /ip firewall mangle add action=set-priority chain=postrouting dst-port=10001-10
094 new-priority=3 passthrough=yes protocol=tcp
[admin@MikroTik] > /ip firewall mangle add action=set-priority chain=postrouting dst-port=10080-17
000 new-priority=3 passthrough=yes protocol=udp
[admin@MikroTik] > /ip firewall mangle add action=set-priority chain=postrouting new-priority=from
-dscp-high-3-bits passthrough=yes comment=“Respect DSCP tagging”
[admin@MikroTik] > /ip firewall mangle add action=set-priority chain=postrouting new-priority=2 pa
cket-size=0-123 passthrough=yes protocol=tcp tcp-flags=ack comment=“Prioritize ACKs”
[admin@MikroTik] > /ip firewall mangle add action=set-priority chain=postrouting priority=0 dscp=0
new-priority=8 passthrough=yes comment=“Set Pri 0 on packets with no tag at all”
[admin@MikroTik] >
[admin@MikroTik] >
[admin@MikroTik] > :for indexA from 0 to 7 do={
{… /ip firewall mangle add action=mark-packet chain=$mangleChain c

{... disabled=no priority=($indexA+1) new-packet-mark=("priority_
o
{… }
failure: no chain specified
[admin@MikroTik] >
[admin@MikroTik] > /queue tree add max-limit=$interfaceBandwidth name=
nterface priority=1
invalid value for max-limit, an integer required
[admin@MikroTik] > :for indexA from=0 to=7 do={
{… :local subClass ([:pick $qosClasses $indexA] )
{… /queue tree add
{... name=($indexA+1 . ". " . $subClass . " - " . $outboundInterfac
{... parent=$queueName
{... priority=($indexA+1)
{... queue=ethernet-default
{... packet-mark=(“priority_” . $indexA+1)
{... comment=(“Priority " . $indexA+1 . " traffic”)
[ 1] :for indexA from=0 to=7 do={
[ 2] :local subClass ([:pick $qosClasses $indexA] )
[ 3] /queue tree add
[ 4] name=($indexA+1 . ". " . $subClass . " - " . $outboundInterface
)
[ 5] parent=$queueName
[ 6] priority=($indexA+1)
[ 7] queue=ethernet-default
[ 8] packet-mark=(“priority_” . $indexA+1)
[ 9] comment=(“Priority " . $indexA+1 . " traffic”)
[10] }
[ 1] :for indexA from=0 to=7 do={
[ 2] :local subClass ([:pick $qosClasses $indexA] )
[ 3] /queue tree add
[ 4] name=($indexA+1 . ". " . $subClass . " - " . $outboundInterface )
[ 5] parent=$queueName
[ 6] priority=($indexA+1)
[ 7] queue=ethernet-default
[ 8] packet-mark=(“priority_” . $indexA+1)
[ 9] comment=(“Priority " . $indexA+1 . " traffic”)
[10] }
{… }
[admin@MikroTik] >

The script is intended to be run as a script, not command line. Copy/Paste the script into a new script and run it from there.

thank you so much for your fast respon .

ok iam going to try it now, anyway what should I do if the game uses 2 port , its own port (10001-10
094) and http port (80) ? it confused me to use port 80

Best thing will be is to run torch when gaming to check the ports its using.

You will most likely not have to do anything. Pretty much every game for the last 10 years sets the DSCP bits on packets, so the router will prioritize based of what the game developers feel is needed.