Answer: Choosing the Best Route, Same Subnet ID, Different Mask

By certskills April 18, 2014 09:05

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.




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.


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 100, 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, with RIP-2. I learned of only one route to, 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 with OSPF. I learned of only one route to, 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 with EIGRP. I learned of only one route to, 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.




Question: Choosing the Best Route, Same Subnet ID, Different Mask
Question: Overlapping Connected and Routing Protocol Routes
By certskills April 18, 2014 09:05
Write a comment


  1. sharadvas March 25, 15:03

    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.


    Reply to this comment
  2. Wendell Odom of Certskills Author March 28, 08:23

    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.

    Reply to this comment
  3. sharadvas March 28, 09:29

    Thanks for the info…

    Reply to this comment
  4. Morgan October 8, 20:22

    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?

    Reply to this comment
    • certskills Author October 13, 10:29

      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.)

      Reply to this comment
  5. Raed February 10, 06:30

    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) 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?


    Reply to this comment
    • certskills Author February 10, 10:59

      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…

      Reply to this comment
View comments

Write a comment

Leave a Reply to certskills Cancel reply