Address space is a hierarchy of bit prefixes
Calculate IPv4 and IPv6 prefix ranges, separate address count from host assignment, and avoid broadcast assumptions that fail across protocols.
On this page
The question for today
What you’ll understand
- Calculate the size and alignment of an address prefix.
- Explain why IPv4 usable-host rules have important exceptions.
- Separate an assigned address from evidence of end-to-end reachability.
An IP address is a fixed-width number interpreted within a network architecture. A prefix groups addresses that share their leading bits, allowing administrators to allocate space and routers to summarize destinations. Neither a familiar decimal spelling nor a large allocation proves that a host can communicate. Learn to count the bit patterns first, then inspect the rules that assign them and the routes that make them reachable. This prevents capacity plans built on memorized subnet tables.
Count suffixes, then check alignment
IPv4 addresses contain 32 bits; IPv6 addresses contain 128. A slash followed by a prefix length fixes that many leading bits. The remaining bits enumerate suffixes. A /26 IPv4 block contains 64 addresses because six bits remain free. Its starting address must align to a 64-address boundary in the final octet when the first 24 bits are fixed. Writing 192.0.2.70/26 describes an address inside the block whose network prefix is 192.0.2.64/26.
Splitting a prefix into equal children increases the prefix length. A /24 divided into /27 blocks has eight children, each containing 32 addresses. Count raw addresses before subtracting reservations or infrastructure assignments. For IPv6, a /48 can contain 65,536 distinct /64 subnets; that is a count of subnet prefixes, not a recommended number of hosts on one link. Hierarchy makes allocations understandable and aggregatable, but operational topology determines whether the summaries remain useful.
Host assignment is protocol and link specific
On an ordinary IPv4 broadcast subnet, the all-zero host suffix identifies the network and the all-one suffix identifies its directed broadcast. This motivates the familiar raw-count-minus-two rule, but only within that context. RFC 3021 permits both addresses of a /31 on an appropriate point-to-point link. A /32 identifies one IPv4 address as a host route. Applying a blanket subtraction to those prefixes produces nonsense and obscures the link model that justifies their use.
IPv6 has no broadcast address type; multicast provides relevant group-delivery functions. Do not subtract an IPv4 broadcast reservation from an IPv6 allocation. Also do not infer that every bit pattern is an ordinary assignable interface address: subnet-router anycast and other architectural conventions still matter. A common /64 link allocation is not a license to disregard the requirements of address configuration or neighbor discovery. Address width, prefix boundaries, and interface assignment policy answer different questions.
A prefix is not a reachability guarantee
An assigned address still needs a correct interface configuration, on-link determination, a usable next hop, return routing, and permitted traffic. IPv4 and IPv6 can fail independently on a dual-stack service. A DNS answer for both families is therefore an invitation to test both, not evidence that either path succeeds. Keep allocation records separate from route advertisements and from application health so a change in one layer does not silently invalidate assumptions in another.
Use the probability lab to examine the limits of random reachability sampling. Set independent per-test failure probability p and trial count n; predict the probability of seeing zero failures before reading the binomial bars. At p=0.1 and n=10 it remains about 0.349. A clean small sample therefore cannot certify every address in a prefix. Real outages often correlate by subnet or next hop, violating independence; stratify tests by family and route boundary rather than treating this illustrative binomial model as a network audit.
Work it through
Allocate a documentation prefix
Split 192.0.2.0/24 into four equal ordinary IPv4 broadcast subnets. Find the block containing 192.0.2.130 and its conventional host range.
Four children require two additional prefix bits, giving /26. Each child has 2⁶ = 64 raw addresses and begins at final-octet offsets 0, 64, 128, or 192.
The address 130 lies between 128 and 191, so its prefix is 192.0.2.128/26. The all-one suffix ends at 192.0.2.191, the directed broadcast for this ordinary subnet.
Exclude the network and broadcast patterns under the stated link assumptions. The conventional host range is 192.0.2.129 through 192.0.2.190, containing 62 addresses before further operator reservations.
The correct block is 192.0.2.128/26 with 64 raw addresses and 62 conventional host positions. A point-to-point /31 would require a different assignment rule.
The living notebook
Explore the model
Interactive lab · probability
A clean sample can miss unreachable addresses
Change success probability p, interpreting success as detection of a failure, and trial count n. Predict the zero-detection bar for independent trials. The model does not enumerate a prefix or simulate correlated routing failures.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forSampling evidence depends on the failure probability and independence assumptions; address count alone says nothing about reachability.
Pause & reason
Check your understanding
Your turn
Try it yourself
A site receives an IPv6 /56 and assigns /64 prefixes to links. How many equal /64 prefixes fit, and why should you not subtract two from that number?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Count the eight bits between the parent and child prefix lengths. Distinguish a count of subnets from an IPv4 host-assignment convention.
Compare with the solution
There are 2⁸ = 256 distinct /64 prefixes within the /56. This counts child subnets, not interface addresses, so subtracting network and broadcast addresses is the wrong operation. IPv6 also has no broadcast address type. The allocation plan must still respect IPv6 address architecture and configuration requirements within each child prefix.
Keep the idea
Take it with you
- Prefix lengths count fixed leading bits; alignment determines the containing block.
- Raw address counts and usable interface assignments are separate calculations.
- IPv4 /31 links and IPv6 invalidate blanket broadcast-subnet shortcuts.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.