How to set up QoS on MikroTik RouterOS?

Solution 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.