0

I'm aware that this is a common question but I've invested two days now to learn this and still could not find a clear explanation...

Recently I bought a Miktotik hEX (RouterOS 6, Level 4), used as the main router for a 100MBit down / 30MBit up fiber connection (speed tests show actually 110/33 as my provider adds a 10% margin). I want to prioritize traffic mainly to avoid issues with VoIP calls (via Twilio).

I had successfully prioritized traffic before with FireQOS using a custom Linux box (that could not handle more than 20Mbit, though) using the following config:

DEVICE=ppp0

INPUT_SPEED=20mbit
OUTPUT_SPEED=10mbit
LINKTYPE="local pppoe-llc"

interface $DEVICE world-in input rate $INPUT_SPEED
  class voip commit 120kbit       # https://www.twilio.com/docs/api/client/regions
    match src 54.171.127.192/26   # Twilio: ie1
    match src 52.215.127.0/24     # Twilio: ie1
    match src 35.156.191.128/25   # Twilio: de1
    match src 185.187.132.64/26   # Twilio: ie1-tnx
    match udp port 5060           # SIP
    match udp dports 10000:10100  # RTP
    match sports 3478,5349        # STUN
  class interactive commit 20%
    match udp port 53             # DNS
    match tcp port 22             # SSH
    match icmp                    # ping
    match tcp sports 5222,5228    # gtalk
  class synacks      
    match tcp syn    
    match tcp ack    
  class web commit 5%
    match tcp sports 80,443 
  class mail
    match tcp sports 25,465,587
  class default

interface $DEVICE world-out output rate $OUTPUT_SPEED
  class voip commit 120kbit
    match dst 54.171.127.192/26   # Twilio: ie1
    match dst 52.215.127.0/24     # Twilio: ie1
    match dst 35.156.191.128/25   # Twilio: de1
    match dst 185.187.132.64/26   # Twilio: ie1-tnx
    match udp port 5060           # SIP
    match udp sports 10000:10100  # RTP
    match dports 3478,5349        # STUN
  class interactive commit 20%
    match udp port 53             # DNS
    match tcp port 22             # SSH
    match icmp                    # ping
    match tcp dports 5222,5228    # gtalk
  class synacks commit 2%      
    match tcp syn    
    match tcp ack    
  class web commit 5%
    match tcp dports 80,443 
  class mail
    match tcp dports 25,465,587
  class default

Meanwhile I tried to set up packet marks accordingly, in RouterOS:

enter image description here

I think I need to set up Queue Trees on the Mikrotik and create a main queue for the available up/down speeds and divide by some priorities.

Currently I don't know where to start as I can't see a way to create two distinct queues for incoming and for outgoing traffic (as I have an asymmetrical bandwidth).

I see there are predefined (parent) queues for each interface but the problem is that I am using VLAN to provide WAN access to three completely independent subnets. The single physical port I'm using is ether2-master:

enter image description here

I guess creating a queue for parent ether2-master won't work as packets won't be marked on that level (right?), since all ether2-master packets are VLAN-tagged.

I'd like to have the same QoS as I had with FireQOS but what's really important is the VoIP part.

So, how should I configure the Queue Tree?

1 Answer 1

1

I would definitely mark the packets before routing decision so you should set your routing mark rules on the prerouting and not the forward chain.

Then add queues for voip traffic under the global queue and set guaranteed speed.

/queue tree add name="voip_in" parent=global packet-mark=VOIP_IN queue=pcq-download-default priority=1 limit-at=120k max-limit=100M
/queue tree add name="voip_out" parent=global packet-mark=VOIP_OUT queue=pcq-upload-default priority=1 limit-at=120k max-limit=30M

You should mark the incoming and outgoing traffic separately too (interactive_in, interactive_out, synacks_in, synacks_out, etc). Then you can create the appropriate queues. You cannot specify the allocated bandwidth in percantage, you have to set bit/s values.

 /queue tree add name="interactive_in" parent=global packet-mark=interactive_in queue=pcq-download-default priority=2 limit-at=20M max-limit=20M
 /queue tree add name="interactive_out" parent=global packet-mark=interactive_out queue=pcq-upload-default priority=2 limit-at=6M max-limit=6M
 /queue tree add name="synacks_in" parent=global packet-mark=synacks_in queue=pcq-download-default priority=3 limit-at=2M max-limit=2M
 /queue tree add name="synacks_out" parent=global packet-mark=synacks_out queue=pcq-upload-default priority=3 limit-at=600k max-limit=600k
 /queue tree add name="web_in" parent=global packet-mark=web_in queue=pcq-download-default priority=4 limit-at=5M max-limit=5M
 /queue tree add name="web_out" parent=global packet-mark=web_out queue=pcq-upload-default priority=4 limit-at=1500k max-limit=1500k
 /queue tree add name="mail_in" parent=global packet-mark=mail_in queue=pcq-download-default priority=5
 /queue tree add name="mail_out" parent=global packet-mark=mail_out queue=pcq-upload-default priority=5
 /queue tree add name="default" parent=global packet-mark=no-mark queue=default priority=6

Please note that the priority value does not mean any packet priority. It's just sets the order of the queues.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .