Page 1 of 1

Easy Dynamic Dual Wan Failover

Posted: Fri Sep 23, 2016 6:07 pm
by tabate47
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?

Re: Easy Dynamic Dual Wan Failover

Posted: Fri Sep 23, 2016 10:47 pm
by tabate47
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.

Re: Easy Dynamic Dual Wan Failover

Posted: Sat Sep 24, 2016 6:15 am
by tabate47
If someone could point me in the right direction so I can learn I would appreciate it.

Re: Easy Dynamic Dual Wan Failover

Posted: Sat Sep 24, 2016 8:12 am
by kivimart
Combination off ip-cloud and script i think.

Skickat från min Nexus 6P via Tapatalk

Re: Easy Dynamic Dual Wan Failover

Posted: Tue Sep 27, 2016 10:57 pm
by Maarten200
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_ ... _Scripting
but one huge drawback, no support for dynamic IP's, if you fill in the interface as gateway the check host is unreachable

Re: Easy Dynamic Dual Wan Failover

Posted: Wed Nov 23, 2016 4:55 pm
by ExNihilo
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.
Any luck with this? I would appreciate any help with an email script for this. Thanks.

Re: Easy Dynamic Dual Wan Failover

Posted: Tue Jan 17, 2017 12:52 am
by Yuna
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?
Is your solution working? I have the same use case and need some help? Kind regards.


Gesendet von iPhone mit Tapatalk Pro

Re: Easy Dynamic Dual Wan Failover

Posted: Tue Jan 17, 2017 1:25 am
by tabate47
It seems to be working, but I haven't really tested it much.

Re: Easy Dynamic Dual Wan Failover

Posted: Wed Jan 18, 2017 6:25 am
by RLithgo
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.

Re: Easy Dynamic Dual Wan Failover

Posted: Wed Jan 18, 2017 7:53 am
by Yuna
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

Re: Easy Dynamic Dual Wan Failover

Posted: Wed Jan 18, 2017 6:23 pm
by tabate47
I would really be interested in checking out the script too. If you could send it to me I would appreciate it.

Thank you.

Re: Easy Dynamic Dual Wan Failover

Posted: Wed Jan 18, 2017 6:47 pm
by td32
would you kindly post the script here
it would be very useful

Re: Easy Dynamic Dual Wan Failover

Posted: Wed Jan 18, 2017 11:01 pm
by Yuna
Please post your script. Thx


Gesendet von iPhone mit Tapatalk Pro

Re: Easy Dynamic Dual Wan Failover

Posted: Wed Jan 18, 2017 11:35 pm
by RLithgo
Hi RLithgo,

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


Gesendet von iPhone mit Tapatalk Pro
My starting point was from here: http://forum.mikrotik.com/viewtopic.php?t=110192
I modified it to suit my needs and to address issues i discovered during testing.

Re: Easy Dynamic Dual Wan Failover

Posted: Thu Nov 16, 2017 6:58 am
by thewickerman666
I improved upon iN0X and tabate47 posts, see here: viewtopic.php?f=2&t=93222&p=617854#p617854