Yes, sorry I forgot that this would only work with point-to-point interfaces. I can add the IP address there, but what if the IP address changes on this gateway?
It seems to work like this:
0 A S 0.0.0.0/0 8.8.8.8 1
1 S 0.0.0.0/0 GW2_IP 10
2 A S 8.8.8.8/32 GW1_IP 1
However this way, I need to update at least GW1_IP in case it changes… What is the best way to do this? DHCP client script?
Thanks for your help and detailed answers!
From the first post I also assumed that this is clearly for failover and not load balancing. Anyway, right now this approach seems to work as it should!
Can I use multiple CheckingHosts here? If yes, how?
Also is it possible to send Email when the failover link becomes active?
I have another location where something similar should be done, however the layout of the network if a little bit different.
I have an LTE uplink and a WiFi client uplink. I want to fallback to WiFi when the LTE is unreachable. I saw that you (same as me) don’t have much experience with LTE, but maybe you can help.
Wifi has DHCP client, so the same script could be used there.
However LTE does not have DHCP client, default route is added in LTE APN. It seems that it is a point-to-point interface because the address/network is
1 D 100.115.98.168/32 100.115.98.168 lte1
What I don’t know if this address changes or not.. If not, then in this scenario gateway=interface can be used right?
Ah, that makes sense. This is what I’ve done. And it works when tested, as my ISP1 goes down pretty often and I never noticed any down-time on my client devices.
Yeah, all your routes are not working It’s because of RouterOS limitation: recursive routes cannot be resolved via interface routes (i.e. gateway=pppoe-out1 is bad route).
As a workaround, you make a copy of your PPP Profile that is used for that PPPoE connection, set “Remote address” to your Host (e.g. remote-address=8.8.8.8) and then simply remove a route to 8.8.8.8. Everything should work after that.
Well I’m pretty sure now that this would work this, because the default route added by ROS is also just using gateway=lte1, so this is a point-to-point interface.
However I have added everything as described, with the lte interface instead of IP and the connection won’t come up with this setup (These devices are in a remote location so I don’t really know what happens after these routes are applied).
Yeah, please see my post above… I don’t know what’s the best way to deal with LTE in that case. If there’s no event-driven scripts (like a script in DHCP Client), then probably a Scheduler is your friend, to check like every minute or so if LTE gateway IP changed and change your route accordingly.
How would we replicate this same work-around when a PPPoE connection has both native IPv4 and native IPv6? I was able to do it for IPv4, but not for IPv6 as the “remote-address” only accepts a single IP.
That can’t be done as mentioned before, “Remote Address” in PPP profile only accepts a single address. Which is the same for IPv4, it limits recursive routing to single “Checking Host” as we can’t use for more than one IP for each PPP profile/interface’s “Remote Address”.
Network of course refers to the “test host”. Address given means any private/unused address? I don’t understand its function/purpose, I don’t see how it would help in recursive routing failover with pppoe interfaces.
I tried this but it results in “reachable” only via single pppoe2 or 1 even if it’s destined for the other one
###Workaround for interfaces###
/ip address
add address=127.0.0.1 comment="Host for Recursive Routing on ISP 1" interface=pppoe-out1 network=8.8.8.8
add address=127.0.0.1 comment="Host for Recursive Routing on ISP 1" interface=pppoe-out1 network=1.1.1.1
add address=127.0.0.1 comment="Host for Recursive Routing on ISP 2" interface=pppoe-out2 network=1.1.1.1
add address=127.0.0.1 comment="Host for Recursive Routing on ISP 2" interface=pppoe-out2 network=8.8.8.8
/ip route
add distance=1 gateway=8.8.8.8 routing-mark=to_ISP1 check-gateway=ping comment="Recursive Route for first test host to ISP 1"
add distance=2 gateway=1.1.1.1 routing-mark=to_ISP1 check-gateway=ping comment="Recursive Route for second test host to ISP 1"
/ip route
add distance=1 gateway=1.1.1.1 routing-mark=to_ISP2 check-gateway=ping comment="Recursive Route for first test host to ISP 2"
add distance=2 gateway=8.8.8.8 routing-mark=to_ISP2 check-gateway=ping comment="Recursive Route for second test host to ISP 2"
You cannot check different uplinks via the same test host. So you need different hosts per uplink (like 8.8.8.8 and 1.1.1.1 for ISP1 and 8.8.4.4 and 1.0.0.1 for ISP2)