Description

I have two downstream OSPF neighbors, one primary link (xe-0/0/0.800) and one secondary (xe-0/0/1.800) for redundancy, and it always selects the route from the neighbor connected via xe-0/0/1.800 (secondary).

 

I would like to prefer via xe-0/0/0.800 (primary). I tried to bounce the secondary interface, but after it comes up, OSPF selects the secondary link again.

Symptoms

As you can see, it is choosing the secondary link instead of the primary:

 

root@SRX> show route brief

 

inet.0: 23 destinations, 24 routes (23 active, 0 holddown, 0 hidden)

+ = Active Route, - = Last Active, * = Both

...

192.168.164.0/22  *[OSPF3/10] 04:59:32, metric 44

            to 192.168.160.1 via xe-0/0/0.800

          > to 192.168.160.5 via xe-0/0/1.800

Solution

OSPF uses SPF algorithm or Dijkstra algorithm to choose the path with the lowest cost. It will have preference for paths that are in the same area or paths with a higher speed link over other paths.

 

If you have two equal-cost paths in the same area (like in this scenario), and SPF is not choosing the desired path, that is because, for some reason, the algorithm is concluding that one of the paths has a lower cost, and we can't modify the algorithm.

 

The solution in this case is to manually configure a higher cost for the secondary link, so that the primary link is selected. Please refer to KB75352: OSPF shortest path selection and how we can manipulate path by using metric/cost. [juniper.net]

 

If you have performance tools, you can also test the performance between both links in case you want to confirm if there is a big performance difference between the two links.

Modification History

2024-08-01 : Article Created