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.
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.
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
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];
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”.
Got a new idea =)
Try to define a static route to any random pingable ip (like 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 =)