Mikrotik PCQ Queues - help wanted

shadow_man

Executive Member
Joined
May 27, 2005
Messages
6,200
According to the Mikrotik Wiki there’s 3 major PCQ groups:

https://wiki.mikrotik.com/wiki/Manual:Queues_-_PCQ_Examples

- equal bandwidth for a number of users
- certain bandwidth equal distribution between users
- unknown bandwidth equal distribution between users.

However I can’t seem to find examples of each.

As far as I understand it the equal bandwidth distribution of users is:

* 10mbps line - 1 user gets full line speed (10mbps), 2 users get 5mbps each, 3 users get 3.33mbps each etc.
* However if say 2 users are connected and one user is using only 2mbps, then when the 2nd user logs in they’ll have the remaining 8mbps to use (and not just 5mbps) - therefore its dynamically allocated as the users need it.

Can anyone point me to what the other 2 do? (and if my understanding of the first is even correct?
 

DWPTA

Expert Member
Joined
Jul 28, 2006
Messages
4,366
Equal bandwidth for a number of users

PCQ.png

Certain bandwidth equal distribution between users
Unknown bandwidth equal distribution between users

1.png
 

DWPTA

Expert Member
Joined
Jul 28, 2006
Messages
4,366
Lets constider that for equal distribution between users

ether1: WAN(public interface to the Internet)
ether2: LAN (local interface where clients are connected)

and LAN network: 10.0.0.0/24

Code:
/ip firewall mangle add action=mark-connection chain=forward comment="PCQ Equal mark-conn" new-connection-mark=equal-mark-con src-address=10.0.0.0/24
/ip firewall mangle add action=mark-packet chain=forward comment="PCQ Equal mark-pack" connection-mark=equal-mark-con new-packet-mark=equal-mark-pack
/queue type add kind=pcq name=pcq_down pcq-classifier=dst-address
/queue type add kind=pcq name=pcq_up pcq-classifier=src-address
/queue tree add name=DOWLOAD packet-mark=equal-mark-pack parent=LAN queue=pcq_down
/queue tree add name=UPLOAD packet-mark=equal-mark-pack parent=WAN queue=pcq_up
 

shadow_man

Executive Member
Joined
May 27, 2005
Messages
6,200
Thanks for the reply - but I still don't understand how these two are different?

Certain bandwidth equal distribution between users
Unknown bandwidth equal distribution between users

To me it looks the same - the bandwidth is split by users in the queue - is it just a case of a static split (bandwidth is reserved for users not even online) vs dynamic (bandwidth is split between online users only)?

I went with this setup in the end:

Code:
/ip firewall mangle add chain=forward src-address=192.168.88.0/24 \
   action=mark-connection new-connection-mark=users-con
/ip firewall mangle add connection-mark=users-con action=mark-packet \
   new-packet-mark=users chain=forward

/queue type add name=pcq-download kind=pcq pcq-classifier=dst-address
/queue type add name=pcq-upload kind=pcq pcq-classifier=src-address

/queue tree add name=Download parent=wlan1 max-limit=1024000
/queue tree add parent=Download queue=pcq-download packet-mark=users

/queue tree add name=Upload parent=ether1-WAN max-limit=512000
/queue tree add parent=Upload queue=pcq-upload packet-mark=users

So if my line is 10mbps down / 5mbps up - then:

If 1 user is online the get 10/5
If 2 users are fighting for bandwidth they get 5/2.5
If 3 users are fighting for bandwidth they get 3.33 / 1.66

However it's possible to have user1 using 8mbps down whilst user2 is only using 2mbps down. IF user2 wants to scale up his usage to 5mbps he can - it will then simply take the remaining 3mbps from User1 in order to make up that shortfall. So bandwidth is dynamically allocated as needed (no static queue limits per IP etc).
 

DWPTA

Expert Member
Joined
Jul 28, 2006
Messages
4,366
Thanks for the reply - but I still don't understand how these two are different?

Certain bandwidth equal distribution between users
Unknown bandwidth equal distribution between users

To me it looks the same - the bandwidth is split by users in the queue - is it just a case of a static split (bandwidth is reserved for users not even online) vs dynamic (bandwidth is split between online users only)?

I went with this setup in the end:

Code:
/ip firewall mangle add chain=forward src-address=192.168.88.0/24 \
   action=mark-connection new-connection-mark=users-con
/ip firewall mangle add connection-mark=users-con action=mark-packet \
   new-packet-mark=users chain=forward

/queue type add name=pcq-download kind=pcq pcq-classifier=dst-address
/queue type add name=pcq-upload kind=pcq pcq-classifier=src-address

/queue tree add name=Download parent=wlan1 max-limit=1024000
/queue tree add parent=Download queue=pcq-download packet-mark=users

/queue tree add name=Upload parent=ether1-WAN max-limit=512000
/queue tree add parent=Upload queue=pcq-upload packet-mark=users

So if my line is 10mbps down / 5mbps up - then:

If 1 user is online the get 10/5
If 2 users are fighting for bandwidth they get 5/2.5
If 3 users are fighting for bandwidth they get 3.33 / 1.66

However it's possible to have user1 using 8mbps down whilst user2 is only using 2mbps down. IF user2 wants to scale up his usage to 5mbps he can - it will then simply take the remaining 3mbps from User1 in order to make up that shortfall. So bandwidth is dynamically allocated as needed (no static queue limits per IP etc).

To answer it's assigning the allotted bandwidth allocated in each PCQ, static or dynamic (both sentences are the same in essence). So it doesn't matter how many users are using bandwidth. Each one has an allocated amount that he can use in that threshold.
 
Last edited:
Top