How to make Queue trees

I really can’t find anywhere in the manual has explained how to make a queue tree and what is
the role of the inner queues.

-I want to implement HTB at each router for each user in this network but the manual is
so confusing and incomplete that I do not know what to do. Can anyone please help?

  • for example at RB2 I must implement 3 HTB queues for the traffic from 3 users u1, u2, u3.
    For download traffic I know the top parent would be “global-out”, but do I need inner queues?
    what they are and what they do? do I need any extra inner queus for u1 and u2 since
    they come from the same interface?

-Please point me to somewhere that talks about how to make the queue trees and identify
the parents and inner queues.
Picture1.jpg
Picture2.jpg
Picture3.jpg

Have you read this?

http://wiki.mikrotik.com/wiki/Manual:Queue

why do you need it on each router? simply setup it on RB3 =)

I need to give each customer some service, so when number of users go up and the links sometimes become overloaded then I have to monitor traffic to each router and drop the non-committed rates if necessary.

So I don’t know at all how to set up the queue trees. even on RB3 I don’t know how to do that. I do not know what the inner queues should be and if I only need one parent like global-out and some children like u1-u3? and no other inner parents in between? I don’t know how to draw the tree and then write the scripts. There is mo manual help.

please help!

thanks very much!

to satisfy CIR, parent=global-out for all leaves is enough. just create leaf with limit-at=CIR for the customer’s traffic and one more leaf for all the rest

yes I have. It still does not say when and why some inner queues are needed. the HTB examples one the web show many inner queue classes but never show what kind of network they correspond to. inversely, I don’t know my network coresponds to what kind of queue tree. there should be a step by step manual to help beginners draw their corresponding queue tree, but there is nothing at all!

do I need to attach my customers leaf to an inner parent before the global-out? like the second picture? or they should be directly connected to the global-out? on winbox if I do the latter I can’t see any hierarchy.

directly. inner parent is necessary if you need to limit summary speed of leaves, for example - you can’t set ‘max-limit’ for ‘global-out’ =)

so how about my other two leaves (u1 and u2)? I have reasons to have a separate HTB queue for them on RB2. Now do they need another parent like my ““third figure””, or they are just treated like u3? if they need another parent what that would be? ether3 or an imaginary parent? what would be the limits on this parent?

you need QoS mainly for CIR, so you don’t need complex hierarchy - use parent=global-out

ok, thanks very much.

If I want to do something like this (send all of the aggregate traffic to a separate queue) I won’t be able to guarantee my CIRs in case the network is larger and congested. But if I implement 2 queues for the aggregate traffic (not from the local user attached to the router) I might be able to avoid HTB per user at each router.

In one queue I want to put the packets belonging to the transmitters sending below their CIR, and in the other Queue I want to put packets belonging to the transmitters sending above their CIRs. This way I will know what packets must be dropped if the network is congested. But I must somehow mark the packets right before transmission from their original router.

How can I do packet marking based on the state of a local HTB queue. In green state mark the packets as “blow-CIR” or something and in the yellow and red state mark them as “above-CIR”. Then when the packets become aggregate to the upcoming routers they go to their corresponding queues. CAN I DO THIS? HOW can I identify the color of a queue in a mangling rule? can I use any “if statement” :slight_smile: ? is this question so naive or funny! :laughing:

yep, a bit naive =) color has nothing to do with CIR =) http://forum.mikrotik.com/t/simple-question-about-priority/36102/10

and don’t try to send packets to different queues depending on current traffic - it’s what HTB was developed for, don’t try to prevent it from doing its work =)

That color post is very confusing, I have to read it in depth later. So forget about the colors. If I want to mark packets based on whether the CIR has reached or not, sending UDP packets of one connection to different queues does not harm anything as there is no guarantee they arrive in order. For the TCP packets though, if I send them to different queues that does not change the orders since a TCP session will stay above CIR until the next ACK arrives. So the packets going to the CIR queue will go through, and the tail which is in the “above CIR” queue will either pass or discarded. If all of them pass the ACK will be returned, if not the window size drops. So I think we don’t have out of order problem with TCP packets either. So do you think I can mark packets based on the traffic?

I really appreciate your help and sharing your knowledge Chupaka.

you do NOT need to use some additional queues for “under/over CIR”. queue do not affect packets all until limit-at value is reached

I guess I was not able to explain what I intend to do.

I read the mangle is valid only within one router. Can I somehow mark the packets such that the packet mark travels with the packet in my network?

you may use DSCP (ToS) value of IP packet

OK,

step1) now suppose RB1 wants to mark U1 and U2 packets in the DSCP field right before tranmitting to RB2 such that if U1 or U2 is sending below CIR its packets are marked as 1, and if above CIR it packets are marked as 2 in the DSCP field.

step 2) When RB2 recieves packet from U1 and U2, looks into their DSCP fields. If they are marked as 1 they are sent to Q1, and if they are marked as 2 they are sent to Q2.

Question: Can I write a script for RB1 to mark the packets the way I explaiend in step1 right before transmitting to RB2?
if yes how? if not why?

DSCP values are set in mangle rules, just like packet marks. There’s no real way to determine whether or not someone is sending/receiving above CIR in all their combined connections in mangle rules.

But really I don’t see why you would need to mark packets that way. Just use DSCP to mark the packets to uniquely identify that they are from U1, then implement the same queues on all routers and mark packets based on DSCP as well. That way R2 can decide all by itself if traffic is above CIR in its own queue trees.