Course · $400 Free reference Certifications

Subnetting & CIDR, one cheat sheet

CIDR prefixes to subnet masks, usable host counts per prefix, and the private address ranges — the subnetting table every Network+/CCNA exam expects.

Advertisement · 728×90

The host-count formula

Formula

Usable hosts per subnet = 2^(32 − prefix) − 2. The −2 removes the network address and the broadcast address.

A /24 = 2^8 − 2 = 254 usable hosts. (Point-to-point /31 links are a special RFC 3021 exception with 2 usable hosts.)

Don't want to do it by hand? Use the interactive subnet calculator — enter an address and prefix to get the mask, network, broadcast and usable range instantly.

Prefix, mask and host count

CIDRSubnet maskTotal addrUsable hosts
/30255.255.255.25242
/29255.255.255.24886
/28255.255.255.2401614
/27255.255.255.2243230
/26255.255.255.1926462
/25255.255.255.128128126
/24255.255.255.0256254
/16255.255.0.065,53665,534
/8255.0.0.016,777,21616,777,214

Private address ranges (RFC 1918)

RangeCIDR
10.0.0.0 – 10.255.255.25510.0.0.0/8
172.16.0.0 – 172.31.255.255172.16.0.0/12
192.168.0.0 – 192.168.255.255192.168.0.0/16

Also worth knowing: 127.0.0.0/8 loopback, 169.254.0.0/16 APIPA/link-local.

Exam traps

  • Forgetting the −2. Total addresses ≠ usable hosts.
  • Mixing up /12 boundaries. 172.16.0.0/12 covers 172.16–172.31, not all of 172.
  • Counting a /31 as unusable. RFC 3021 allows 2 hosts on point-to-point links.

Test yourself

4 quick questions — tap an answer to check it instantly. Nothing is sent anywhere.

1. How many usable hosts in a /26?

Answer: B. 2^(32−26) − 2 = 64 − 2 = 62.

2. The subnet mask for /24 is…

Answer: B. /24 = 255.255.255.0.

3. Which is a private (RFC 1918) range?

Answer: B. 172.16.0.0/12 is private; 169.254 is APIPA, 127 is loopback.

4. Why subtract 2 from the host count?

Answer: B. The network and broadcast addresses can't be assigned to hosts.

Sources

  1. CompTIA Network+ / Security+ exam objectives.
  2. Relevant RFCs and vendor documentation.

Reference summary only. For authoritative addressing rules see the relevant RFCs.