## Monday, May 24, 2010

For example, if the number of hosts(510) given and a sample IP(172.30.0.0) has given. How to find out the subnet mask?

=> Here in this case answers is
255.255.254.0

172.30.0.0 is an IP Address of type Class B. So the possible subnet mask will be 255.255.0.0

As per the problem only 510 hosts are allowed and 0,255 reserved for special purposes. So the total of 512 hosts possible.

i.e. 512(Decimal) = 2^9.

Means
only 9 bits will be used for IP and the remaining will be used for Sub net Masking.

As we know, each IP will have 4 Octets and each Octet will be represented by 8 bits. So out of 9 bits, 8 bits will be used by Fourth Octet and 1 bit will be used by Third Octet.

If you see the, Class B sub net mask, First and Second Octets will be represented by 255. Means all the bits are used for Sub net masking only.

First Octet - 1111 1111 - 255
Second Octet - 1111 1111 - 255
Third Octet - 1111 1110 - 254(only 7 bits)
Fourth Octet - 0000 0000 - 0

So, the final subnet mask will be 255.255.254. 0

For more details on Sub net mask calculations,
http://www.joshgentry.com/networking/subnet.htm