0% found this document useful (0 votes)
37 views

Qos 2020

This document configures queue scheduling and traffic prioritization/marking on a router or firewall. It defines several queues using different queueing disciplines (e.g. SFQ, PCQ). It then uses traffic marking rules to classify and mark different traffic flows based on protocols, ports and packet properties. These marks are then used by the queueing subsystem to place packets into specific priority queues for scheduling and rate limiting.

Uploaded by

Rafael Sena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Qos 2020

This document configures queue scheduling and traffic prioritization/marking on a router or firewall. It defines several queues using different queueing disciplines (e.g. SFQ, PCQ). It then uses traffic marking rules to classify and mark different traffic flows based on protocols, ports and packet properties. These marks are then used by the queueing subsystem to place packets into specific priority queues for scheduling and rate limiting.

Uploaded by

Rafael Sena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

/queue type

set 0 kind=sfq
set 1 kind=sfq
add kind=pcq name=qos pcq-classifier=src-address,dst-address \
pcq-dst-address6-mask=64 pcq-rate=600M pcq-src-address6-mask=64
set 6 kind=sfq
set 7 kind=sfq
set 8 kind=sfq
set 9 kind=sfq
set 10 kind=sfq

/queue simple
add name=DNS packet-marks=dns-prio priority=1/1 queue=qos/qos target=""
add name=ICMP packet-marks=icmp priority=2/2 queue=qos/qos target=""
add name=ZAP packet-marks=zapzap priority=3/3 queue=qos/qos target=""
add name=FREE-FIRE packet-marks=free-fire priority=3/3 queue=qos/qos target=""
add name=MEET packet-marks=meet priority=3/3 queue=qos/qos target=""

/queue tree
add max-limit=600M name=QOS-DOWN packet-mark=QoS parent=global priority=1 \
queue=qos
add max-limit=600M name=1-DNS packet-mark=dns-prio parent=QOS-DOWN priority=1 \
queue=qos
add max-limit=600M name=2-ICMP packet-mark=icmp parent=QOS-DOWN priority=2 \
queue=qos
add max-limit=600M name=2-FREE-FIRE packet-mark=free-fire parent=QOS-DOWN \
priority=2 queue=qos
add max-limit=600M name=3-MEET packet-mark=meet parent=QOS-DOWN priority=3 \
queue=qos
add max-limit=600M name=3-ZAPZAP packet-mark=zapzap parent=QOS-DOWN priority=3 \
queue=qos
add max-limit=600M name=6-HTTP-HTTPS-OUTROS parent=QOS-DOWN priority=6 queue=\
qos
add comment="porta 80 e 443" max-limit=600M name=1->1k-500k parent=\
6-HTTP-HTTPS-OUTROS priority=1 queue=qos
add max-limit=600M name=1k packet-mark=1k parent=1->1k-500k priority=1 queue=\
qos
add max-limit=600M name=5k packet-mark=5k parent=1->1k-500k priority=2 queue=\
qos
add max-limit=600M name=10k packet-mark=10k parent=1->1k-500k priority=3 queue=\
qos
add max-limit=600M name=100k packet-mark=100k parent=1->1k-500k priority=4 \
queue=qos
add max-limit=600M name=200k packet-mark=200k parent=1->1k-500k priority=5 \
queue=qos
add max-limit=600M name=500k packet-mark=500k parent=1->1k-500k priority=6 \
queue=qos
add max-limit=600M name=outros-leves packet-mark=outros-leves parent=1->1k-500k \
queue=qos
add comment="outras portas como IPTV, jogos, etc.." max-limit=600M name=\
2->OUTROS parent=6-HTTP-HTTPS-OUTROS priority=2 queue=qos
add max-limit=600M name=1-500k-outros packet-mark=500k-outros parent=2->OUTROS \
priority=1 queue=qos
add max-limit=600M name=2-outros2-leves packet-mark=outros2-leves parent=\
2->OUTROS priority=2 queue=qos
add max-limit=600M name=3-5M-outros packet-mark=5000k-outros parent=2->OUTROS \
priority=3 queue=qos
add max-limit=600M name=4-20M-outros packet-mark=20000k-outros parent=2->OUTROS \
priority=4 queue=qos
add max-limit=600M name=5-50M-outros packet-mark=50000k-outros parent=2->OUTROS \
priority=5 queue=qos
add comment="porta 80 e 443" max-limit=600M name=3->1M-20M parent=\
6-HTTP-HTTPS-OUTROS priority=3 queue=qos
add max-limit=600M name=1-1M-2M packet-mark=1000k parent=3->1M-20M priority=2 \
queue=qos
add max-limit=600M name=2-2M-3M packet-mark=2000k parent=3->1M-20M priority=3 \
queue=qos
add max-limit=600M name=3-3M-5M packet-mark=3000k parent=3->1M-20M priority=4 \
queue=qos
add max-limit=600M name=4-5M-20M packet-mark=5000k parent=3->1M-20M priority=5 \
queue=qos
add comment="porta 80 e 443" max-limit=600M name=4->20M-emdiante parent=\
6-HTTP-HTTPS-OUTROS priority=4 queue=qos
add max-limit=600M name=1-20M-50M packet-mark=20000k parent=4->20M-emdiante \
priority=1 queue=qos
add max-limit=600M name=2-50M-200M packet-mark=50000k parent=4->20M-emdiante \
priority=2 queue=qos
add max-limit=600M name=3-200M-emdiante packet-mark=200M-emdiante parent=\
4->20M-emdiante priority=3 queue=qos

