The main goal for traffic prioritization is to limit high traffic connections and prioritize that is not bandwidth-hog

My favorite script to do just that is through Connection-Rate

Connection-Rate captures traffic intensive connections so you can mark them

Quick Start

/ip firewall mangle
add chain=forward action=mark-connection connection-mark=!heavy_traffic_conn \
    new-connection-mark=all_conn
add chain=forward action=mark-connection connection-bytes=500000-0 \
    connection-mark=all_conn connection-rate=200k-100M \
    new-connection-mark=heavy_traffic_conn protocol=tcp
add chain=forward action=mark-connection connection-bytes=500000-0 \
    connection-mark=all_conn connection-rate=200k-100M \
    new-connection-mark=heavy_traffic_conn protocol=udp
add chain=forward action=mark-packet connection-mark=heavy_traffic_conn \
    new-packet-mark=heavy_traffic passthrough=no
add chain=forward action=mark-packet connection-mark=all_conn \
    new-packet-mark=other_traffic passthrough=no

/queue tree
add name=upload parent=ether1 max-limit=10M
add name=other_upload parent=upload limit-at=6M max-limit=10M \
    packet-mark=other_traffic priority=1
add name=heavy_upload parent=upload limit-at=3M max-limit=10M \
    packet-mark=heavy_traffic priority=8
add name=download parent=bridgeLocal max-limit=10M
add name=other_download parent=download limit-at=6M max-limit=10M \
    packet-mark=other_traffic priority=1
add name=heavy_download parent=download limit-at=3M max-limit=10M \
    packet-mark=heavy_traffic priority=8

Be sure to check the parent in queue tree since it will depend on your current setup. If your internet is coming from ether1, then the upload parent should be ether1. For the download, check the name of your bridge and change the download parent base on its name

You can also change the script according to your available bandwidth in /queue tree. You do not need to change anything in the firewall mangle.

Leave a Reply

Your email address will not be published. Required fields are marked *