MikroTik PCQ Calculator

Size PCQ queues properly: work out the per-user rate, queue limits and total limit for a shared uplink, and generate the queue tree that implements it.

Calculator MikroTik / RouterOS Runs in your browser
Try:

Result

Fair share per user (down)
5.00 Mbit/s
Fair share per user (up)
5.00 Mbit/s
pcq-rate (download)
0 (unlimited, equal share)
Oversubscription
n/a - pure fair share
Recommended pcq-limit
50 packets
per sub-queue
Recommended pcq-total-limit
10000 packets
RouterOS queue tree with PCQ
/queue type
add name=pcq-download kind=pcq pcq-rate=0 pcq-classifier=dst-address pcq-limit=50 pcq-total-limit=10000
add name=pcq-upload kind=pcq pcq-rate=0 pcq-classifier=src-address pcq-limit=50 pcq-total-limit=10000

/ip firewall mangle
add chain=forward action=mark-packet new-packet-mark=lan-down passthrough=no out-interface=bridge-lan comment="Netvorx PCQ"
add chain=forward action=mark-packet new-packet-mark=lan-up passthrough=no in-interface=bridge-lan

/queue tree
add name=total-download parent=global max-limit=1000000k
add name=users-download parent=total-download packet-mark=lan-down queue=pcq-download limit-at=900000k max-limit=1000000k
add name=total-upload parent=global max-limit=1000000k
add name=users-upload parent=total-upload packet-mark=lan-up queue=pcq-upload limit-at=900000k max-limit=1000000k
pcq-rate = 0
pcq-rate=0 means every active user gets an equal share of whatever is left - the queue divides the parent limit dynamically as users come and go. A non-zero pcq-rate caps each user at that rate regardless of how much capacity is idle.

About MikroTik PCQ Calculator

PCQ (Per Connection Queue) is the RouterOS mechanism for sharing a link fairly among many users with a single rule. Instead of one queue per customer, PCQ classifies traffic by address and creates a sub-queue dynamically, so one entry scales to thousands of users.

Classifier direction is everything

For download traffic, classify on dst-address - the destination is the LAN user. For upload, classify on src-address. Getting this backwards creates one giant sub-queue keyed on the internet side, and the fairness you were trying to build disappears.

pcq-limit and pcq-total-limit

pcq-limit is the packet depth of each sub-queue; 50 is a good default. Too small and you drop packets on healthy bursts, too large and you build bufferbloat. pcq-total-limit caps memory across all sub-queues - size it to roughly the user count times the per-queue limit, and keep an eye on router RAM.

Common use cases

  • Sharing a hotspot or apartment-block uplink fairly.
  • Preventing one downloader from starving an office link.
  • Sizing a WISP sector before adding more subscribers to it.

Edge cases and gotchas

  • Queue trees act on packet marks, so the mangle rules must exist and match before the tree does anything.
  • PCQ operates on the router CPU - on low-end hardware, high packet rates will hit the CPU ceiling before the configured limit.
  • Fast Track bypasses queues entirely. Exclude marked traffic from Fast Track or the shaping will simply not apply.

Frequently asked questions

Why is PCQ not limiting anything?
Nine times out of ten, Fast Track is enabled in the firewall and the connections never reach the queue. Either disable fasttrack-connection or exclude the traffic you are shaping.
Should pcq-rate be zero?
Zero gives pure fair share - each active user takes an equal slice of the available capacity, and idle capacity is fully used. Set a rate only when you need a hard per-user cap for a product tier.