/ip firewall mangle
#DOWNLOADS
add action=mark-connection chain=prerouting comment="==// FLUXO ENTRADA TCP (D\
OWN) \\\\== 80 (http) | 443 (ssl) | 21 (ftp) | 22 (ssh/sftp) | 23 (telnet)\
\_| 110 (pop3) | 995 (pop_ssl) | 143 (imap) | 993 (imap_ssl)" disabled=no \
in-interface=pppoe-out1 new-connection-mark=conn_fluxo_down passthrough=\
yes protocol=tcp src-port=80,443,21,22,23,110,995,143,993
add action=mark-packet chain=prerouting comment="" connection-bytes=0-256000 \
connection-mark=conn_fluxo_down disabled=no in-interface=pppoe-out1 \
new-packet-mark=pac_fluxo_down_0_256 passthrough=no
add action=mark-packet chain=prerouting comment="" connection-bytes=\
256001-512000 connection-mark=conn_fluxo_down disabled=no in-interface=\
pppoe-out1 new-packet-mark=pac_fluxo_down_256_512 passthrough=no
add action=mark-packet chain=prerouting comment="" connection-bytes=\
512001-2048000 connection-mark=conn_fluxo_down disabled=no in-interface=\
pppoe-out1 new-packet-mark=pac_fluxo_down_512_2M passthrough=no
add action=mark-packet chain=prerouting comment="" connection-bytes=\
2048001-4096000 connection-mark=conn_fluxo_down disabled=no in-interface=\
pppoe-out1 new-packet-mark=pac_fluxo_down_2M_4M passthrough=no
add action=mark-packet chain=prerouting comment="" connection-bytes=\
4096001-10240000 connection-mark=conn_fluxo_down disabled=no \
in-interface=pppoe-out1 new-packet-mark=pac_fluxo_down_4M_10M \
passthrough=no
add action=mark-packet chain=prerouting comment="" connection-bytes=\
10240001-20480000 connection-mark=conn_fluxo_down disabled=no \
in-interface=pppoe-out1 new-packet-mark=pac_fluxo_down_10M_20M \
passthrough=no
add action=mark-packet chain=prerouting comment="" connection-bytes=\
20480001-102400000 connection-mark=conn_fluxo_down disabled=no \
in-interface=pppoe-out1 new-packet-mark=pac_fluxo_down_20M_100M \
passthrough=no
add action=mark-packet chain=prerouting comment="" connection-bytes=\
102400001-0 connection-mark=conn_fluxo_down disabled=no in-interface=\
pppoe-out1 new-packet-mark=pac_fluxo_down_100M_... passthrough=no
#UPLOADS
add action=mark-connection chain=postrouting comment="==// FLUXO SA\CDDA TCP (\
UPLOAD) \\\\== 80 (http) | 443 (ssl) | 21 (ftp) | 22 (ssh/sftp) | 23 (teln\
et) | 110 (pop3) | 995 (pop_ssl) | 143 (imap) | 993 (imap_ssl) | 25 (smtp)\
" disabled=no dst-port=80,443,21,22,23,110,995,143,993,25 \
new-connection-mark=conn_fluxo_up out-interface=pppoe-out1 passthrough=\
yes protocol=tcp
add action=mark-packet chain=postrouting comment="" connection-bytes=0-64000 \
connection-mark=conn_fluxo_up disabled=no new-packet-mark=\
pac_fluxo_up_0_64 out-interface=pppoe-out1 passthrough=no
add action=mark-packet chain=postrouting comment="" connection-bytes=\
64001-128000 connection-mark=conn_fluxo_up disabled=no new-packet-mark=\
pac_fluxo_up_64_128 out-interface=pppoe-out1 passthrough=no
add action=mark-packet chain=postrouting comment="" connection-bytes=\
128001-512000 connection-mark=conn_fluxo_up disabled=no new-packet-mark=\
pac_fluxo_up_128_512 out-interface=pppoe-out1 passthrough=no
add action=mark-packet chain=postrouting comment="" connection-bytes=\
512001-1024000 connection-mark=conn_fluxo_up disabled=no new-packet-mark=\
pac_fluxo_up_512_1M out-interface=pppoe-out1 passthrough=no
add action=mark-packet chain=postrouting comment="" connection-bytes=\
1024001-2048000 connection-mark=conn_fluxo_up disabled=no \
new-packet-mark=pac_fluxo_up_1M_2M out-interface=pppoe-out1 passthrough=\
no
add action=mark-packet chain=postrouting comment="" connection-bytes=\
2048001-3072000 connection-mark=conn_fluxo_up disabled=no \
new-packet-mark=pac_fluxo_up_2M_3M out-interface=pppoe-out1 passthrough=\
no
add action=mark-packet chain=postrouting comment="" connection-bytes=\
3072001-5120000 connection-mark=conn_fluxo_up disabled=no \
new-packet-mark=pac_fluxo_up_3M_5M out-interface=pppoe-out1 passthrough=\
no
add action=mark-packet chain=postrouting comment="" connection-bytes=\
5120000-0 connection-mark=conn_fluxo_up disabled=no new-packet-mark=\
pac_fluxo_up_5M_... out-interface=pppoe-out1 passthrough=no
#QUEUES PCQ
/queue type
add kind=pcq name=PCQ_Down_Free pcq-classifier=dst-address pcq-limit=50 \
pcq-rate=0 pcq-total-limit=2000
add kind=pcq name=PCQ_Up_Free pcq-classifier=src-address pcq-limit=50 \
pcq-rate=0 pcq-total-limit=2000
#QUEUE TREE
/queue tree
#DOWN
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=5121k name="=((( ENTRADA -DOWN- )))=" parent=global-in \
priority=8
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 1a DOWN" parent="=((( ENTRADA -DOWN- )))=" \
priority=1
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=2M \
max-limit=5120k name="-+--|----> down TCP 0~256" packet-mark=\
pac_fluxo_down_0_256 parent="==// 1a DOWN" priority=1 queue=PCQ_Down_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 2a DOWN" parent="=((( ENTRADA -DOWN- )))=" \
priority=2
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=700k \
max-limit=5120k name="-+--|----> down TCP 256~512" packet-mark=\
pac_fluxo_down_256_512 parent="==// 2a DOWN" priority=2 queue=\
PCQ_Down_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 3a DOWN" parent="=((( ENTRADA -DOWN- )))=" \
priority=3
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=400k \
max-limit=4M name="-+--|----> down TCP 512~2M" packet-mark=\
pac_fluxo_down_512_2M parent="==// 3a DOWN" priority=3 queue=\
PCQ_Down_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 4a DOWN" parent="=((( ENTRADA -DOWN- )))=" \
priority=4
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=300k \
max-limit=3M name="-+--|----> down TCP 2M~4M" packet-mark=\
pac_fluxo_down_2M_4M parent="==// 4a DOWN" priority=4 queue=PCQ_Down_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 5a DOWN" parent="=((( ENTRADA -DOWN- )))=" \
priority=5
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=200k \
max-limit=2M name="-+--|----> down TCP 4M~10M" packet-mark=\
pac_fluxo_down_4M_10M parent="==// 5a DOWN" priority=5 queue=\
PCQ_Down_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 6a DOWN" parent="=((( ENTRADA -DOWN- )))=" \
priority=6
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=150k \
max-limit=1500k name="-+--|----> down TCP 10M~20M" packet-mark=\
pac_fluxo_down_10M_20M parent="==// 6a DOWN" priority=6 queue=\
PCQ_Down_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 7a DOWN" parent="=((( ENTRADA -DOWN- )))=" \
priority=7
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=100k \
max-limit=1M name="-+--|----> down TCP 20M~100M" packet-mark=\
pac_fluxo_down_20M_100M parent="==// 7a DOWN" priority=7 queue=\
PCQ_Down_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 8a DOWN" parent="=((( ENTRADA -DOWN- )))=" \
priority=8
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=36k \
max-limit=1M name="-+--|----> down tcp 100M~..." packet-mark=\
pac_fluxo_down_100M_... parent="==// 8a DOWN" priority=8 queue=\
PCQ_Down_Free
#UP
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=512k name="=((( SA\CDDA -UP- )))=" parent=global-out priority=8
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 1a UP" parent="=((( SA\CDDA -UP- )))=" priority=1
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=200k \
max-limit=512k name="-+--|----> up TCP 0~64" packet-mark=\
pac_fluxo_up_0_64 parent="==// 1a UP" priority=1 queue=PCQ_Up_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 2a UP" parent="=((( SA\CDDA -UP- )))=" priority=2
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=60k \
max-limit=512k name="-+--|----> up TCP 64~128" packet-mark=\
pac_fluxo_up_64_128 parent="==// 2a UP" priority=2 queue=PCQ_Up_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 3a UP" parent="=((( SA\CDDA -UP- )))=" priority=3
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=30k \
max-limit=512k name="-+--|----> up TCP 128~512" packet-mark=\
pac_fluxo_up_128_512 parent="==// 3a UP" priority=3 queue=PCQ_Up_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 4a UP" parent="=((( SA\CDDA -UP- )))=" priority=4
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=15k \
max-limit=512k name="-+--|----> up TCP 512~1M" packet-mark=\
pac_fluxo_up_512_1M parent="==// 4a UP" priority=4 queue=PCQ_Up_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 5a UP" parent="=((( SA\CDDA -UP- )))=" priority=5
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=13k \
max-limit=400k name="-+--|----> up TCP 1M~2M" packet-mark=\
pac_fluxo_up_1M_2M parent="==// 5a UP" priority=5 queue=PCQ_Up_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 6a UP" parent="=((( SA\CDDA -UP- )))=" priority=6
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=12k \
max-limit=300k name="-+--|----> up TCP 2M~3M" packet-mark=\
pac_fluxo_up_2M_3M parent="==// 6a UP" priority=6 queue=PCQ_Up_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 7a UP" parent="=((( SA\CDDA -UP- )))=" priority=7
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=10k \
max-limit=200k name="-+--|----> up TCP 3M~5M" packet-mark=\
pac_fluxo_up_3M_5M parent="==// 7a UP" priority=7 queue=PCQ_Up_Free
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=0 name="==// 8a UP" parent="=((( SA\CDDA -UP- )))=" priority=8
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=3k \
max-limit=120k name="-+--|----> up TCP 5M~..." packet-mark=\
pac_fluxo_up_5M_... parent="==// 8a UP" priority=8 queue=PCQ_Up_Free
Para adicionar comentários, você deve ser membro de MK-AUTH.
Respostas
Os créditos vão à Mikrotik.
Outro detalhe que havia esquecido, não funciona nas versões 6x, ok?
pra que serve essas regras?
pra quer servi?
Priorização de tráfego por tamanho de pacotes. Ele sempre dá prioridade para pacotes pequenos...as imagens do facebook carregam parece a full.
Mas não se engane, o cliente não vai navegar a full, ele vai navegar na banda contratada. Essas regras apenas priorizam o link de internet.
É ideal onde os links são saturados ou querem dar uma aceleradinha nas paginas.
Aqui nesta parte você deve colocar o tamanho do seu link (velocidade de download)
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
max-limit=5121k name="=((( ENTRADA -DOWN- )))=" parent=global-in \
priority=8
E aqui o tamanho (velocidade uoload)
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=200k \
max-limit=512k name="-+--|----> up TCP 0~64" packet-mark=\
pac_fluxo_up_0_64 parent="==// 1a UP" priority=1 queue=PCQ_Up_Free
Lembrando que essa configuração da Mikrotik é para um link ADSL, tanto é que há pppoe-out1 nas regras.
Caso não use o Mikrotik discando o pppoe, mude o nome de pppoe-out1 para o nome de sua interface.