cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Join Customer Connection to register!
1494
Views
20
Helpful
9
Replies
169.254.X.Y
Beginner

Routing Table Question!

This is how I understood from ICND1.

AD is only used to distinguish between two routes with the same length. Longest prefix always win.

1) Longest match - Longest Prefix Matching Rule 

2) AD

 

 

 

Please let me know if I am wrong :) 

1 ACCEPTED SOLUTION

Accepted Solutions
Peter Paluch
Hall of Fame Cisco Employee

Hi all,

Please allow me to join.

I believe that we are confusing and mixing two independent things: How a routing table is populated, and how a routing table is searched through after it is populated.

When populating a routing table, the tiebreakers if multiple sources offer the same [Network, Netmask] entry for the routing table are:

  1. Administrative distance
  2. Metric

As an example, consider this:

  • OSPF offers:
    • 10.0.1.0/24, metric 100
    • 10.0.0.0/16, metric 50
    • 0.0.0.0/0, metric 20
  • EIGRP offers:
    • 10.0.1.0/24, metric 9999
    • 10.0.0.0/24, metric 5555
    • 0.0.0.0/0, metric 1000

For each of these networks above, the routing protocols may also know about longer paths that have higher metrics, but they are uninteresting - what is shown above are only the least cost paths as known to the respective protocols.

Notice that these two protocols compete only for networks 10.0.1.0/24 and 0.0.0.0/0 - they both are trying to insert the very same network into the routing table. However, 10.0.0.0/16 and 10.0.0.0/24 are different networks because they differ in their netmask (or prefix length), and so there is no competition here. Therefore, the routing table will be:

  • 10.0.1.0/24, EIGRP, metric 9999 (due to lower AD)
  • 10.0.0.0/24, EIGRP, metric 5555
  • 10.0.0.0/16, OSPF, metric 50
  • 0.0.0.0/0, EIGRP, metric 1000 (due to lower AD)

Once again, when multiple protocols tried to insert the same network they know about, the protocol with the lower AD was preferred, and that protocol in turn installed the least cost path it knows, hence - lowest AD first, lowest metric second.

However, when searching this routing table for a match, the longest-prefix-match rule applies, and it always depends on the destination IP address of the packet to see which entry is matching:

  • Packet for 10.0.1.1 would be matched by 10.0.1.0/24, 10.0.0.0/16, and 0.0.0.0/0, but 10.0.1.0/24 is the most specific, and so this one will be used.
  • Packet for 10.0.0.1 would be matched by 10.0.0.0/24, 10.0.0.0/16, and 0.0.0.0/0, but 10.0.0.0/24 is the most specific, and so this one will be used.
  • Packet for 10.0.2.2 would be matched by 10.0.0.0/16 and 0.0.0.0/0, but 10.0.0.0/16 is the most specific, and so this one will be used.
  • Packet for 10.1.2.3 would be only matched by 0.0.0.0/0, so this one will be used.

Note: In this process, we were not looking at modifying the routing table contents anymore; we were just pondering the best match from the choices that were already available. Building a routing table is a different process than performing lookups in a routing table.

The bottom line is: There are two aspects to a routing table - one relates to how a routing table is populated with entries, the other is related how the contents of a routing table are used once they are there. When populating the routing table, the order of preference is AD first, metric second; when performing a lookup in the routing table, the longest-prefix-match rule is the exclusive rule.

Best regards,
Peter

View solution in original post

9 REPLIES 9
Mark Malone
VIP Mentor

Your right

 

  1. Prefix Length - The longest-matching route is preferred first. Prefix length trumps all other route attributes.
  2. Administrative Distance - In the event there are multiple routes to a destination with the same prefix length, the route learned by the protocol with the lowest administrative distance is preferred.
  3. Metric - In the event there are multiple routes learned by the same protocol with same prefix length, the route with the lowest metric is preferred. (If two or more of these routes have equal metrics, load balancing across them may occur.)

