Tuesday, May 11, 2021

Mikrotik PCQ Tutorial

In Mikrotik, as we can limit the bandwidth for a single IP address, in the same way, we can limit the bandwidth for the total network also. The restriction applied on the basis of a single IP address will work only for that specific IP address. On the other hand, the restriction applied on the basis of the full network will work for all IP addresses, which are the members of that network. 

Suppose the 5 Mbps restriction is applied on a single IP address and we are assuming that our single IP address is 192.168.1.100/24. In that case, this single IP address will be restricted to that 5 Mbps bandwidth. This 5 Mbps bandwidth will available only for that IP address ie. 192.168.1.100/24. No other IP addresses are not going to share this bandwidth.

But if we apply the restriction on a network address instead of a single IP address, in that case, this 5 Mbps bandwidth will be shared among all IP addresses which are the members of that network. We are assuming that our network address is 192.168.1.0/24.

But mind that, this 5 Mbps bandwidth will be shared on an unequal basis. This means if one IP address of that network is taking or consuming the full bandwidth then other IP addresses will be affected by that. They will get poor bandwidth until that IP address is not release the bandwidth.

That's why we want every IP address of that network should have to get 5 Mbps equal bandwidth for their respective connection. As a result, there is no chance to consume the full bandwidth by a single IP address. The bandwidth will distribute equally per their connection.

To achieve this target, we have to use a special queue type called "PCQ (Per Connection Queue)".

In this tutorial, we will learn how to use Mikrotik PCQ to  distribute bandwidth or limit bandwidth on an equally per-connection basis of the total network. We will use the "Winbox" tool to complete those processes.

According to our scenario, we have to ensure that every IP address will get 5Mbps dedicated upload and download bandwidth for their respective connection.

Now create a new "Simple Queue" rule and specify a name for that rule. According to our scenario, our target network will be 192.168.1.0/24. We have to write this network address at the "Target" parameter box.


In this case, we will not define any maximum download or upload limit. Leave it with default settings.

Now we have to change our default queue type. By default, Mikrotik uses the "default-small" queue for applying the upload and download bandwidth restriction. We can change it using the "Advanced" tab.


Instead of using the "default-small" queue type, we have to use the "PCQ" queue type.


If we want we can use this existing PCQ queue type or we can create a new type for our upload and download restriction. In this tutorial, we will create a new queue type to achieve our target. We have to create two queue types. One queue will work for the download restriction and the second queue will work for the upload restriction.

To create a new queue type, please navigate to the "Queue Types" tab from the "Queues" menu and then click on the (+) sign to create a new type.


After clicking on the (+) sign, please change the queue type to "pcq" from the "Kind" parameter.


Now we will write the bandwidth amount into the "Rate" field. According to our scenario, we want to ensure that every user will get 5 Mbps dedicated upload and download bandwidth respective to their connection.


Mind that, we have to create two new queue types. One is for download and the other is for upload restriction.

For download queue type, we have to select "Dst. Address" as the classifier value. 


For upload queue type, we have to select "Src. Address" as the classifier value.


That's it. After clicking on the "Apply" and "OK" button, our new queue type will ready to work.

Now we have to change our "Queue Type" value to the newly created custom queue type. We have to change both of the queue types mean one is for upload and the other is for download.


Everything is done. From now on all the available IP addresses should get 5mbps upload and download bandwidth respective to their connection. The bandwidth will distribute equally among all the IP addresses.

In this tutorial, we learned how to distribute bandwidth or limit bandwidth on an equal basis per connection using Mikrotik PCQ.



No comments:

Post a Comment