cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2074
Views
5
Helpful
25
Replies

Routing table routes with different administrative distance

irealwaseemrana
Level 1
Level 1

When a router receives two routes from the same routing protocol to the same destination network, it uses the Metric to decide which one to add to the routing table, so if Metric was different it will add only one of them (The one with the lowest Metric) and if both have the same Metric then it will load balance between them .

Now if the router receives two routes from two different routing protocols (Example: RIP and OSPF) for the same destination network, does the router adds both of them to the routing table (adds the second as backup route maybe and uses the route with lowest AD to route packets) or will only add the one with the lowest Administrative Distance to the routing table ?

Regards

25 Replies 25

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello @irealwaseemrana ,

>> will only add the one with the lowest Administrative Distance to the routing table 

this is what happens if the prefix and the prefix length are the same the AD are checked and OSPF route is installed in the routing table and RIP route is not installed. This is managed by the daemon that manages the routing table.

When multiple routes for the same prefix are provided by the same routing protocol multiple paths can be installed for IGPs like OSPF that have a default maximum-paths of 4 (in the past  I don't know it has been increased to 8 in latest releases) .

BGP has a default of a single path like maximum-paths = 1 . BGP multipath uses its own commands.

Hope to help

Giuseppe

 

Martin L
VIP
VIP

"The longest prefix match always wins among the routes installed in the routing table, while the routing protocol with the lowest administrative distance always wins when the routes are installed into the routing table.

In summary, to make a forwarding decision consists of three sets of processes: the routing protocols, the routing table, and the actual process which makes a forwarding decision and switches packets. These three sets of processes are illustrated, along with their relationship, in the next image: "

see details at https://www.cisco.com/c/en/us/support/docs/ip/enhanced-interior-gateway-routing-protocol-eigrp/8651-21.html

Regards, ML
**Please Rate All Helpful Responses **

 

M02@rt37
VIP
VIP

Hello @irealwaseemrana,

Bases to this output:

Screenshot_20230821_091604.jpg

The choice is based to the way you "read" the route.... following this order to choose the best route to install in the RIB:

[1]-Longuest prefix match 

[2]-Administrative Distance

[3]-Metric

In the scenario you have described, the router does not perform load balancing between routes from different routing protocols. Instead, it prioritizes the route with the lower Administrative Distance.

@Giuseppe Larosa add something:

When multiple routes for the same prefix [1] are provided by the same routing protocol [2], multiple paths can be installed for IGPs like OSPF that have a default maximum-paths of 4 [...] BGP has a default of a single path like maximum-paths = 1 . BGP multipath uses its own commands.

--Also, note that EIGRP can do unequal cost load balancing.

 

 

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

I Send you message check it

Joseph W. Doherty
Hall of Fame
Hall of Fame

BTW, ADs can be modified, and I believe different vendors can prioritize routing protocols differently.

You ask about whether a higher AD excluded route is kept as a backup?  Depends on meaning of "backup".  Certainly if better AD route is withdrawn, same prefix higher AD will then be inserted, but don't know whether router keeps such info or has to "ask" routing sources got anything better.  Same final result, but possibly big differences in time to make change and on router resources.

Multi routes to same destination, as noted by others does vary based on routing protocols, both their defaults and how they work.  For example, given 6 equal cost OSPF routes but limited to 4, which 4?  Unsure that's determinist, might be a race condition.

I don't recall rules, if any, multiple same destination, same AD, across different routing sources.  Again, if limits are exceeded, results might not be deterministic, again, possibly another race condition.

BTW, just spun up CML.  With an OSPF and static route, for same prefix, and with same AD, static route bumped OSPF route out of the route table.

In case of the same AD with AD being modified on this purpose (for no reason other then to make things \interested), IOS will compare original ADs values (values before modification)  and use lower one.  So, u can say "goes back to original values".  I think we tested this during INE CCIE RS v4 lab bootcamp long time ago (I would have to check my notes).  Of course, things may have changed and this may vary between Cisco IOS versions (XR, XE, etc).   So, it make sense that, static route would win over OSPF route for the same prefix and the same AD In case of AD modification,

Important note: AD values are locally significant and don't travel at all. 

Regards, ML
**Please Rate All Helpful Responses **

I activated OSPF routing first, then added static with its metric set to 110.

So, for same prefix, static never had a better metric.

Is that what your lab did?

Hello @Joseph W. Doherty ,

when you add a static route with AD 110 it becomes comparable to the OSPF route but please notice that the static route has [110,0 ]  and the OSPF route will have [110, <OSPF metric > 0> ] so I would say it is expected that the static route will replace the OSPF path in the routing table.

Hope to help

Giuseppe

 

Hmm, good point.

Might be able to confirm that's the case using OSPF and EIGRP, with same destination, same AD, and same metric.

Rereading Martin's post, I was thinking he meant the static route initially had a better AD, but he might just meant statics as a whole, by default, have the best AD, implying with same AD they are always considered "better".

BTW, also tested setting static AD to 111, and no surprise, OSPF with 110 was considered the better route.

It didn't appear to be a race condition, i.e. it appeared, to me, to be deterministic (but my testing wasn't extensive), and either of yours or Martin's why that might be so, are reasonable.

