The Mathematics of CIDR & Bitwise Subnet Masking (VLSM)
Classless Inter-Domain Routing (CIDR), standardized in RFC 4632 and RFC 1519, replaced the legacy classful addressing architecture (Classes A, B, and C) to allocate IPv4 address space with mathematical precision.
An IPv4 address consists of exactly 32 bits divided into 4 octets. In CIDR notation (e.g. 192.168.1.0/24), the prefix length p specifies the number of contiguous leading bits assigned to the network identifier, while the remaining 32 − p bits identify individual hosts.
Bitwise Logic & Subnet Calculations
For a standard /24 network, p = 24 yields 28 = 256 total addresses, with 254 usable host addresses because the network ID (all host bits 0) and the broadcast address (all host bits 1) are reserved. Under RFC 3021, point-to-point links using /31 subnets allocate exactly 2 usable host addresses without broadcast overhead.
IPv4 Subnet Mask & Host Capacity Quick Reference Matrix
Engineers sizing cloud Virtual Private Clouds (VPCs) and corporate networks rely on standard CIDR prefix boundaries:
| Prefix | Subnet Mask | Wildcard Mask | Total IPs | Usable Hosts | Common Architecture Role |
|---|---|---|---|---|---|
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | Primary Cloud VPC Supernet (AWS, GCP, Azure) |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | Large Kubernetes Pod CNI Network |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | Standard Corporate LAN / Availability Zone Subnet |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | Database Cluster / Private Tier |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | Load Balancer (ALB) Management Tier |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | ISP Small Office Static IP Block |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | Legacy Router-to-Router Point-to-Point Link |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | RFC 3021 Modern Point-to-Point (No Broadcast) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | Loopback Interface / Specific Host Route ACL |
RFC Special-Use Address Blocks, Private Ranges & CGNAT
The Internet Assigned Numbers Authority (IANA) reserves specific IPv4 address blocks for private routing, internal testing, and telecommunication infrastructure:
-
RFC 1918 Private Ranges (Non-Routable on Public Internet):
10.0.0.0/8(10.0.0.0 – 10.255.255.255) — 16,777,216 addresses for enterprise networks.172.16.0.0/12(172.16.0.0 – 172.31.255.255) — 1,048,576 addresses commonly used in container runtimes (Docker, Podman).192.168.0.0/16(192.168.0.0 – 192.168.255.255) — 65,536 addresses ubiquitous in consumer Wi-Fi routers.
-
RFC 6598 Carrier-Grade NAT (CGNAT):
100.64.0.0/10(100.64.0.0 – 100.127.255.255) provides 4,194,304 addresses deployed by Internet Service Providers (ISPs) to multiplex residential subscribers behind shared public IPv4 gateways. -
RFC 3927 Link-Local (APIPA):
169.254.0.0/16is automatically assigned when a host fails to acquire a lease from a DHCP server. -
RFC 1122 Loopback:
127.0.0.0/8routes traffic internally back to the local host operating system.
Subnetting Traps: Cloud Reserved Addresses & Wildcard Masks
Network engineers and DevOps professionals must guard against two critical architectural gotchas:
-
The Cloud 5-IP Reservation Rule (AWS & Azure): While on-premise RFC 4632 subnets reserve only 2 addresses (Network ID and Broadcast), public cloud providers (such as AWS VPC) reserve 5 IP addresses in every subnet:
.0: Network address.1: VPC router gateway.2: DNS resolver (AmazonProvidedDNS).3: Future AWS internal service use.255: Network broadcast address
/28cloud subnet (16 total IPs) provides only 11 usable IP addresses, not 14! -
ACL Wildcard Masks (Inverted Netmasks): Cisco and firewall Access Control Lists (ACLs) use wildcard bitmasks where binary
0signifies "must match exactly" and1signifies "ignore / wildcard". For instance, a/24subnet mask255.255.255.0translates to the wildcard mask0.0.0.255.
Practical Real-World Use Cases
Partition a primary cloud VPC block (e.g., 10.0.0.0/16) into isolated public web tiers (/24), private microservice tiers (/22), and database clusters (/26) with zero IP overlap across availability zones.
Configure ultra-efficient /31 subnets for dedicated point-to-point router-to-router links, conserving public IPv4 allocations without wasting 50% of the block on unused network and broadcast addresses.
Plan cluster pod CIDR ranges (such as 10.244.0.0/16) and assign deterministic /24 subnets per worker node, ensuring sufficient IP capacity for auto-scaling container workloads without IP exhaustion.
Derive exact network boundaries and broadcast ranges when creating ingress firewall rules, avoiding accidental over-permissioning of adjacent internal networks.
Absolute Privacy & Zero Server Upload
Internal enterprise IP schemes, VPC topology plans, and subnet boundaries represent sensitive infrastructure configuration. OmniTools runs 100% locally in your browser using pure client-side bitwise arithmetic:
- Zero Network Transmissions: Your IP addresses, CIDR masks, and internal host counts never leave your local machine or touch a remote server.
- Zero Logging or Telemetry: No external analytics capture your network designs, keeping your enterprise topologies confidential.
- Instant Offline Operation: Fully functional offline without internet access, making it safe for air-gapped data centers and security audit environments.
Frequently Asked Questions
How do I convert a subnet mask to CIDR notation or calculate CIDR IP ranges?
Count the number of continuous leading 1-bits in the 32-bit binary subnet mask. For example, 255.255.255.0 has 24 leading 1-bits (/24) with 256 total IPv4 addresses (254 usable hosts), while 255.255.0.0 equals /16 with 65,536 total addresses. Enter any IPv4 address and prefix length above to compute the network address, broadcast address, wildcard mask, and usable host IP range.
How many usable IP addresses are in a /24 vs /28 subnet?
Under standard RFC 4632 networking, a /24 subnet provides 256 total IPs and 254 usable host IPs (reserving network and broadcast addresses), while a /28 subnet provides 16 total IPs and 14 usable hosts. In cloud VPCs like AWS, Azure, and GCP, 5 IPs are reserved per subnet, leaving 251 usable IPs in a /24 and 11 usable IPs in a /28.
What is the difference between a subnet mask and a wildcard mask?
A subnet mask uses binary 1s to identify the network prefix and 0s for the host portion (e.g., 255.255.255.0 for /24). A wildcard mask is the bitwise inverse (255.255.255.255 minus the subnet mask, e.g., 0.0.0.255), used in Cisco ACLs and OSPF routing rules.