Subnetting: Detrmining Subnet Mask based on Desired Hosts?

Hello,
Just finished the Subnetting section on CBT nuggets. Started searching for more subnetting exercises online and found a great practice sheet. However the practice work Im doing now Gives me the Class of the network (A,B,C) and wants me to determine the best subnet mask to use based on the desired amount of subnets.
The first question is if you have a Class A network and wish to have 50 subnets what should the subnet be if you want the most hosts per network as possible. The answer is already goven as 255.252.0.0 however it doesn't explain the math process to get to this number and I'm curious how to do it. If any of you subnetting Gurus know more about this please help.
Thanks.
Just finished the Subnetting section on CBT nuggets. Started searching for more subnetting exercises online and found a great practice sheet. However the practice work Im doing now Gives me the Class of the network (A,B,C) and wants me to determine the best subnet mask to use based on the desired amount of subnets.
The first question is if you have a Class A network and wish to have 50 subnets what should the subnet be if you want the most hosts per network as possible. The answer is already goven as 255.252.0.0 however it doesn't explain the math process to get to this number and I'm curious how to do it. If any of you subnetting Gurus know more about this please help.
Thanks.
Comments
128 (1 additional bit)
192 (2 additional bits)
224 (3 additional bits)
240 (4 additional bits)
248 (5 additional bits)
252 (6 additional bits)
254 (7 additional bits)
255 (8 additional bits)
Class A subnet mask is 255.0.0.0 (8bits); when subnetted to 255.252.0.0, you are adding 6 bits to be used for additional subnets, 2^6 = 64, this meets the requirements for 50 subnets, 5 bits (.248 ) won't work because 2^5 = 32 which is <50.
Also, you should know that IPv4 addresses are 32 bits, so 32-8-6=18 bits are available for addressing the hosts within each subnets. In other words, 255.252.0.0 will support 64 subnets each with 2^18 - 2 host addresses (You need to subtract 2 because of the network/broadcast addresses)
To answer your question...
A class A address defaults to a 255.0.0.0 mask. The question is asking you to divide it so there is exactly 50 subnets. It doesn't say this directly, but if you divided it into 51 or more subnets, then you would no longer to have the maximum hosts possible.
2^x=50 is the equation that you need.
2^1=2 (not enough)
2^2=4 (not enough)
2^3=8 (not enough)
2^4=16 (not enough)
2^5=32 (not enough)
2^6=64 (more than enough, we only needed 50 subnet, but we are going to get 64)
So we must give 6 more bits to the network address.
Default mask: 11111111.00000000.00000000.00000000
New mask: 11111111.11111100.00000000.00000000
Convert the new mask into decimal, and you have 255.252.0.0
I should say that 2^x >= 50 is the equation that you are looking for. The reason being, if your boss asks for 50 subnets, and you give him 32, there is going to be trouble. If he asks for 50, and you give him 64, then you have an extra 14 subnets for if your company expands.
And yes, you could have borrowed 7 bits, and given him 128 subnets. But now you don't have the maximum number of hosts per subnet. As number of subnets increases, the number of potential hosts goes down. As the number of subnets decreases, the number of potential hosts go up.
I just remembered something I heard in the video. From 1995 and prior you had to subtract -2 from the subnets because of the routers. Perhaps this Question sheet wanted me to subtract two and therfore I would have had to go with 2^3=8 which would in fact give me 255.255.224.0
There is probably the issue.
For me, I subtract 2 if I am given the number of hosts. But do not subtract 2 if given the number of subnets. You do not need to lose 2 subnets, but you will lose 2 possible addresses because of the network address and the broadcast address.
Just remember, that when a bit in the mask is a 1, it is used for the network and when it is a 0, it is used for the host. So when you are working on a problem that says you have a class B address and need to have 500 hosts per subnet you do the following.
2^x-2=500
2^x=502
x=9
Since you are working with hosts, this means that you need to have at least 9 0's.
So your mask could be anything from 255.255.0.0 to 255.255.254.0, but there will likely be a second part of the question to determine what the answer is, such as "while having the most number of subnets." (which would make the answer 255.255.254.0)
Just a note, I usually use shorthand to write subnet masks. 255.255.255.0 is the same as 11111111.11111111.11111111.00000000 but I will only usually write out the binary for the octet that the change occurs in. So for your initial problem, I would use something like 255.11111100.0.0 just to save time and space. I will only convert to full binary when I am finished with the problem. I'm not fluent enough with subnetting to look at 224 and instantly know that it is 11100000 so I work it out and write it down. If my way doesn't make sense to you, don't use it. There are a thousand ways to subnet, pick the one that works for you.