Page 1 of 1

OSPF Force path for specific subnet

Posted: Wed Jul 03, 2019 10:30 pm
by DotTest37
I have OSPF running between two Mikrotik Routers, each of them with 2 WANs configured on failover.
I have few private subnets behind each router.

Right now my OSPF Interfaces are configured like this:
ISP-A Cost : 10
ISP-B Cost: 30
Thats how I got OSPF to use ISP-A by default for all the intra-office traffic using the private subnets, and is working great.
If any of the two routers loose the ISP-A , then OSPF converge to ISP-B, and back when is again available.

Now, I just added two new private subnets on each side, for VoIP, but Id like to use by default ISP-B only for those subnets, since is the stand-by and not in use.
(I would add QoS later, etc, but I still want to use the unused link)

How can I force OSPF to add routes for the new subnets that use ISP-B without affecting all other routes that are going over ISP-A ?

Re: OSPF Force path for specific subnet

Posted: Thu Jul 04, 2019 9:02 am
by savage
Static routes. Pretty much all that comes to mind.

OSPF can't manipulate cost per route, only per interface.

Re: OSPF Force path for specific subnet

Posted: Sat Jul 06, 2019 4:51 pm
by DotTest37
Static routes. Pretty much all that comes to mind.

OSPF can't manipulate cost per route, only per interface.
Static Routes wont failover when the main ISP goes down.
I would have to create a script for that.
That would defeat the purpose of the OSPF.
Any other option? Another routing protocol? multiple OSPF instances perhaps?

Re: OSPF Force path for specific subnet

Posted: Sun Jul 07, 2019 3:27 am
by mducharme
Any other option? Another routing protocol? multiple OSPF instances perhaps?
You might be able to do this with BGP, depending on your topology.

Re: OSPF Force path for specific subnet

Posted: Sun Jul 07, 2019 6:26 pm
by DotTest37
Any other option? Another routing protocol? multiple OSPF instances perhaps?
You might be able to do this with BGP, depending on your topology.
:-) I wouldn't even know how to start with that.

Can you run two instances of OSPF between the same two routers (with multiple loopback addresses, etc) and make this work?

Re: OSPF Force path for specific subnet

Posted: Mon Jul 08, 2019 12:41 am
by mducharme
Can you run two instances of OSPF between the same two routers (with multiple loopback addresses, etc) and make this work?
Possibly, but that would be a really strange setup. It is very unusual to establish OSPF neighbor with another ISP. You would typically use BGP in this role.

Re: OSPF Force path for specific subnet

Posted: Mon Jul 08, 2019 12:53 am
by joegoldman
Static routes, with check-gateway = ping.

So if Link A is your defailt and you want a specific subnet to go via Link B, then static route with check gateway on Link B (or a netwatch script, which is just as simple), so if Link B dies that traffic goes back via Link A