Burst for each TCP connection

This is little how-to create manual burst using queue tree.

As it is bandwidth control using queue tree first we need to mangle traffic

first i mangle all connections, then i mark first 2Mbytes then i mark the rest of packets

/ip firewall mangle add chain=forward protocol=tcp action=mark-connection new-connection-mark=new_conn passthrough=yes comment="mark all new connections" disabled=no 
/ip firewall mangle add chain=forward protocol=tcp  connection-mark=new_conn connection-bytes=0-2000000 action=mark-packet new-packet-mark=new_packet passthrough=no comment="mark packets" disabled=no 
/ip firewall mangle add chain=forward protocol=tcp connection-mark=new_conn action=mark-packet new-packet-mark=old_packets passthrough=no comment="marking old packets" disabled=no

now, when packets has been marked i need queue types that allows me limit traffic per-user basis, so i have to create 2 queue types.

/queue type add name="PCQ_Upload" kind=pcq pcq-rate=0 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=2000 
/queue type add name="PCQ_Download" kind=pcq pcq-rate=0 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=2000

now i have to limit all the rates using queue tree, i will limit it that way - that first 2Mbits (as in mangle) will have higher priority over rest of traffic where connection bytes exceed 2Mbits.

i assume that connection that is available have 5Mbits full-duplex

/queue tree add name="Main_Upload" parent=Public packet-mark="" limit-at=0 queue=default priority=8 max-limit=5000000 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no 

/ queue tree add name="Up First 2Mbyte" parent=Main_Upload packet-mark=new_packet limit-at=4000000 queue=PCQ_Upload priority=1 max-limit=5000000 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no 

/ queue tree add name="Up Rest Mbytes" parent=Main_Upload packet-mark=old_packets limit-at=1000000 queue=PCQ_Upload priority=8 max-limit=5000000 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no 

/ queue tree add name="Main_Download" parent=Local packet-mark="" limit-at=0 queue=default priority=8 max-limit=5000000 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no 

/ queue tree add name="Down First 2Mbyte" parent=Main_Download packet-mark=new_packet limit-at=4000000 queue=PCQ_Download priority=1 max-limit=5000000 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no 

/ queue tree add name="Down Rest Mbytes" parent=Main_Download packet-mark=old_packets limit-at=1000000 queue=PCQ_Download priority=8 max-limit=5000000 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no

any suggestions? comments?

I was 1day from doing the same thing (make some configuration and paste it in here) - Good work Janis

And what about UDP??? :sunglasses: :sunglasses: :wink:

maybe someone could do that?

hi,

i’m also very interesting in this advances QoS. It will be gret to find a right solution and to put it like an example in one of manual.

I’ll try also to post some scripts

WIKIPEDIA is for examples. If you make some good example script, better place it here: http://wiki.mikrotik.com/wiki/Main_Page

this is very useful and powerful procedure…thank u janisk…i applied it to my MT and it works fine :laughing:

does the marking rules mark the PROXY packets ??
i think it doesnt ..

very important :

from the manual :

connection-bytes=2000000-0 means that the rule matches if more than 2MB has been transfered through the relevant connection

2000000 is 2MByte not 2Mbit…

in that field you enter value of - how many bits to count.

byte is 8 bits

kbyte is 1024 bytes and 8192 bits

so do the math how much 2000000 bits are in Bytes or MBytes

thats right .. but in your post you said 2Mbits which is wrong ..
its 2Mbytes according to the manual..

corrected error in my post, thx for pointing that out.

these really are bytes not bits

then do not mess with M is for 1000000 not 1024*1024 (like in hard-drives)

Hi Janisk,


Thanks for this good configuration, it’s so cool.

But how to target those mangle markings above to some IP addresses or some Group of IP addresses?? Hopefully you won’t mind to teach a newbie like me.


Thks n Rgds,

Men Fung

Hi Janisk,

I did it well… I was confous before, I shared the internet connection to 2 networks, LAN and WLAN, but everything is OK now, I also solve my client’s http download problem that caused all the other clients can not browse. Your configuration is really good… once more thks..

And if I have another problem in future, pls give a hand.


Thks n Rgds,

Men Fung

what mean pubblic in configuration of queue tree

what should be in parent if we use PPPOE client instead? because after that we would limit the user in simple queue.

i have the same problem… probably the default config. All simple is in this.

Sorry.. just read this message…

Public is the name I gave to the interface that connected to the ISP.


thks,

Why is on Parent Upload and Download queue queue type set to default and not to PCQ_UP/PCQ_DL?

Anyone…?

because PCQ do not affect child queues, so it really makes no matter, what type you set for parent: parent is just to see total traffic