Share
Before calculating the total number of host and subnets of a certain IP address you have to have a clear idea about the IP classes. By looking at the first four bits of IP address you can determine the class of address.
  • Class A- It begins with 0xxx, or 1 to 126 decimal. 
  • Class B- It begins with 10xx, or 128 to 191 decimal.
  • Class C- It begins with 110x, or 192 to 223 decimal.
  • Class D- It begins with 1110, or 224 to 239 decimal.
  • Class E- It begins with 1111, or 240 to 254 decimal.
Determine the Number of IP Subnets and Hosts
Every IP address has two parts- Network and Host. For different classes the network and host parts-
  • Class A- Network.Host.Host.Host
  • Class B- Network.Network.Host.Host
  • Class C- Network.Network.Network.Host
  • Class D- Network.Network.Network.Network
For this tutorial we will use the following IP address:
162.190.107.127
255.255.255.224

Step 01: 
Determine the class of address using the first octet of the IP address.
162.190.107.127 = Class B
255.255.255.224

Step 02:
Now, determine the host and network octets.
Network.Network.Host.Host = Class B
162.190.107.127
255.255.255.224

Step 03:
Find out which bits are set to one in the host octets. Notice, if no bits are set to one then there is no subset.
162.190.107.127
255.255.255.224 = xxxxxxxx.xxxxxxxx.11111111.11100000 

Step 04:
Assume 'X' denotes the total number of ones. Then we will use this formula '(2^X)-2' to find out number of usable subnets. Example-
11111111.11100000 = 11 ones.
(2^11)-2= 2048-2= 2046 subnets in total for use.

Step 05:
Assume 'Y' denotes the total number of zeros. Then we will use this formula '(2^Y)-2' to find out number of usable hosts. Example-
11111111.11100000 = 5 zeros.
(2^5)-2= 32-2= 30 host address for use.