HTB QoS explore the Mikrotik RouterOS

Implementation of QoS (Quality of Services) at the Mikrotik much depends on the system HTB (Hierarchical Token Bucket). HTB allows us to create a queue to be more structured, by performing multilevel groupings. What many do not realize is, if we do not implement the HTB Queue (both Simple Queue and Queue Tree), there were some parameters that do not work as we inginkan.Beberapa parameters that do not work is the priority, and dual limitation (CIR / MIR).

In the discussion of this article, we will take the example of a simple QoS system, where we want to allocate bandwidth of 400kbps for 3 clients, where each client can get a maximum of 200kbps. Among these three clients, have different priorities, namely: 1.2, and 3.

To facilitate the monitoring and verification, we will use the queue tree. The easiest way to do queue with queue tree, is to determine the parameters:
  •   Parent (which must be filled with outgoing-interface),
  •   Packet-mark (must be made first in-ip-firewall mangle),
  •   Max-limit (which is the maximum speed limit), or also known as MIR (Maximum Information Rate)
For the initial experiment, all the priority required the same numbers: 8, and parameters-at the limit we are not content. The following figure is an illustration of what will happen with the above configuration.

Since allocation of the available bandwidth is only 400kbps, while the third cumulative exceeding client (600 kbps), then the client will be the third fight each other, and can not be predicted who will win (using the full bandwidth) and who will lose (do not get the bandwidth that appropriate).

Suppose that Q1 is the client with the highest priority, and Q3 is the client with the lowest priority. We will try to enter the priority value for each client in accordance with priorities.

Shown in the picture above, though now Q1 already has the highest priority, but the third was still scrambling client bandwidth and uncontrolled.

The following picture will try to implement the value-at the limit. It should, limit-at the CIR (Committed Information Rate), a parameter in which a client will get bandwidth, regardless of other conditions, as long as bandwidth is available.

It turned out that Q1 is still not getting the bandwidth in accordance with the limit-at (CIR) it. In fact, since the available bandwidth is 400kbps, should be sufficient to supply each client in accordance with its limit-at.

Next, we will use the parent queue, and queue a third place as a child had been a client of the parent queue queue that we will create. At the parent queue, we simply include outgoing-interface on the parent parameter, and for the third child, we change the parameters of parent to parent queue name. First of all, we are not going to put the value of max-limit on the parent-queue, and delete all the parameters at the limit, all clients.

Shown in the example above, because we did not include the value of max-limit on the parent, then the priority on the child could not even awake. After we put max-limit parameter on the parent queue, then the priority on the client will run.

Shown in the example above, Q1 and q2 have almost as much bandwidth max-limit, whereas almost missed Q3 bandwidth. Priority has been going well. However, in actual conditions, we certainly do not want a client who did not get the bandwidth.

For that, we need to set the limit value-at on each client. Value-at this limit is the minimum speed that will be found by the client, and not be distracted by other clients, other clients how besarpun 'suck' bandwidth, or whatever priorities. We set the value as the limit-75kbps on all clients at.

Seems that the Q3, which has the lowest priority, get the bandwidth of the limit-at him. Q1 which has the highest priority, can get bandwidth of max-limit, while the priority q2 between Q1 and Q3, can get over the bandwidth limit-at, but did not reach max-limit. In the example above, all clients will be guaranteed a bandwidth of the limit-at, and if any remaining, will be distributed until the total reaches max-limit parent, in accordance with the priorities of each client.

The amount accumulated from the limit-at not exceed max-limit parent. If that happened, like the example below, the number of limit-at the third client is 600kbps, while the value of max-limit parent is 400kbps, then the max-limit parent will leak. The example below assumes that the overall capacity is able to reach a total value of the limit-at. However, if the available bandwidth does not reach the total limit-at, then the client will return a scramble and a priority system does not work.

Meanwhile, the max-limit, max-limit a client can not exceed max-limit parent. If this happens, then the client will never reach the max-limit, and will only get a maximum speed limit of max-parent (less than the max-limit client).

If all clients have the same priority, then the client will share the remaining bandwidth. Look at the example below, all clients get the same bandwidth, approximately 130kbps (400kbps total divided by 3).

 The need to remember about HTB:
  1. HTB can only work, if the client queue rule under the level of at least 1 parent, every client has a queue-limit parameter at and max-limit, and the parent queue must have a max-limit quantities.
  2. The total number of limit-at the client must not exceed the max-limit parent.
  3. Max-limit each client must be less than or equal to max-limit parent.
  4. For the parent with the highest level, requires only max-limit (the limit does not require parameters-at).
  5. For all parent, or sub-parent, priority parameters are not taken into account. Priority is only calculated on the child queue.
  6. Calculation of the new priority will be done after all limit-at (both at the queue or sub-child parent) have been met.
Practical guidance how to calculate the limit-at and max-limit

In assuming the available bandwidth of 1000kbps. And the total number of clients is 70. To know is:
  1. What is the maximum number of clients who use the internet at the same time. This amount is not necessarily equal to the number of computers available, if all the client never connected simultaneously. For example, for this case we assume is 50.
  2. What is the minimum number of clients who use the internet at the same time. For example, for this case we assume is 10
Thus, for each client (created 1 client rule 1 queue), the limit is, at its 1000 / 50 = 20kbps, and its max-limit is 1000 / 10 = 100 kbps.

Do not forget to add the parent with max-limit of 1000kbps (no limit-at), and put all the client queue under the parent queue. If for some terminals require a greater priority, then we can use a different priority depending on the order of priority.

Created by: Valens Riyadi - MIKROTIK INDONESIA -
Thanks For Valens

Ardhosting | faster, reliable webhosting

Share this

Related Posts