1. The Fundamental Subnetting Formulas
Every IPv4 subnet calculation is governed by three mathematical identities derived from the 32-bit register architecture:
Number of Usable Hosts
H = 2^(32 - P) - 2. Where P is the prefix length and 32 - P is the number of host bits. Two addresses are reserved (Network and Directed Broadcast).
Subnets Created (Bits Borrowed)
S = 2^(borrowed bits). When borrowing N bits from the host portion of an existing prefix (e.g. from /24 to /26, borrowing 2 bits), you create 2^2 = 4 new subnets.
Block Size (Increment)
Increment = 256 - Octet Mask. For a subnet mask of 255.255.255.224, the interesting octet is 224. The block size is 256 - 224 = 32. Networks increment by 32.
2. Step-by-Step Worked Example: Dividing a /24 into Four /26 Subnets
Suppose an organization owns the Class C private network 192.168.1.0/24 and needs to segment it into four equal departments (Engineering, Marketing, Sales, Operations).
To create 4 subnets, we need 2^N ≥ 4 → N = 2 bits. New prefix: 24 + 2 = /26.
Fourth octet has two 1s: 11000000 = 192 → Mask: 255.255.255.192. Block size: 256 - 192 = 64 addresses per subnet.
| # | Subnet CIDR | Usable Host Range | Broadcast Address | Usable Hosts |
|---|---|---|---|---|
| #1 | 192.168.1.0/26 | 192.168.1.1 - 192.168.1.62 | 192.168.1.63 | 62 |
| #2 | 192.168.1.64/26 | 192.168.1.65 - 192.168.1.126 | 192.168.1.127 | 62 |
| #3 | 192.168.1.128/26 | 192.168.1.129 - 192.168.1.190 | 192.168.1.191 | 62 |
| #4 | 192.168.1.192/26 | 192.168.1.193 - 192.168.1.254 | 192.168.1.255 | 62 |
3. Variable Length Subnet Masking (VLSM) Strategy
VLSM enables engineers to allocate different subnet masks to different subnets within the same routing domain, preventing address exhaustion.
4. Subnetting Edge Cases: RFC 3021 /31 & /32 Host Routes
Point-to-point router links use /31 (RFC 3021) without broadcast addresses, while single host routes use /32 for loopback interfaces.