Community discussions

MikroTik App
 
anjey
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Nov 24, 2008 12:11 pm

Queue Tree: Priority and Shaping

Sun Nov 30, 2008 11:57 am

Hello.

I'm trying to use queue trees to prioritize AND shape traffic. I want to make few clients with 256k/256k dl/ul traffic limit and prioritize ICMP, HTTP, POP3, DNS for them. I've started by simply adding two child queues with priorities (all packets in mangle are marked properly and all queues are ticking):
Flags: X - disabled, I - invalid 
 0   name="Main Down" parent=intranet packet-mark="" limit-at=2000000 
     queue=pcq-down priority=8 max-limit=2000000 burst-limit=0 
     burst-threshold=0 burst-time=0s 

 1   name="Clients 256k" parent=Main Down packet-mark="" limit-at=0 
     queue=pcq-down-256k priority=6 max-limit=0 burst-limit=0 
     burst-threshold=0 burst-time=0s 

 2   name="queue1" parent=Clients 256k packet-mark=256k in limit-at=0 
     queue=pcq-down priority=1 max-limit=0 burst-limit=0 burst-threshold=0 
     burst-time=0s 

 3   name="queue2" parent=Clients 256k packet-mark=256k in2 limit-at=0 
     queue=pcq-down priority=8 max-limit=0 burst-limit=0 burst-threshold=0 
     burst-time=0s 
here's queue types list:
 5 name="pcq-up" kind=pcq pcq-rate=0 pcq-limit=50 pcq-classifier=src-address 
   pcq-total-limit=2000 

 6 name="pcq-down" kind=pcq pcq-rate=0 pcq-limit=50 pcq-classifier=dst-address 
   pcq-total-limit=2000 

 7 name="pcq-down-256k" kind=pcq pcq-rate=262144 pcq-limit=50 
   pcq-classifier=dst-address pcq-total-limit=2000 

now i have the following problem: Queue "Clients 256k" is not limiting traffic regardless of "pcq-down-256k" queue type pcq-rate=262144 settings.

I don't want to create separate tree branch for each of my clients and if i set "pcq-down-256k" as queue type for "queue1" and "queue2" EACH type of trafic will get 256k. Wat's wrong with my setup? How could I achieve my goal?
 
anjey
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Nov 24, 2008 12:11 pm

Re: Queue Tree: Priority and Shaping

Mon Dec 01, 2008 9:02 pm

any suggestions?
 
anjey
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Nov 24, 2008 12:11 pm

Re: Queue Tree: Priority and Shaping

Wed Dec 03, 2008 7:57 am

Up.
Still needs help! URGENTLY =(
 
imtrulylovd
just joined
Posts: 20
Joined: Wed Nov 26, 2008 9:30 am

Re: Queue Tree: Priority and Shaping

Wed Dec 03, 2008 7:42 pm

Post mangle config as well please.
 
anjey
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Nov 24, 2008 12:11 pm

Re: Queue Tree: Priority and Shaping

Thu Dec 04, 2008 8:42 am

 8 X chain=forward action=mark-packet new-packet-mark=256k out passthrough=yes 
     src-address-list=256k/256k dst-address-list=!Not NAT Networks 

 9 X chain=forward action=mark-packet new-packet-mark=256k in passthrough=yes 
     protocol=tcp src-address-list=!Not NAT Networks 
     dst-address-list=256k/256k src-port=80 connection-bytes=0-1024000 

10 X chain=forward action=mark-packet new-packet-mark=256k in2 passthrough=yes 
     src-address-list=!Not NAT Networks dst-address-list=256k/256k 
     packet-mark=!256k in 
here's mangle config related to Queue Trees. Rules are currently disabled but they was enabled on testing. Everything was ticking (including Queue Tree counters) but traffic was not limited by pcq-rate
 
anjey
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Nov 24, 2008 12:11 pm

Re: Queue Tree: Priority and Shaping

Sun Dec 07, 2008 2:02 pm

anyone?
 
dot-bot
Member Candidate
Member Candidate
Posts: 164
Joined: Tue Oct 11, 2005 7:05 pm

Re: Queue Tree: Priority and Shaping

Sun Dec 07, 2008 4:52 pm

Are you following these rules:

When marking packets and creating Queues for them, you must not forget other packets that you may have not marked that would travel the same direction. Because they will have unlimited speed.
 
anjey
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Nov 24, 2008 12:11 pm

Re: Queue Tree: Priority and Shaping

Sun Dec 07, 2008 9:01 pm

Are you following these rules:

When marking packets and creating Queues for them, you must not forget other packets that you may have not marked that would travel the same direction. Because they will have unlimited speed.
all packets are marked!
pls read my first post closely, i've wrote that queue is counting well but not limiting
 
anjey
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Nov 24, 2008 12:11 pm

Re: Queue Tree: Priority and Shaping

Thu Dec 11, 2008 2:59 pm

Updated to latest 3.17 ... still could not solve my problem.

Anyone? Pls help!
 
dot-bot
Member Candidate
Member Candidate
Posts: 164
Joined: Tue Oct 11, 2005 7:05 pm

Re: Queue Tree: Priority and Shaping

Thu Dec 11, 2008 5:34 pm

Problem is you are setting the pcq-down-256k on a parent queue (that has at least one child queue).
http://wiki.mikrotik.com/wiki/Queue#Queue_Tree
Queue tree creates a unidirectional queue in one of the HTBs. It is also the only way to add a queue on a separate interface. This way it is possible to ease mangle configuration - you don't need separate marks for download and upload - only upload will get to Private interface and only download will get to Public interface.
Also it is possible to have double queuing (example: prioritization of traffic in global-in or global-out, limitation per client on the outgoing interface). If you have simple queues and queue tree in the same HTB - simple queues will get traffic first.
Queue tree is not ordered - all traffic passes it together (unlike simple queue).

priority ( 1..8 ) : Prioritize one child queue over other child queue. Does not work on parent queues (if queue has at least one child). One is the highest, eight is the lowest priority. Child queue with higher priority will have chance to reach its limit-at before child with lower priority and after that child queue with higher priority will have chance to reach its max-limit before child with lower priority. Priority has nothing to do with bursts.
Try to set the child queue to the 256k one. If results are not satisfying, start using the limit-at and max-limit settings to limit the users to 256K.

If you have more problems, please when pasting your configs, first EXPORT them with the export command. Will be easier for me.

Don't forget to post here what results you get - successful or not.
 
anjey
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Nov 24, 2008 12:11 pm

Re: Queue Tree: Priority and Shaping

Thu Dec 11, 2008 9:16 pm

So as I could understand from your quote i can so shaping on outgoing interface with queue tree on outgoing interface and priorities on global-in global-out? But how should i distinguish traffic for shaping? If i do priorities I have 5-6 at least and 20-25 at most packets marks for EACH client. Should i add all this packet marks for shaping queue or should i add postrouting mangle rule that marks all packets with connection mark with single packet mark like "Inet traffic" or something so clearing all "HTTP", "FTP", "Torrents" marks?

Can u please give me some advices with implementing following setup:

I have 4 client types:
DL/UL
256/256 ~ 30 clients
512/512 ~ 20 clients
1M/256k ~ 5 clients
1M/512k ~ 10 clients
All clients also have 10M UL/DL for local resources (local FTP, mmedia services, etc.)
Currently i do shaping only with pcq queue trees.

I need to do traffic priorities for each type of clients but i also want to keep my shaping setup. As i mentioned before i've failed to do this by classifying traffic on the test router and simply adding child queues. I do not want to create separate tree node for each client ('couse it will be hell). Can you please help me with sample config which I could try and learn from?

