OSPF - Routing 2 gateways

Hi,

I have 2 routers (1100AHx2 and CCR1036) connected by 2 different links (1x 24ghz Ubiquiti, 1x 5GHz Airfiber 5X HD Ubiquiti). The CCR is the fiber gateway of my network.

In my network I have some subnets (for example: 172.18.2.0/24, 172.18.5.0/24, 172.18.19.0/24) (connected to 1100AHx2)

Now I want, always for example, route 172.18.19.0/24 with the 24ghz link, and 172.18.2.0/24 and 172.18.5.0/24 with the 5ghz link)
I’m using static routing and route rules to make it works:
1100AHx2

/ip route
add distance=1 gateway=192.168.248.241 routing-mark=VIAZZI5GHZ
add distance=1 gateway=192.168.247.49 (24GHZ link)

/ip route rule
add action=lookup-only-in-table comment="RETE 2" dst-address=0.0.0.0/0 \
    interface="ether6 - VsRete2" table=VIAZZI5GHZ
add action=lookup-only-in-table comment="RETE 5" dst-address=0.0.0.0/0 \
    interface="ether5 - VsRete5" table=VIAZZI5GHZ
add action=lookup-only-in-table comment="RETE 12" dst-address=0.0.0.0/0 \
    interface=ether12 table=VIAZZI5GHZ

CCR 1036

/ip route
add distance=1 dst-address=172.18.2.0/24 gateway=192.168.248.244
add distance=1 dst-address=172.18.5.0/24 gateway=192.168.248.244
add distance=1 dst-address=172.18.19.0/24 gateway=192.168.247.50 (24GHZ link)

Now, I want, if possible, to have also failover between the two links.
If 5ghz link goes down all traffic is routed on 24ghz and viceversa. Is it possible with OSPF, I have to do it statically? (if yes, can you give me some help?)

Thank you!

OSPF cannot distinguish subnets like that. Starting an OSPF session over the links will balance traffic equally between them. If they are majorly dissimilar, ie: a 500 Mb/s link and a 1 Gb/s link; you can use vLANs to make them equal. IP Architechs calls this method “transit fabric” and has a good write-up on their blog: https://stubarea51.net/2016/10/27/wisp-design-using-ospf-to-build-a-transit-fabric-over-unequal-links/
You still get the active fail-over with OSPF, but you can’t say that one subnet gets one link and the other subnet gets the other link (which shouldn’t be a big deal unless there is a specific business practice that requires this).


If you’re already using static routes, you could also use the check-gateway option to fail the links in the case that one dies. I prefer ARP in this scenario, because it states if the router doesn’t have the MAC address of the IP in it’s ARP table it fails. You can also use PING to do this, but in my experience the link never fails because the IP is still reachable over the other link and therefore doesn’t drop the route.

Example for your RB1100:

/ip route
add distance=1 gateway=192.168.248.241 routing-mark=VIAZZI5GHZ check-gateway=arp
add distance=250 gateway=192.168.247.49 routing-mark=VIAZZI5GHZ
add distance=1 gateway=192.168.247.49 check-gateway=arp
add distance=250 gateway=192.168.248.241