cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
992
Views
5
Helpful
9
Replies
Frequent Contributor

ospf two neis with equal cost

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
Hall of Fame Master

Re: ospf two neis with equal cost

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

VIP Expert

Re: ospf two neis with equal cost

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.)
Hall of Fame Master

Re: ospf two neis with equal cost

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

9 REPLIES 9
Beginner

Re: ospf two neis with equal cost

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

Highlighted
Beginner

Re: ospf two neis with equal cost

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.
Hall of Fame Master

Re: ospf two neis with equal cost

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

Hall of Fame Master

Re: ospf two neis with equal cost

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 

Frequent Contributor

Re: ospf two neis with equal cost

Thanks for reply Rich.

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

 

Regards

MAhesh

VIP Expert

Re: ospf two neis with equal cost

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.)
Hall of Fame Master

Re: ospf two neis with equal cost

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

Frequent Contributor

Re: ospf two neis with equal cost

Many thanks Rich for great explanation!

 

Best Regards

Mahesh

Hall of Fame Master

Re: ospf two neis with equal cost

Mahesh

 

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

 

HTH

 

Rick

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards