Bandwidth Management Fast-Track ! No theory, Just coding …
Requirement:
We want to restrict client with 128 kbps. BUT also want to prioritize it based on traffic type.
Example …
Client-A IP = 101.11.14.1 (my-desktop)
Bandwidth Allowed = 128k Total
Priority 1 = ICMP Traffic
Priority 2 = HTTPS Traffic
Priority 3 = HTTP Traffic
Priority 4 = All Other Traffic
Marking traffic from Client-A in MANGLE
First Mark User Traffic in Mangle Section.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/ip firewall mangle # Mark HTTP 80Traffic Connections/Packets add action=mark-connection chain=forward comment="my-Desktop - Mark HTTP Port 80" dst-port=80 new-connection-mark=my_Desktop_http_80_Conn protocol=tcp src-address=101.11.14.1 add action=mark-packet chain=forward connection-mark=my_Desktop_http_80_Conn new-packet-mark=my_Desktop_http_80_pkts passthrough=no # Mark HTTPS 443 Traffic Connections/Packets add action=mark-connection chain=forward comment="my-Desktop - Mark HTTPS Port 443" dst-port=443 new-connection-mark=my_Desktop_https_443_Conn protocol=tcp src-address=101.11.14.1 add action=mark-packet chain=forward connection-mark=Zaib_Desktop_https_443_Conn new-packet-mark=my_Desktop_httsp_443_pkts passthrough=no add action=mark-connection chain=forward comment="my Desktop - ICMP" new-connection-mark=my_Desktop_ICMP_Conn protocol=icmp src-address=101.11.14.1 # Mark ICMP TRAFFIC Connections/Packets add action=mark-connection chain=forward comment="my Desktop - ICMP" new-connection-mark=my_Desktop_ICMP_Conn protocol=icmp src-address=101.11.14.1 add action=mark-packet chain=forward connection-mark=my_Desktop_ICMP_Conn new-packet-mark=my_Desktop_ICMP_Pkts passthrough=no # Mark ALL OTHER Traffic Connections/Packets add action=mark-connection chain=forward comment="my Desktop - All Other Traffic" connection-mark=no-mark new-connection-mark=my_Desktop_All_Other_Traffic src-address=101.11.14.1 add action=mark-packet chain=forward connection-mark=my_Desktop_All_Other_Traffic new-packet-mark=my_Desktop_All_Other_Pkts passthrough=no |
Creating QUEUE TREE to restrict and Prioritize traffic for above marked packets
Now we we will create Parent Queue Tree to restrict 128k then other child queues to prioritize his traffic base on marked packets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# Mark QUEUE TREE /queue tree add limit-at=128k max-limit=128k name="my Dekstop - 128k" parent=global queue=default # 1st Priority to ICMP Traffic from above 128k Parent Queue add name="PRIO 1 - ICMP" packet-mark=my_Desktop_ICMP_Pkts parent="my Dekstop - 128k" queue=default priority=1 # 2nd Priority to HTTPS 443 Traffic from 128k Parent Queue add name="PRIO 2 - HTTPS" packet-mark=my_Desktop_httsp_443_pkts parent="my Dekstop - 128k" queue=default priority=2 # 3rd Priority to HTTP Port 80 Traffic from 128k Parent Queue add name="PRIO 3 - HTTP" packet-mark=my_Desktop_http_80_pkts parent="my Dekstop - 128k" queue=default priority=3 # 4th Priority to All Other Traffic from 128k Parent Queue add name="PRIO 4 - All Other Traffic" packet-mark=my_Desktop_All_Other_Pkts parent="my Dekstop - 128k" queue=default priority=8 |
RESULT # 1
When ICMP have low priority over other protocols
BEFORE ICMP PRIORITY
RESULT # 2
When ICMP have high priority over others
*** A F T E R ***
Comments
0 comments
Please sign in to leave a comment.