Burst for each TCP connection

By admin

Diambil dari http://forum.mikrotik.com/viewtopic.php?t=12870

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

No Comments