1 renomear o roteador system/identty *identty = nome do roteador (PCnovo (67)99211-5862) - ok 2 renomear as interfaces interfaces/interface *dois click encima da interface em name mudar nome. ehther1-wan1 ehther2-wan2 ehther3-lan1 ehther4-lan2 ehther5-lan3 3 criar uma bridge breidge/bridge + Name: rede local 4 ativar as portas bridge bridge/ports + interface: ehther3-lan1 bridge: rede local ok interface: ehther4-lan2 bridge: rede local ok interface: ehther5-lan3 bridge: rede local ok 5 configurar ip andress rede local ip/addresses + anddresses: 192.168.3.1/24 interfece: rede local ok 6 DHCP rede local ip/DHCP server/dhcp setup dhcp server interface:rede local dhcp adress space 192.168.30/24 gateway for DHCP network: 192.168.3.1 Addresses to give out (pool ip inicial-ip final):192.168.3.100-192.168.3.200 DNS server:1.1.1.3 cetinha para baixo DNS server:1.0.0.3 lease time: 00:10:00 7 criar vlan clientes interface/vlan + name: vlan clientes vlan ID:1001 interface: rede local ok 8 bridge vlan clientes bridge/port + geral/interface: vlan cliente bridge: rede local ok 9 configurar ip andress vlan clientes ip/addresses + anddresses: 172.16.0.1/24 interfece: vlan clientes ok 10 DHCP vlan clientes ip/DHCP server/dhcp setup dhcp server interface:vlan cliente dhcp adress space 172.16.0.0/24 gateway for DHCP network: 172.16.0.1 Addresses to give out (pool ip inicial-ip final):172.16.0.2-172.16.0.254 DNS server:1.1.1.3 cetinha para baixo DNS server:1.0.0.3 lease time: 00:10:00 11 ativar portas wan (link) ip/dhcp client + interfece: ether1-wan1 ok ip/dhcp client + interfece: ether2-wan2 ok 12 ativar o nat ip/firewall/nat + geral/chain: srcnat geral out.interface ether1-wan1 action:masquerade ok ip/firewall/nat + geral/chain: srcnat geral out.interface ether2-wan2 action:masquerade ok 13 adivar dns do roteador ip/dns servers :1.1.1.3 ceta para baixo:1.0.0.3 14 atualizar a mikrotik system/Package List check for updates channel: long tem download/instal ok ************************************************************** 1 failover desabilitar default rout ip/dhcp cliente dois cliques em ether-wan1 add default route: no ok ip/dhcp cliente dois cliques em ether-wan1 add default route: no ok 2 configurar rota estatica ip/rotes + geral/gateway 192.168.15.1 (ip modem wan1) Comment: ether-wan1 OK OK ip/rotes + geral/gateway 192.168.0.1 (ip modem wan2) Comment: ether-wan2 OK OK 3 configurar prioridade do link ip/rotes dois cliques encima da rota ether1-wan1 geral/distance:1 ok ip/rotes dois cliques encima da rota ether2-wan2 geral/distance:2 ok 4 rodar o script new terminal colar ******************************************************************************* #================================================= # Desenvolvido por Francisco Neto # www.redesbrasil.com #================================================= #============== Instruções ======================= # Colocar comentario nas rotas default # Ex. Link1, Link2, Link-Vivo, Link-OI #================================================= #================================================= #================================================= #======== Remove regras e scripts antigas ====== #================================================= /ip route remove [find comment~"!=="] /ip route rule remove [find comment~"!=="] /system script remove [find name=failover] /system scheduler remove [find name="executa script failover"] #================================================= #================================================= #================================================= #======== Cria as rotas de teste =============== #================================================= :foreach i in=[/ip route find dst-address=0.0.0.0/0 routing-mark<>""] do={ :global gateway [/ip route get number=$i gateway] :global comentario [/ip route get number=$i comment] #:put ($gateway."-".$comment) /ip route add gateway=$gateway routing-mark=("rota-de-teste-para-" . $comentario) comment=("!== Rota de teste para " . $comentario) /ip route rule add action=lookup-only-in-table routing-mark=("rota-de-teste-para-" . $comentario) table=("rota-de-teste-para-" . $comentario) comment=("!== Force teste para o failover ==> ".$comentario) } #================================================= #================================================= ########################################################################################################################### /system scheduler add interval=30s name="executa script failover" on-event=failover policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup /system script add name=failover owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="# IPs a serem testados separados por virgula (n\E3o usar nom\ es, pois se todas as rotas ficarem paradas n\E3o tem como resolver nomes e logo as rotas nunca ir\E3o voltar)\r\ \n# Interlavo = timeout de cada ping onde 00:00:00.5 corresponde a 500ms \r\ \n:global IPsParaTeste \"8.8.8.8,8.8.4.4,200.160.0.8,31.13.80.8\"\r\ \n:global NumeroDePings 2\r\ \n:global Intervalo 00:00:00.5\r\ \n\r\ \n\r\ \n\r\ \n#Converte sitrngs em arrays\r\ \n:global IPsParaTeste [:toarray \$IPsParaTeste];\r\ \n\r\ \n\r\ \n\r\ \n#\r\ \n#Seleciona as tebelas de roteamento para teste\r\ \n\r\ \n:foreach i in=[/ip route find dst-address=0.0.0.0/0 routing-mark<>\"\"] do={\r\ \n\r\ \n:global comentario [/ip route get number=\$i comment]\r\ \n:global TabRoteAtual (\"rota-de-teste-para-\" . \$comentario)\r\ \n\r\ \n{\r\ \n:global LinkUP 0\r\ \n:foreach IPAtualParaTeste in=\$IPsParaTeste do= \\\r\ \n\r\ \n{\r\ \n:set LinkUP (\$LinkUP + [ping \$IPAtualParaTeste interval=\$Intervalo count=\$NumeroDePings routing-table=\$TabRoteAtual])\r\ \n:put (\$TabRoteAtual)\r\ \n:put \$LinkUP\r\ \n\r\ \n}\r\ \n#De acordo com o estado do link ativa ou desativa as rotas\r\ \n\r\ \n################## if down ##################\r\ \nif (\$LinkUP=0) do={if ([/ip route print count-only where comment=\$comentario disabled]=0) do={\r\ \n\r\ \n/ip route disable [find comment=\$comentario]\r\ \n\r\ \n\r\ \n}}\r\ \n\r\ \n################## if up ##################\r\ \nif (\$LinkUP>0) do={if ([/ip route print count-only where comment=\$comentario disabled]>0) do={\r\ \n\r\ \n/ip route enable [find comment=\$comentario]\r\ \n\r\ \n\r\ \n}}\r\ \n\r\ \n}\r\ \n}\r\ \n" ****************************************************************************** fim