1. Introduction to Classless Inter-Domain Routing (CIDR)
Before Classless Inter-Domain Routing (CIDR) was introduced in RFC 1519 in 1993, IPv4 address space was allocated using rigid classes (Class A, Class B, and Class C). A Class A network provided 16,777,214 host addresses, while a Class B network provided 65,534 hosts. Organizations that required 500 addresses had no choice but to request a Class B block, resulting in massive address waste.
CIDR replaced this inefficient scheme by introducing variable-length subnet masking (VLSM). With CIDR, the boundary between the network prefix and the host identifier can be placed at any bit position from /0 to /32.
2. Understanding CIDR Notation (/24, /26, /30)
The forward slash followed by a number (e.g. /24) denotes the prefix length: the exact number of contiguous high-order bits set to 1 in the 32-bit subnet mask.
- /24 Prefix: 24 network bits, 8 host bits. Mask:
255.255.255.0. Hosts: 28 - 2 = 254 usable hosts. - /26 Prefix: 26 network bits, 6 host bits. Mask:
255.255.255.192. Hosts: 26 - 2 = 62 usable hosts. - /30 Prefix: 30 network bits, 2 host bits. Mask:
255.255.255.252. Hosts: 22 - 2 = 2 usable hosts (classic point-to-point link). - /31 Prefix (RFC 3021): 31 network bits, 1 host bit. Mask:
255.255.255.254. Specifically designed for point-to-point router links where network and broadcast addresses are eliminated.
3. The Bitwise Logic of Subnetting
Every IPv4 calculation is executed through bitwise Boolean algebra:
IP Address: 192.168.1.130 -> 11000000.10101000.00000001.10000010
Subnet Mask: 255.255.255.192 -> 11111111.11111111.11111111.11000000
----------------------------------------------------------------------
Bitwise AND: 192.168.1.128 -> 11000000.10101000.00000001.10000000 (Network ID)
The broadcast address is calculated by performing a bitwise OR between the IP address and the inverted mask (wildcard mask):
Network ID: 192.168.1.128 -> 11000000.10101000.00000001.10000000
Wildcard Mask: 0.0.0.63 -> 00000000.00000000.00000000.00111111
----------------------------------------------------------------------
Bitwise OR: 192.168.1.191 -> 11000000.10101000.00000001.10111111 (Broadcast)
4. Practical Tips for Network Engineers
- Memorize the Powers of 2: 128, 64, 32, 16, 8, 4, 2, 1. Subnet increments always align with these block sizes.
- Plan for 30% Growth: When sizing cloud VPC subnets or on-prem VLANs, always allocate at least 30-50% more host addresses than current capacity requires.
- Account for Cloud Reservations: AWS and Azure reserve 5 IP addresses per subnet (Network ID, VPC router, DNS server, future use, and Broadcast). A /28 in AWS yields 11 usable IPs, not 14.