Prioritizing traffic

Hi all,

Ok first of all, I am not very familiar with Mikrotik devices. I am only now getting used to the interface and layout of everything.

So please dont flame me if something is incorrect, or if I am being stupid.

I need to sort out a traffic prioritizing problem I have.

Here is part of my current config. Could someone please have a look and perhaps advise?

Created the following queue trees
---------------------------------
/queue tree
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k \
    max-limit=128k name=ether2-in parent=global-in priority=1
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k \
    max-limit=128k name=ether2-out parent=global-out priority=1

Added the following queue types
-------------------------------
/queue type
add kind=pfifo name=test-pfifo pfifo-limit=5
add kind=sfq name=test-sfq sfq-allot=1514 sfq-perturb=10

Added the following to 'ether2-in' queue tree - added above
-----------------------------------------------------------
/queue tree
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=32k \
    max-limit=128k name=in-fast packet-mark=in-fast parent=\
    ether2-in priority=2 queue=test-pfifo
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=64k \
    max-limit=128k name=in-prio packet-mark=in-prio parent=\
    ether2-in priority=3 queue=test-pfifo
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=16k \
    max-limit=115k name=in-normal packet-mark=in-normal parent=\
    ether2-in priority=5 queue=test-sfq
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=16k \
    max-limit=64k name=in-slow packet-mark=in-slow parent=\
    ether2-in priority=8 queue=test-sfq

Added the following to 'ether2-out' queue tree - added above
-----------------------------------------------------------
/queue tree
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=32k \
    max-limit=128k name=out-fast packet-mark=out-fast parent=\
    ether2-out priority=2 queue=test-pfifo
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=64k \
    max-limit=128k name=out-prio packet-mark=out-prio parent=\
    ether2-out priority=3 queue=test-pfifo
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=16k \
    max-limit=115k name=out-normal packet-mark=out-normal \
    parent=ether2-out priority=5 queue=test-sfq
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=16k \
    max-limit=64k name=out-slow packet-mark=out-slow parent=\
    ether2-out priority=8 queue=test-sfq

Added the follow mangle rules to mark packets
---------------------------------------------
/ip firewall mangle
add action=mark-packet chain=prerouting comment="" disabled=no dscp=4 \
    in-interface=ether2 new-packet-mark=in-fast passthrough=no \
    protocol=tcp
add action=mark-packet chain=prerouting comment="" disabled=no in-interface=\
    ether2 new-packet-mark=in-fast passthrough=no protocol=icmp
add action=mark-packet chain=prerouting comment="" disabled=no in-interface=\
    ether2 new-packet-mark=in-fast passthrough=no protocol=tcp \
    tcp-flags=ack
add action=mark-packet chain=prerouting comment="" disabled=no in-interface=\
    ether2 new-packet-mark=in-prio passthrough=no src-address=\
    192.168.1.23
add action=mark-packet chain=prerouting comment="" disabled=no in-interface=\
    ether2 new-packet-mark=in-prio passthrough=no src-address=\
    192.168.1.24
add action=mark-packet chain=prerouting comment="" disabled=no dst-port=25 \
    in-interface=ether2 new-packet-mark=in-slow passthrough=no \
    protocol=tcp
add action=mark-packet chain=prerouting comment="" disabled=no dst-port=465 \
    in-interface=ether2 new-packet-mark=in-slow passthrough=no \
    protocol=tcp
add action=mark-packet chain=prerouting comment="" disabled=no in-interface=\
    ether2 new-packet-mark=in-normal passthrough=no


add action=mark-packet chain=postrouting comment="" disabled=no dscp=4 \
    new-packet-mark=out-fast out-interface=ether2 passthrough=no \
    protocol=tcp
add action=mark-packet chain=postrouting comment="" disabled=no \
    new-packet-mark=out-fast out-interface=ether2 passthrough=no \
    protocol=icmp
add action=mark-packet chain=postrouting comment="" disabled=yes \
    new-packet-mark=out-fast out-interface=ether2 passthrough=no \
    protocol=tcp tcp-flags=ack
add action=mark-packet chain=postrouting comment="" disabled=no dst-address=\
    192.168.1.23 new-packet-mark=out-prio out-interface=ether2 \
    passthrough=no
add action=mark-packet chain=postrouting comment="" disabled=no dst-address=\
    192.168.1.24 new-packet-mark=out-prio out-interface=ether2 \
    passthrough=no
add action=mark-packet chain=postrouting comment="" disabled=no dst-port=25 \
    new-packet-mark=out-slow out-interface=ether2 passthrough=no \
    protocol=tcp
add action=mark-packet chain=postrouting comment="" disabled=no dst-port=465 \
    new-packet-mark=out-slow out-interface=ether2 passthrough=no \
    protocol=tcp
add action=mark-packet chain=postrouting comment="" disabled=no \
    new-packet-mark=out-normal out-interface=ether2 passthrough=no

Now, everything “seems” to work fine, with the marking working and directing to the various queues, except for 2 of the mangle rules above.

As you can see per the rules above, they are diabled.
When I enable these 2 rules (below), it seems to ‘confuse’ the other rules for some reason.

add action=mark-packet chain=prerouting comment="" disabled=no in-interface=\
    ether2 new-packet-mark=in-fast passthrough=no protocol=tcp \
    tcp-flags=ack

add action=mark-packet chain=postrouting comment="" disabled=no \
    new-packet-mark=out-fast out-interface=ether2 passthrough=no \
    protocol=tcp tcp-flags=ack

All I require at the end of the day is 4 different priorities

in-slow
in-normal
in-prio
in-fast

out-slow
out-normal
out-prio
out-fast

With the different traffic specified marked and put in the various queues:

Outgoing icmp traffic - out-fast
Outgoing ‘ack’ packets - out-fast
All outgoing traffic to 192.168.1.23 - out-prio
All outgoing traffic to 192.168.1.24 - out-prio
All outgoing traffic to destination port 25 - out-slow
All outgoing traffic to destination port 465 - out-slow
All other outgoing traffic - out-normal

and

incoming icmp traffic - in-fast
Incoming ‘ack’ packets - in-fast
All incoming traffic to 192.168.1.23 - in-prio
All incoming traffic to 192.168.1.24 - in-prio
All incoming traffic to port 25 - in-slow
All incoming traffic to port 465 - in-slow
All other incoming traffic - in-normal


The device on the remote side of ether2 is configured in a similar way.

Is there something I am missing here?

Am I heading in the right direction?

Anybody have any advice to get this working correctly?

All input will be greatly appreciated…

Thank you,

Jakez

Can anybody assist with this?

All I need at the end of the day is to prioritize ack packets over other traffic.

I have tried the rule as per my previous post with no luck. am i missing something?

Are mangle rules orders? will it make a difference if I move the ack packet rules higher?

Assistance will be much appreciated.

Jakez

Could you be more specific about what you mean by confused? Regular tcp packets can have the ack flag and carry data as well. Perhaps this is causing the “confusion”?