cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
23947
Views
0
Helpful
13
Replies

OSPF Equal Cost Path Selection

fgleeson
Level 1
Level 1

This is a nerdy enough qeury in reality.

We have a single area - area 0.0.0.32. 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 10.32.51.0 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.

13 Replies 13

fgleeson
Level 1
Level 1

File attached this time

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

   5

4     7

1 172.16.34.4 20 msec
172.16.35.5 12 msec
172.16.36.6 16 msec
2 172.16.47.7 20 msec
172.16.57.7 12 msec
172.16.67.7 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. 

Amit Singh
Cisco Employee
Cisco Employee

Hello,

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.

http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094820.shtml

HTH,please rate if it does.

-amit singh

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.

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

Disclaimer

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.

Posting

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

what would be the equivalent command for ip cef load-balancing per-packet on a cisco 6500? Am trying to do that command but do not see the option?

 

Thank you.

 

I am not clear what the answer is on 6500. I would like to offer a cautionary note about using load balancing per packet. This is intuitively attractive - we would like to make use of multiple paths. But this choice is subject to the law of unintended consequences. You probably are looking for this as a way to improve performance. But it is quite possible that this choice may degrade performance. Load share per packet is likely to increase the possibility of out of order packets. Depending on the application out of order packets are likely to have a negative impact on performance.

 

HTH

 

Rick

HTH

Rick

Thanks for your input. So the current behavior from your experience would be best. My current situation is I have 2 10G interface and the cost is the same by default so its "load balancing" but with the default behavior from what i have read here with destination ip. Is that correct assumption am stating here? 

Yes, in my experience the current behavior of load balance per destination is the best. If you have two paths and they have equal cost then OSPF will put two paths into the routing table for each destination. Assuming that CEF is enabled, then for each destination CEF will choose one path or the other. If you have a reasonably diverse group of destinations you should come fairly close to equal use of both paths. If you have only a small number of destinations or if one destination has an unusually large proportion of the traffic then utilization of the paths may be unbalanced.

 

I am not sure what question you are trying to ask or what problem you are trying to solve.

 

HTH

 

Rick 

HTH

Rick

No issue. Just trying to have the best option. Thanks for the input. i will leave it with the default behavior. thanks.

Thanks for clarifying that you are just trying to make sure that you have chosen the best option. I agree that the default of per destination load sharing is that best option.

 

HTH

 

Rick

HTH

Rick

duplaa
Level 1
Level 1

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]

http://www.cisco.com/c/en/us/support/docs/ip/express-forwarding-cef/18285-loadbal-cef.html

my 2 cts

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco