Hallo ppl. Have a question, how correctly can make failover with two DHCP WAN ports. Without scripting, if you may..
Do you need load balancing?
Yep. It’s will be second problem..
/IP Route
destination=0.0.0.0/0 gateway=ISP_gateway_IP (not wanIP) ping gateway distance=1
destination=0.0.0.0/0 gateway=ISP2_gateway_IP distance=2
If you want to check external hosts such as google or OPENDNS for connectivity before switching then it gets a bit more complicated.
If you need to use the secondary WAN to check ISP email for example (not use primary WAN), then add the following route
destination=ISP_mailserver_IP gateway=ISP2_gateway_IP
If you wanted to check external hosts not the gateway IP (as people have noted its not always the best indicator as it can be up but the network down etc…)
/ip route
add dst-address=Host1(8.8.8.
gateway=gatewayIP (of primary ISP)
add dst-address=Host2(208.67.222.222) gateway=gatewayIP (of primary ISP)
add dst-address=Host3(8.8.4.4) gateway=gatewayIP (of secondary ISP)
add dst-address=Host4(208.67.220.220) gateway=gatewayIP (of secondary ISP)
/ip route
add distance=1 gateway=Host1(8.8.8.
check-gateway=ping
add distance=2 gateway=Host2(208.67.222.222) check-gateway=ping
add distance=3 gateway=Host3(8.8.4.4) check-gateway=ping
add distance=4 gateway=Host4(208.67.220.220) check-gateway=ping
/Ip route
add destination=0.0.0.0/0 gateway IP (ISP Primary) distance=1
add destination= 0.0.0.0/0 gateway IP(ISP Secondary) distance=2
What this will do is monitor that the external hosts are pingable through the gateways.
For example if Google is down from ISP1, the router will check OPENDNS from gateway1, if that is also down, the router
will check gateway2 for google and if not working OPENDNS
If the hosts are available on gateway2, the router will use that for traffic until gateway1 comes back up on either opendns or google.
Two hosts are used in case for example GOOGLE servers are not up.
If you just wanted to use OPENDNS for example..
/ip route
add dst-address=Host1(208.67.222.222) gateway=gatewayIP (of primary ISP)
add dst-address=Host2(208.67.220.220) gateway=gatewayIP (of secondary ISP)
/ip route
add distance=1 gateway=Host1(208.67.222.222) check-gateway=ping
add distance=2 gateway=Host1(208.67.220.220) check-gateway=ping
/Ip route
add destination=0.0.0.0/0 gateway IP (ISP Primary) distance=1
add destination= 0.0.0.0/0 gateway IP(ISP Secondary) distance=2
However the above can also be accomplished by a script (from 2frogs) and in this case GOOGLE servers were used.
Netwatch is a tool that has a specific function to check connections.
“Netwatch monitors state of hosts on the network. It does so by sending ICMP pings to the list of specified IP addresses. For each entry in netwatch table you can specify IP address, ping interval and console scripts. The main advantage of netwatch is it’s ability to issue arbitrary console commands on host state changes.”
/ip route
add gateway=gateway1ip distance=1 comment=WAN1
add gateway=gateway2ip distance=2 comment=WAN2
add dst-address=8.8.8.8/32 gateway=gateway1ip
/tool netwatch
add down-script=[color=#00BF80]"/ip route set [find where comment=\"WAN1\"] distance=3;\r\
\n:log warning \"WAN1 down, switching to WAN2\"" host=8.8.8.8 up-script="/ip\
\_route set [find where comment=\"WAN1\"] distance=1;\r\
\n:log warning \"WAN1 restored\""[/color]
oh, bro! Like your post!!! Very very usefull info! Thanks a lot..