PCQ Queue Tree with Load Balancing in Mikrotik Router


Load Balancing + PCQ

On my last post about PCC Load Balancing in Mikrotik Router OS we are talking about how to create load balancing if we have two or more internet or public interfaces.

Now, I'm writing about how to create PCQ Queue Tree if we have implemented the PCC Load Balancing. I'm assuming that you have read and done in implementation on my  PCC Load Balancing in Mikrotik Router OS post.

Before we start, PCQ (Per Connection Queuing) is used to recognizes the current direction and can divides the bandwidth equally. PCQ can be used on either Simple Queue or Queue Tree. The difference that we can see directly that is only in terms of how to use it. Simple Queue Where specifically is designed for ease of configuration. Queue Tree is designed to perform more complex queue tasks and need a good understanding about traffic flow in router.

The Differences between Simple Queue and Queue Tree:
1. Simple Queue

  • Has a very strict rules of order, the queue is processed from the top to the bottom.
  • Set the packet flow is bidirectional (two ways).
  • Able to restrict traffic based on IP addresses.
  • One queue can limit the both traffic (upload and download) at once.
  • If Simple Queue and Queue Tree are used together, Simple Queue will be processed earlier than Queue Tree.
  • Supporting the PCQ implementation, so the bandwidth allocation can be divided equally.
  • Able to create fix bandwidth limitation.
  • As it's name, the settings are simple, ideal for network administrator who doesn't want complicated traffic control or firewall mangle.

2. Queue Tree

  • Does not have a sequence, each queue will be processed together.
  • The packet flow is directional (one way).
  • Requires setting / firewall mangle to limit traffic per IP address.
  • Requires setting / firewall mangle to differentiate the download and upload traffic.
  • As the second priority after Simple Queue.
  • Supports the PCQ usage.
  • Queue management with marking the packages in firewall mangle.
  • More flexible and need a good understanding in firewall mangle particularly about traffic control.

Now, go to IP->Firewall->Mangle
Then, type this rules in your terminal :


/ip firewall mangle
add action=mark-packet chain=forward disabled=no in-interface=WAN1 mark-packet=Global_WAN passthrough=yes
add action=mark-packet chain=forward disabled=no in-interface=WAN2 mark-packet=Global_WAN passthrough=yes
add action=mark-packet chain=forward disabled=no in-interface=WAN1 out-interface=LAN mark-packet=LANTraffic passthrough=yes
add action=mark-packet chain=forward disabled=no in-interface=WAN2 out-interface=LAN mark-packet=LANTraffic passthrough=yes


After that, create PCQ

/queue type add name="PCQ_download" kind=pcq pcq-rate=64000 pcq-classifier=dst-address

Last, create Queue Tree

/queue tree add parent=global-in queue=default packet-mark=Global_WAN name="GLOBAL_IN"
/queue tree add parent=GLOBAL_IN queue=PCQ_download packet-mark=LANTraffic name="Download"


That's all and you may add for upload just the opposite from in interface.

Hope this will help.

Comments

  1. how to add QOS to these PCQs?

    ReplyDelete
  2. Hi Kevin, can i know the script for upload? i try but not really understand it which i was not successful create the upload script. TQ for your advice

    ReplyDelete

Post a Comment

Please leave your comment politely and do not write a spam message.

Thank you. :)