MikroTik PCQ generator
Share a link fairly among all clients with one Per Connection Queue: choose a per-user rate and the total, and get the queue types plus a simple queue or queue tree.
Runs in your browser; nothing you type leaves your device
Generates RouterOS v7 syntax (also valid on v6) for IPv4. The queue tree method marks connections that LAN clients open towards the WAN; others pass unshaped. pcq-limit and pcq-total-limit stay at their defaults. MikroTik and RouterOS are trademarks of SIA Mikrotīkls. This tool is independent and not affiliated with or endorsed by MikroTik.
How to set up PCQ on MikroTik
- Choose the method: one simple queue for the LAN subnet (simplest) or a queue tree fed by mangle marks (more control).
- Enter the per-client rate, or 0 to share the total equally, and the total upload and download just under your real link speed.
- Copy the script or download the .rsc file, and make sure FastTrack is off for the shaped traffic.
Per Connection Queue in practice
PCQ is a queue type, defined under /queue type with kind=pcq, that a simple queue or a queue tree then uses. Its pcq-classifier decides what counts as one stream: dst-address for downloads, so each client's download is one stream, and src-address for uploads. RouterOS creates the sub-streams on the fly and removes them when they go quiet, so there is nothing to maintain as clients come and go.
Two settings shape the result. pcq-rate caps each stream; leave it at 0 and the streams simply share whatever the queue's max-limit allows, equally. The max-limit of the queue that uses PCQ should be a little under the real capacity of the link: PCQ can only share bandwidth fairly when packets queue on the router rather than in the modem upstream.
Simple queue or queue tree?
The simple queue method needs no marking: a single queue with the LAN subnet as target and queue=upload-type/download-type. The queue tree method uses mangle to mark connections from LAN to WAN and two queues under parent=global; it leaves traffic between local networks unshaped and is the starting point for priority classes. Either way, burst settings per client belong in simple queues; compare them with the simple queue generator and the burst calculator.
Questions
What does PCQ do?
A PCQ queue type sorts packets into sub-queues by a classifier, usually the client's address, and serves the sub-queues in turn. With pcq-rate set, each sub-queue is capped at that rate; with pcq-rate 0, the parent's limit is divided equally among the clients active at that moment. One queue therefore gives hundreds of clients a fair share, which would otherwise take hundreds of simple queues.
Why is download classified by dst-address and upload by src-address?
Download packets travel to the client, so the client's address is the destination; upload packets come from it, so it is the source. Swapping them would put every client in one sub-queue keyed by the remote servers' addresses.
Why does the queue tree use parent=global and the forward chain?
Upload packets must be classified before source NAT replaces the client's address with the WAN address, and the global queue runs before source NAT. Marking in the forward chain sees download packets after destination NAT has restored the client's address. Marking on the WAN interface instead would put every upload in one sub-queue.
What is the address mask for?
With /32 each address is its own sub-queue. A WISP that gives each customer a small subnet, such as a /29, can set the mask to 29 so the whole subnet shares one sub-queue and one rate.
PCQ has no effect. What should I check?
FastTrack first: fasttracked packets skip mangle and all queues. Then the totals: if the max-limit is above what the line really delivers, the queue never fills, and the ISP's equipment does the queuing instead of your router.
Is my configuration sent anywhere?
No. Everything is generated in your browser.