If somewhere Cisco documents what determines the outcome, that's fine, but without such documentation, it also might be implementation specific.

Conceptionally, for what I specifically did, logically it doesn't matter which route source's route is placed into the route table, as both routes are "equal", beyond the issue of a particular protocol's additional metric.  However, as a protocol's metric is protocol specific, how do we "know", between two different protocols, how to compare the "value" of their metrics?

For example, if a OSPF and EIGRP route has the same AD, is the EIGRP route always better than the OSPF route regardless of metric, or does the metric value of the EIGRP router have to also be better than OSPF metric?

Fortunately (?) such situations are something we're unlikely to "normally" encounter.

sorry, I don't recall order of making AD changes but it should not matter; lower original AD value should win.

in case of OSPF and EIGRP with the same ADs,  Yes, EIGRP route should win over OSPF route regardless of metric.  Unfortunately I don,t have my CML to do some testing but getting same metric for EIGRP and Ospf requires some heavy traffic engineering

Regards, ML
**Please Rate All Helpful Responses **

"sorry, I don't recall order of making AD changes but it should not matter; lower original AD value should win."

Also sorry, when you wrote "original AD value", it was unclear, to me, if you meant what a particular routing source uses as its default, or whether you meant whatever a particular prefix had before it has been modified.

What I have in mind between for two possible interpretations of original AD value.

No statics in config:

 

conf t
ip route 1.2.3.0 255.255.255.0 5.6.7.8 
ip route 1.2.3.0 255.255.255.0 5.6.7.8 110
end

vs.

conf t
ip route 1.2.3.0 255.255.255.0 5.6.7.8 110
end

 

I.e. for same AD tie breaking purposes, does the router "remember" what a particular prefix's AD was before it was modified, or it always uses the default AD value for tie breaking?  (I now believe, Martin, intended to mean the latter.)

"in case of OSPF and EIGRP with the same ADs,  Yes, EIGRP route should win over OSPF route regardless of metric"

Very possible, but why if ADs are the same? 

Ah, I may have just found the answer on Wiki (specific to Cisco).

In the event that two routing protocols are configured with the same administrative distance, theCiscorouter will ignore the configured values and instead use the default values.[4]    #1, below

  1.  Cisco Systems(n.d.), Information About Routing, Cisco Systems Inc, retrieved 16 September 2013

The above Wiki information, I believe also mentions only one route source is used to avoid possible routing loops.  This makes sense, as any individual routing protocol should be loop free.

Of course, accidentally creating routing loops using static routes, might happen, but then static routing doesn't preclude that.

The above, then, explains why my static route overrode the OSPF route each having the same AD.  (Again, I suspect this was what Martin was trying to tell us.)

Regarding Giuseppe's thought, it appears, that a routing protocol's metric, if the above is accurate, shouldn't matter when ADs are the same.

Right, "default" wording is correct one and better choice; that;'s what I meant by saying "original AD value before modification".

Regarding of metric, Metric does not matter because it comes after protocol selection is done based on lower AD (step 2 mention above while metric is step 3).  Metric matters when the same protocol has to make decision between multiple routes to the same destination (aka, same route/prefix length).   

Regards, ML
**Please Rate All Helpful Responses **

Hello @Joseph W. Doherty ,

thanks for correction.

We learn something new everyday here in Cisco forums

Hope to help

Giuseppe

 

Review Cisco Networking for a $25 gift card