Community discussions

MikroTik App
 
tabate47
Long time Member
Long time Member
Topic Author
Posts: 510
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Easy Dynamic Dual Wan Failover

Fri Sep 23, 2016 6:07 pm

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?
 
tabate47
Long time Member
Long time Member
Topic Author
Posts: 510
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Easy Dynamic Dual Wan Failover

Fri Sep 23, 2016 10:47 pm

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.
 
tabate47
Long time Member
Long time Member
Topic Author
Posts: 510
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Easy Dynamic Dual Wan Failover

Sat Sep 24, 2016 6:15 am

If someone could point me in the right direction so I can learn I would appreciate it.
 
kivimart
Frequent Visitor
Frequent Visitor
Posts: 54
Joined: Thu Oct 10, 2013 3:06 pm

Re: Easy Dynamic Dual Wan Failover

Sat Sep 24, 2016 8:12 am

Combination off ip-cloud and script i think.

Skickat från min Nexus 6P via Tapatalk
 
Maarten200
just joined
Posts: 5
Joined: Tue Sep 27, 2016 9:56 pm
Location: Belgium

Re: Easy Dynamic Dual Wan Failover

Tue Sep 27, 2016 10:57 pm

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
 
ExNihilo
just joined
Posts: 6
Joined: Sun Mar 29, 2015 12:03 am

Re: Easy Dynamic Dual Wan Failover

Wed Nov 23, 2016 4:55 pm

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.
 
Yuna
just joined
Posts: 11
Joined: Fri Dec 16, 2016 8:12 am

Re: Easy Dynamic Dual Wan Failover

Tue Jan 17, 2017 12:52 am

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
 
tabate47
Long time Member
Long time Member
Topic Author
Posts: 510
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Easy Dynamic Dual Wan Failover

Tue Jan 17, 2017 1:25 am

It seems to be working, but I haven't really tested it much.
 
RLithgo
newbie
Posts: 30
Joined: Mon Dec 12, 2016 12:21 am

Re: Easy Dynamic Dual Wan Failover

Wed Jan 18, 2017 6:25 am

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.
 
Yuna
just joined
Posts: 11
Joined: Fri Dec 16, 2016 8:12 am

Re: Easy Dynamic Dual Wan Failover

Wed Jan 18, 2017 7:53 am

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
 
tabate47
Long time Member
Long time Member
Topic Author
Posts: 510
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Easy Dynamic Dual Wan Failover

Wed Jan 18, 2017 6:23 pm

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

Thank you.
 
td32
Member Candidate
Member Candidate
Posts: 111
Joined: Fri Nov 18, 2016 5:55 am

Re: Easy Dynamic Dual Wan Failover

Wed Jan 18, 2017 6:47 pm

would you kindly post the script here
it would be very useful
 
Yuna
just joined
Posts: 11
Joined: Fri Dec 16, 2016 8:12 am

Re: Easy Dynamic Dual Wan Failover

Wed Jan 18, 2017 11:01 pm

Please post your script. Thx


Gesendet von iPhone mit Tapatalk Pro
 
RLithgo
newbie
Posts: 30
Joined: Mon Dec 12, 2016 12:21 am

Re: Easy Dynamic Dual Wan Failover

Wed Jan 18, 2017 11:35 pm

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.
 
User avatar
thewickerman666
just joined
Posts: 8
Joined: Sun Sep 10, 2017 9:28 am

Re: Easy Dynamic Dual Wan Failover

Thu Nov 16, 2017 6:58 am

I improved upon iN0X and tabate47 posts, see here: viewtopic.php?f=2&t=93222&p=617854#p617854

Who is online

Users browsing this forum: Bing [Bot], mstanciu, nhongooi, parm, raiser, sas2k, smirgo, vingjfg and 101 guests