Understanding IPv4 Subnetting and Classless Inter-Domain Routing (CIDR)
In computer networking, an Internet Protocol Version 4 (IPv4) address consists of a 32-bit numeric value partitioned into four 8-bit octets separated by dots (dotted-decimal notation). Originally defined under RFC 791, IPv4 partitioned addresses into strict classes (Class A, B, and C). However, exponential internet growth in the early 1990s quickly depleted Class B blocks, prompting the Internet Engineering Task Force (IETF) to introduce Classless Inter-Domain Routing (CIDR) under RFC 1519 and RFC 4632.
1. Anatomy of the Subnet Mask and Host Formula
A subnet mask demarcates where the network portion of an address ends and the host portion begins. In CIDR notation, the suffix (e.g. /24) denotes the count of contiguous 1-bits from left to right. The formula to calculate usable hosts in standard subnets is:
Usable Hosts = 2^(32 - Prefix) - 2
Two addresses are subtracted because:
- Network Identifier: All host bits set to
0identifies the subnetwork itself for routing tables. - Directed Broadcast Address: All host bits set to
1sends packets to all connected hosts simultaneously.
2. Common CIDR Subnet Cheat Sheet
| CIDR Prefix | Subnet Mask | Wildcard Mask | Total Addresses | Usable Hosts | Typical Application |
|---|---|---|---|---|---|
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | Point-to-point router links |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | Small server rack / DMZ subnet |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | Standard office LAN / Wi-Fi subnet |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | Corporate campus / AWS VPC default |
3. Related Developer & Infrastructure Tools
- DNS Health Check: Query MX, A, and NS records with our DNS Record Lookup Tool.
- Inspect SSL Expiry: Audit TLS certificate validities with our SSL Certificate Checker.
- CORS & Security Headers: Validate HTTP security headers with our HTTP Header CORS Checker.
- Generate Random Tokens: Create cryptographically secure API keys with our Random Token Generator.