Failover em Mikrotik utilizando Netwatch

Nessa dinâmica configuraremos um Mikrotik do zero ao failover entre duas operadoras.

Export do RouterOS onde configuramos o Failover utilizando o Netwatch

/interface ethernet
set [ find default-name=ether2 ] name=ether2-oper-1
set [ find default-name=ether3 ] name=ether3-oper-2
set [ find default-name=ether4 ] name=ether4-lan

/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik

/ip address
add address=10.10.10.2/30 interface=ether2-oper-1 network=10.10.10.0
add address=10.10.20.2/30 interface=ether3-oper-2 network=10.10.20.0
add address=192.168.100.1/24 interface=ether4-lan network=192.168.100.0

/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether2-oper-1
add action=masquerade chain=srcnat out-interface=ether3-oper-2

/ip route
add comment=ROTA-DEFAULT-OPERADORA-1 distance=1 gateway=10.10.10.1
add distance=2 gateway=10.10.20.1
add comment=HOST-MONITORADO-OPER-1 distance=1 dst-address=200.160.2.3/32 \
    gateway=10.10.10.1

/tool netwatch
add down-script="/ip route set [find comment=\"ROTA-DEFAULT-OPERADORA-1\"] dis\
    tance=3\r\
    \n/ip firewall connection tracking set enable=no\r\
    \n:delay 1s\r\
    \n/ip firewall connection tracking set enable=auto" host=200.160.2.3 \
    interval=10s up-script="/ip route set [find comment=\"ROTA-DEFAULT-OPERADO\
    RA-1\"] distance=1\r\
    \n/ip firewall connection tracking set enable=no\r\
    \n:delay 1s\r\
    \n/ip firewall connection tracking set enable=auto"
twitterlinkedin

Deixe um comentário