IPv4 Subnetting, CIDR Notation & Variable Length Subnet Masking (VLSM)
Subnetting is the fundamental engineering practice of partitioning a single physical IPv4 network into multiple logical sub-networks. This improves network performance, isolates broadcast domains, and enforces security boundaries.
1. Classless Inter-Domain Routing (CIDR) Prefix Mechanics
Every IPv4 address is composed of exactly 32 binary bits represented in four 8-bit octets (e.g., 192.168.1.0). CIDR prefix notation (/24) denotes the number of contiguous leading bits allocated to the Network Identifier, leaving the remaining bits for Host Identifiers.
| CIDR Prefix | Subnet Mask | Total Addresses | Usable Host Count | Common Application |
|---|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point router links |
| /28 | 255.255.255.240 | 16 | 14 | Small DMZ / server racks |
| /24 | 255.255.255.0 | 256 | 254 | Standard office / LAN segment |
| /20 | 255.255.240.0 | 4,096 | 4,094 | Enterprise campus network |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Cloud VPC / Data Center core |
2. Usable Host Count Formula & Boundary Addresses
For all subnets between /0 and /30, the usable host count is calculated using the formula:
The subtraction of 2 accounts for the two unassignable boundary addresses reserved by RFC 791: the Network ID (all host bits set to 0, representing the wire itself) and the Directed Broadcast Address (all host bits set to 1, used to address all nodes in the subnet simultaneously).
3. RFC 1918 Private IP Address Allocations
The Internet Engineering Task Force (IETF) designated three non-routable address ranges for internal enterprise and home networks that do not require globally unique public IPv4 addresses:
- Class A Block:
10.0.0.0/8(10.0.0.0 – 10.255.255.255, 16,777,216 total addresses) - Class B Block:
172.16.0.0/12(172.16.0.0 – 172.31.255.255, 1,048,576 total addresses) - Class C Block:
192.168.0.0/16(192.168.0.0 – 192.168.255.255, 65,536 total addresses)