First we will go through the Classes of IP addresses and their default subnet mask
Class A IP addresses IP : 0-126 .0.0.0
Default Subnet mask : 255.0.0.0
Class B IP addresses IP : 128-191 .0.0.0
Default Subnet Mask : 255.255.0.0
Class C IP addresses IP : 192-223 . 0.0.0
Default Subnet mask : 255 .255.255.0
Class D and E IP addresses are reserved for research and development .
The Internet Assigned Numbers Authority (IANA) has reserved the following three ranges of IP addresses and are called as the Private IP addresses that are used for the local networks and should not be used on the Internetwork .
PRIVATE IP ADDRESSES
Class A : 10.0.0.0 - 10.255.255.255
Class B : 172.16.0.0 – 172.31.255.255
Class C : 192.182.0.0 -192.168.255.255
Now lets proceed on determining the number of Subnets and the IP addresses per subnet .
Lets First take an example of Class A IP address .
A)
IP address : 30.56.62.11
Subnet mask : 255.224.0.0
As the default subnetmask for class A is 255.0.0.0 you need not consider the first octet to determine the number of subnets and the IP addresses per subnet , in class B the first two octets and in class C the first three octets .
Now the second octet is 224 , you will need to convert the given subnet mask to binary which comes to
11111111.11100000.00000000.00000000
You need to leave the first octet that is the first eight bits . The number of 1s leaving the first octet is 3 and the number of zeros is 21
Number of 1’s or subnet bits is = 3
Numbers of 0’s or host bits is = 21
Therefore the number of subnets = 2 ³ -2 = 6 subnets
The number of IP addresses per subnet = 2 ²¹ -2 = 2097150 IP Addresses
You need to substract 2 from the number of IP addresses because the First IP address is used as a Subnet Number and the last IP address is used for broadcasting where all the bits are set to on that is 1 .
Lets Take an example of class B IP address
B) IP address : 75.93.168.110
Subnet Mask : 255.255.240.0
Now lets convert the subnet mask to binary which comes to
11111111.11111111.11110000.00000000
Note that here you have to not consider the first two octets. Here the number of 1’s is 4 and the number of 0’s is 12
Number of 1’s or the subnet bits is = 4
Number of 0’s or the host bits is = 12
Therefore the number of subnets = 2 ^4 -2 =14 subnets
The number of IP addresses per subnet is = 2 ¹ ² -2 = 4094 IP addresses per subnet
Now Lets take an example of class C IP address.
C )
IP address : 213.175.193.168
Subnet Mask : 255.255.255.240
Lets convert the subnet mask to binary number which comes to
11111111.11111111.11111111.11110000
Here the number of 1’s or subnet bits leaving the first 3 octets is 4 and numbers of 0’s is 4 .
Therefore the number of subnets = 2^4 -2 = 14 subnets
And the IP addresses per Subnet = 2^4 -2 = 14 IP addresses per Subnet

