Static routing lab question

sratakhinsratakhin Posts: 818Member
I'm doing a lab from "101 CCNA Labs" workbook. It's about configuring static routes for loopback interfaces. 2 routers are connected to a switch. R1 has three loopback interfaces that need to be reachable from R2. I configured static routes to
Loopback101 (IP address 172.100.1.1/32, ip route 172.100.1.1 255.255.255.255 F0/0)
Loopback102 (IP address 172.101.0.1/29, ip route 172.101.0.0 255.255.255.248 F0/0)

My question is about the Loopback103. It has an IP address of 172.102.5.1/17. I tried to use the command ip route 172.102.5.0 255.255.128.0, but Packet tracer tells me something about inconsistent address and mask.
The only command that works is ip route 172.102.0.0 255.255.128.0 F0/0.

Well, what if there is another router on my network, and I want to give it an IP address 172.102.1.1? Doesn't the command ip route 172.102.5.0 255.255.128.0 f0/0 ​cover the whole range of IP addresses starting with 172.102?

Comments

  • Forsaken_GAForsaken_GA Posts: 4,024Member
    With a /17 prefix, that covers a range of 128, so the actual IP's covered by 172.101.0.0/17 are 172.101.0.0 through 172.101.127.255, so yeah, 172.102.5.0 is contained within that range.

    If you had a router configured with 172.102.1.1, it would need to have a prefix longer than 17 (/18 or higher) in order to make it into the routing table and actually have traffic forwarded to it.

    In the routing table, longest prefix wins.

    For example -

    172.101.0.0/16
    172.101.0.0/17
    172.101.0.0/18
    172.101.0.0/19
    172.101.0.0/20
    172.101.0.0/21
    172.101.0.0/22
    172.101.0.0/23
    172.101.1.0/24

    You could, theoretically, have all of those prefixes in the same routing table, and 172.101.1.0/24 would be valid in the range of every single one of them.

    If you wanted to ping 172.101.1.1, which route does it take? It could take all of them! Answer - it takes the /24. Why? Because it's the longest match on the routing table. Longest prefix always wins normal forwarding lookups.
  • sratakhinsratakhin Posts: 818Member
    Thank you! I see where I'm wrong now.
    And I thought I could subnet very well... I mixed up /17 and /23, thinking that 172.102.5.1 is in 172.102.4.0 network.
  • Forsaken_GAForsaken_GA Posts: 4,024Member
    sratakhin wrote: »
    Thank you! I see where I'm wrong now.
    And I thought I could subnet very well... I mixed up /17 and /23, thinking that 172.102.5.1 is in 172.102.4.0 network.

    I mix up prefix masks every now and again myself, I think everyone who subnets in their head does. It's amazing what a difference a bit here and there can make hehe
Sign In or Register to comment.