OSPF route configuration problem

Hello everyone,

I have an OSPF configuration task where I need to send traffic between routers on specified routes. In the picture of logical scheme below you can see that traffic from Loopback0 on R3 needs to flow over R1 and R2 in order to get to Loopback0 on R4. It is marked with red line.
Also Loopback1 interfaces on R3 and R4 need to communicate through blue line (R3-R4). Routers R1, R2, R3 & R4 are currently all part of OSPF area 0.
What method would you recommend me to use in order to make this work?

Kind regards,

Hello Kristijan

Well, it might be worth taking a look at what we can’t do and why. OSPF, as a link-state protocol, does not allow you to specify metrics for specific prefixes. OSPF works with LSAs rather than prefixes, and you can filter out specific LSAs from being redistributed, but only between areas. Any LSAs shared within an area, such as in your example here, cannot be filtered. Changing the cost of loopback or other interfaces will affect OSPF routing, but it will do so for all routes, so you can’t differentiate between one or the other.

It is actually quite difficult to influence OSPF routing within an area in the way you are suggesting because parameters like cost, bandwidth, and filtering will affect all routing in the same way, and not based on particular prefixes. That’s how OSPF has been designed. It’s link based and not prefix based.

As far as I can see, there is no way to to do this in OSPF unless you break apart the OSPF area into four areas, one for each router involved. Then you can adjust the routing between OSPF areas quite easily using LSA filtering.

I hope this has been helpful!