Community discussions

MikroTik App
 
TLS
just joined
Topic Author
Posts: 3
Joined: Fri Sep 02, 2016 9:01 pm

Dual Wan failover with 1 static and 1 dynamic IP?

Fri Sep 02, 2016 9:39 pm

I am trying to figure out how to implement WAN failover with 2 different ISP's - A Comcast connection providing a static IP and a Century Link connection providing a dynamic IP.

I believe I've figured out how to accomplish this if both were static, correct me if I am wrong, under IP Addresses I would simply assign ether1 and ether2 their own static IP's and then under System Scripts I would add this script (http://wiki.mikrotik.com/wiki/Failover_Scripting) and edit where necessary.

I can purchase a static from Century Link if I have to but would prefer not to. Any help or suggestions would be much appreciated, thanks.
 
User avatar
shailparmar
Frequent Visitor
Frequent Visitor
Posts: 97
Joined: Wed Aug 20, 2014 6:07 pm
Location: GB
Contact:

Re: Dual Wan failover with 1 static and 1 dynamic IP?

Sat Sep 03, 2016 11:45 am

you can simply do fail over without scripting, by define gateway route distance.
set primary connection gateway route distance to 0 and back up connection route distance to 1.
if 0 route is unreachable router automatic enable route 1.
 
tabate47
Long time Member
Long time Member
Posts: 510
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Dual Wan failover with 1 static and 1 dynamic IP?

Sat Sep 24, 2016 8:58 pm

If you do it that way, how can you get notified via email?
 
User avatar
tarikin
newbie
Posts: 35
Joined: Sat Sep 24, 2016 11:55 pm
Location: Vietnam
Contact:

Re: Dual Wan failover with 1 static and 1 dynamic IP?

Mon Sep 26, 2016 4:58 am

If you do it that way, how can you get notified via email?
Use netwatch tool, add a gateway's known static ip address to watch list and define e-mail scripts for UP and DOWN events.
This article may help you:
http://gregsowell.com/?p=819
 
tabate47
Long time Member
Long time Member
Posts: 510
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Dual Wan failover with 1 static and 1 dynamic IP?

Mon Sep 26, 2016 6:09 am

Gateway has dynamic ip!
 
User avatar
che
Member Candidate
Member Candidate
Posts: 111
Joined: Fri Oct 07, 2005 1:04 pm

Re: Dual Wan failover with 1 static and 1 dynamic IP?

Mon Sep 26, 2016 10:41 am

You didn't state what type of WAN connection you have on dynamic gateway, so I'll just assume it's DHCP client. Since you would like to keep the script from wiki, replace current static variable with new one that reads acutal gateway value, and schedule script to run in a reasonable interval (15 minutes for example, if your IP changes frequently):

Old variable:
:local GatewayISP2 2.2.2.2
New variable (assuming you have only one DHCP client):
:local GatewayISP2 [/ip dhcp-client get value-name=gateway number=0];
 
tabate47
Long time Member
Long time Member
Posts: 510
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Dual Wan failover with 1 static and 1 dynamic IP?

Mon Sep 26, 2016 3:19 pm

Yes, it is dhcp client, but I have 2 dynamic dhcp clients.

Can it still be done?
 
User avatar
che
Member Candidate
Member Candidate
Posts: 111
Joined: Fri Oct 07, 2005 1:04 pm

Re: Dual Wan failover with 1 static and 1 dynamic IP?

Tue Sep 27, 2016 10:35 am

Sure it can.

You need to find out exact order of DHCP clients. Afaik, you can not do that from Winbox (you can only assume list position, but it's not numbered), so you have to open new terminal either from Winbox or use telnet/ssh, and enter this command:
ip dhcp-client print
If DHCP client you want is with number "0" then you don't have to edit anything from my previous post, but if it's under "1" - you will have to replace "number=0" with "number=1".
 
User avatar
tarikin
newbie
Posts: 35
Joined: Sat Sep 24, 2016 11:55 pm
Location: Vietnam
Contact:

Re: Dual Wan failover with 1 static and 1 dynamic IP?

Tue Sep 27, 2016 1:30 pm

Got a new idea =)
Try to define a static route to any random pingable ip (like 8.8.8.8) thu a certain interface gateway. As i know, ROS is able to determine a gateway's IP it was set dynamically via DHCP Client.
Next is netwatch the 8.8.8.8.
Once the static route is set, the 8.8.8.8 shouldn't be able to be reachable thru another gateway and netwatch reports "Down" status.

Another way is to find out any local provider's ip that is reachable only from local network and netwatch it =)
 
User avatar
thewickerman666
just joined
Posts: 8
Joined: Sun Sep 10, 2017 9:28 am

Re: Dual Wan failover with 1 static and 1 dynamic IP?

Tue Sep 12, 2017 2:33 am

Take a look at InoX's solution works for me. You may need to modify for the static wan

viewtopic.php?f=2&t=93222&p=617854#p617854

Who is online

Users browsing this forum: avis99, unhuzpt and 92 guests