OSPF Equal Cost Path Selection

Unanswered Question
May 31st, 2007
User Badges:

This is a nerdy enough qeury in reality.

We have a single area - area All intra-area routes. We have 2 switches in the core of the network, and 10 switches at the edge. All of these switches are connected via layer 3 OSPF routed links.

The cost for all links is 20 - which is based on bandwidth between the boxes - which is 2Gbps.

Have a look at the enclosed jpeg to get an idea.

Very simple.

Query revolves around the path selection available to OSPF.

The path from Core 2 to the network is easy - straight across the link between the core switches for a cost of 20.

Question :- if the link between the cores fail, which path will be chosen by OSPF and why?

It can go through ANY of the other edge switches for a total cost of 40, but it will choose a particular one. What criteria does OSPF use to select this path?

Remember, the path costs are equal, they are all intra-area.

I tried messing with Router ID, but this doesn't seem to be it.

I tried highest interface IP addresses, but it doesn't seem to be this.

It is not a random act, the algorithm chooses the same one every time.

There must be some parameter in the LSDB that is the defining one when it comes to path selection.

Can you help me out please. I need someone who understands the OSPF algorithm better than I do (which might not be hard!).

Appreciate any comments for debate.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Amit Singh Thu, 05/31/2007 - 04:43
User Badges:
  • Cisco Employee,


In this case OSPF will install the available 3 routes to the destination connected to Core Switch1. By default OSPF can do equal-cost path load-balancing, so it will install upto 4 routes by default as we have equal cost for the destination.

By default on Cisco router interface, per-destination load-balancing is enabled which means that as far as your destination ip addrress remains same, traffic will always use one link. If you want your traffic to be distributed across all the available paths, you have to enable " per-packet " load balancing and it will use all the avilable 3 paths.

If CEF is not enabled on the box then you can use " no ip route-cache" under the interface to enable per-packet load-balancing. If CEF is enabled use " ip cef load-balancing per-packet" under the interface.

This link should help you understanding the same.


HTH,please rate if it does.

-amit singh

fgleeson Thu, 05/31/2007 - 05:34
User Badges:

Thanks for the reply amit.

I should have put in the catch - the Core switches are Nortel 8600 layer 3 switches. They do not have ECMP enabled by default so they only select a single OSPF route.

I imagine it must be the same if i restricted the Cisco router to selecting only 1 path for routing.

Which one of the 3 would it choose and why?

What are the factors that would make it choose one over another?

It's a really tough OSPF question.

Many thanks for your reply.

sunnykhan.m Wed, 04/10/2013 - 02:27
User Badges:

it is very simple fgleeson

if you have same cost for the all the three routes and you want to chosse one them, you can increase the cost manually for non-selecting  interfaces..

Joseph W. Doherty Wed, 04/10/2013 - 06:45
User Badges:
  • Super Bronze, 10000 points or more


The  Author of this posting offers the information contained within this  posting without consideration and with the reader's understanding that  there's no implied or expressed suitability or fitness for any purpose.  Information provided is for informational purposes only and should not  be construed as rendering professional advice of any kind. Usage of this  posting's information is solely at reader's own risk.

Liability Disclaimer

In  no event shall Author be liable for any damages whatsoever (including,  without limitation, damages for loss of use, data or profit) arising out  of the use or inability to use the posting's information even if Author  has been advised of the possibility of such damage.


My guess (as I haven't re-read the RFC), selection of an ECMP to retain in a routing table (assuming all possible ECMP are not retained) and/or exactly how packets or flows are ECMP routed is implementation dependent.

I recall years ago bumping into a situation where I had 6 (OSPF) ECMP on a Cisco router which had the (then) default allowance of 4 ECMP in the route table.  I don't recall exactly what the issue was, but whatever it was doing I considered it a bug.  The "fix" was to allow the router to use all 6 ECMP.  (Again, don't remember the specifics, but the issue I saw was more involved than 2 of the 6 ECMPs weren't retained.)


This Discussion