Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

OSPF Equal Cost Path Selection

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.

New Member

Re: OSPF Equal Cost Path Selection

File attached this time

New Member

I got a similar question. 

I got a similar question. 

scenario - 5 routers full mesh - all share the same cost "bandwidth" running OSPF. 

is it normal to see a traceroute from 3 to 7  as per below doing loadbalancing?

3     6


4     7

1 20 msec 12 msec 16 msec
2 20 msec 12 msec 20 msec
I dont think this is right so i'm adding a lower cost to prefer for router from each corner to flow thru 5 and. Dong point to point osp network... 
Is the traceroute above normal for OSPF loadbalancing. To me doesnt seem right.. .but wanted to check as havent been able to find the right answer out there. 

Cisco Employee

Re: OSPF Equal Cost Path Selection


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

New Member

Re: OSPF Equal Cost Path Selection

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.

New Member

OSPF Equal Cost Path Selection

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..

Super Bronze

Re: OSPF Equal Cost Path Selection


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.)

New Member

Hi there,

Hi there,


I was looking for the show command today and found this unsolved topic.

I also found the answer when CEF is activated.

show ip cef exact-route {source-ip-address} {dest-ip-address} [internal]

my 2 cts

CreatePlease login to create content