# Calculating number of subnets and host in each subnet [duplicate]

Possible Duplicate:
How does Subnetting Work?

Hi all!
I need to determine the new subnet mask showing it in dotted decimal and as a binary field, calculate the actual numbers of subnets and host in each subnet, determine if the company can subnet as desired.

Example:Company ABC has a class C IP address. It wants to have 5 subnets with a max of 25 computers on each subnet.

My solution: The default mask for the class C IP address is 255.255.255.0
There are 8 bits in the host address field: 11111111
Company ABC wants 5 subnets. The nearest possible value is 2^3 – 2 = 6.
Therefore, we take 3 top bits for the subnet field and remaining 5 bits for the host address field: ssshhhhh.
The subnet mask in our case is: 11111111 11111111 11111111 11100000
The subnet mask in dotted-decimal: 255.255.255.224
(since the corresponding bit pattern, 11100000, equates to 2^7 + 2^6+ 2^5= 128 + 64 + 32 = 224)
Actual number of subnets = 2^((number of subnet bits taken from the host) ) – 2 = 2^3– 2 = 6.
Number of hosts in each subnet = 2^((number of remaining bits in the host) ) – 2 = 2^5– 2 = 30.

Company ABC can subnet as desired.

Is it correct?

-