/ip firewall mangle


add action=jump chain=forward comment="QOS - nao remover" jump-target=QoS \
out-interface=ether1
add action=jump chain=forward comment="QOS - nao remover" in-interface=ether1 \
jump-target=QoS
add action=mark-packet chain=QoS comment="QOS - DOWNLOAD/UPLOAD" \
new-packet-mark=QoS passthrough=yes
add action=mark-packet chain=QoS comment=QOS-DNS dst-port=53 new-packet-mark=\
dns-prio packet-mark=QoS passthrough=no protocol=udp
add action=mark-packet chain=QoS new-packet-mark=dns-prio packet-mark=QoS \
passthrough=no protocol=udp src-port=53
add action=mark-packet chain=QoS dst-port=53 new-packet-mark=dns-prio \
packet-mark=QoS passthrough=no protocol=tcp
add action=mark-packet chain=QoS new-packet-mark=dns-prio packet-mark=QoS \
passthrough=no protocol=tcp src-port=53
add action=mark-packet chain=QoS comment=QOS-ICMP new-packet-mark=icmp \
packet-mark=QoS passthrough=no protocol=icmp
add action=mark-packet chain=QoS comment=QOS-Whatsapp-chamadas/chat dst-port=\
3478,3479 new-packet-mark=zapzap packet-mark=QoS passthrough=no protocol=\
udp
add action=mark-packet chain=QoS new-packet-mark=zapzap packet-mark=QoS \
passthrough=no protocol=udp src-port=3478,3479
add action=mark-packet chain=QoS dst-port=5220-5228 new-packet-mark=zapzap \
packet-mark=QoS passthrough=no protocol=tcp
add action=mark-packet chain=QoS new-packet-mark=zapzap packet-mark=QoS \
passthrough=no protocol=tcp src-port=5220-5228
add action=mark-packet chain=QoS comment=HTTP-HTTPS-pesados connection-bytes=\
500000-0 connection-rate=200k-100M new-packet-mark=con_pesadas packet-mark=\
QoS passthrough=yes protocol=udp src-port=80,443
add action=mark-packet chain=QoS connection-bytes=500000-0 connection-rate=\
200k-100M new-packet-mark=con_pesadas packet-mark=QoS passthrough=yes \
protocol=tcp src-port=80,443
add action=mark-packet chain=QoS connection-bytes=500000-0 connection-rate=\
200k-100M dst-port=80,443 new-packet-mark=con_pesadas packet-mark=QoS \
passthrough=yes protocol=udp
add action=mark-packet chain=QoS connection-bytes=500000-0 connection-rate=\
200k-100M dst-port=80,443 new-packet-mark=con_pesadas packet-mark=QoS \
passthrough=yes protocol=tcp
add action=mark-packet chain=QoS comment=HTTP-HTTPS-leves new-packet-mark=\
con_leves packet-mark=QoS passthrough=yes protocol=udp src-port=80,443
add action=mark-packet chain=QoS new-packet-mark=con_leves packet-mark=QoS \
passthrough=yes protocol=tcp src-port=80,443
add action=mark-packet chain=QoS dst-port=80,443 new-packet-mark=con_leves \
packet-mark=QoS passthrough=yes protocol=udp
add action=mark-packet chain=QoS dst-port=80,443 new-packet-mark=con_leves \
packet-mark=QoS passthrough=yes protocol=tcp
add action=mark-packet chain=QoS comment=QOS-FREE-FIRE dst-port=\
9000-9020,10000-10020,11000-11020,12000-12020,13000-13020 new-packet-mark=\
free-fire packet-mark=QoS passthrough=no protocol=udp
add action=mark-packet chain=QoS new-packet-mark=free-fire packet-mark=QoS \
passthrough=no protocol=udp src-port=\
9000-9020,10000-10020,11000-11020,12000-12020,13000-13020
add action=mark-packet chain=QoS dst-port=\
9000-9020,10000-10020,11000-11020,12000-12020,13000-13020 new-packet-mark=\
free-fire packet-mark=QoS passthrough=no protocol=tcp
add action=mark-packet chain=QoS new-packet-mark=free-fire packet-mark=QoS \
passthrough=no protocol=tcp src-port=\
9000-9020,10000-10020,11000-11020,12000-12020,13000-13020
add action=mark-packet chain=QoS new-packet-mark=free-fire packet-mark=QoS \
passthrough=no protocol=udp src-port=6000-6010,7000-7010,8000-8010
add action=mark-packet chain=QoS dst-port=6000-6010,7000-7010,8000-8010 \
new-packet-mark=free-fire packet-mark=QoS passthrough=no protocol=udp
add action=mark-packet chain=QoS new-packet-mark=free-fire packet-mark=QoS \
passthrough=no protocol=tcp src-port=6000-6010,7000-7010,8000-8010
add action=mark-packet chain=QoS dst-port=6000-6010,7000-7010,8000-8010 \
new-packet-mark=free-fire packet-mark=QoS passthrough=no protocol=tcp
add action=mark-packet chain=QoS comment="QOS-GSuite, Google Meet" \
new-packet-mark=meet packet-mark=QoS passthrough=no protocol=udp src-port=\
19302-19309
add action=mark-packet chain=QoS dst-port=19302-19309 new-packet-mark=meet \
packet-mark=QoS passthrough=no protocol=udp
add action=mark-packet chain=QoS comment="inicio con_leves" connection-bytes=\
1-1000 new-packet-mark=1k packet-mark=con_leves passthrough=no
add action=mark-packet chain=QoS connection-bytes=1000-5000 new-packet-mark=5k \
packet-mark=con_leves passthrough=no
add action=mark-packet chain=QoS connection-bytes=5000-10000 new-packet-mark=\
10k packet-mark=con_leves passthrough=no
add action=mark-packet chain=QoS connection-bytes=10000-100000 new-packet-mark=\
100k packet-mark=con_leves passthrough=no
add action=mark-packet chain=QoS connection-bytes=100000-200000 \
new-packet-mark=200k packet-mark=con_leves passthrough=no
add action=mark-packet chain=QoS connection-bytes=200000-500000 \
new-packet-mark=500k packet-mark=con_leves passthrough=no
add action=mark-packet chain=QoS connection-bytes=500000-0 new-packet-mark=\
outros-leves packet-mark=con_leves passthrough=no
add action=mark-packet chain=QoS comment="inicio con_pesadas" connection-bytes=\
500000-1000000 new-packet-mark=1000k packet-mark=con_pesadas passthrough=no
add action=mark-packet chain=QoS connection-bytes=1000000-2000000 \
new-packet-mark=2000k packet-mark=con_pesadas passthrough=no
add action=mark-packet chain=QoS connection-bytes=2000000-3000000 \
new-packet-mark=3000k packet-mark=con_pesadas passthrough=no
add action=mark-packet chain=QoS connection-bytes=3000000-5000000 \
new-packet-mark=5000k packet-mark=con_pesadas passthrough=no
add action=mark-packet chain=QoS connection-bytes=5000000-20000000 \
new-packet-mark=20000k packet-mark=con_pesadas passthrough=no
add action=mark-packet chain=QoS connection-bytes=20000000-50000000 \
new-packet-mark=50000k packet-mark=con_pesadas passthrough=no
add action=mark-packet chain=QoS connection-bytes=50000000-200000000 \
new-packet-mark=200M-emdiante packet-mark=con_pesadas passthrough=no
add action=mark-packet chain=QoS comment="OUTROS - DOWNLOADS - pesados" \
connection-bytes=500000-0 connection-rate=200k-100M new-packet-mark=\
outros_pesadas packet-mark=QoS passthrough=yes protocol=udp
add action=mark-packet chain=QoS connection-bytes=500000-0 connection-rate=\
200k-100M new-packet-mark=outros_pesadas packet-mark=QoS passthrough=yes \
protocol=tcp
add action=mark-packet chain=QoS comment="OUTROS - DOWNLOADS - leves" \
new-packet-mark=outros_leves packet-mark=QoS passthrough=yes protocol=udp
add action=mark-packet chain=QoS new-packet-mark=outros_leves packet-mark=QoS \
passthrough=yes protocol=tcp
add action=mark-packet chain=QoS connection-bytes=1-500000 new-packet-mark=\
500k-outros packet-mark=outros_leves passthrough=no
add action=mark-packet chain=QoS connection-bytes=500000-0 new-packet-mark=\
outros2-leves packet-mark=outros_leves passthrough=no
add action=mark-packet chain=QoS connection-bytes=500000-5000000 \
new-packet-mark=5000k-outros packet-mark=outros_pesadas passthrough=no
add action=mark-packet chain=QoS connection-bytes=5000000-20000000 \
new-packet-mark=20000k-outros packet-mark=outros_pesadas passthrough=no
add action=mark-packet chain=QoS connection-bytes=20000000-50000000 \
new-packet-mark=50000k-outros packet-mark=outros_pesadas passthrough=no
add action=mark-connection chain=forward comment=9-QoS_Client_PPPoE disabled=\
yes in-interface=all-ppp new-connection-mark=Conn_QoS_Down_TCP passthrough=\
yes protocol=tcp
add action=mark-packet chain=forward connection-bytes=0-524288 connection-mark=\
Conn_QoS_Down_TCP disabled=yes new-packet-mark=QoS_512K_Client passthrough=\
yes protocol=tcp
add action=mark-packet chain=forward connection-bytes=524289-5242880 \
connection-mark=Conn_QoS_Down_TCP disabled=yes new-packet-mark=\
QoS_5M_Client passthrough=yes protocol=tcp
add action=mark-packet chain=forward connection-bytes=5242881-20971520 \
connection-mark=Conn_QoS_Down_TCP disabled=yes new-packet-mark=\
QoS_20M_Client passthrough=yes protocol=tcp
add action=mark-packet chain=forward connection-bytes=20971521-52428800 \
connection-mark=Conn_QoS_Down_TCP disabled=yes new-packet-mark=\
QoS_50M_Client passthrough=yes protocol=tcp
add action=mark-packet chain=forward connection-bytes=52428801-0 \
connection-mark=Conn_QoS_Down_TCP disabled=yes new-packet-mark=\
QoS_Infinity_Client passthrough=yes protocol=tcp
add action=mark-connection chain=forward disabled=yes in-interface=all-ppp \
new-connection-mark=Conn_QoS_Down_UDP passthrough=yes protocol=udp
add action=mark-packet chain=forward connection-bytes=0-524288 connection-mark=\
Conn_QoS_Down_UDP disabled=yes new-packet-mark=QoS_512K_Client passthrough=\
yes protocol=udp
add action=mark-packet chain=forward connection-bytes=524289-5242880 \
connection-mark=Conn_QoS_Down_UDP disabled=yes new-packet-mark=\
QoS_5M_Client passthrough=yes protocol=udp
add action=mark-packet chain=forward connection-bytes=5242881-20971520 \
connection-mark=Conn_QoS_Down_UDP disabled=yes new-packet-mark=\
QoS_20M_Client passthrough=yes protocol=udp
add action=mark-packet chain=forward connection-bytes=20971521-52428800 \
connection-mark=Conn_QoS_Down_UDP disabled=yes new-packet-mark=\
QoS_50M_Client passthrough=yes protocol=udp
add action=mark-packet chain=forward connection-bytes=52428801-0 \
connection-mark=Conn_QoS_Down_UDP disabled=yes new-packet-mark=\
QoS_Infinity_Client passthrough=yes protocol=udp

You might also like