IPV4 ADDRESSING · CCNA

Subnetting formula and usable hosts cheat sheet

Almost every CCNA subnetting question reduces to one formula and one shortcut. Learn both, then use the table at the bottom to check your work.

The usable hosts formula

An IPv4 address has 32 bits. If the prefix length is n, the number of host bits is h = 32 − n.

total addresses = 2^h
usable hosts    = 2^h − 2

You subtract two because the first address is the network address and the last is the broadcast address. Neither can be assigned to a host. For a /26: h = 6, 2^6 = 64 addresses, 64 − 2 = 62 usable hosts.

Find the subnet with the block-size method

Look at the interesting octet, the one where the mask is neither 0 nor 255. The block size is 256 minus the mask value in that octet, and subnets start at multiples of the block size.

Example: 192.168.10.70 with mask 255.255.255.192. The interesting octet is the fourth, and the block size is 256 − 192 = 64. Subnets begin at .0, .64, .128 and .192, so 70 belongs to the .64 subnet:

network    192.168.10.64
first host 192.168.10.65
last host  192.168.10.126
broadcast  192.168.10.127

The broadcast address is the next network address minus one. Try the same method on the subnetting practice questions.

How many subnets and how big?

The /31 and /32 exceptions

The “minus two” rule is for ordinary broadcast subnets. A /32 is a single host route. A /31 has two addresses and is used on point-to-point links; under RFC 3021 both addresses are usable. If an exam question asks about usable hosts in a normal LAN subnet, apply 2^h − 2; if it describes a point-to-point link, read it carefully.

CIDR quick reference

Totals and usable hosts for common prefixes. The sizes follow directly from the formula above.

PrefixSubnet maskTotal addressesUsable hosts
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/21255.255.248.02,0482,046
/22255.255.252.01,0241,022
/23255.255.254.0512510
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242

Spot the pattern: every extra prefix bit halves the block. You can also rebuild the table from memory by starting at /24 = 256 and halving.

Sources and further reading

ccna.dev is independent and not affiliated with or endorsed by Cisco. Always confirm exam details with Cisco.