] back to main article
This was written by Kyle as an addendum to the subnet tutorial.  It is his method of figuring out a subnet when given the problem of having to allow x amount of  hosts per subnet.

Say your boss comes to you and says, hey, I just got us a nice new Class B IP address of The number of subnets isn't important, but what I do need is that each subnet can handle 95 hosts. 
Now you have a problem, but not for long.  What you do is this. I always love to bust the addresses down into binary, makes it a lot simpler for later steps and ANDing too.
First things first, since I know that 149 is Class B, I know that there will be a mandatory 16 bits being used for the Subnet Mask. So I will write out my IP address as follows on paper: /16  (16 is for the number of bits being used by the subnet mask)
Then for the binary translation. Ok, so an IP address of translates into binary as follows:
10010101 00001010 00000000 00000001 /16
Subnet Mask in binary is as follows:
11111111 11111111 00000000 00000000
Now for the problem at hand. You know that you boss needs 95 hosts per subnet. So let's figure out how many bits it will take to get you up to 95. It would take 7. The formula would be (2^7-2) = 126. This is good because it also allows for future growth if additional hosts need to be added besides the already planned for 95.
This is where it gets interesting. So since you know it will take 7 bits for the desired amount of hosts all you have to do is take the 32 bits that are used for the subnet mask and subtract the number of bits being used for the hosts, so 32-7 = 25. 
That breaks down to, 25 bits for the Subnets and 7 for the hosts.
So now lets see what we got here.
We will still have the IP address but the subnet bits have changed from /16 to /25
The IP and subnet mask would look like this: /25