Short tutorial that explains you on how to calculate Subnet Mask of IP address.
Subnet mask is a 32 bits long address used to distinguish between
network address and host address in IP address. Subnet mask are used to identify
which part of an IP address is network address and which part is host
address. Subnetting helps to organize a network by breaking it into several subnets. The subnet mask explicitly defines network and host bits as 1 and 0, respectively.
There are 3 classes of IP addresses.
Binary Classifications of the three classes are,
For example let us consider an IP address 192.35.128.93 which belongs to the network with 6 subnets. How to calculate subnet mask?
Step 1: Determine the network class of the given IP Address 192.35.128.93.
Step 2: As the IP starts with 192, the address falls on Class C.
Step 3: Calculate Number of bits, to define the subnets.
Step 4: Formula to calculate Number of bits = Log2(Number of subnets + 2).
Step 5: Given here is 6 subnets, Applying the values in the formula, we get, Number of Bits = Log2(Number of subnets + 2) = Log2(6+2) = 3 bits.
Step 6: Use the bits calculated in the above step, to compose the subnet mask in binary form using the default binary classification.
Step 7: IP Address 192.35.128.93 falls on Class C, whose Binary Classification is 11111111.11111111.11111111.00000000. Substitute the subnet bits in the binary classification and we get 11111111.11111111.11111111.11100000.
Step 8: Convert the binary values to its equivalent decimal values using the following rules,
Step 9: Converting the IP 11111111.11111111.11111111.11100000 into binary using the above rules, we get,
Step 10: Hence, the IP Subnet Mask = 255.255.255.224