The primary goal of traffic prioritization is to manage high-traffic connections effectively, giving precedence to those that are less bandwidth-intensive. This article will guide you through the process of achieving this using a script known as Connection-Rate. This script is designed to identify and manage traffic-intensive connections, allowing you to mark them for prioritization.

To begin, you’ll need to implement the Connection-Rate script. This script is a powerful tool that can help you regulate your network traffic more efficiently.

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

It’s crucial to verify the parent in the queue tree, as this will vary based on your current setup. If your internet connection is sourced from ether1, then the upload parent should be ether1. For the download parent, you’ll need to check the name of your bridge and adjust the download parent accordingly.

The Connection-Rate script can be modified to suit your available bandwidth in the /queue tree. This flexibility allows you to tailor the script to your specific network needs, ensuring optimal performance. Remember, there’s no need to make any changes in the firewall mangle. This feature remains constant, allowing you to focus on optimizing other aspects of your network. By following this guide, you can effectively manage your MikroTik traffic prioritization, ensuring a smoother, more efficient network experience

.

4 thoughts on “Optimizing MikroTik Traffic Prioritization: A Comprehensive Guide to Connection-Rate Script”

Leave a Reply

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