cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6090
Views
10
Helpful
12
Replies

ospf two neis with equal cost

mahesh18
Level 6
Level 6

Hi Everone,

 

We have 2 OSPF nei with same cost as shown below

 

interface Vlan3500

ip address 10.0.12.62 255.255.255.252

ip ospf cost 100
!
interface Vlan3600

ip address 10.0.12.66 255.255.255.252

ip ospf cost 100

 

show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
10.2.10.199 1 FULL/DR 00:00:39 10.0.12.65 Vlan3600
10.2.10.200 1 FULL/DR 00:00:39 10.0.12.61 Vlan3500

 

Need to confirm if cost is same then nei with lowest router id which is 10.2.10.199 will be always used as next hop?

 

if i do 

 

show ip route 10.36.121.20
Routing entry for 10.36.121.0/24
Known via "ospf 2", distance 110, metric 201, type extern 1
Last update from 10.0.12.65 on Vlan3600, 07:39:28 ago
Routing Descriptor Blocks:
* 10.0.12.65, from 10.0.24.229, 07:39:28 ago, via Vlan3600
Route metric is 201, traffic share count is 1

 

need to know  if under current config will this router do load sharing with two current ospf nei?

 

Regards

Mahesh

 

3 Accepted Solutions

Accepted Solutions

Mahesh

 

With a mask of 255.255.255.252 there is certainly not anything on these vlans other than the neighbor router. But I do not believe that this necessarily means that you need to configure them as point to point neighbors.

 

You show us the interfaces which are assigned the same OSPF cost. But that does not necessarily mean that the routes advertised to you by the neighbor will have the same cost. Let us think of a simple example. Let us assume that neighbor 1 learns a route to subnet 10.10.10.0/24 from a directly connected neighbor and has assigned it a metric of 100. Let us assume that neighbor 2 learns a route to that subnet but it is two hops away and neighbor 2 has a metric of 200. Both neighbors advertise the subnet to your switch/router which applies the interface cost of 100. The result is that the OSPF data base has two entries for the subnet, but their cost is not equal. So there will be no load sharing in this case.

 

It is true that by default OSPF does do equal cost load sharing. So if there are two entries in the OSPF data base with equal metric then both will be put into the IP routing table and load sharing will take place. The comparison is based on both the local interface cost and the metric advertised from the neighbor.

 

HTH

 

Rick

HTH

Rick

View solution in original post

They are both used, equally, assuming the maximum-path setting supports the number of equal cost routes. To further clarify, the load sharing is for equal cost per destination network, not just equal cost to the next hop or adjacent OSPF router.

What I don't recall being documented, is which hop is used if the maximum-path doesn't support the actual number of equal cost paths. (Years ago, I ran into what I considered a bug, when the number of equal cost routes exceeded the maximum-path setting.)

View solution in original post

I like the way that Joseph makes a point that I tried to make in a previous response. It is not equal cost to the OSPF neighbor but is equal cost to the destination address (composite of costs through each OSPF router on the path to the destination).

 

I am not positive but I believe that when the number of available equal cost paths exceeds the max path value that IOS chooses the paths that have been in the data base the longest (the most stable of the paths).

 

HTH

 

Rick

HTH

Rick

View solution in original post

12 Replies 12

GoncaloContente
Level 1
Level 1

Hi Mahesh,

 

OSPF load balances across equal cost paths to the same destination by default, the number of default equal cost paths is 4, this means that the router will only install 4 equal cost routes to the same destination on the routing table, although you can have up to 16 equal cost routes, for this you need to configure the maximum-paths under router ospf:

R1(config)#router ospf 1
R1(config-router)#maximum-paths 8
R1(config-router)#end
R1#

 This will tell OSPF to  install 8 equal cost routes into the routing table.

 

Hope this helps

 

Regards


Goncalo Reis

Yachay
Level 1
Level 1

A couple of things:

 

  • According to your configuration, I am assuming you are using P2P links. So, you will need to specify on each SVI and router the following command: ip ospf network point-to-point
  • I think you are thinking of the designated router (DR.) Even, if routers don't have the previous configuration, that doesn't affect the behavior for load balancing (under the current configuration.) DR (and BDR) is used for propagation of the updates of the routes.

Mahesh

 

With a mask of 255.255.255.252 there is certainly not anything on these vlans other than the neighbor router. But I do not believe that this necessarily means that you need to configure them as point to point neighbors.

 

