A /20 mask indicates that the first 20 bits are set to “1”, which in expressed in dotted decimal as 255.255.240.0. The way to determine the number of valid hosts is much like the previous section in determining the number of valid subnets, in that you must first determine how many subnet bits are present. The difference is that when determining the number of valid hosts, it is the number of host bits you’re concerned with, rather than the number of subnet bits.

Once the number of host bits is determined, use this formula to arrive at the number of valid hosts:

The number of valid hosts = (2 raised to the power of the number of host bits) – 2

In the example question, there is a Class B network, with a default mask of /16. The subnet mask is /20, indicating there are four subnet bits. Here’s where the difference comes in. There are 16 network bits and 4 subnet bits. That’s 20 out of 32 bits, meaning that there are 12 host bits. 2 to the 12th power is 4096; subtract 2 from that, and there are 4094 valid host addresses.

Illustrating the masks in binary illustrates where the host bits lie:

Default Network Mask 1st Octet2nd Octet3rd Octet 4th Octet

255.255.0.0 111111111111111100000000 00000000

Subnet Mask

255.255.240.0 11111111 11111111 11110000 00000000

Remember, previously mentioned, that the bits that are set to “0” in the default mask and “1” in the subnet mask are the subnet bits? The bits that are set to “0” in both masks are the host bits. That’s the value you need to have for the formula to determine the number of valid hosts. Note that in both the formula for determining the number of valid hosts and valid subnets, 2 is subtracted at the end. What two hosts are being subtracted? The “all-zeroes” and “all-ones” host addresses, which are considered unusable.

How many valid host addresses exist in the 220.11.10.0 /26 subnet?

This is a Class C network, with a default mask of /24. The subnet mask is /26, indicating that there are 2 subnet bits. With 24 network bits and 2 subnet bits, that leaves 6 host bits:

Default Network Mask 1st Octet2nd Octet3rd Octet 4th Octet

255.255.0.0 11111111111111110000000000000000

Subnet Mask

255.255.240.0 11111111 11111111 1111000000000000

(Boldfaced 11 bits are representative of the Host bits.) 2 to the 11th (211 ) power equals 2048; subtract 2 from that and 2046 valid host addresses remain.