Community discussions

MikroTik App
 
bblankenship
just joined
Topic Author
Posts: 2
Joined: Fri Oct 03, 2014 9:24 pm

Fail over scripting

Fri Oct 03, 2014 9:28 pm

I kow it has been accomplished by moving gateway metrics, but i am looking for a basic failover method.

I have a main (cable) and a backup (cellular) connection. I am looking to script a ping every 5 seconds or so that looks to the outside world say google, if that fails, it will switch to the backup connection.

The only examples I see ping the gateway, I have tried this but been unsuccessful, perhaps I am doing it wrong.
 
User avatar
etche
just joined
Posts: 15
Joined: Mon Jul 26, 2010 11:00 pm
Location: La Plata, Argentina

Re: Fail over scripting

Wed Oct 15, 2014 4:48 pm

Hi, i've tried two different methods:

1) By assigning to every interface a route and then routing traffic through it with different metric. That actually works.

2) By applying VRRP, different solution - equal result.

But the question that seems that no one can answer is: How to do a smart failover checking link quality?

I have a similar issue, i'm having 3 differents WAN but it always chooses that one that have the lowest metric, and can't choose the one with the best performance.

I mean, if i have 80% loss over number 1 metric - Traffic goes over there anyway.
 
bblankenship
just joined
Topic Author
Posts: 2
Joined: Fri Oct 03, 2014 9:24 pm

Re: Fail over scripting

Wed Oct 15, 2014 4:56 pm

Thank you for the reply,

I am currently doing mangle fail over but the issue seems to be it will only failover if my modem or gateway is not reachable, I need a script that will ping the outside world. (i.e Google or nist)

Wan1 is a cable modem
Wan2 is a cellular backup.

Most of my outages have been beyond the node gateway of the cable company. because the Mtik can see the cable modem gateway it doesn't redirect the metric.
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: Fail over scripting

Wed Oct 15, 2014 7:11 pm

If you are able to evaluate the link quality, why not to set the distance metrics according that?
 
User avatar
etche
just joined
Posts: 15
Joined: Mon Jul 26, 2010 11:00 pm
Location: La Plata, Argentina

Re: Fail over scripting

Fri Oct 17, 2014 4:53 pm

If you are able to evaluate the link quality, why not to set the distance metrics according that?

Good point, if you already know who is the main ISP you only have to assign it the lowest metric.

Example:
[admin@Router] > ip route print
# DST-ADDRESS PREF-SRC GATEWAY DISTANCE
0 A S 0.0.0.0/0 [IP GW main] 1
1 S 0.0.0.0/0 [IP GW bk ] 2


Then you can do something else, you can set the "check-gateway ping" for both conections.

In your main ISP, i see that you don't have any trouble... you already did it.

But with your secondary (the cell) you should do this:

add dst-address=8.8.8.8 gateway=[IP GW bk ] scope=10
add distance=2 gateway=8.8.8.8 check-gateway=ping

So... when you send any request to 8.8.8.8 it will be always by the GW BK. Then you have to set 8.8.8.8 as a Gateway (to get a reference IP) and you can now set check-gateway=ping

That is a homemade and easy way, but i recommend you to read about vrrp that is what you need to apply in this scenario.

http://wiki.mikrotik.com/wiki/Manual:VRRP-examples

Regards.

Who is online

Users browsing this forum: No registered users and 57 guests