Easy Dynamic Dual Wan Failover

It seems the easiest way to have a dynamic dual wan failover is to add 2 dhcp clients with distances of 1 and 2. When the first goes down, the second goes up, etc.

The issue is dynamic dhcp routes have no option to ping the gateway, so if the physical connection remains intact, but the internet feed goes down, the router thinks the wan is still up and does not switch to the backup #2.

I found on the forums this command that allows a dynamic dhcp route to ping the gateway:

/routing filter
add action=passthrough chain=dynamic-in disabled=no set-check-gateway=ping

Once you add this, the dynamic dhcp does ping the gateway, and everything seems to work.

This seems very simple and fool proof. Are there any drawbacks to using this method?

I’ve been testing this all day and it works fine.

I would like to send an email when wan1 goes down and wan2 is active, and another email when wan1 goes backup.

Can this be done with internal variables already built into routeros, or do I have to write a script to handle everything?

Thanks.

If someone could point me in the right direction so I can learn I would appreciate it.

Combination off ip-cloud and script i think.

Skickat från min Nexus 6P via Tapatalk

Watch out to only check your gateway. I’m also looking for a solution to this.

Here in Belgium one of the biggest ISP Telenet has an modem/router witch assigns public IP’s with DHCP.
But if the connection goes offline but the modem is still powered on the modem assigns private 192.168.0.0/24 IP’s. This results in that the gateway is stil reachable.

So the solution you posted wil not work if your ISP does the same
The only good solution is to check if you can reach an IP on the internet, preferably multiple IP’s

The easiest solution i found is: http://wiki.mikrotik.com/wiki/Advanced_Routing_Failover_without_Scripting
but one huge drawback, no support for dynamic IP’s, if you fill in the interface as gateway the check host is unreachable

Any luck with this? I would appreciate any help with an email script for this. Thanks.

Is your solution working? I have the same use case and need some help? Kind regards.


Gesendet von iPhone mit Tapatalk Pro

It seems to be working, but I haven’t really tested it much.

I ended up deploying a scripted solution. Pinging the gateway is useless if your gateway is up but their link is down (which is what happens when by fibre link goes down).
I actually prefer the scripted solution as it gives you much better control.
The script i have switches gateway on more than 80% packet loss to 2 different ip addresses over 5 pings each.
It will resume the main gateway on < 20% packet loss.
It also sends me emails when switching gateways.

I found the original script via google and then tweaked it to suit my needs.
So far it’s been working really well.

Hi RLithgo,

Can you send me or post the script? Your solution sounds well. Kind regards.


Gesendet von iPhone mit Tapatalk Pro

I would really be interested in checking out the script too. If you could send it to me I would appreciate it.

Thank you.

would you kindly post the script here
it would be very useful

Please post your script. Thx


Gesendet von iPhone mit Tapatalk Pro

My starting point was from here: http://forum.mikrotik.com/t/solved-failover-script-for-2xwan-pppoe-client-and-usb-4g-lte-with-e-mail-notification/99835/1
I modified it to suit my needs and to address issues i discovered during testing.

I improved upon iN0X and tabate47 posts, see here: http://forum.mikrotik.com/t/dual-wan-failover-with-dhcp-on-wan-port/84680/4