OSPF equal cost path

On this post, I will try to show how OSPF behaves when there are two equal cost paths towards a destination. To demonstrate this, I have prepared my usual topology.

ospf-equal-cost-path-junos

On this topology all routers are running OSPF but our focus is on the router J32 which is circled at the bottom and our destination network is 172.40.1.0/24 Since we have set the reference bandwidth to 10G and each links are 1G a single link OSPF cost is 10. Now let’s see how J32 device reaches this destination network.

We can see that metric towards this destination is 40 and OSPF lists both routes but are we really using them? Let’s check the forwarding table. The important thing here is also that if one of the path’s metric was higher, we wouldn’t see it here in the list. We only see the paths if they have equal paths.

Nope! we don’t install both next hops but only one. This is something we can manipulate.

First we create a policy for load balancing and then export it into the forwarding table as below.

Once we commit the changes, we check the forwarding table again.

Bingo! we have installed both next hops on the forwarding table which actually means J32 router should load balance the flows towards this destination. How the load balancing algorithm works is out of the scope of this post.

Now we will play a bit with the cost of the links to demonstrate that OSPF installs only the best path.

I am just increasing the metric to 20 from 10 which should make the total cost equal to 50 on the north PATH#1

and then we check the routing table on J32 once again and see that 192.168.195.1 next hop disappeared as it has a higher metric (more cost)

I hope this was an informative post!

You have a feedback?