Is there an easy way to find a begining and end subnet for a given iP?

gbdavidxgbdavidx Member Posts: 840
lets say i have 192.168.152.129/28 i need to find what subnet its on really quick for the exam is there a fast and easy way to do this?

i am using the subnetting made easy on tech exams, figuring out how to subnet the 192.168.152 isn't a problem, it just takes time and was wondering if there was a qucker way for finding the subnets

thanks

Comments

  • boredgameladboredgamelad Member Posts: 365 ■■■■□□□□□□
    Yes, there's a very well known method for doing this. I personally don't recommend doing this until you can subnet perfectly by hand. I believe that understanding why this works is as important as understanding how. But if it works for you, by all means go for it.

    This is known by most as the magic number method. You're probably looking at the size of this post and thinking "I asked if there was a quick method!" Well, you did ask for a quick method and while this post may seem long, there are really only three steps to this method and it's basically the quickest there is:

    1.) Find the interesting octet.
    2.) Find your magic number and identify your target.
    3.) Find the multiple of your magic number that is as close to your target as possible without going over.

    I explain it here in depth but there are seriously very few steps involved. Once you master this method you can subnet any (valid) IP address and mask combination in 30 seconds or less. Knowing your x16 multiplication table or at least a good handful of them will get you there quicker.

    ######################

    Convert your subnet mask from CIDR to decimal:

    /28 = 255.255.255.240

    Find the interesting octet. In other words, what is the rightmost octet that is not 255 or 0. In this case, it's the 4th octet where the value is 240. Subtract this number from 256. The result is your magic number (AKA your increment). 256-240 = 16.

    All your subnet IDs will fall on multiples of 16 (0, 16, 32, etc.). Look at the interesting octet for the address you're subnetting and consider that your target (192.168.152.129). Finding the subnet is as easy as finding the largest multiple of 16 that doesn't go over your target number of 129. You're the next contestant on the Price is Right!

    There are a number of ways to do this without having to add 16 to itself until you get the answer. I like to pick a number I know is a multiple and work backward or forward from there.

    16 * 10 = 160.

    160 is above our target number of 127. Let's subtract 16s until we get below it.
    144
    128

    Our subnet ID is 192.168.152.128.
    .129 is the first usable IP.

    Since we know the increment, we know that 128 + 16 = 144 will be the next subnet ID. So, subtract 1 from that number to get the broadcast ID of the subnet we're working in (143) and subtract one more to get the last usable address (142).

    Here's our results for 192.168.152.129/28:

    The subnet ID is 192.168.152.128
    The first usable IP is 192.168.152.129
    The last usable IP is 192.168.152.142
    The broadcast ID: 192.168.152.143

    A few more examples, done quickly:

    Example 1: 172.16.25.15/22

    Convert CIDR to binary: /22 = 255.255.252.0
    Interesting octet: 252
    Subtract from 256, magic number = 4.

    4 * 6 = 24 (closest multiple of 4 we can get without going over 25)

    172.16.25.15/22 belongs to the subnet 172.16.24.0/22. The next subnet is 172.16.28.0, therefore:

    172.16.24.0 = subnet ID
    172.16.24.1 = first usable
    172.16.27.254 = last usable
    172.16.27.255 = broadcast ID

    Example 2: 172.16.8.54/26

    CIDR to binary: /26 = 255.255.255.192
    Magic number: 256 - 192 = 64
    Target: 172.16.8.54 = 54.

    This one's easy. 64 is our magic number and 64 is above our target. Our subnet ID must be 172.16.8.0.

    172.16.8.0 is the subnet ID
    172.16.8.1 is the first usable address
    172.16.8.62 is the last usable address
    172.16.8.63 is the broadcast ID
  • gbdavidxgbdavidx Member Posts: 840
    Thank you so much for this write up, it should be added as a sticky!! i will try this later tonight
  • JasonITJasonIT Member Posts: 114
    To add to bored's great post, I always used this chart to get my magic number. This was before I had it memorized, hope it helps. This represents the CIDR to decimel notation and which magic number it correlates with.

    /25---/26---/27---/28----/29----/30----/31---/32
    128---192---224---240---248---252---254---255
    128----64----32
    16
    8
    4
    2
    1
  • pamccabepamccabe Member Posts: 315 ■■■□□□□□□□
    JasonIT wrote: »
    To add to bored's great post, I always used this chart to get my magic number. This was before I had it memorized, hope it helps. This represents the CIDR to decimel notation and which magic number it correlates with.

    /25---/26---/27---/28----/29----/30----/31---/32
    128---192---224---240---248---252---254---255
    128----64----32
    16
    8
    4
    2
    1
    Very nice to share Jason. Going to write that down and commit to memory before the exam. I do know it, but get anxiety with big exams like this. I'll probably write it down on the white board they give you so I don't blackout during exam lol
Sign In or Register to comment.