Parameters Related to the Subnet Mask
Given an IP address and its associated subnet mask, we can determine anything we need about the properties of the IP subnet. In addition to the network address, which we calculated in the prior example, the following parameters can be calculated:
Host Address: this is the portion of the IP address that does not correspond to the network address. If you were to invert the subnet mask (exchange "0"s with "1"s and "1"s with "0"s--this is known as the 1's complement), and calculate the bitwise-AND of this with the IP address, the result would be the host portion. There is no point in calculating this parameter, because people never use it.
Broadcast Address: the broadcast address is a reserved address in each IP subnet which can be used to speak to all of the IP hosts via a single packet (called a broadcast). For a given subnet, it is the network address together with the bits in the host portion of the address all set to "1". Put another way, it is the highest (or last) host address in the subnet. It is easiest calculated by performing a bitwise-OR of the IP address and the 1's complement of the subnet mask.
Number of Host Addresses in this IP Subnet: this quantity is used for planning deployment of address space. The value is calculated by raising two to the power of the number of "0"s in the subnet mask. But because the first address in the subnet is always reserved for the network address, and the last address for the broadcast address, you should subtract two from this value to find the maximum number of hosts. You can use these formulae:
Max # of host addresses = 2 (32 -maskbits)
Max # of hosts = 2 (32 -maskbits) -2