Code: Select all
# DST-ADDRESS PREF-SRC GATEWAY DISTANCE
0 A S 0.0.0.0/0 192.168.10.2 1
2 A S 0.0.0.0/0 192.168.10.10 1
4 ADo 0.0.0.0/0 192.168.10.2 110
5 Do 0.0.0.0/0 192.168.10.10 110
/ip firewall mangle
add action=mark-routing chain=prerouting disabled=no in-interface=ether4 \
new-routing-mark=left passthrough=yes
add action=mark-routing chain=prerouting disabled=no in-interface=ether5 \
new-routing-mark=right passthrough=yes
/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
192.168.10.2 routing-mark=left scope=30 target-scope=10
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
192.168.10.10 routing-mark=right scope=30 target-scope=10
However, check-gateway=ping is not the correct criteria for disabling the static routes that preferentially route traffic along one of the two paths depending on the source IP. Assuming there's more than one node between the device whose IP is the gateway and the Internet router, a link past the immediate gateway could go down and kill the OSPF derived route but the static route would still merrilly send traffic to the gateway who now has no route to the Internet.
i.e, the topology would be:
Code: Select all
A_ospf A_ospf
instance 1 instance 2
\ /
B D
| |
C E
\ /
F -- Internet
With router A with the static routes passing traffic along one of the two directions, if router C would go down check-gateway would still ping both static default routes as up against B and D, but B would no longer have a route to 0.0.0.0/0.
This really needs to be done by seeing if the router sees a dynamic ospf-provided default route that matches the immediate gateway set in the static route. When a link goes down OSPF will note it and remove the dynamic default route from the routing table of router A, at which point A should note this and disable the static route until which time as OSPF recreates the dynamic route.
I can't find anything in the router that will do this. How would I go about doing this sort of thing?