Thanks!
 
dot-bot
Member Candidate
Member Candidate
Posts: 164
Joined: Tue Oct 11, 2005 7:05 pm

Re: Queue Tree: Priority and Shaping

Thu Dec 11, 2008 9:54 pm

Sure friend. Here you go: http://mum.mikrotik.com/presentations/US08/janism.pdf . And if you use this http://wiki.mikrotik.com/wiki/Basic_tra ... _protocols for QoS you will be a HERO for all. Please paste your configs when you are ready.

P.S. for Layer 7 QoS (which is much better) you will need RouterOS v3.17/latest with /system hardware multi-cpu=no for better stability and a good enough CPU to handle it all. Don't let you router reach 100% CPU for the sake of better service quality.
 
anjey
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Nov 24, 2008 12:11 pm

Re: Queue Tree: Priority and Shaping

Thu Dec 11, 2008 9:59 pm

Appreciate for this links. I think i need a few days to get everything up and when i'll get things working i'll post my config here. (Or if i'l have some problems... hope there will be no problems)

Thx for your help!
 
anjey
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Nov 24, 2008 12:11 pm

Re: Queue Tree: Priority and Shaping

Thu Dec 11, 2008 10:07 pm

So as I can understand from this document

1. Mark packets by service type in Prerouting mangle table
2. Prioritize 'em in global-in queue
3. Mark packets by client type in forward/postrouting mangle table
4. Shape packets in global-out OR interface queues

Is that strategy correct?

Thanx
 
dot-bot
Member Candidate
Member Candidate
Posts: 164
Joined: Tue Oct 11, 2005 7:05 pm

Re: Queue Tree: Priority and Shaping

Thu Dec 11, 2008 10:59 pm

QoS includes several facilities, in the following order:

1. Mangle chain prerouting
2. HTB global-in
3. Mangle chain forward
4. Mangle chain postrouting
5. HTB global-out
6. HTB out interface

So, in one router, you can shape twice if you use:

a) #1 and #2 for first marking and shaping, and #3+#5 for second
b) #1 and #2 for first marking and shaping, and #3+#6 for second
c) #1 and #2 for first marking and shaping, and #4+#5 for second
d) #1 and #2 for first marking and shaping, and #4+#6 for second
So yes, the strategy is correct. I hope to see a correct config as well :D
 
dot-bot
Member Candidate
Member Candidate
Posts: 164
Joined: Tue Oct 11, 2005 7:05 pm

Re: Queue Tree: Priority and Shaping

Thu Dec 11, 2008 11:43 pm

QoS etc will work only for TCP traffic. Currently in my setup I apply the BW management and QoS only to TCP protocol. I still have to test if this will work well on the upload channel of a DSL line though where the max limit is set by the technology itself.

Who is online

Users browsing this forum: disc09 and 21 guests