/ip firewall mangle
add action=mark-connection chain=output comment="SEM BALACE CACHE FULL" \
content="X-Cache: HIT" disabled=yes new-connection-mark=conn_squid-up \
protocol=tcp src-port=3128
add action=mark-packet chain=output connection-mark=conn_squid-up disabled=\
yes new-packet-mark=pacotes_squid-up
add action=mark-connection chain=prerouting disabled=yes dst-port=3128 \
new-connection-mark=conn_squid-down protocol=tcp
add action=mark-packet chain=prerouting connection-mark=conn_squid-down \
disabled=yes new-packet-mark=pacotes_squid-down
add chain=prerouting comment="FORA DO BALANCE" dst-address-list=sembalance \
dst-port=443 in-interface=local protocol=tcp
add chain=prerouting comment="ACEITAR TRAFEGO DA REDE INTERNA" dst-address=\
192.168.1.0/24 src-address=192.186.1.0/24
add action=mark-connection chain=prerouting comment=\
"MARCAR CONE\C7\D5ES LINKS 1 E 2" connection-mark=no-mark in-interface=\
link1 new-connection-mark=conn_link1 protocol=tcp
add action=mark-connection chain=prerouting connection-mark=no-mark \
in-interface=link2 new-connection-mark=conn_link2
add action=mark-connection chain=prerouting comment=\
"PROXY MARCAR CONE\C7\D5ES LINKS 1 E 2" connection-mark=no-mark disabled=\
yes dst-port=3128 in-interface=link1 new-connection-mark=conn_link1 \
protocol=tcp
add action=mark-connection chain=prerouting connection-mark=no-mark disabled=\
yes dst-port=3128 in-interface=link2 new-connection-mark=conn_link2 \
protocol=tcp
add action=mark-connection chain=prerouting comment=\
"MARCA\C7\C3O DE DIVIS\C3O DO LINK OI 4M" connection-mark=no-mark \
dst-address-type=!local in-interface=local new-connection-mark=conn_link1 \
per-connection-classifier=both-addresses-and-ports:5/0
add action=mark-connection chain=prerouting connection-mark=no-mark \
dst-address-type=!local in-interface=local new-connection-mark=conn_link1 \
per-connection-classifier=both-addresses-and-ports:5/1
add action=mark-connection chain=prerouting connection-mark=no-mark \
dst-address-type=!local in-interface=local new-connection-mark=conn_link1 \
per-connection-classifier=both-addresses-and-ports:5/2
add action=mark-connection chain=prerouting connection-mark=no-mark \
dst-address-type=!local in-interface=local new-connection-mark=conn_link1 \
per-connection-classifier=both-addresses-and-ports:5/3
add action=mark-connection chain=prerouting comment=\
"PROXY MARCA\C7\C3O DE DIVIS\C3O DO LINK OI 4M" connection-mark=no-mark \
dst-address-type=!local dst-port=3128 in-interface=local \
new-connection-mark=conn_link1 per-connection-classifier=\
both-addresses-and-ports:5/0 protocol=tcp
add action=mark-connection chain=prerouting connection-mark=no-mark \
dst-address-type=!local dst-port=3128 in-interface=local \
new-connection-mark=conn_link1 per-connection-classifier=\
both-addresses-and-ports:5/1 protocol=tcp
add action=mark-connection chain=prerouting connection-mark=no-mark \
dst-address-type=!local dst-port=3128 in-interface=local \
new-connection-mark=conn_link1 per-connection-classifier=\
both-addresses-and-ports:5/2 protocol=tcp
add action=mark-connection chain=prerouting connection-mark=no-mark \
dst-address-type=!local dst-port=3128 in-interface=local \
new-connection-mark=conn_link1 per-connection-classifier=\
both-addresses-and-ports:5/3 protocol=tcp
add action=mark-connection chain=prerouting comment=\
"MARCA\C7\C3O DE DIVIS\C3O DO LINK EMBRATEL 1M" connection-mark=no-mark \
dst-address-type=!local in-interface=local new-connection-mark=conn_link2 \
per-connection-classifier=both-addresses-and-ports:5/4
add action=mark-connection chain=prerouting comment=\
"PROXY MARCA\C7\C3O DE DIVIS\C3O DO LINK EMBRATEL 1M" connection-mark=\
no-mark dst-address-type=!local dst-port=3128 in-interface=local \
new-connection-mark=conn_link2 per-connection-classifier=\
both-addresses-and-ports:5/4 protocol=tcp
add action=mark-routing chain=prerouting comment=\
"MARCA\C7\C3O DE ROTA PARA LINKS" connection-mark=conn_link1 \
in-interface=local new-routing-mark=rota_link1
add action=mark-routing chain=prerouting connection-mark=conn_link2 \
in-interface=local new-routing-mark=rota_link2
add action=mark-routing chain=output comment=\
"MARCANDO ROTA DE SAIDA PARA LINK" connection-mark=conn_link1 \
new-routing-mark=rota_link1
add action=mark-routing chain=output connection-mark=conn_link2 \
new-routing-mark=rota_link2
add action=mark-packet chain=postrouting connection-mark=thunder-c \
new-packet-mark=thunder-P passthrough=no