I have a couple of questions regarding the correct place to apply queue trees that prioritize traffic that will not override simple queues that are performing bandwidth limiting/shaping for customers. First, I'll state the facts of what I understand and have taken from the manual:
There are 3 virtual interfaces in RouterOS, in addition to real interfaces:
global-in - represents all the input interfaces in general (INGRESS queue). Please note that queues attached to global-in apply to traffic that is received by the router, before the packet filtering. global-in queueing is executed just after mangle and dst-nat
global-out - represents all the output interfaces in general. Queues attached to it apply before the ones attached to a specific interface
global-total - represents a virtual interface through which all the data, going through the router, is passing. When attaching a qdisc to global-total, the limitation is done in both directions. For example, if we set a total-max-limit to 256000, we will get upload+download=256kbps (maximum)
HTB (Hierarchical Token Bucket) in RouterOS
There are 4 HTB trees maintained by RouterOS:
- interface queue
Simple Queues and HTB:
When adding a simple queue, it creates 3 HTB classes (in global-in, global-total and global-out), but it does not add any classes in interface queue.
Queue Trees and HTB:
Queue trees are more flexible - you can add them to any of the four HTB's.
Packet Traversal and HTB:
- When packet travels through the router, it passesall 4 HTB trees - global-in, global-total, global-out and interface queue.
- When a packet is destined for the router, it passes global-in and global-total HTB queues.
- When a packet is sent from the router, it traverses global-total, global-out and interface queues.
OK. I read all of this and understand it. Now, I am implementing the following configuration:
I am using Simple Queues to BW limit customers by IP. Each customer has a simple queue. By definition, three HTB classes are created in: global-in, global-total and global-out
Next, I am mangling and marking packets as they enter the router. For this example, I have a total throughput of 1Mb avaialable for customer use. I want to limit p2p traffic to 128kbps and other traffic to the remaining bandwidth. In order for traffic prioritization to work, it must be prioritized/limited before the simple queues limiting bandwidth for each customer:
(up to 128Kbps) (up to 1Mbps)
I can create two queue trees:
1. p2p with a max-limit of 128kbps
2. other traffic with a max-limit of 1Mbps.
By definition, queues attached to global-in are applied after mangling. Therefore, if I apply both queue trees created above to global-in and global-out to limit overall upload/download, I have the following questions:
1. By definition, queue trees take presedence over simple queue if applied at the same place. Since Simple queues are automatically applied to global-in, global-total and global-out, will the simple queues still BW limit each user?
2. Is this the correct place to apply the queue trees?