I have started studying TCP/IP and was eager to dive into Subnetting
thinking it would be the hardest thing ever. It is in fact pretty easy when you get a few
ground rules down and I have just started to be able to do this in my head. The first
thing is you have to know how to convert from Binary (base 2) to decimal (base 10)
and back again. I won't get into that here and you should be able to do this Junior High
School math.
You should also know about how addresses are made up of four 8 bit octets. I'll add
pages later to explain this rudimentary part of IP Addressing. Remember that Subnet
masking is exactly that. You are masking a portion of the IP address to be used for
Network ID's and the remainder for hosts.
Oh so here's the straight poop... You have to know two other things up front, What type
of address you have been assigned or are working with, Class A, B or C and how many
subnets and /or hosts you need. For the purpose of this discussion we will assume it is a
class B address. Now lets say you need 25 subnets with 500 hosts on each one. OK lets see
if that is possible. Look at the table above (you will have to memorize this to do this
fast!) Look at the Subnets Available row in the table above. Which one is the lowest value
that will include 25 plus 1 subnets? 30 of course! Your subnet mask for a Class B address
is 248 or 255.255.248.0 from the "This is your Mask" row!!! . If I
asked for 31 subnets you would have done 31 +1 = 32 and the next highest is 64 so your
subnet would have been 252 or 255.255.252.
Well we have the subnet mask pretty quickly huh? I will get into how this table was
derived but for now we just want to do it fast!
Well how many hosts can we have on each of the 25 subnets in our example?
This is not too hard as well. Look at the column that has the 248 mask and note what bit
position it is..5 so we have 3 left for the hosts! Now add that to the 8 bit
positions from the last octet and we have 11 available positions for the hosts (remember
this is a class B address so the last two octets are available for hosts and subnets).Ok
take 2 to the 11th power and subtract two what do you get?
2,4,8,16,32,64,128,256,512,1024,2048!! 2048 less 2 =2046 hosts per subnet.
Now for the last and best part.... What are the valid host ID's?. Go to the table and
look at the Column that has out subnet mask and note the bit position (5) and look at the
bottom two rows of our table what is the pattern key for that bit position...8!
Ok so assume we were assigned a Class B IP address of 145.15.0.0 the first group of
valid host ID's, using a Subnet mask of 255.255.248.0 would use this pattern starting with
8 and increasing in intervals of 8 so we would get 145.15.8.0 then 145.15.16.0 then
145.15.24.0 till we ran out at 145.15.248.0 which we cant use because it is is all 1's. So
then you take the first address we got and add 1 so we get 145.15.8.1. this is the
beginning of the range of valid Host ID's on a subnet. To get the ending address of
the range take the next address in the pattern generated addresses (145.15.16.0) and
subtract 2 and we get 145.15.15.254.
VOILA! We have our range for the first subnet 145.15.8.1 through 145.15.15.254!!!
Repeat this for all subsequent subnets and we get 145.15.16.1 through 145.15.23.254
etc....
Here are more stuff on subnetting for your practice........
even easier!