Definition

CIDR (Classless Inter-Domain Routing) writes an address with /p, where p is the number of network bits. A mask has p consecutive ones followed by 32-p zeros.

Example

/23 = 11111111.11111111.11111110.00000000
    = 255.255.254.0

200.23.16.0/23 contains 512 addresses, from 200.23.16.0 to 200.23.17.255.

Conversion reference

PrefixMaskTotal addresses
/16255.255.0.065,536
/23255.255.254.0512
/24255.255.255.0256
/25255.255.255.128128
/28255.255.255.24016
/29255.255.255.2488
/30255.255.255.2524
/31255.255.255.2542
/32255.255.255.2551

Important rules

  • Valid mask octet values: 0, 128, 192, 224, 240, 248, 252, 254, 255.
  • The entire 32-bit mask must be contiguous; 255.0.255.0 is invalid despite individually allowed octets.
  • Total addresses = 2^(32-p). Usable hosts depend on the subnet’s role.
  • In the octet containing the boundary, 256 - mask octet gives the block increment. For /23 this is 2 in the third octet, not two total addresses.

Common mistakes

Confusing the netmask with the Network ID, or reading the slide’s per-octet increments as complete host counts.

Source

Lecture 01 - IPv4 Addressing and Routing, PDF pages 8-10. Range calculations and cautions are added study explanation.