You show us the interfaces which are assigned the same OSPF cost. But that does not necessarily mean that the routes advertised to you by the neighbor will have the same cost. Let us think of a simple example. Let us assume that neighbor 1 learns a route to subnet 10.10.10.0/24 from a directly connected neighbor and has assigned it a metric of 100. Let us assume that neighbor 2 learns a route to that subnet but it is two hops away and neighbor 2 has a metric of 200. Both neighbors advertise the subnet to your switch/router which applies the interface cost of 100. The result is that the OSPF data base has two entries for the subnet, but their cost is not equal. So there will be no load sharing in this case.

 

It is true that by default OSPF does do equal cost load sharing. So if there are two entries in the OSPF data base with equal metric then both will be put into the IP routing table and load sharing will take place. The comparison is based on both the local interface cost and the metric advertised from the neighbor.

 

HTH

 

Rick

HTH

Rick

I just read the original post again and realize that an additional question was asked which needs a response. "Need to confirm if cost is same then nei with lowest router id which is 10.2.10.199 will be always used as next hop?" The lowest router ID does not have anything to do with which route will be used.

 

HTH

 

Rick 

HTH

Rick

Thanks for reply Rich.

So how the next hop is choosen if cost to two next hops is same?

 

Regards

MAhesh

They are both used, equally, assuming the maximum-path setting supports the number of equal cost routes. To further clarify, the load sharing is for equal cost per destination network, not just equal cost to the next hop or adjacent OSPF router.

What I don't recall being documented, is which hop is used if the maximum-path doesn't support the actual number of equal cost paths. (Years ago, I ran into what I considered a bug, when the number of equal cost routes exceeded the maximum-path setting.)

I like the way that Joseph makes a point that I tried to make in a previous response. It is not equal cost to the OSPF neighbor but is equal cost to the destination address (composite of costs through each OSPF router on the path to the destination).

 

I am not positive but I believe that when the number of available equal cost paths exceeds the max path value that IOS chooses the paths that have been in the data base the longest (the most stable of the paths).

 

HTH

 

Rick

HTH

Rick

Many thanks Rich for great explanation!

 

Best Regards

Mahesh

Mahesh

 

You are welcome. I am glad that you find our explanations helpful.

 

HTH

 

Rick

HTH

Rick

Hi a bit late with a reply, but I have just labbed this. I checked and it is not LSA age. I had 7 routers providing equal cost default routes to a central router and gradually increased the number of maximum paths from 1 to 7. The paths that got chosen within the max paths value seemed to be pretty random. Pathways that were chosen at 4 max paths weren't always chosen at 5 max paths but might be at 6 max paths. It looked random, but I didn't think it could be. However, it wasn't based on router-id, next hop address, cost to neighbor, or age of LSA or any obvious and consistent criteria. I compared the LSA database and the routing table to see if there was a consistent pattern, but there wasn't.

 

So I thought about what other criteria might rationally be used to make the choice. It seemd to me it would make sense to include routes within the max paths based upon the routers you last heard from most recently. So if you had a max paths of 4 and 7 possible equal pathways you would choose the pathways from the 4 routers you most recently recieved hellos from. So I tested it by adjusting hello timers to 30 seconds and 60 seconds on two of the routers hoping that the hellos for the default routers being sent at 10 seconds would pretty much always be received before the hellos from the routers with the longer hellow interval. It worked perfectly, the two routers with the longer hello intervals didn't get picked to include in the max paths until I got to 6 and 7 max paths respectively. Not absolute proof, but pretty strong evidence for my hypothesis. I know you didn't say it was defintiely the LSA age, so I am not correcting you, but I though you might be interested in a more accurate answer.

Interesting, but, BTW, when something is undocumented, and not defined in the standards, always, I believe, good practice to not rely on a "discovery" like this, as, vendor might change it in a new release.

BTW, in my post where I noted finding, what I thought was a "bug", when actual equal paths exceeded max paths, it wasn't the dropping of the "excess" equal cost paths or what appeared to "random" drops, I recall, it was dropping paths that weren't actually equal cost.  It worked fine when max paths did "cover" actual number of equal cost paths.

A newer release of IOS no longer showed this behavior.

@cmulcaire thanks for the results of your testing. In my response I did not say it was age of the LSA. LSAs get refreshed and the LSA age is not an indicator of how long the entry has been in the data base. What I was referring to is like what you see in the output of show ip route where it shows how long the entry has been in the routing table. This behavior would be similar to the path selection criteria for BGP where one of the steps is to select the entry that has been in the data base the longest.

HTH

Rick
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