Addressing and masks
An address mask separates the network portion from the host portion of the 32-bit IP address.
Class A addresses have 8 bits of network address and 24 bits of host address.
Class B addresses have 16 bits of network address and 16 bits of host address.
Class C addresses have 24 bits of network address and 8 bits of host address.
Subnets can be defined using the defined “class” schemes or using a locally defined split of network/host bits.
The all-zero and all-ones addresses are reserved on all subnets for the network and broadcast addresses, respectively. This implies that the maximum number of hosts on a network with
nbits in the host portion of the address is 2n–2. For example, a class C network has 8 bits in the host portion. Therefore, it can have a maximum of 28–2=254 hosts.