What is CIDR?
CIDR notation writes a network as an address plus a prefix length, like 10.0.0.0/24: the prefix says how many of the 32 bits identify the network, the rest identify hosts. A /24 leaves 8 host bits (256 addresses), a /16 leaves 16 (about 65 thousand).
The network address is the address ANDed with the prefix mask; the broadcast address has all host bits set. Both are reserved, so usable hosts are 2(32 − prefix) − 2 — except /31 point-to-point links (RFC 3021) and /32 single hosts, which use every address.
The wildcard mask is the inverse netmask used in router ACLs; the IP class is the pre-CIDR vocabulary; and an address is private when it falls in the RFC 1918 ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).
Common prefix lengths
| CIDR | Netmask | Addresses | Hosts |
|---|---|---|---|
/8 | 0.0.0.255 | 16,777,216 | 16,777,214 |
/16 | 0.0.255.255 | 65,536 | 65,534 |
/20 | 0.240.255.255 | 4,096 | 4,094 |
/22 | 0.252.255.255 | 1,024 | 1,022 |
/23 | 0.254.255.255 | 512 | 510 |
/24 | 0.255.255.255 | 256 | 254 |
/25 | 128.255.255.255 | 128 | 126 |
/26 | 192.255.255.255 | 64 | 62 |
/27 | 224.255.255.255 | 32 | 30 |
/28 | 240.255.255.255 | 16 | 14 |
/29 | 248.255.255.255 | 8 | 6 |
/30 | 252.255.255.255 | 4 | 2 |