CIDR notation explained: what does /24 mean?
What the /24 in 192.168.1.0/24 means, how many addresses a prefix holds, how subnet masks map to prefix lengths, where prefixes start, and where CKIP shows them.
5 min readPart 14 of 16
On this page
192.168.1.0/24, 8.8.8.0/24, 2001:db8::/32: an address followed by a slash and a number is CIDR notation. It describes a whole block of consecutive addresses, also called a prefix or a subnet. Routes, firewall rules, registration records and ASN announcements are all written this way, so once you can read it, a lot of networking material makes sense.
What the number after the slash means
An IPv4 address is a 32-bit binary number. The number after the slash is the prefix length: how many of the leading bits are fixed. The remaining bits can be anything, and every address they can make belongs to the block.
FixedVaries
203.0.113.0/24
First 24 bits fixed, last 8 vary: 256 addresses, 203.0.113.0 to 203.0.113.255
203.0.113.0/26
First 26 bits fixed, last 6 vary: 64 addresses, 203.0.113.0 to 203.0.113.63
So a block holds 2 to the power of (32 minus the prefix length) addresses. Every step up in prefix length halves the block; every step down doubles it.
Common block sizes
| Prefix | Subnet mask | Addresses |
|---|---|---|
/8 | 255.0.0.0 | 16,777,216 |
/16 | 255.255.0.0 | 65,536 |
/20 | 255.255.240.0 | 4,096 |
/22 | 255.255.252.0 | 1,024 |
/24 | 255.255.255.0 | 256 |
/26 | 255.255.255.192 | 64 |
/30 | 255.255.255.252 | 4 |
/32 | 255.255.255.255 | 1 |
Where you'll typically meet them:
- /24 is the most common size for a home network, and the smallest IPv4 block that can be announced on its own on the internet. Anything more specific usually doesn't propagate globally.
- /30 and /31 are common on links between two routers, which only need two addresses.
- /32 is a single address, often used in firewall rules to mean "just this one IP".
- /8 is the largest size, and some big organizations were handed whole /8s in the early days.
The /24 limit shows up clearly in the global routing table. RIPE's route collectors gather routes from hundreds of networks worldwide, and the most widely spread routes are seen by 438 of these peers. 1.08 million IPv4 routes are seen by at least 100 peers, and nearly two thirds are /24s:
IPv4 routes by prefix length
- /161.3%13,729
- /170.8%8,319
- /181.2%13,333
- /192.4%25,536
- /204.2%45,926
- /215.0%53,820
- /2210.5%114,358
- /2310.3%112,169
- /2463.9%692,670
- /25–/32None seen by 100 peers
Subnet masks: the same thing, written differently
The subnet mask you see in router and computer network settings, such as 255.255.255.0, says the same thing as a prefix length. Write the mask in binary and count the 1s: that's the prefix length. 255.255.255.0 is 24 ones followed by 8 zeros, so it's a /24.
The first and last address in a block
On a local network, the first address stands for the network itself and is called the network address. The last one reaches every device on the network and is called the broadcast address. Neither is normally given to a device, so the usable addresses in 192.168.1.0/24 are 192.168.1.1 to 192.168.1.254, 254 in total.
This broadcast address has nothing to do with the "broadcast IPs" Chinese users talk about, which CKIP calls cross-border IPs; see Native and cross-border IPs.
The exceptions are /31 and /32. A /31 has two addresses, and on a point-to-point link both are usable. A /32 is a single address, and it's just that address.
Where blocks start
A block can't start just anywhere. A /24 always starts at .0, and a /26 can only start at .0, .64, .128 or .192: the start has to be a multiple of the block's size. When you see 8.8.8.1/24, it really means 8.8.8.0/24, and CKIP's ASN history normalizes it that way.
Two neighboring, aligned blocks can be combined into a bigger one: 203.0.113.0/25 plus 203.0.113.128/25 is 203.0.113.0/24. The reverse is also true: an arbitrary range of addresses isn't always a single block. 203.0.113.0 to 203.0.113.95 has to be split into 203.0.113.0/26 and 203.0.113.64/27. When a WHOIS record's address range works out like that, CKIP lists every block it splits into.
Prefixes on the internet
Routes on the internet are announced as prefixes. When an address falls inside several announced prefixes, routers pick the most specific one, the one with the longest prefix. If one network announces 203.0.112.0/22 and another announces 203.0.113.0/24 inside it, traffic to 203.0.113.5 follows the /24.
Packet to 203.0.113.5
Routing table
This rule lets networks split their addresses flexibly, and it's also why route hijacks work: an impostor only has to announce a more specific prefix to pull the traffic away; see IP address history.
IPv6 prefixes
IPv6 addresses are 128 bits long. Prefixes are written the same way, with bigger numbers:
- /64 is the standard size for one local network, and devices use it to build their own addresses.
- /56 and /60 are common for the prefix an ISP gives a household, which can be split into several /64s; see IPv4 vs IPv6.
- /48 is often assigned to an organization or site, and it's the smallest IPv6 block that can be announced on its own on the internet. In the same routing snapshot, 260,000 IPv6 routes are seen by at least 100 peers; 45.9% are /48s, and none is more specific.
- /32 is a common size for the blocks regional registries allocate to ISPs.
Prefixes on CKIP
- ASN pages: type an ASN into the search box, such as AS13335. The network size section shows how many IPv4 and IPv6 prefixes the network announces and how many IPv4 addresses that adds up to. The prefix list below gives each prefix with a sample address; select the address to look it up.
- WHOIS lookup: look up an IP, and the Network and Address range fields show the same block written both ways.
- ASN history: enter a prefix directly to see which networks have announced it, up to an IPv4 /16 or an IPv6 /32.
Working out a block yourself
If you have Python, one line gives you the mask, the number of addresses and the first and last address:
python3 -c "import ipaddress as i; n = i.ip_network('203.0.113.0/26'); print(n.netmask, n.num_addresses, n[0], n[-1])"255.255.255.192 64 203.0.113.0 203.0.113.63Swap in any block you like between the quotes. To split an arbitrary range into blocks, use summarize_address_range:
python3 -c "import ipaddress as i; print(*i.summarize_address_range(i.ip_address('203.0.113.0'), i.ip_address('203.0.113.95')))"203.0.113.0/26 203.0.113.64/27And to merge neighboring blocks, use collapse_addresses:
python3 -c "import ipaddress as i; print(*i.collapse_addresses([i.ip_network('203.0.113.0/25'), i.ip_network('203.0.113.128/25')]))"203.0.113.0/24