cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2398
Views
0
Helpful
11
Replies

Prefix length or administrative distance?

cosimodagostino
Level 1
Level 1

Excuse a router in its routing table gives priority to prefix length or administrative distance? For example, if I have a route eigrp / 24 and a route ospf / 28 which router will insert in the routing table? They taught me the most specific route before anything else but I see conflicting opinions on the net

2 Accepted Solutions

Accepted Solutions

I am not clear what your confusion (or your issue) is about. I would suggest a slightly different way of thinking about the steps.

The first step is that there are potentially multiple processes that develop routing information (possibly one or multiple OSPF processes, possibly one or multiple EIGRP processes, possibly a BGP process, possibly a static route process). Each of these processes operate independently of each other and each process develops routes for a destination and present that candidate route to the routing table.

The next step is that there is a process that maintains the routing table. It considers inputs from the various route development processes. If a candidate route has a prefix that is unique (address of the prefix and length of the prefix) then the candidate route is entered into the routing table. So if there were a candidate route from ospf of 192.168.10.0 with a prefix length of /28 and there were a candidate route from eigrp of 192.168.10.0 with a prefix length of /24 (as suggested in the original post) then both are unique and both will be entered into the routing table. If 2 candidate route have the same prefix address and have the same prefix length (if both ospf and eigrp learned 192.168.10.0/28) then administrative distance would come into play and the route with the better AD will be entered into the routing table (eigrp would win).

The next step is that there is a process that forwards packets. When it is starting to forward a packet it looks into the routing table to find a route for the destination. The forwarding process does not care where the route came from or what its AD is. The forwarding process only wants to find the most precise match in the routing table and use that to forward the packet.

So let us think about a few examples. If the forwarding has a packet with a destination of 192.168.10.5. It would search the routing table and would find the route from ospf and the route from eigrp. The route from ospf is a more specific match and would be used to forward the packet. What if the forwarding process had a packet with a destination of 192.168.10.130? It would find the entry from eigrp (and not find the entry from ospf since it is not a match) and the eigrp route would be used. What if the forwarding process had a packet with a destination of 192.168.9.46? Is there an entry in the routing table that would match? The default route is a route with a length of zero and would be a match.

So it helps to think about this in terms of the various processes, what are their inputs and what are they trying to accomplish. The route development processes develop candidate routes and present them to the routing table maintenance process. The routing table maintenance process considers the candidate routes and determines which ones should enter the routing table. The packet forwarding process has a packet to forward and consults the routing table to find the optimum path toward the destination.

HTH

Rick

View solution in original post

Thanks for the clarification. You do have confirmation.

HTH

Rick

View solution in original post

11 Replies 11

Hi

   They will considered as different destination and all routes will be installed.  You can see a clear explanation here:

Look for: " How Metrics Determine the Route Selection Process "

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

Jon Marshall
Hall of Fame
Hall of Fame

 

Always the most specific prefix before anything else. 

 

Only if you have equal length prefixes would AD come into it as a decider. 

 

Jon

The original poster says he has seen conflicting opinions on the net. That is not surprising. I have found in the case of conflicting opinions that frequently the sources of the opinions are really talking about slightly different things, or define some terms differently, or something in the frame of reference is different. And it is always possible that one of the differing opinions was wrong.

In the example given in the original post there are 2 routing entries, a /24 and a /28. IOS would treat these as 2 different prefixes and insert both routes into the routing table. In making a forwarding decision IOS would check to see if the destination matches the /28 and if it does then the packet would be forwarded using the next hop defined in the /28 entry. If the destination did not match the /28 but did match the /24 then the packet would be forwarded using the next hop defined in the /24.

Administrative distance would only come into consideration if there are 2 routing entries for the same length.

HTH

Rick

