Community discussions

MikroTik App
 
Gr0ove
just joined
Topic Author
Posts: 20
Joined: Thu Apr 03, 2014 6:58 pm

Internet connection bandwidth upload/download QoS

Wed Jan 21, 2015 1:50 pm

Hello there,

I'm posting this situation due to the fact that, after a lot of searching, reading and testing based on Queue tree examples for controling the internet bandwidth usage I wasn't successful implementing a Queue tree like the next one:

DOWNLOAD_TOTAL (Max limit: 10Mbps) <-- parent
-Network1_download (max limit: 4Mbps) <-- child of DOWNLOAD_TOTAL
-Network2_download (max limit: 2Mbps) <-- child of DOWNLOAD_TOTAL
-Network3_download (max limit: 1Mbps) <-- child of DOWNLOAD_TOTAL
UPLOAD_TOTAL (Max limit: 4Mbps) <-- parent
-Network1_upload (max limit: 2Mbps) <-- child of UPLOAD_TOTAL
-Network2_upload (max limit: 1Mbps) <-- child of UPLOAD_TOTAL
-Network3_upload (max limit: 512kbps) <-- child of UPLOAD_TOTAL

Using simple queues I can limit the bandwidth for each network based on their network address (i.e. 192.168.1.0/24) separately no problem at all but that's not what I'm looking to achieve here.
I'm looking to have two parents (DOWNLOAD_TOTAL and UPLOAD_TOTAL) and their children would be the download and upload limits respectively like the tree scheme presented above (nothing fancy at all but not getting there unfortunatly...)

I tryed different kinds of connection and packets marking in the mangles (forward, prerouting, postrouting, etc) but I just can't get how to create the parents traffic marking to work so that they would be the "MASTER" of the total type bandwidth (download or upload) they supposed to manage.

Like I said, the objective I'm trying to achieve isn't that fancy but I've been in circles around it for quite some time now.

For testing purposes I have a simple network scheme mounted like the next image:
Image

Any guidelines how to achieve such a bandwidth queue tree?

Thanks in advance to everyone
 
Gr0ove
just joined
Topic Author
Posts: 20
Joined: Thu Apr 03, 2014 6:58 pm

Re: Internet connection bandwidth upload/download QoS

Wed Jan 21, 2015 6:24 pm

I think I got it... :D

For the connection and packet marking, in mangles:
/ip firewall mangle
add action=mark-connection chain=postrouting comment=network1-download dst-address=\
    192.168.1.0/24 new-connection-mark=network1_download_conn
add action=mark-packet chain=postrouting connection-mark=network1_download_conn \
    new-packet-mark=network1_download_packets passthrough=no
add action=mark-connection chain=prerouting comment=network1-upload \
    new-connection-mark=network1_upload_conn src-address=192.168.1.0/24
add action=mark-packet chain=prerouting connection-mark=network1_upload_conn \
    new-packet-mark=network1_upload_packets passthrough=no
add action=mark-connection chain=postrouting comment=network2-download dst-address=\
    192.168.2.0/24 new-connection-mark=network2_download_conn
add action=mark-packet chain=postrouting connection-mark=network2_download_conn \
    new-packet-mark=network2_download_packets passthrough=no
add action=mark-connection chain=prerouting comment=network2-upload \
    new-connection-mark=network2_upload_conn src-address=192.168.2.0/24
add action=mark-packet chain=prerouting connection-mark=network2_upload_conn \
    new-packet-mark=network2_upload_packets passthrough=no
add action=mark-connection chain=postrouting comment=network3-download dst-address=\
    192.168.3.0/24 new-connection-mark=network3_download_conn
add action=mark-packet chain=postrouting connection-mark=network3_download_conn \
    new-packet-mark=network3_download_packets passthrough=no
add action=mark-connection chain=prerouting comment=network3-upload \
    new-connection-mark=network3_upload_conn src-address=192.168.3.0/24
add action=mark-packet chain=prerouting connection-mark=network3_upload_conn \
    new-packet-mark=network3_upload_packets passthrough=no
For que Queue tree:
/queue tree
add max-limit=10M name=DOWNLOAD parent=global queue=default
add max-limit=4M name=UPLOAD parent=global queue=default
add max-limit=4M name=network1-download packet-mark=network1_download_packets parent=\
    DOWNLOAD queue=default
add max-limit=2M name=network1-upload packet-mark=network1_upload_packets parent=UPLOAD \
    queue=default
add max-limit=2M name=network2-download packet-mark=network2_download_packets parent=\
    DOWNLOAD priority=1 queue=default
add max-limit=1M name=network2-upload packet-mark=network2_upload_packets parent=UPLOAD \
    queue=default
add max-limit=1M name=network3-download packet-mark=network3_download_packets parent=\
    DOWNLOAD priority=1 queue=default
add max-limit=512k name=network3-upload packet-mark=network3_upload_packets parent=UPLOAD \
    queue=default
I think I was marking the packets with the wrong chain...bah...

For the time being it's functional :D but still in tests

Thanks