Subnet masks and CIDR

Networking Fundamentals · lesson 5 of 17 · 20 min

Subnet masks and CIDR notation A subnet mask is a 32-bit number that separates the network portion of an IP address from the host portion. Written in dotted decimal ( 255.255.255.0 ) or CIDR prefix notation ( /24 ).

  • How subnet masks work
  • A subnet mask of

255.255.255.0 (/24) means the first 24 bits are the network, the last 8 bits are the host. For 192.168.1.100/24 : network = 192.168.1.0 , host = .100 , broadcast = 192.168.1.255 . Calculating usable hosts Usable hosts = 2^(host bits) − 2. The −2 accounts for the network address (all host bits 0) and broadcast address (all host bits 1). /24 → 8 host bits → 2^8 − 2 = 254 usable hosts /25 → 7 host bits → 2^7 − 2 = 126 usable hosts /30 → 2 host bits → 2^2 − 2 = 2 usable hosts (point-to-point links)

Subnet mask quiz

How many usable host addresses does a /26 subnet provide?

  • 62
  • 64
  • 30
  • 126

Answer: 62
/26 leaves 6 host bits. 2^6 = 64 total addresses. Subtract 2 (network + broadcast) = 62 usable hosts.

What is the network address for 172.16.5.200/24?

  • 172.16.5.0
  • 172.16.0.0
  • 172.16.5.200
  • 172.16.5.255

Answer: 172.16.5.200
Wait — /24 means the first 24 bits are the network. 172.16.5 is the network portion, so the network address is 172.16.5.0.


Previous lesson: IPv4 address structure
Back to Networking Fundamentals
Next lesson: Subnetting practice