So in short the steps are the following: 1) the router learns all the routes example / 24/28/27/16 2) on the basis of the algorithms used (eigrp and ospf in the example) each of them elaborates its optimal path based on their metric 3) presents it in the routing table with their administrative distance 90 eigrp and 110 ospf) 4) If the destination ip is for example 192.168.10.18/28 and in the routing table there is ospf 192.168.10.16/25 and eigrp 192.168.1.16/24 stopping here the ospf one would be chosen but if they were both / 25 would have chosen eigrp. 5) If continuing to set a static route 192.168.10.16/28, the latter would be chosen or even more precisely, if a host route 192.168.10.18/32 would be chosen, this would be chosen. The confusion in the network I think is due to the fact that the router first learns then elaborates and installs in the routing table and then chooses when to execute the path on which to forward the packet. Anyone who gets confused thinks he thinks that when he learns the route he already decides the prefix length and here is the mistake

I am not clear what your confusion (or your issue) is about. I would suggest a slightly different way of thinking about the steps.

The first step is that there are potentially multiple processes that develop routing information (possibly one or multiple OSPF processes, possibly one or multiple EIGRP processes, possibly a BGP process, possibly a static route process). Each of these processes operate independently of each other and each process develops routes for a destination and present that candidate route to the routing table.

The next step is that there is a process that maintains the routing table. It considers inputs from the various route development processes. If a candidate route has a prefix that is unique (address of the prefix and length of the prefix) then the candidate route is entered into the routing table. So if there were a candidate route from ospf of 192.168.10.0 with a prefix length of /28 and there were a candidate route from eigrp of 192.168.10.0 with a prefix length of /24 (as suggested in the original post) then both are unique and both will be entered into the routing table. If 2 candidate route have the same prefix address and have the same prefix length (if both ospf and eigrp learned 192.168.10.0/28) then administrative distance would come into play and the route with the better AD will be entered into the routing table (eigrp would win).

The next step is that there is a process that forwards packets. When it is starting to forward a packet it looks into the routing table to find a route for the destination. The forwarding process does not care where the route came from or what its AD is. The forwarding process only wants to find the most precise match in the routing table and use that to forward the packet.

So let us think about a few examples. If the forwarding has a packet with a destination of 192.168.10.5. It would search the routing table and would find the route from ospf and the route from eigrp. The route from ospf is a more specific match and would be used to forward the packet. What if the forwarding process had a packet with a destination of 192.168.10.130? It would find the entry from eigrp (and not find the entry from ospf since it is not a match) and the eigrp route would be used. What if the forwarding process had a packet with a destination of 192.168.9.46? Is there an entry in the routing table that would match? The default route is a route with a length of zero and would be a match.

So it helps to think about this in terms of the various processes, what are their inputs and what are they trying to accomplish. The route development processes develop candidate routes and present them to the routing table maintenance process. The routing table maintenance process considers the candidate routes and determines which ones should enter the routing table. The packet forwarding process has a packet to forward and consults the routing table to find the optimum path toward the destination.

HTH

Rick

We have said the same thing in different ways. I turned here because I wanted confirmation from people more experienced than me than I have studied. The confusion arose when I found conflicting information online. In short if a router learns from eigrp and ospf the same route with the same prefix length eg 192.168.10.0/28 in this case you will see the administrative distance. If, on the other hand, it receives 192.168.10.0/25 from eigrp and receives 192.168.10.0/28 from ospf, the router installs both of them in the routing table, then in the forwarding process it will choose the most specific one for the destination address with the most specific prefix length. I wanted confirmation here that it is an official site

Thanks for the clarification. You do have confirmation.

HTH

Rick

both EIGRP and OSPF same prefix the router select the EIGRP because it is AD=90, and inject it to routing table and use it to forward the traffic. 

EIGRP have two path same prefix the router will use load-balance 
OSPF have two path same prefix the router will use load-balance

 

Can't help feeling this thread is confusing the issue. 

 

The longest match prefix always wins, it is simple as that both for route selection and forwarding packets. 

 

Jon

friend the AD is process by CPU and the final result appear in routing table.
in routing table the AD is only appear but here it don't have any effect, the longest match is tie break which path the packet will pass.

Control-Data-Plane-RIB-FIB.jpg

Review Cisco Networking products for a $25 gift card