IPv4 subnetting can be understood as a partition of the integer interval from 0 through 2^32 - 1. Every IPv4 address maps to exactly one integer in that interval. Dotted-decimal notation presents the integer as four base-256 components, but binary arithmetic determines the network boundaries.
A CIDR prefix length p fixes the first p bits of the address. The remaining 32 - p bits may vary, generating a set of 2^(32 - p) consecutive numerical addresses. Because the varying bits occupy the low-order portion of the integer, each subnet is aligned to a multiple of its block size.
This explains both the power-of-two capacity rule and the predictable boundaries observed in subnet calculations. The subnet mask is a binary word consisting of p leading ones followed by 32 - p zeros. When that mask is combined with an address through a bitwise AND operation, every host bit becomes zero, leaving the subnet's lowest address.
To obtain the highest address of the block, the host-bit positions are instead set to one. For conventional IPv4 prefixes, that highest value is the subnet's directed broadcast address. A wildcard mask is the bitwise complement of the subnet mask.
It has zeros where the network prefix is fixed and ones where host bits are permitted to vary. Wildcard masks are useful for understanding matching logic, although their use in configuration syntax varies by platform and should not be confused with universal interface behavior. An important distinction is the mathematical block versus address-assignment semantics.
The arithmetic always determines how many bit patterns a prefix contains. Whether particular positions can represent ordinary hosts depends on protocol rules and link type. In conventional IPv4 subnets with sufficient host bits, the first position is the network identifier and the final position serves as directed broadcast.
In a /31 point-to-point link, both addresses can represent endpoints under the applicable rules. A /32 identifies one specific address and does not require a two-address exclusion. Boundary cases also clarify the model.
A /0 prefix mathematically covers the entire IPv4 address space and contains 2^32 address patterns, but that does not imply those addresses are freely assignable or belong to one deployable local subnet. At the opposite end, a /32 matches precisely one address. These extremes illustrate why capacity arithmetic alone cannot describe operational suitability.
Once subnetting is viewed as binary masking and interval alignment, the dependence on historical address classes disappears. Prefixes of different lengths can be compared systematically without appealing to obsolete classful assumptions.