Answer: Choosing the Best Route, Same Subnet ID, Different Mask
What happens when a router happens to learn three separate routes for the same subnet ID – but with different masks, and with different routing protocols? What should you be thinking about when predicting how a router acts? These questions are the key to understanding the multi-choice question posed in the previous post. Today’s post walks through the answer to the question and the reasons.
Answer
D
Disclaimer
First, for emphasis, the design used for this question is poor and not recommended. I just used it as a way to make one router receive routing updates for three subnets that have the same subnet ID but different masks, as learned with three different routing protocols, just as an exercise. Don’t use a similar design in a real network! The goal of the question is to let us focus on how a router thinks about adding routes to its IP routing table.
Background
CCNA discussed two related concepts to a fairly deep level.
First, when using one routing protocol only, when one router learns multiple routes for the same subnet, the routing protocol chooses the best route based on the metric. Simple enough.
Second, CCNA does discusses how a router chooses between two routes to the same subnet when learning those routes using different routing protocols. Routers use the administrative distance (AD) of the routing protocol. For example, by default, EIGRP’s AD is set to 90, OSPF’s is set to 110, and RIP’s is set to 120, with lowest being best. A router learning routes for the same subnet with all three routing protocols would ignore the metrics, use the AD, and choose the EIGRP route.
However, none of the above rules apply to this question, because the subnets are different subnets. not only are the real subnets in three different locations in the design, they each have different masks, so they are similar subnets, overlapping subnets, but not the same subnet.
The Core Reasons for Choosing Answer D
A subnet is defined (identified) by the subnet ID and the mask. In the scenario shown for this question, R1 learns about three different subnets. They all happen to have the same subnet ID, but they all have different mask. R1 thinks like this:
- I learned only one route to the subnet defined as 10.1.2.0/25, with RIP-2. I learned of only one route to 10.1.2.0/25, so there is no competition from within RIP-2 or from another routing information source. Put that one route in the routing table.
- I learned a route to subnet 10.1.2.0/26 with OSPF. I learned of only one route to 10.1.2.0/26, so there is no competition from within OSPF or from another routing information source. Put that one route in the routing table.
- I learned a route to subnet 10.1.2.0/27 with EIGRP. I learned of only one route to 10.1.2.0/27, so there is no competition from within EIGRP or from another routing information source. Put that one route in the routing table.
As a result, R1 adds a route for all three subnets to the routing table, making answer D correct.
Hi Wendell,
Is follow-up of this video available, where-in you have explained about what happens when router has to make routing decision.
My thinking is that router wlll use longest prefix match logic for the dest addr, but will it also uses AD in deciding next hop, is my doubt.
If yes, what will happen if same routes are learned by protocols but with diff masks (i mean eigrp route with/25, rip with /27) etc.
Looking forward to know more.
Thanks
Hi Sharad,
There’s no follow-up video. The videos turned out to be a time sink, so for now, most of my posts have been text.
However, I think I see part of the misconception you are having. AD impacts what the router chooses to put in its routing table, but it does not change the contents of the route. So, here’s the sequence:
Router learns routes from many sources
Router happens to learn >1 route for the exact prefix/mask combo, from >1 routing source (eg, RIP and EIGRP)
Router choose the better route based on AD (in this case, by default, EIGRP)
Router adds the better AD route to the routing table
Router completely ignores AD when choosing which route in the routing table matches a particular packet destination IP address
In short, AD impacts what the router adds to its routing table, which is an independent thought process compared to the routing (aka packet forwarding) process. In other words, the AD logic is part of the control plane logic of the router.
You’re gonna love working on CCNP ROUTE, I can tell! There’s a lot of details like this to get into for that exam.
Wendell
Thanks for the info…
I understand how and why all 3 routes get added to the routing table, but, my question is, would the same explanation hold true if all three were learned from the same routing protocol, for instance OSPF. My understanding makes me want to say yes?
Morgan,
I agree. Even w/ OSPF used on all routers, the router on the left would add routes to all three subnets in this case, because they are indeed separate subnets (because of using different masks.)
Hello
My question at logic of making routing decision (after added 3 routes to same subnet with diffrenet prefix length) ignoring routing sources, in this scenario above ,router will always choose (match) 10.1.2.0/27 route considered it has a longest prefix mask length ,so am I true?
And If I am true so Why the router added 2 not useful routes? Considered it never use them?
thanks
Raed,
To your first question: correct.
To your second question, you see those other routes as “not useful”. They are not useful for forwarding packets to that particular destination, but they are useful to forward packets that don’t match the /27 route but do match one or the other shorter-prefix routes. However, to understand more of the reasons why you should instead think of the features that would cause such an overlap, and you don’t normally see those until CCNP. EG:
Manual route summarization, which makes routing tables shorter by advertising one shorter-prefix route vs. many longer-prefix routes,
Automatic route summarization, which advertises routes for classful networks at the boundaries of classful networks,
Route redistribution, which inject new routes to a second routing domain (routing protocol),
Default routes, which match all packet destinations (essentially prefix length /0).
The above doesn’t explain it all, but those are the topics that give you the reasoning. Networkers choose to use those features, which then happen to cause overlapping routes in the routing table, so we need to understand how the router then chooses which to use.
Hope this helps…
Wendell
Hello Wendell,
Which is correct? As per CCNA study guide Admin distance for OSPF ois 110 but here you stated”OSPF’s is set to 100″. Could this be a typo?
Hi Tewa,
It was a typo or just a mistake. Regardless… I changed it to 110, which is the correct default admin distance. Thanks for the assist!