Community discussions

MikroTik App
 
Cablenut9
Long time Member
Long time Member
Topic Author
Posts: 542
Joined: Fri Jan 08, 2021 5:30 am

VRRP trigger from lost internet connection

Mon Apr 19, 2021 3:11 am

The Mikrotik Wiki describes VRRP as a thing to let other routers take over when a main one fails, but this seems too limited. By that definition, VRRP only works when the main router loses power or gets disconnected from the network. However, I need VRRP to trigger when the internet connection on the main router becomes unavailable which doesn't seem to be a feature of VRRP. Is there a workaround?
 
joegoldman
Forum Veteran
Forum Veteran
Posts: 766
Joined: Mon May 27, 2013 2:05 am

Re: VRRP trigger from lost internet connection

Mon Apr 19, 2021 3:56 am

Depending on how your internet works - probably a Netwatch script that then modifies VRRP priorities to force the other one to take over Master
 
Cablenut9
Long time Member
Long time Member
Topic Author
Posts: 542
Joined: Fri Jan 08, 2021 5:30 am

Re: VRRP trigger from lost internet connection

Mon Apr 19, 2021 4:29 am

Depending on how your internet works - probably a Netwatch script that then modifies VRRP priorities to force the other one to take over Master
Could this be like:

watch 1.1.1.1 (or 8.8.8.8)
on up: set vrrp priority = higher than the backup router
on down: set vrrp priority = lower than the backup router

I can see a problem with this, and it's that once the backup takes over, then Netwatch might get a connection again and create an endless cycle. If I could specify some interface to use, then that'd be good.
 
joegoldman
Forum Veteran
Forum Veteran
Posts: 766
Joined: Mon May 27, 2013 2:05 am

Re: VRRP trigger from lost internet connection

Wed Apr 21, 2021 3:16 am

You'd have to put some checks and balances in there. This is why I said it is setup specific.

If you have PPPoE - you could try using on/off scripts in the ppp profile section so a script is run as PPPoE Client goes online and offline.
If you have Static IP hand-off, you could try pinging your gateway as netwatch, which shouldn't be pingable if internet was to swap to other router
If you have no other option - choose a random highly available IP (such as 8.8.8.8, 8.8.4.4, 1.1.1.1, 1.0.0.1) and add a static route via your internet and do the netwatch on that - so when it flips over to the other provider the netwatched IP will still be trying to route via the downed internet and fail until it restores.

There are many ways to skin a cat - as the saying goes. Best way is highly dependent on your setup.
 
Cablenut9
Long time Member
Long time Member
Topic Author
Posts: 542
Joined: Fri Jan 08, 2021 5:30 am

Re: VRRP trigger from lost internet connection

Wed Apr 21, 2021 3:46 am

If you have Static IP hand-off, you could try pinging your gateway as netwatch, which shouldn't be pingable if internet was to swap to other router
The problem with this is, the gateway would always be powered up and pingable even when the internet is down (hurricane knocks out outdoor fiber lines) so this couldn't work. The fix for me would be to ping some known IP that does indicate internet (such as 1.1.1.1 or 8.8.8.8 or the next hop over in the AT&T network).
 
joegoldman
Forum Veteran
Forum Veteran
Posts: 766
Joined: Mon May 27, 2013 2:05 am

Re: VRRP trigger from lost internet connection

Wed Apr 21, 2021 5:55 am

If you have Static IP hand-off, you could try pinging your gateway as netwatch, which shouldn't be pingable if internet was to swap to other router
The problem with this is, the gateway would always be powered up and pingable even when the internet is down (hurricane knocks out outdoor fiber lines) so this couldn't work. The fix for me would be to ping some known IP that does indicate internet (such as 1.1.1.1 or 8.8.8.8 or the next hop over in the AT&T network).
Yes - exactly why I said it is VERY dependent on your exact setup. Just hard static routing via your provider to 1.1.1.1 should be OK, and change the netwatch script on that. Just don't let that static route propogate to the other router too otherwise clients will not reach 1.1.1.1 when on backup.

Who is online

Users browsing this forum: No registered users and 25 guests