How to control downloads using MIkrotik PCQ

Have you ever wished there is a way to share your 5Mbps internet link equally among the 20 users on your network in such a way that a user’s download does not in any way slow down the browsing speed of others? If yes, then this post is what you seek. In this demonstration, I will share with us on how to evenly share bandwidth among connected users, using Mikrotik PCQ.

The Mikrotik PCQ which stands for per connection classifier, is a router OS feature that allows one to dynamically queue connected users by setting a max limit for each user. Using the parameters specified by the administrator during Mikrotik pcq configuration, the router will ensure that each established connection is limited to a predefined connection speed. When properly configured, PCQ ensures that a user using download accelerator or bit torrent does not take up the entire bandwidth while other users struggle.

Setting up Mikrotik PCQ to control downloads

To setup Mikrotik PCQ to control downloads, we need to define to the router what download packets are. This will be done using the mangle rule. See below.


Also see: How to queque customers to subscribed bandwidth on Ubiquiti PowerBeam


Capture LAN users’ packets

/ip firewall mangle

add action=mark-connection chain=prerouting src-address= in interface=ether5 new-connection-mark=office-conn

add action=mark-packet chain=prerouting connection-mark=office-conn new-packet-mark=Lan-packets



The rule above captures packets destined to the LAN address ( as they enter through the WAN interface (ether1). This rule will be used in later step.


You may also like: How to queue customers to subscribed bandwidth on Cisco routers


Mikrotik PCQ configuration

Here, we will create two pcq rules: one for downloads and the other for uploads. See below

/queue type

add name=Office-down kind=pcq pcq-rate=1M pcq-limit=50KiB  pcq-classifier=dst-address pcq-total-limit=2000KiB pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-src-address-mask=32 pcq-dst-address-mask=32 pcq-src-address6-mask=64 pcq-dst-address6-mask=64

add name=office-up kind=pcq pcq-rate=1M pcq-limit=50KiB pcq-classifier=src-address pcq-total-limit=2000KiB pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-src-address-mask=32 pcq-dst-address-mask=32 pcq-src-address6-mask=64 pcq-dst-address6-mask=64

From the command above, we can see the queue name are set to “office-up” and “office-down” while the total number of dynamic queues that can be established is set to 50. Since I have just about 2 connected users, I am assuming that established connection at any particular cannot exceed 50. If you have up to 200 users on your network, it will be wise to increase yours to 300 or beyond but bear in mind that the more the queues, the more RAM and processor space it will take from your router. Each user will be limited to 1Mbps upload and download from a total bandwidth from what ever the ISP is giving me. This means that the maximum bandwidth that any connected users can pull is 1Mbps.

Next, I will implement queue tree using the pcq created above as well as the mangle rule created in step one. There are two approaches to this. You can set a max rate for all connected users. That way, the sum of connected users’ bandwidth consumption can not exceed a figure set by you. To do this, first  create a queue that will be used as parent queue for subsequent ones. See below:


/queue tree

add name=”download” parent=total-bandwidth packet-mark=office-pack limit-at=0 queue=Office down priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s bucket-size=0.1

add name=”upload” parent=total-bandwidth packet-mark=office-pack limit-at=0 queue=office-up priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s bucket-size=0.1

add name=”total-bandwidth” parent=global packet-mark=office-pack limit-at=3M queue=default-small priority=8 max-limit=3M burst-limit=0 burst-threshold=0 burst-time=0s bucket-size=0.1

If you want connected users to work with what the ISP has available, then there is no need setting the first queue in the image above. Just set rules 2 and 3 making sure that the parent is set to global. That way, each connected user can pull a maximum of 1Mbps from what the ISP is given. At peak period, users may not be able to pull up to 1Mbps. PCQ can help stop users from exceeding a defined bandwidth limit but does not guarantee that users can pull up to a certain speed at all times.

Spread the love

View Comments

Recent Posts

Optimize your Metro ethernet with Jumbo MTU

Optimizing Metro Ethernet segments with jumbo MTU (Maximum Transmission Unit) can significantly enhance network performance…

1 week ago

Mikrotik switchOS configuration: a step-by-step guide

MikroTik's SwitchOS is an operating system specifically designed for their line of network switches. It…

1 month ago

Improve your network uptime with VRRP right now

A properly configured VRRP setup does not only track device uptime but also tracks connection…

1 month ago

Have you been configuring NAT the right way on Mikrotik?

Network Address Translation (NAT) is a technique used in networking to map private IP addresses…

1 month ago

Implementing VXLAN over MPLS with Mikrotik

In the ever-evolving landscape of networking technologies, the demand for efficient and scalable solutions has…

2 months ago

Multi-Area OSPF implementation on Mikrotik routers

Setting up Multi-Area OSPF (Open Shortest Path First) on Mikrotik routers involves a few steps.…

2 months ago