Sei sulla pagina 1di 3

/interface ethernet

set [ find default-name=ether1 ] comment="Link 1 - Ethernet 8M"


set [ find default-name=ether2 ] comment="Link 2 - DHCP 4M"
set [ find default-name=ether3 ] comment="Link 3 - PPPoE 2M"
set [ find default-name=ether4 ] comment="Rede Interna 14M"
/ip pool
add name=dhcp_pool0 ranges=192.168.10.2-192.168.10.254
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=ether4 name=dhcp1
/ppp profile
add name=Link3 on-down=\
"/ip route remove [find comment=\"Monitoramento-Link3\"]" on-up="/ip route\
\_add ds=208.67.222.222 gateway=\$\"remote-address\" scope=10 comment=Moni\
toramento-Link3"
/interface pppoe-client
add disabled=no interface=ether3 name=PPPoE-Link3 password=link3 profile=\
Link3 use-peer-dns=yes user=link3
/ip address
add address=192.168.10.1/24 interface=ether4 network=192.168.10.0
add address=200.200.200.2/30 interface=ether1 network=200.200.200.0
/ip dhcp-client
add add-default-route=no dhcp-options=hostname,clientid disabled=no \
interface=ether2 script="{\r\
\n :local count [/ip route print count-only where comment=\"Monitoramen\
to-Link2\"]\r\
\n :if (\$bound=1) do={\r\
\n :if (\$count = 0) do={\r\
\n /ip route add ds=8.8.4.4 gateway=\$\"gateway-address\" comme\
nt=\"Monitoramento-Link2\" scope=10\r\
\n } else={\r\
\n :if (\$count = 1) do={\r\
\n :local test [/ip route find where comment=\"Monitorament\
o-Link2\"]\r\
\n :if ([/ip route get \$test gateway] != \$\"gateway-addre\
ss\") do={\r\
\n /ip route set \$test gateway=\$\"gateway-address\"\r\
\n }\r\
\n } else={\r\
\n :error \"Multiple routes found\"\r\
\n }\r\
\n }\r\
\n } else={\r\
\n /ip route remove [find comment=\"Monitoramento-Link2\"]\r\
\n }\r\
\n}"
/ip dhcp-server network
add address=192.168.10.0/24 dns-server=8.8.8.8 gateway=192.168.10.1
/ip firewall address-list
add address=192.168.0.0/16 list=Rede-Interna
add address=10.0.0.0/8 list=Rede-Interna
add address=172.16.0.0/12 list=Rede-Interna
/ip firewall mangle
add action=accept chain=prerouting comment="Bypass Rede Interna" \
dst-address-list=Rede-Interna src-address-list=Rede-Interna
add action=mark-connection chain=prerouting comment="Entrada Conexao Link 1" \
connection-mark=no-mark in-interface=ether1 new-connection-mark=\
Link1-Conexao passthrough=yes
add action=mark-connection chain=prerouting comment="Entrada Conexao Link 2" \
connection-mark=no-mark in-interface=ether2 new-connection-mark=\
Link2-Conexao passthrough=yes
add action=mark-connection chain=prerouting comment="Entrada Conexao Link 3" \
connection-mark=no-mark in-interface=PPPoE-Link3 new-connection-mark=\
Link3-Conexao passthrough=yes
add action=mark-routing chain=output comment="Saida Conexao Link 1" \
connection-mark=Link1-Conexao new-routing-mark=Link1-Rota passthrough=yes
add action=mark-routing chain=output comment="Saida Conexao Link 2" \
connection-mark=Link3-Conexao new-routing-mark=Link3-Rota passthrough=yes
add action=mark-routing chain=output comment="Saida Conexao Link 3" \
connection-mark=Link2-Conexao new-routing-mark=Link2-Rota passthrough=yes
add action=mark-connection chain=prerouting comment=\
"PCC Marca Conexao Link 1 7/0" dst-address-type=!local in-interface=\
ether4 new-connection-mark=Link1-Conexao passthrough=yes \
per-connection-classifier=both-addresses:7/0
add action=mark-connection chain=prerouting comment=\
"PCC Marca Conexao Link 1 7/1" dst-address-type=!local in-interface=\
ether4 new-connection-mark=Link1-Conexao passthrough=yes \
per-connection-classifier=both-addresses:7/1
add action=mark-connection chain=prerouting comment=\
"PCC Marca Conexao Link 1 7/2" dst-address-type=!local in-interface=\
ether4 new-connection-mark=Link1-Conexao passthrough=yes \
per-connection-classifier=both-addresses:7/2
add action=mark-connection chain=prerouting comment=\
"PCC Marca Conexao Link 1 7/3" dst-address-type=!local in-interface=\
ether4 new-connection-mark=Link1-Conexao passthrough=yes \
per-connection-classifier=both-addresses:7/3
add action=mark-connection chain=prerouting comment=\
"PCC Marca Conexao Link 2 7/4" dst-address-type=!local in-interface=\
ether4 new-connection-mark=Link2-Conexao passthrough=yes \
per-connection-classifier=both-addresses:7/4
add action=mark-connection chain=prerouting comment=\
"PCC Marca Conexao Link 2 7/5" dst-address-type=!local in-interface=\
ether4 new-connection-mark=Link2-Conexao passthrough=yes \
per-connection-classifier=both-addresses:7/5
add action=mark-connection chain=prerouting comment=\
"PCC Marca Conexao Link 3 7/6" dst-address-type=!local in-interface=\
ether4 new-connection-mark=Link3-Conexao passthrough=yes \
per-connection-classifier=both-addresses:7/6
add action=mark-routing chain=prerouting comment="PCC Marca Rota Link 1" \
connection-mark=Link1-Conexao in-interface=ether4 new-routing-mark=\
Link1-Rota passthrough=yes
add action=mark-routing chain=prerouting comment="PCC Marca Rota Link 2" \
connection-mark=Link2-Conexao in-interface=ether4 new-routing-mark=\
Link2-Rota passthrough=yes
add action=mark-routing chain=prerouting comment="PCC Marca Rota Link 3" \
connection-mark=Link3-Conexao in-interface=ether4 new-routing-mark=\
Link3-Rota passthrough=yes
/ip firewall nat
add action=masquerade chain=srcnat comment="NAT Link 1" out-interface=ether1
add action=masquerade chain=srcnat comment="NAT Link 2" out-interface=ether2
add action=masquerade chain=srcnat comment="NAT Link 3" out-interface=\
PPPoE-Link3
/ip route
add comment=Rota-PCC-Link1 distance=1 gateway=8.8.8.8 routing-mark=Link1-Rota
add comment=Rota-PCC-Link3 distance=1 gateway=208.67.222.222 routing-mark=\
Link3-Rota
add comment=Rota-PCC-Link1 distance=1 gateway=8.8.4.4 routing-mark=Link2-Rota
add check-gateway=ping comment=Rota-Padrao-Link1 distance=1 gateway=8.8.8.8
add check-gateway=ping comment=Rota-Padrao-Link2 distance=2 gateway=8.8.4.4
add check-gateway=ping comment=Rota-Padrao-Link3 distance=3 gateway=\
208.67.222.222
add comment=Monitoramento-Link2 distance=1 dst-address=8.8.4.4/32 gateway=\
192.168.200.1 scope=10
add comment=Monitoramento-Link1 distance=1 dst-address=8.8.8.8/32 gateway=\
200.200.200.1 scope=10
add comment=Monitoramento-Link3 distance=1 dst-address=208.67.222.222/32 \
gateway=205.205.205.10 scope=10

Potrebbero piacerti anche