02-11-2018 09:17 PM - edited 03-08-2019 01:48 PM
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
Solved! Go to Solution.
02-12-2018 08:29 AM
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
02-15-2018 07:13 AM
02-15-2018 07:51 AM
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
02-11-2018 11:13 PM
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
02-12-2018 04:52 AM
A couple of things:
02-12-2018 08:29 AM
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
02-12-2018 08:33 AM
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
02-15-2018 06:58 AM
Thanks for reply Rich.
So how the next hop is choosen if cost to two next hops is same?
Regards
MAhesh
02-15-2018 07:13 AM
02-15-2018 07:51 AM
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
02-27-2018 08:52 PM
Many thanks Rich for great explanation!
Best Regards
Mahesh
02-28-2018 03:09 PM
Mahesh
You are welcome. I am glad that you find our explanations helpful.
HTH
Rick
06-27-2021 04:17 PM
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.
06-27-2021 05:30 PM - edited 06-27-2021 05:31 PM
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.
06-28-2021 12:09 PM
@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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide