Options

How to convert Subnet mask to CIDR notation fast?

SlayerXSlayerX Member Posts: 86 ■■□□□□□□□□
So, I have just started my subnetting and I am using this formula as it is the easiest method for me to understand.

How many subnets and hosts per subnet can you get from the network
10.1.1.0/24

We know that:

1. The default subnet mask is /8 as the address given is a class A address
2. The subnet mask in the question is /24

The number of subnets = 2 ^ (24 - icon_cool.gif = 2 ^ 16 = 65536 subnets.
The number of hosts = (2 ^ (32 - 24)) - 2 = (2 ^ icon_cool.gif - 2 = 254 hosts per subnet

But there is a problem. I don't know how to convert a Subnet mask back to CIDR notation as I need it to solve these problems.
So If I get a mask that is 255.255.254 what is the easiest way or fastest way to convert it back to CIDR notation?
If anyone has some quick helpful advice that is simple please let me know.
I tried this method but I don't understand it
How to subnet an IP address the easy way

Comments

  • Options
    TurK-FXTurK-FX Member Posts: 174
    128 - 64 - 32 - 16 - 8 - 4 - 2 - 1 <
    increments
    25 - 26 - 27 - 28 - 29- 30- 31- 32 <
    if subnet is in octet 4
    17 - 18 - 19 - 20 - 21- 22- 23- 24 <
    if subnet is in octet 3
    9 - 10- 11 - 12 - 13- 14- 15- 16 <
    if subnet is in octets 2
    128-192- 224 - 240-248-252-254-255

    check this chart. it shows increment points(which some called magic number),
    so since 254 is in 3rd octet, you check 254 which is equal to /23 you can get that number by adding 128+64+32+16+8+4+2=254

    My method is kind of complicated and confusing. but once you get it down, you can recreate it before the exam in exam room, and use it as reference. It will save you time. Most subnet questions take me no more than 30 sec. some takes a minute or so.
    WGU classes: Transferred -> AGC1, CLC1, TBP1, CJC1, BVC1, C278, CRV1, IWC1, IWT1, C246, C247, C132, C164, INC1, C277. Appealed -> WFV1 and C393.
    What is Left to take - > EUP1, EUC1, C220, C221, BNC1, GC1, C299, CTV1, DJV1, DHV1, CUV1, CJV1, TPV1, C394
    Currently Studying -> CCNA security (Designing Customized Security & Security)
  • Options
    SlayerXSlayerX Member Posts: 86 ■■□□□□□□□□
    That makes my head hurt haha. I understand what your getting at TurK.
    I think I will just remember these numbers 128, 192, 224, 240, 248, 252, 254, 255.
    But your chart inspired me to make my own and I think it will make things easy for me.

    128, 192, 224, 240, 248, 252, 254, 255 <--subnet mask ranges
    1 1 1 1 1 1 1 0 <--Network bits on

    It works cause I know 255.255=8 bits + 8 bits = 16 bits so I count up 7 bits to reach the subnet mask 254
    255.255.254 must be a /23 because 16 bits + 7 bits = 23bits

    anything more then 255. I can figure out now. Thanks for the help though it inspired me :)
  • Options
    Brandon1981Brandon1981 Member Posts: 19 ■□□□□□□□□□

    Here is a chart that I use. Similar to Turk-FX's. It helps to memorize the increments at certain points along the CIDR chain. For example, I know that .252 in the last octet is /30. I know that .128 in the last octet is /25. If you get .252 or .128 in the 2nd or 3rd octet, just subtract 8 or 16 from those numbers and that gives you the CIDR prefix.

    Example
    What is the CIDR notation of the mask 255.255.252.0?

    Since I know that .252 in the last octet is /30, subtract 8 and now I know that .252 in the 3rd octet is /22.

    Understand?

    That may have been ultra confusing, but it makes sense to me. Hopefully it will to you too.
  • Options
    IsmaeljrpIsmaeljrp Member Posts: 480 ■■■□□□□□□□
    I think if I followed these charts and stuff, I'd get worse at subnetting.

    Learn your binary. And powers of 2. Learn how many 0 it takes for a certain amount of hosts. Your subnetting speed will become unfairly fast. I can usually pinpoint an address's details in about 5-10 seconds. The thing that takes up time for me is writing down the answer or telling someone the answer.
  • Options
    kurosaki00kurosaki00 Member Posts: 973
    just count them man
    every octets has 8 bits

    1 2 3 4 5 6 7 8
    128 64 32 16 8 4 2 1

    I wrote 1-8 to help familiarize that octets have 8 bits but I usually just see them as on or off
    if you want to know where your bit is just subtract the subnet mask host portion from 256
    example if you get 255.255.255.240
    then you subtract 256-240 = 16
    now you count up there it takes you 4 bits to get to that place
    so by this logic we know that 255 means all the bits are taken right?
    This always means 8 bits
    so if we add up 255.255.255.240 = 8+8+8+4 = 28
    /28
    there we go
    meh
  • Options
    Reck_Reck_ Member Posts: 25 ■□□□□□□□□□
    Hi,

    Armed with your fundamentals, here is my thought.

    128 192 224 240 248 252 254 255
    + 1 2 3 4 5 6 7 8

    255 = 8

    let me explain with an example:

    255.255.255.0 = /24
    8 + 8 + 8 + 0 = 24

    255.255.255.192 = /26
    8 + 8 + 8 + 2 = 26

    255.255.255.252 = /30
    8 + 8 + 8 + 6 = 30

    and your question is : 255.255.254.0 (i assume you have 0 for the last octet)

    255.255.254.0 = /23
    8 + 8 + 7 + 0 = 23


    the 10k ft. question is... do i need to write these down ? not necessarily...

    in the 1st example...

    255.255.255.0 = /24
    8 + 8 + 8 + 0 = 24

    if i see my 3 octets is full of 255's then i have /24 in my heart which is the DSM (Default
    Subnet Mask) of Class C address. then i need not to worry about the last octet since its zero

    in the second example

    255.255.255.192 = /26
    8 + 8 + 8 + 2 = 26

    if i see my 3 octets is full of 255's then i have /24 in my heart which is the DSM
    (Default Subnet Mask) of Class C address. Then what I need to worry about is the last octet
    which is 192. And what do I need to add then ? its 2 right ? so its 24+2 and thats why we get a /26
    in a 255.255.255.192 subnetmask

    in the 3rd example

    255.255.255.252 = /30
    8 + 8 + 8 + 6 = 30

    if i see my 3 octets is full of 255's then i have /24 in my heart which is the DSM (Default
    Subnet Mask) of Class C address. then what I need to worry about is the last octet which is
    252. And what do I need to add then ? its 6 right ? so its 24+6 and thats why we get a /30 in
    a 255.255.255.252 subnetmask

    in your example...

    255.255.254.0
    8 + 8 + 7 + 0 = 23

    if i see my 2 octets is full of 255's then i have /16 in my heart which is the DSM (Default
    Subnet Mask) of Class B address. then what I need to worry about is the 3rd octet which is
    254. And what do I need to add then ? its 7 right ? so its 16+7 and thats why we get a /23 in
    a 255.255.254.0 subnetmask.Do I need to worry about the 4th octet ? 0 is nothing (in this
    case), so why bother.


    the 101k ft. question is... can I make this faster ?

    why not ? if you rely heavily on memorizing, why not change the the "+ values" with the actual CIDR notation.You can follow along Todds Lammles table for the exact CIDR equivalent on p.116, 6th ed of his CCNA book.

    You will see a lot of techniques in subnetting, some are popular textbook based and some are from great guys that eventually see and share a much easier way to learn how to subnet.I was there struggling/confused once. All of us trying to learn the world of computer networking will share same experience, so be vigorous about learning.But one thing is for sure, learn the basics and it will not fail you.Do not be anxious about being fast in subnetting, be accurate. Being fast (sometimes) leads to cramming, being accurate earn exam points.

    Goodluck.
  • Options
    IvanjamIvanjam Member Posts: 978 ■■■■□□□□□□
    Try this method:

    (1) Starting from the left, add up the value of each complete octet in bits (i.e., each octet with value 255 counts as 8 bits) e.g., 255.0.0.0 = 8; 255.255.255.0 = 8 + 8 + 8 = 24.

    (2) If the last octet has a value other than 0 or 255, subtract that value from 256. Next, calculate what power of two that difference is and subtract the answer obtained from 8 (2^8 = 256). Finally, add this last value to the value obtained from the sum of complete octets. Voila!

    Example: 255.255.255.192. The first three octets yield: 8 + 8 + 8 = 24. Subtract the value of the last octet from 256: 256 - 192 = 64. What power of 2 is 64? 64 = 2^6. Next, subtract your answer from 8: 8 - 6 = 2. Finally, we obtain: 8 + 8 + 8 + 2 = 26. So 255.255.255.192 = /26.

    Basically, one just needs to quickly recall or calculate the first 8 powers of 2: 2^1=2, 2^2=4, 2^3=8, 2^4=16, 2^5=32, 2^6=64, 2^7=128, 2^8=256.
    Fall 2014: Start MA in Mathematics [X]
    Fall 2016: Start PhD in Mathematics [X]
  • Options
    IvanjamIvanjam Member Posts: 978 ■■■■□□□□□□
    To get from CIDR to dotted octet notation, do the reverse of the steps in my previous post:
    (1) Do an integer division the number of bits (CIDR notation) by 8 (do not discard the remainder). The result (quotient) of the division will be the number of complete octets. Populate the octets starting from the left with 255 as many times as the quotient of the division. Next subtract the remainder obtained in the first step from 8. Next, elevate 2 to the power of the difference. Subtract the last result from 256. Finally, append the answer to the right of the last complete octet.

    Example: What is the octet notation for /23? First, 23 ÷ 8 = 2 with a remainder of 7. First, we populate the first 2 octets with 255 giving 255.255.0.0. Next, we subtract the remainder from the division from 8: 8-7=1. Next, 2^1=2. then 256-2=254. Finally, we put 254 in the 3rd octet yielding: 255.255.254.0.
    Fall 2014: Start MA in Mathematics [X]
    Fall 2016: Start PhD in Mathematics [X]
Sign In or Register to comment.