1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

IP route matching question

Discussion in 'Routing & Switching' started by pedwar1, Jan 12, 2009.

  1. pedwar1

    pedwar1 New Member

    7
    0
    11
    Am having a bit of trouble understanding a piece in the ICND1 official certification guide book by Wendell Odom in chapter 15 – Troubleshooting IP routing.

    The piece is regarding finding the matching route on a Router. The scenario is to use a sample output from a router using the “show ip route” command and work out which of the routes that router would match packets destined for the following addresses:

    172.16.1.1, 172.16.1.2 , 172.16.2.2 and 172.16.4.3

    Output is:

    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, Serial 0/1/0
    R 172.16.0.0/22 [120/1] via 172.6.25.2, 00:00:04, Serial0/1/1
    R 172.16.0.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

    I understand that the route chosen will be the one with the longest prefix, and understand the first 3 routes, i.e.

    “172.16.1.1 matches all 5 routes, but will go through the route with the /32 as it is the longest prefix length
    172.16.1.2 matches the first 4 routes but the 172.16.1.0/24 has the longest prefix
    172.16.2.2 matches the last 3 routes, but will use the 172.16.0.0/22”

    My query is regarding the 172.16.4.3 address. The book says:

    “Destination address 172.16.4.3 matches the last two routes listed with the route for 172.16.0.0/16 having the longest prefix length”.

    If you work out the address ranges for the routes, then surely it would use the 172.16.0.0/22 route wouldn’t it?

    Valid host address ranges for 172.16.0.0/22 should be 172.16.0.1 – 172.16.3.254
    and 172.16.4.1 – 172.16.7.254
    etc…

    The 2nd subnet includes the 172.16.4.3 address and has a longer prefix than the /16 route doesn’t it and therefore should be used in preference over it?
     
    Certifications: CCENT
    WIP: CCNA
  2. Spice_Weasel

    Spice_Weasel Kilobyte Poster

    254
    45
    45
    pedwar1,

    The book is correct - 172.16.4.3 matches the last two routes, and of those 172.16.0.0/16 is the longest match. The last two referred to are 172.16.0.0/16 and 0.0.0.0/0. The route to 172.16.0.0/22 doesn't match 172.16.4.3 - a /22 to match that destination would be 172.16.4.0/22

    Although, the line refering to 172.16.1.2 does appear to have a typo, and should read "last" instead of "first".

    Spice_Weasel
     
    Certifications: CCNA, CCNP, CCIP, JNCIA-ER, JNCIS-ER,MCP
    WIP: CCIE
  3. pedwar1

    pedwar1 New Member

    7
    0
    11
    Sorry, the typo was from me, not the book.

    Thanks for the reply, however I'm still a bit confused and think I'm missing an important point.

    The route 172.16.0.0/22 to me implies subnets using a block size of 4 in the 3rd octet so :
    172.16.0.0
    172.16.4.0
    172.16.8.0
    172.16.12.0 etc

    The route 172.16.0.0/16 implies subnets using a block size of 1 in the 3rd octet so:
    172.16.0.0
    172.16.1.0
    172.16.2.0
    172.16.3.0
    172.16.4.0 etc


    The destination address 172.16.4.3 would therefore be in the 2nd subnet of the /22 and also the 5th subnet of the /16 with the /22 being the longest prefix.

    Am I getting the implication wrong, and is it just that the /16 route is more generalised than the /22 route so therefore 172.16.0.0/22 would match any address from 172.16.0.1 to 172.16.3.254 , and 172.16.0.0/16 would match any address in any of the subnets from 172.16.0.0 to 172.16.255.0 ?

    Not sure if I've explained that well ....

    Sorry if I'm being dense.
     
    Certifications: CCENT
    WIP: CCNA
  4. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,623
    115
    224
    Er - no - this isn't the case. In a route table the network given is the *only* network for that line.

    So R 172.16.0.0/22 [120/1] via 172.6.25.2, 00:00:04, Serial0/1/1 is talking about the 172.16.0.0 network *only*.

    You are mixing this with subnetting questions that ask how many networks fit in a range!

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  5. pedwar1

    pedwar1 New Member

    7
    0
    11
    Aha right - the penny drops.

    Many thanks for the replies. At least I was correct about one thing - it was me being dense :)
     
    Certifications: CCENT
    WIP: CCNA
  6. Spice_Weasel

    Spice_Weasel Kilobyte Poster

    254
    45
    45
    It just takes a bit of practice - you are clearly on the right track. However, just a few corrections to your post, above:

    The networks you list above are actually all part of the same /16 network, 172.16.0.0/16. Other /16 networks would be 172.17.0.0/16, 172.18.0.0/16, 172.19.0.0/16, etc.

    A route to 172.16.0.0/22 will match any address from 172.16.0.0 to 172.16.3.255, not 172.16.0.1 to 172.16.3.254. Don't confuse routing with usable host ip addresses! Also, 172.16.0.0/16 matches 172.16.0.0 to 172.16.255.255.

    One thing I think should be emphasized is that the subnet mask is only relevant at the final destination of the packet - people often seem to think that routers somehow know what the remote network is - they don't - packets only have an destination ip address, no network information is part of the packet. So, if a router receives a packet destined for 192.168.1.255, don't think to yourself, "aha, a packet being sent to the broadcast address of network 192.168.1.0/24" - because that may be a host address in 192.168.0.0/16, or the broadcast of 192.168.1.252/30, or something else entirely. You have no way of knowing, because only the final router really knows what the network is.

    Spice_Weasel
     
    Certifications: CCNA, CCNP, CCIP, JNCIA-ER, JNCIS-ER,MCP
    WIP: CCIE

Share This Page

Loading...