How to set up simple PCQ queue with children

Hello,
I am trying to understand Mikrotik queues.
I would like to distribute all available bandwidth between the active users. For for a few I would like to set a maximum value for up and download.
So I’ve created a PCQ queue ‘all’ with limits 80/200, and two queue children.
I have read in section “Limits specified on parent simple queues”(https://wiki.mikrotik.com/wiki/Tips_and_Tricks_for_Beginners_and_Experienced_Users_of_RouterOS#Limits_specified_on_parent_Simple_Queue_are_not_working)
that I needed to repeat the parent target to a child, without limits. So I’ve included another child (users) with the same target of the entire subnet.

However, if I run a test from the test2 machine, the limits do not get honoured. Everything is reported in the “users” child.
If I remove the “users” child, the test systems report properly, but none of the other users are reported on the parent.

How should I set this up?



0 I name=“test1” target=192.168.0.135/32 parent=all packet-marks=“” priority=8/8 queue=default-small/default-small limit-at=1M/1M max-limit=20M/20M
burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1

1 I name=“all” target=192.168.0.0/24 parent=none packet-marks=“” priority=8/8 queue=pcq-download-default/pcq-upload-default limit-at=0/0
max-limit=80M/200M burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1

2 I name=“users” target=192.168.0.0/24 parent=all packet-marks=“” priority=8/8 queue=pcq-upload-default/pcq-download-default limit-at=0/0
max-limit=0/0 burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1

3 I name=“test2” target=192.168.0.150/32 parent=all packet-marks=“” priority=8/8 queue=default-small/default-small limit-at=0/0 max-limit=40M/40M
burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1

You should follow a Parent-Child Setup instead of just adding simple rules…
The simplest you can do, is set as target your whole subnet, for example 192.168.1.0/24, set the Max Up/Down Limits and on the second tab for PCQ Type select PCQ Upload/Download default…
With just this rule, delete all others, it will work…

I say again, this is the simplest you could do just for testing…
A parent-Child setup is recommended, or even Queue Trees…

Hello Zacharias,
Thanks for your reply. I actually tried to create a parent/child setup in the above rules. “all” is the parent, the others all have "all"as parent.

If I just use the simplest way, as you suggested, how can I limit the up/download rate for a few specified addresses?

This is how you would limit specific addresses:

/queue simple
add max-limit=10M/2M name=Parent queue=pcq-upload-default/pcq-download-default \
    target=192.168.1.0/24
add max-limit=2M/500k name="Child 1" parent=Parent target=192.168.1.2/32
add max-limit=5M/1M name="Child 2" parent=Parent target=192.168.1.3/32

Anything you dont want to be limited just let it out of the queues, meaning it must be before the Parent, in numbering order…

I tried - but no success.
To be clear:

  1. I want all (active) clients to share specified bandwidth (i.e pcq with pcq-rate=0)
  2. In addition a few of those clients should have a smaller max up/download.

I tried your configuration, and it works fine for the specified clients (192.168.1.2 and 192.168.1.3) but none of the other clients are limited. At least they are not reported in the statistics.
If I add the entire subnet as another client - without limits - as suggested in the link I mentioned above, the other clients in the net are not reported either - not in the total and not in the child.

I must be doing something wrong - but still don’t understand what.
I have included a screenshot (I replaced the actual IP addresses in the image).
The parent statistics in the topline only show the traffic on the listed children. I expected the traffic on the Clients child to be the total of all other traffic (about 30-50 Mbits/s). But it shows 0.
pcq.png

As i can see the queue works just fine… Just add manually all the childs under the Parent as i did for 192.168.1.2 and 192.168.1.3… 1.5, 1.6, 1.7 and so on…
You can use a for Loop for that…
Or you have the choice of queue trees as well…
But if you do as suggested above it will work…

Do you have to add all the stations individually? I would have hoped the system would interpret the 192.168.1.0/24 as all children.

I think I am beginning to get it right. I’ve modified the set up by specifying min/max limits to the Clients child.
Everything appears to be reporting properly now.
Thanks for your help!

Yes it must be set individually..
OR you can just create 1 simple queue for the 192.168.1.0/24 subnet, set your Max Limits, select PCQ as your queue kind and then the queue will equally share the bandwidth to everyone under this subnet… Then if you want 192.168.1.2 to follow a different limit, you can move it above the simple queue created before…
But if you do it like this, you cant set priority or limit-at… They won’t work!!!