Community discussions

MikroTik App
 
User avatar
robmaltsystems
Long time Member
Long time Member
Topic Author
Posts: 690
Joined: Fri Jun 21, 2019 12:04 pm

Definitive guide to failover

Wed Oct 04, 2023 2:43 pm

I've read many articles and watched many videos on this subject but not set it up for years. Just re-visiting this for a client. Is there a definitive guide for this on RouterOS v6 these days? Requirement is quite simple. WAN1 connection on Ether1. WAN2 on Ether2. Use WAN1 in preference unless data stops flowing through it in which case failover to WAN2. Fail back when connection comes back up.
Last edited by robmaltsystems on Wed Oct 04, 2023 4:47 pm, edited 1 time in total.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 4089
Joined: Sun May 01, 2016 7:12 pm
Location: California
Contact:

Re: Definitive guide to failover

Wed Oct 04, 2023 4:28 pm

V6 is not much different for failover. You have all the same choices:
Route Failover
/ip route add gateway=192.168.1.1 distance=1 check-gateway=ping
/ip route add gateway=192.168.2.1 distance=2
The first gateway will begin as its distance is smaller (default 1); the check-gateway will make sure it is up. When the ping will fail, it will disable the first gateway and the second will take over and when the first one comes up, it will return to its function.
(https://help.mikrotik.com/docs/display/ ... +Balancing)

If you want to check an internet host to know if WAN should failover, that's needs "recursive routing". The ONLY difference here between V6 and V7 is the "scope"/"target-scope" in the recursive route, since rules changes from = to >= in resolving scope — but AFAIK the V7 scope/target-scope in example should also work on V6:
https://help.mikrotik.com/docs/pages/vi ... d=26476608
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 4089
Joined: Sun May 01, 2016 7:12 pm
Location: California
Contact:

Re: Definitive guide to failover

Wed Oct 04, 2023 4:33 pm

Also, one thing that is better in V6 if your WAN using dhcp-client to get it's Internet address is you can use a "dynamic-in" rule to set the need "check-gateway=ping" used in both of the above approaches:
/routing filter add chain=dynamic-in distance=1 set-check-gateway=ping 
Note: the default-route-distance set in /ip/dhcp-client need to match above rule to set check-gateway=ping

Overall, a route's distance= controls the order of WAN selection, outside other factors. So if both WANs are DHCP (or LTE, in which case the default-route-distance in the APN profile), it really is dirt simple to set the default-route-distance=1 on primary and ...=2 on secondary & use above rule & done. If the ISP gateway fails, it will failover. NOW, you need recursive routing if you want to cover cases where the ISP's gateway is pingable but has no internet beyond that.
 
llamajaja
Member Candidate
Member Candidate
Posts: 275
Joined: Sat Sep 30, 2023 3:11 pm

Re: Definitive guide to failover

Sat Oct 07, 2023 7:51 pm

See paragraph I for starters. --- viewtopic.php?t=182373
 
User avatar
robmaltsystems
Long time Member
Long time Member
Topic Author
Posts: 690
Joined: Fri Jun 21, 2019 12:04 pm

Re: Definitive guide to failover

Sun Oct 08, 2023 6:32 pm

Thanks for all the references. Will be having a look at this during the week. Last time I did this, I used a couple of small scripts. Think that was to handle the DHCP nature of the WAN links.

Who is online

Users browsing this forum: Google [Bot] and 26 guests