Options

A question about 'longest prefix length'?

BeanyBeany Member Posts: 177
Afternoon,

going through the book, im struggling to understand what 'longest prefix length' is in a routing table when a packet's destination route matches a few routes in the routing table?

what does it mean by longest prefix length? got an example in the book but still not sure.

thanks

Comments

  • Options
    networker050184networker050184 Mod Posts: 11,962 Mod
    For example you are trying to send packets to a host 192.168.1.1 and you have the below routes in the routing table.

    192.0.0.0/8 via FastEthernet0/0
    192.168.0.0/16 via FastEthernet0/1
    192.168.1.0/24 via FastEthernet0/2

    Which route is it going to take? Look at the prefix length. The first is a /8, the second /16 and the third /24. The /24 is longest and most specific match. The most specific is always used.
    An expert is a man who has made all the mistakes which can be made.
  • Options
    BeanyBeany Member Posts: 177
    thanks for this but in the following example:

    sending a packet to the host 172.16.4.3 with the routes in routing table:

    172.16.1.1/32 via serial 0/1/1
    172.16.1.0/24 via serial 0/1/0
    172.16.0.0/22 via serial 0/1/1
    172.16.0.0/16 via serial 0/1/0

    the route it would take would be 172.16.0.0/16.

    why is this? why does it not take the route 172.16.0.0/22 which has a higher prefix of /22?
  • Options
    networker050184networker050184 Mod Posts: 11,962 Mod
    Because 172.16.4.3 does not fall into the 172.16.0.0/22 range.

    172.16.0.0/22 = 172.16.0.0-172.16.3.255
    An expert is a man who has made all the mistakes which can be made.
  • Options
    BeanyBeany Member Posts: 177
    ah cool... thanks
  • Options
    lantechlantech Member Posts: 329
    Remember that just because a question doesn't specifically ask you to subnet doesn't mean you won't have to subnet.

    The same goes for on the job as well. You might have to do subnetting to help you isolate where the problem with the network is.
    2012 Certification Goals

    CCENT: 04/16/2012
    CCNA: TBD
  • Options
    goldenlightgoldenlight Member Posts: 378 ■■□□□□□□□□
    ""sending a packet to the host 172.16.4.3 with the routes in routing table:

    172.16.1.1/32 via serial 0/1/1
    172.16.1.0/24 via serial 0/1/0
    172.16.0.0/22 via serial 0/1/1
    172.16.0.0/16 via serial 0/1/0

    the route it would take would be 172.16.0.0/16.

    why is this? why does it not take the route 172.16.0.0/22 which has a higher prefix of /22? ""


    NICe Subnetting Question. Adding to study. icon_study.gif
    The Only way to do great work is to love what you do. If you haven't found it keep looking. Don't settle - Steve Jobs
  • Options
    BeanyBeany Member Posts: 177
    lantech wrote: »
    Remember that just because a question doesn't specifically ask you to subnet doesn't mean you won't have to subnet.

    The same goes for on the job as well. You might have to do subnetting to help you isolate where the problem with the network is.

    I'll bear that in mind for future, thank you
  • Options
    BeanyBeany Member Posts: 177
    guys,

    im going braindead here,

    can someone subnet 172.16.0.0/16 for me please? want to completely understand this topic before i move on.

    thanks
  • Options
    networker050184networker050184 Mod Posts: 11,962 Mod
    172.16.0.0/16 is an easy one. You have sixteen network bits so its 172.16.0.0-172.16.255.255.

    It sounds like you are having issues with subnetting, not longest prefix match.
    An expert is a man who has made all the mistakes which can be made.
  • Options
    BeanyBeany Member Posts: 177
    172.16.0.0/16 is an easy one. You have sixteen network bits so its 172.16.0.0-172.16.255.255.

    It sounds like you are having issues with subnetting, not longest prefix match.

    i thought i was confident with subnetting but probably not looking at it for a while has made me forgetful. Was struggling to subnet ip addresses with /8 /16 /24 masks. Was getting confused with which octet needed to be increased when creating subnets from this IP.
  • Options
    ToLuTionToLuTion Registered Users Posts: 1 ■□□□□□□□□□
    Because 172.16.4.3 does not fall into the 172.16.0.0/22 range.

    172.16.0.0/22 = 172.16.0.0-172.16.3.255


    thanks for this but in the following example:
    Adding a little twist to it. what if
    sending a packet to the 172.16.1.1 address with the routes in routing table:

    172.16.1.1/32 via serial 0/1/1
    172.16.1.0/24 via serial 0/1/0
    172.16.0.0/22 via serial 0/1/1
    172.16.0.0/16 via serial 0/1/0

    the route it would take would be?

    why is this?
    why does it not take the route ?

    if longer prefix length is better then 172.16.1.1/32 seems write
    but 172.16.1.0/24 seems correct also it will have the address 1720.16.1.1 in its network...
    kindly explain why and how your answer is...
  • Options
    CCIE Wanna BeCCIE Wanna Be Member Posts: 95 ■■□□□□□□□□
    If you need help with subnetting start here, it helped me. I know it's an older thread, but still relevant.

    http://www.techexams.net/forums/ccna-ccent/38772-subnetting-made-easy.html
    In Progress:
    WGU B.S. - I.T. - Security (and all the certs that come with it)
  • Options
    HeeroHeero Member Posts: 486
    ToLuTion wrote: »
    thanks for this but in the following example:
    Adding a little twist to it. what if
    sending a packet to the 172.16.1.1 address with the routes in routing table:

    172.16.1.1/32 via serial 0/1/1
    172.16.1.0/24 via serial 0/1/0
    172.16.0.0/22 via serial 0/1/1
    172.16.0.0/16 via serial 0/1/0

    the route it would take would be?

    why is this?
    why does it not take the route ?

    if longer prefix length is better then 172.16.1.1/32 seems write
    but 172.16.1.0/24 seems correct also it will have the address 1720.16.1.1 in its network...
    kindly explain why and how your answer is...

    172.16.1.1 matches all four of those routes. Therefore, the router determines which to use via the longest prefix match rule. The /32 is the matching route with the longest prefix so it chooses that.
Sign In or Register to comment.