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.0200.23.16.0/23 contains 512 addresses, from 200.23.16.0 to 200.23.17.255.
Conversion reference
| Prefix | Mask | Total addresses |
|---|---|---|
| /16 | 255.255.0.0 | 65,536 |
| /23 | 255.255.254.0 | 512 |
| /24 | 255.255.255.0 | 256 |
| /25 | 255.255.255.128 | 128 |
| /28 | 255.255.255.240 | 16 |
| /29 | 255.255.255.248 | 8 |
| /30 | 255.255.255.252 | 4 |
| /31 | 255.255.255.254 | 2 |
| /32 | 255.255.255.255 | 1 |
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.0is 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 octetgives 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.
Related concepts
- IPv4 Network IDs and Subnet Boundaries
- IPv4 Host Counts and Point-to-Point Subnets
- Classful IPv4 Addressing
Source
Lecture 01 - IPv4 Addressing and Routing, PDF pages 8-10. Range calculations and cautions are added study explanation.