-
Step 1
First, identify how many bits have been used. If you are presented with an IP address and it has a slash notation on the end (often called CIDR) -- e.g. /24 -- this is just another way of writing the subnet mask. It essentially means that you have 24 bits to create the subnet mask.
-
Step 2
Translate slash notation to binary numbers. Once you know how many bits are being used you can now write out the slash notation in its binary equivalent. If we use the example above, we know that we have used 24 bits. Now that you know this, you will need to write the number out in groups of eight. Once you have reached the number of bits you have borrowed, fill the rest of the octets in with 0’s.
For example, /24 = 24 bits - 24 bits in groups of 8 is three groups of 8 - or 11111111.11111111.11111111.00000000 -
Step 3
Now that you have the binary numbers, you can easily translate them into a subnet mask. Take each octet (each group of 8) and turn them into a normal decimal number. Starting at the left and working right, each bit is 2^x (two to the xth power) starting with 8.
So first one would be 2^8 (2 to the 8th power - or 256), then 2^7 (128), etc and add together all the numbers that are represented by a 1.
The first octet has all ones in it, so you place a one under each number in the binary scale. Once you have used all the ones up for that octet you add all the numbers above them to find out the denary number of that octet.
128 64 32 16 8 4 2 1
Do this for each octet and you will see that a /24 = 255.255.255.0
You can do this for any subnet you want.











Comments
rabuk said
on 8/28/2009 2^8=256 AND 2^7=128 AND 2^6=64
SILLY MISTAKES..