Syed Jahanzaib Personal Blog to Share Knowledge !

November 24, 2015

Quick Note: Limit interface total bandwidth by Queue Tree

Filed under: Mikrotik Related — Tags: , , — Syed Jahanzaib / Pinochio~:) @ 3:12 PM

1

limit.jpg


Requirement:

We want to limit WAN interface upload/download to 300 mb so that it may not cross this limit to avoid any chocking or lets say for our own bandwidth management.

Solution:

We can use Mangle section to mark up/down traffic on particular interface and then using Queue tree we can achieve our required task.

  • Tested with Mikrotik 6.4x.x (It was also working with older versions as well)
# Mark packets for up/down on WAN interface, we are using ether1 for test, change it as per required
/ip firewall mangle
add action=mark-packet chain=prerouting comment="Mark Packets for Upload on WAN interface / jz" in-interface=ether1 new-packet-mark=wan_upload_pkts passthrough=yes
add action=mark-packet chain=postrouting comment="Mark Packets for Download on WAN interface / jz" new-packet-mark=wan_download_pkts out-interface=ether1 passthrough=yes

# Add Parent Queue to define Maximum Limit that WAN can touch
/queue tree
add comment="Limit Total Traffic to 300mb for WAN interface ether1 / zaib" max-limit=300M name=wan-total-traffic parent=global queue=default

# Now add 2 queues to control download/upload , and point it to use above PARENT queue , so that up/down can remain in limit.
add comment="Limit upload Packets marked by mangle / Jz" name=upload packet-mark=wan_upload_pkts parent=wan-total-traffic queue=default
add comment="Limit download Packets marked by mangle / Jz" name=download packet-mark=wan_download_pkts parent=wan-total-traffic queue=default

 

You can use it to distribute specific amount of bandwidth to specific interface, or lets say subnet or number of users. Example if you have 10 mb of bandwidth link and you want to distribute 5 mb to specific number of users. Lot of other queuing trick you can achieve using Marking/Queue combination !

Regard’s
Syed Jahanzaib

%d bloggers like this: