IPv4 & IPv6 Subnet Calculator (CIDR & Netmask Range Tool)

Network Architecture & VPC Design

IPv4 Subnet & CIDR Range Calculator

Calculate network address, broadcast address, usable host ranges, netmask, and wildcard mask with binary bitwise inspection for AWS VPCs, Azure VNets, and enterprise subnets.

Subnet Parameters

IP Address Class & Type
Class C – Private (RFC 1918)

Subnet Calculations

Network Address
192.168.1.0
Broadcast Address
192.168.1.255
Usable Host Range
192.168.1.1 – 192.168.1.254
Usable Hosts
254
Wildcard Mask
0.0.0.255
Subnet Mask
255.255.255.0

Production Incident Runbook: Mitigating VPC Subnet Exhaustion in Kubernetes Clusters

In modern containerized architectures (such as AWS EKS with the Amazon VPC CNI or Google Cloud GKE in VPC-native mode), every Kubernetes pod is assigned a secondary private IPv4 address directly from the underlying subnet. If network architects deploy worker nodes into small subnets (e.g. /24 with 251 usable IPs), a rapid horizontal pod autoscaling event or rolling deployment can instantly exhaust all available IP addresses in the subnet. When IP exhaustion strikes, the cluster enters an operational blackout where new pods remain stuck in ContainerCreating with FailedCreatePodSandBox: no IP addresses available in network. Follow this emergency triage runbook:

  1. Identify Subnet Allocation Depletion: Query AWS EC2 to inspect the available IP addresses across all subnets in the VPC:
    aws ec2 describe-subnets --filters "Name=vpc-id,Values=vpc-0123456789abcdef0" --query "Subnets[*].[SubnetId,CidrBlock,AvailableIpAddressCount,AvailabilityZone]" --output table
    Subnets with fewer than 10 available IPs are in critical starvation.
  2. Associate a Secondary IPv4 CIDR Block to the VPC: AWS VPC allows associating up to 5 additional IPv4 CIDRs (such as from the 100.64.0.0/10 Carrier-Grade NAT space or another 10.x.0.0/16 block) without tearing down existing infrastructure:
    aws ec2 associate-vpc-cidr-block --vpc-id vpc-0123456789abcdef0 --cidr-block 100.64.0.0/16
  3. Create Pod-Specific Secondary Subnets: Slice the new /16 into large /20 or /19 subnets dedicated exclusively to pod networking.
  4. Enable Custom Networking in AWS VPC CNI: Configure the CNI daemonset to assign pod IPs exclusively from the secondary subnet pool while keeping worker node primary network interfaces (ENIs) on the original management subnet:
    kubectl set env daemonset aws-node -n kube-system AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG=true
  5. Tune CNI Warm IP Target Settings: By default, the VPC CNI holds excess unused IP addresses in a "warm" pool on every EC2 node. Reduce waste across large clusters by setting WARM_IP_TARGET=5 and MINIMUM_IP_TARGET=10 in the aws-node daemonset environment.

Enterprise Subnetting Cheat Sheet & Architecture Sizing Matrix

The table below details standard subnet masks, total addresses, usable hosts, and standard cloud architectural applications:

CIDR Prefix Subnet Mask Total Addresses AWS Usable Hosts Standard Architectural Use Case
/16 255.255.0.0 65,536 65,531 Standard Enterprise VPC / VNet Root Envelope
/20 255.255.240.0 4,096 4,091 Dense Kubernetes Pod Subnet per Availability Zone
/24 255.255.255.0 256 251 Public DMZ, Load Balancer (ALB), or NAT Gateway Subnet
/28 255.255.255.240 16 11 Dedicated Database Tier (RDS Multi-AZ, ElastiCache)
/30 255.255.255.252 4 0 in AWS (2 in on-prem) On-premises Point-to-Point Router Interconnects
/32 255.255.255.255 1 1 (Host Route) Security Group Host Rules, VPN Client Tunnel Endpoint

The Cloud Provider "5 Reserved IPs" Rule

In traditional on-premises networking, every subnet sacrifices exactly 2 addresses: the Network Address (first IP) and the Broadcast Address (last IP). However, major cloud providers like Amazon Web Services (AWS) reserve 5 IP addresses in every subnet:

  • x.x.x.0: Network address (Identifies the subnet block).
  • x.x.x.1: Reserved by AWS for the VPC default router gateway.
  • x.x.x.2: Reserved by AWS for the Amazon-provided DNS (Route 53 Resolver).
  • x.x.x.3: Reserved by AWS for future internal infrastructure use.
  • x.x.x.255: Network broadcast address (AWS does not support broadcast, but the IP is reserved).

Therefore, an AWS subnet sized at /28 (16 total addresses) provides only 11 usable IP addresses. Sizing mistakes that ignore this 5-IP deduction can cause database cluster provisioning to fail.

Frequently Asked Questions: Subnetting & CIDR Calculations

What is CIDR and why did it replace classful IP addressing?

Classless Inter-Domain Routing (CIDR, RFC 1519) was introduced in 1993 to replace rigid Class A, B, and C network allocations. Under classful routing, organizations needing 500 IPs were forced to take an entire Class B block (65,534 IPs), wasting 99% of assigned addresses. CIDR allows arbitrary prefix lengths (like /23 with 510 usable hosts), preserving IPv4 address space and shrinking global BGP routing tables.

What is a wildcard mask and where is it used?

A wildcard mask is the exact bitwise inverse of a subnet mask (calculated as 255.255.255.255 - Subnet Mask). For example, a 255.255.255.0 netmask has a wildcard mask of 0.0.0.255. Wildcard masks are used primarily in Cisco IOS Access Control Lists (ACLs) and OSPF/EIGRP routing protocols to match arbitrary bit patterns.

Can two VPCs communicate if their CIDR blocks overlap?

Standard VPC Peering and AWS Transit Gateway cannot route traffic between VPCs with overlapping CIDR blocks due to routing table ambiguity. To connect overlapping networks without re-IPing workloads, network engineers must deploy Private NAT Gateways or PrivateLink endpoints that translate overlapping source and destination addresses across transit boundaries.

IPv6 Subnetting Architecture: Mastering the /64 Standard & Global Prefixes

As IPv4 addresses become prohibitively expensive on public cloud providers (with AWS charging $0.005/hr or ~$43.80/year for every idle or attached public IPv4 address), enterprise engineering teams are rapidly adopting dual-stack and IPv6-only architectures. IPv6 uses 128-bit addresses (providing $3.4 \times 10^{38}$ total addresses) and follows fundamentally different subnetting rules:

  • The Universal Subnet Standard (/64): In IPv6, every standard local network, VLAN, and cloud subnet is sized as a /64. A single /64 subnet provides $18,446,744,073,709,551,616$ ($1.84 \times 10^{19}$) host addresses. This massive size is required for Stateless Address Autoconfiguration (SLAAC, RFC 4862) to generate unique interface identifiers from device MAC addresses without DHCP.
  • Site Allocations (/48 and /56): Internet Service Providers (ISPs) and Regional Internet Registries (RIRs) assign organizations a /48 or /56 prefix. A single /48 enterprise allocation grants 65,536 distinct /64 subnets, eliminating subnet fragmentation and allowing clean hierarchical network partitioning.
  • Point-to-Point Links (/127): RFC 6164 specifies /127 subnets (2 addresses) specifically for point-to-point router interconnections to prevent ping-pong packet loops and neighbor discovery table exhaustion attacks.

Multi-VPC Transit Gateway CIDR Route Table Aggregation

In enterprise cloud topologies connecting dozens of AWS VPCs via an AWS Transit Gateway (TGW), unorganized CIDR assignments cause route table bloat and exceed AWS route table limits (maximum 10,000 routes). Network architects must implement hierarchical CIDR summary routes:

Environment Tier Summary CIDR Block Individual VPC Allocations TGW Aggregated Route
Production VPCs 10.100.0.0/16 VPC-Prod-A (10.100.0.0/20), VPC-Prod-B (10.100.16.0/20) 10.100.0.0/16 -> TGW
Staging & QA VPCs 10.101.0.0/16 VPC-Stage-A (10.101.0.0/20), VPC-QA-A (10.101.16.0/20) 10.101.0.0/16 -> TGW
Shared Services / SecOps 10.102.0.0/16 VPC-Logging (10.102.0.0/20), VPC-Egress (10.102.16.0/20) 10.102.0.0/16 -> TGW

Dual-Stack Kubernetes Pod Networking: Overcoming IPv4 Exhaustion with Cilium eBPF

Modern cloud-native architectures deploy Cilium with eBPF to route dual-stack traffic natively. By enabling IPv6 pod addressing, clusters scale to millions of concurrent pods without consuming scarce corporate RFC 1918 IPv4 address space:

# cilium-helm-values.yaml - Dual-Stack eBPF Networking
ipv4:
  enabled: true
ipv6:
  enabled: true
routingMode: native
ipv6NativeRoutingCIDR: "2001:db8:1::/48"
enableIPv6BIGTCP: true
bpf:
  masquerade: true
loadBalancer:
  mode: dsr # Direct Server Return for zero-latency ingress

Frequently Asked Questions: Subnetting & IP Range Mechanics

Why do /31 subnets have 2 usable hosts instead of zero in point-to-point links?

RFC 3021 formalized the use of 31-bit prefixes on point-to-point links. Because point-to-point links connect exactly two router interfaces, broadcast and network addresses are unnecessary. Both addresses (e.g. 192.0.2.0 and 192.0.2.1) are treated as valid host addresses, conserving IPv4 space on high-density router interconnects.

What is Carrier-Grade NAT (CGNAT) space and when should it be used in cloud subnets?

Defined in RFC 6598, 100.64.0.0/10 provides 4,194,304 private IPv4 addresses reserved for shared transition space. Enterprise cloud architects commonly attach CGNAT blocks as secondary CIDRs in AWS VPCs when corporate 10.0.0.0/8 addresses are fully exhausted by on-premises data centers.

How does Virtual Router Redundancy Protocol (VRRP) interact with subnet sizing?

VRRP (RFC 5798) enables high-availability gateway failover by assigning a shared Virtual IP (VIP) across two or more physical routers. When sizing a subnet hosting VRRP firewalls, you must allocate at least 3 IPs per network segment: one dedicated IP for Router A, one dedicated IP for Router B, and the shared Virtual IP serving as the default gateway for client workstations.

Supernetting & Route Summarization: The Bitwise AND Algorithm

Supernetting (Classless Inter-Domain Routing aggregation) combines contiguous smaller class C subnets into a single larger routing advertisement. For example, summarizing four /24 subnets (192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, and 192.168.3.0/24) into a single 192.168.0.0/22 prefix requires examining their binary representations:

192.168.0.0/24:  11000000.10101000.00000000.00000000
192.168.1.0/24:  11000000.10101000.00000001.00000000
192.168.2.0/24:  11000000.10101000.00000010.00000000
192.168.3.0/24:  11000000.10101000.00000011.00000000
------------------------------------------------------
Matching Bits:   11000000.10101000.000000..  (22 bits match)
Summarized CIDR: 192.168.0.0/22 (Mask: 255.255.252.0)

By advertising 192.168.0.0/22 instead of four distinct /24 blocks, border routers reduce routing table size, prevent BGP route flapping during edge interface instability, and optimize hardware Ternary Content-Addressable Memory (TCAM) efficiency on enterprise network switches.

Network Security Architecture: Microsegmentation & Zero Trust Subnets

Modern cloud enterprise architectures replace monolithic flat subnets with software-defined microsegmentation. Rather than relying solely on network perimeter firewalls, security architects enforce granular ingress and egress policies at the individual subnet and host interface tier:

  • Tiered Multi-AZ Isolation: Segment every virtual private cloud into isolated public ingress subnets (for external application load balancers), private application subnets (for Kubernetes container worker nodes without public internet gateways), and strictly isolated database subnets (with zero outbound internet access and no NAT gateway routing).
  • Network Access Control Lists (NACLs) vs Security Groups: In AWS and cloud environments, subnet-level stateless NACLs act as the first line of defense to drop blacklisted IP ranges before packets hit instance boundaries, while stateful security groups provide fine-grained host filtering.