Currently, if I have a multiwan setup and I am trying to get reliable failover, I have to use different methodologies, based on my physical config. Some of these would be.
- Dynamic IP address. Can’t use source address in a test without scripting, but my interface is known.
- Behind another local router. Can’t use check gateway as it will always be up if the upstream router is offline.
- Direct connection on static IP. This is quite easy.
Currently, if I want to check for a link up in scenario 1, or 2 above, I need to choose an IP address as a test target per interface. E.G. 8.8.8.8.
I set a set a static route to this address via the current default gateway (Need to search for the right gateway with known terms). E.G. /ip route; add dst-address=8.8.8.8 distance=10 gateway=[get [find immediate-gw~“ether1-LTE-modem” and routing-table=main
and dst-address=0.0.0.0/0] value=gateway]
I then set a black hole route to this address at a lower priority, so this test address cannot be used by any other connection.
/ip route; add blackhole dst-address=8.8.8.8 distance=20
I create a netwatch pinging 8.8.8.8. If it is down, I disable the route that forces me through the correct interface.
/ip route; disable [find immediate-gw~“ether1-LTE-modem” and routing-table=main
and dst-address=0.0.0.0/0]
When netwatch comes back
/ip route; enable [find immediate-gw~“ether1-LTE-modem” and routing-table=main
and dst-address=0.0.0.0/0]
So you can see this is a fair bit of work and I need a unique, reliable ping target for each connection.
If I could just use the outbound interface in netwatch as a selector, I could more easily do this with the same target for each netwatch. I would just create a policy route for each interface based on the outbound interface.
Am I missing something here? If there is an easier way, I would love to know.