My new net instructor said what would happen on the routing table if he uses eigrp, rip version 2 and ospf. I said all three will be on the routing table. He said, only eigrp will be on the routing table since it has the lowest AD value. Who is correct me or new net instructor?

What about that you are both right? He probably means that all three processes anounce the same networks.

I just wan to make sure. If all three processes announce the same networks, one with the lowest AD will show up in the routing table. But, if all three announce different networks, then all three will show up and later will be selected by longest match rule when send the packet. Am I right?

No the one with the longest match prefix wins between the 3 protocols even if EIGRP is there

check this example exactly what your asking

http://packetlife.net/blog/2010/aug/16/route-preference/

once the next hop is valid the most specific route will determine the table choice as per the router selection process but what Karsten said is true too maybe break down exactly what hes trying to say to you get him to show you what he means
Peter Paluch
Hall of Fame Cisco Employee

Hi all,

Please allow me to join.

I believe that we are confusing and mixing two independent things: How a routing table is populated, and how a routing table is searched through after it is populated.

When populating a routing table, the tiebreakers if multiple sources offer the same [Network, Netmask] entry for the routing table are:

  1. Administrative distance
  2. Metric

As an example, consider this:

  • OSPF offers:
    • 10.0.1.0/24, metric 100
    • 10.0.0.0/16, metric 50
    • 0.0.0.0/0, metric 20
  • EIGRP offers:
    • 10.0.1.0/24, metric 9999
    • 10.0.0.0/24, metric 5555
    • 0.0.0.0/0, metric 1000

For each of these networks above, the routing protocols may also know about longer paths that have higher metrics, but they are uninteresting - what is shown above are only the least cost paths as known to the respective protocols.

Notice that these two protocols compete only for networks 10.0.1.0/24 and 0.0.0.0/0 - they both are trying to insert the very same network into the routing table. However, 10.0.0.0/16 and 10.0.0.0/24 are different networks because they differ in their netmask (or prefix length), and so there is no competition here. Therefore, the routing table will be:

  • 10.0.1.0/24, EIGRP, metric 9999 (due to lower AD)
  • 10.0.0.0/24, EIGRP, metric 5555
  • 10.0.0.0/16, OSPF, metric 50
  • 0.0.0.0/0, EIGRP, metric 1000 (due to lower AD)

Once again, when multiple protocols tried to insert the same network they know about, the protocol with the lower AD was preferred, and that protocol in turn installed the least cost path it knows, hence - lowest AD first, lowest metric second.

However, when searching this routing table for a match, the longest-prefix-match rule applies, and it always depends on the destination IP address of the packet to see which entry is matching:

  • Packet for 10.0.1.1 would be matched by 10.0.1.0/24, 10.0.0.0/16, and 0.0.0.0/0, but 10.0.1.0/24 is the most specific, and so this one will be used.
  • Packet for 10.0.0.1 would be matched by 10.0.0.0/24, 10.0.0.0/16, and 0.0.0.0/0, but 10.0.0.0/24 is the most specific, and so this one will be used.
  • Packet for 10.0.2.2 would be matched by 10.0.0.0/16 and 0.0.0.0/0, but 10.0.0.0/16 is the most specific, and so this one will be used.
  • Packet for 10.1.2.3 would be only matched by 0.0.0.0/0, so this one will be used.

Note: In this process, we were not looking at modifying the routing table contents anymore; we were just pondering the best match from the choices that were already available. Building a routing table is a different process than performing lookups in a routing table.

The bottom line is: There are two aspects to a routing table - one relates to how a routing table is populated with entries, the other is related how the contents of a routing table are used once they are there. When populating the routing table, the order of preference is AD first, metric second; when performing a lookup in the routing table, the longest-prefix-match rule is the exclusive rule.

Best regards,
Peter

View solution in original post

Thank you very very much. This is what I have been looking for. I was confused how a routing table is populated and how a routing table is searched through after populated. Your explanation is perfect and clear. I really really appreciate :)

Cisco Employee so smart!

>Cisco Employee so smart!

especially this one ... ;-)