Overlapping Routes Question - Need help!
ChickenNuggetz
Member Posts: 284
in CCNA & CCENT
Hey guys, I'm stuck with this particular question and I'm not entirely sure how to work out the answer. Here's the question:
Predict which route this router would match for packets destined to the following IP addresses:
172.16.1.1
172.16.1.2
172.16.2.2
172.16.4.3
Here's the show ip route command output
172.16.0.0/16 is variably subnetted, 5 subnets, 4 masks
R 172.16.1.1/32 [120/1] via 172.16.25.2, 00:00:04, Serial0/1/1
R 172.16.1.0/24 [120/2] via 172.16.25.129, 00:00:09, Serial0/1/0
R 172.16.0.0/22 [120/1] via 172.16.25.2, 00:00:04, Serial0/1/1
R 172.16.1.0/16 [120/2] via 172.16.25.129, 00:00:09, Serial0/1/0
R 0.0.0.0/0 [120/3] via 172.16.25.129, 00:00:09, Serial0/1/0
Any advice/tips?
Predict which route this router would match for packets destined to the following IP addresses:
172.16.1.1
172.16.1.2
172.16.2.2
172.16.4.3
Here's the show ip route command output
172.16.0.0/16 is variably subnetted, 5 subnets, 4 masks
R 172.16.1.1/32 [120/1] via 172.16.25.2, 00:00:04, Serial0/1/1
R 172.16.1.0/24 [120/2] via 172.16.25.129, 00:00:09, Serial0/1/0
R 172.16.0.0/22 [120/1] via 172.16.25.2, 00:00:04, Serial0/1/1
R 172.16.1.0/16 [120/2] via 172.16.25.129, 00:00:09, Serial0/1/0
R 0.0.0.0/0 [120/3] via 172.16.25.129, 00:00:09, Serial0/1/0
Any advice/tips?
:study: Currently Reading: Red Hat Certified Systems Administrator and Engineer by Ashgar Ghori
Certifications: CCENT; CCNA: R&S; Security+
Next up: RHCSA
Certifications: CCENT; CCNA: R&S; Security+
Next up: RHCSA
Comments
-
Forsaken_GA Member Posts: 4,024Longest match on the prefix wins.
ie, /32 routes will be taken over /24's which will be taken over /16's.
So look at the ip, figure out which routes in the routing table it matches. If it can match more than one, look to see who has the longest prefix. That's the route it will take. -
SubnetZero Member Posts: 124Forsaken_GA wrote: »Longest match on the prefix wins.
ie, /32 routes will be taken over /24's which will be taken over /16's.
Agreed. More specific routing (longest prefix match) always wins. In his example the following is true:
A packet destined to 172.16.1.1 is forwarded to 172.16.1.1 (longest prefix match)
A packet destined to 172.16.1.2 is forwarded to 172.16.25.129 (longest prefix match)
A packet destined to 172.16.2.2 is forwarded to 172.16.25.2 (longest prefix match)
A packet destined to 172.16.4.3 is forwarded to 172.16.25.129 (longest prefix match)
Had the /16 not existed the 172.16.4.2 would have been forwarded using the default (0/0) route which still would have been 172.16.25.129.
While no trees were harmed in the transmission of this message, several electrons were severely inconvenienced :cool: -
ChickenNuggetz Member Posts: 284Forsaken_GA wrote: »Longest match on the prefix wins.
ie, /32 routes will be taken over /24's which will be taken over /16's.
So look at the ip, figure out which routes in the routing table it matches. If it can match more than one, look to see who has the longest prefix. That's the route it will take.
Oh ok I think I got it now! I wasnt realizing I needed to figure out which of subnets each IP address fits into (derp derp).
So I think the answer should be:
172.16.1.1 = 172.16.1.1/32 (all five routes are applicable, but this one is the best)
172.16.1.2 = 172.16.1.0/24 (bottom 4 routes are applicable, but this one is the best)
172.16.2.2 = 172.16.0.0/22 (bottom 3 routes are applicable, but this one is the best)
172.16.4.3 = 172.16.1.0/16 (bottom 2 routes are applicable, but this one is the best)
Does this sound right?:study: Currently Reading: Red Hat Certified Systems Administrator and Engineer by Ashgar Ghori
Certifications: CCENT; CCNA: R&S; Security+
Next up: RHCSA -
Forsaken_GA Member Posts: 4,024ChickenNuggetz wrote: »172.16.4.3 = 172.16.1.0/16 (bottom 2 routes are applicable, but this one is the best)
Does this sound right?
Actually, I think that ones a typo, as 172.16.1.0/16 isn't a valid prefix, that should be 172.16.0.0/16.
But otherwise, yes, you're correct. If an IP can match multiple routes, then the prefix length is the tiebreaker, and longest match always wins. -
4_lom Member Posts: 485Forsaken_GA wrote: »Longest match on the prefix wins.
ie, /32 routes will be taken over /24's which will be taken over /16's.
So look at the ip, figure out which routes in the routing table it matches. If it can match more than one, look to see who has the longest prefix. That's the route it will take.
'nough said.Goals for 2018: MCSA: Cloud Platform, AWS Solutions Architect, MCSA : Server 2016, MCSE: Messaging -
ChickenNuggetz Member Posts: 284Forsaken_GA wrote: »Actually, I think that ones a typo, as 172.16.1.0/16 isn't a valid prefix, that should be 172.16.0.0/16.
But otherwise, yes, you're correct. If an IP can match multiple routes, then the prefix length is the tiebreaker, and longest match always wins.
Haha, yeah that was a typo, thanks for the help!:study: Currently Reading: Red Hat Certified Systems Administrator and Engineer by Ashgar Ghori
Certifications: CCENT; CCNA: R&S; Security+
Next up: RHCSA