Options
When a Destination Address matches Multiple Routes...
Rute675
Member Posts: 2 ■□□□□□□□□□
in CCNA & CCENT
I need help with an aspect of ip routing. When one destination address matches multiple routes, how is it determined which route or interface it is sent to? I've come across the term Longest Prefix Length, and I understand that to mean a /24 would be chosen over a /16, but I'm still not 100% on this topic. Let me give one of the two examples I'm currently fighting to understand:
R 172.16.0.0/22 120/1 172.16.25.2 Serial0/1/1
R 172.16.0.0/16 120/2 172.16.25.129 Serial0/1/0
R 0.0.0.0/0 120/3 172.16.25.129 Serial0/1/0
Destination address 172.16.4.3
I'm told the route selected based on this destination address is the 172.16.0.0/16 route. I fully understand why the destination address matches the 2nd and 3rd routes. Why does it not match the first route?
R 172.16.0.0/22 120/1 172.16.25.2 Serial0/1/1
R 172.16.0.0/16 120/2 172.16.25.129 Serial0/1/0
R 0.0.0.0/0 120/3 172.16.25.129 Serial0/1/0
Destination address 172.16.4.3
I'm told the route selected based on this destination address is the 172.16.0.0/16 route. I fully understand why the destination address matches the 2nd and 3rd routes. Why does it not match the first route?
Comments
-
Optionskalebksp Member Posts: 1,033 ■■■■■□□□□□172.16.0.0/22 encompasses 172.16.0.0 - 172.16.3.255. 172.16.4.3 does not fall within the subnet so it doesn't apply.
-
OptionsColbyG Member Posts: 1,264172.16.0.0/22 doesn't include 172.16.4.3, it encompasses 172.16.0.0 - 172.16.3.255, so in your example the closest match would be 172.16.0.0/16.
Edit: kaleb beat me. -
Optionshypnotoad Banned Posts: 915172.16.0.0/22 encompasses 172.16.0.0 - 172.16.3.255. 172.16.4.3 does not fall within the subnet so it doesn't apply.
Right, 172.16.4.3 doesn't fit, assuming it did fit, it would in fact use the longest prefix. The longest prefix says that /24 defines more bits than /16, so it would take the /24 route. In other words, the longest prefix narrows it down better so it's chosen as being more accurate. -
OptionsForsaken_GA Member Posts: 4,024because it's a /22 prefix.
172.16.0.0/22 is the same as saying
172.16.0.0 - 172.16.3.255
You're borrowing 2 bits from the third octet to subnet with, which means your subnets will be in the range of 4. (2 ^2 = 4)
So the IP 172.16.4.3 does not fall within that range.
If the route had been 172.16.4.0/22 (or 172.16.0.0/21) then it would have matched the range the IP is in and be chosen as the best route because it has the longest prefix match (even though all three would match at that point) -
Optionsfieldmonkey Users Awaiting Email Confirmation Posts: 254 ■■■□□□□□□□Page 171, an excellent place to start my studying again!
Time to get back into the game and stop eating so muchWIP:
Husband & Fatherhood Caitlin Grace born 8-26-2010
Future Certs:
Q1-2011 - INCD2, Microsoft or Linux (decisions, decisions...)