Universal Cloud Networking Flows: CIDR, Subnets & NAT Across AWS, Azure, and GCP π
A deep dive into IPv4 CIDR allocation, regional vs. global virtual networks, and outbound NAT routing architectures across the big three cloud providers.
Published by AHP β’ cicdclouds.com
1. Universal Foundation: CIDR (Classless Inter-Domain Routing)
Before analyzing how AWS, Microsoft Azure, and Google Cloud Platform (GCP) route traffic internally, every cloud engineer must master CIDR (Classless Inter-Domain Routing). Developed to supersede the inflexible classful network addressing system (Classes A, B, and C), CIDR allows architects to allocate right-sized IP address blocks with zero address wastage.
At its operational core, CIDR relies on Variable-Length Subnet Masking (VLSM). This enables an enterprise to carve out micro-subnets suited for specific workloadsβsuch as small /28 subnets for external load balancers or extensive /20 blocks for high-density Kubernetes pods.
CIDR Block Breakdown (192.168.1.0/24)
192.168.1.0: The base network address identifying the subnet boundary./24: The prefix length indicating that the first 24 bits out of the 32-bit IPv4 address are dedicated to the Network ID, leaving 8 bits for host allocation.
IPv4 Total Length : 32 bits (4 Octets / 4 Bytes)
Network Bits (First 24 bits) : 11000000.10101000.00000001
Host Bits (32 - 24 = 8 bits) : .00000000
Total Theoretical IPs : 2^8 = 256 IP addresses
Standard Usable Hosts : 256 - 2 = 254 usable IPs (Network .0 and Broadcast .255 reserved)
*Cloud Provider Reservations : AWS and Azure reserve 5 IPs per subnet; GCP reserves 4 IPs per subnet.
Benefits of CIDR in Modern Cloud Engineering
- Precision IP Provisioning: Prevents address exhaustion in large containerized environments.
- Route Summarization (Supernetting): Reduces border gateway routing table entries by aggregating multiple continuous subnets into single upstream declarations.
- Multi-Cloud Interconnectivity: Mitigates route poisoning and overlapping collisions when peering AWS VPCs, Azure VNets, and GCP networks with corporate on-premises datacenters.
2. Types of Network IPs: Public vs. Private (RFC 1918)
IP space within public clouds is bifurcated into two routing domains:
- Public IP Addresses: Globally unique IPv4 addresses routable over the public internet, assigned to edge devices like Internet Gateways, Application Load Balancers, and NAT Gateways.
- Private IP Addresses (RFC 1918): Non-routable addresses designated exclusively for internal VPC/VNet communications. Instances in private subnets require outbound Network Address Translation (NAT) or proxy gateways to reach external repositories and APIs.
π IPv4 Address Class Ranges
| Class | Starting Address | Ending Address | Default Mask | Purpose |
|---|---|---|---|---|
| Class A | 1.0.0.0 |
126.255.255.255 |
/8 (N.H.H.H) |
Unicast (Large Enterprise Networks) |
| Class B | 128.0.0.0 |
191.255.255.255 |
/16 (N.N.H.H) |
Unicast (Medium Sized Networks) |
| Class C | 192.0.0.0 |
223.255.255.255 |
/24 (N.N.N.H) |
Unicast (Small Networks & DMZs) |
| Class D | 224.0.0.0 |
239.255.255.255 |
N/A | Multicast Streaming |
| Class E | 240.0.0.0 |
255.255.255.255 |
N/A | Experimental / Research Reserved |
Note: The 127.0.0.0/8 block (e.g., 127.0.0.1) is strictly reserved for local host Loopback testing.
π RFC 1918 Private IPv4 Address Ranges
| RFC 1918 Range | Classful Equivalent | CIDR Block | Cloud Usage Pattern |
|---|---|---|---|
10.0.0.0 β 10.255.255.255 |
1 Class A Network | 10.0.0.0/8 |
Standard default for enterprise VPC/VNet topologies across AWS, Azure, and GCP. |
172.16.0.0 β 172.31.255.255 |
16 Class B Networks | 172.16.0.0/12 |
Default AWS VPC CIDR (172.31.0.0/16) and default Docker bridge networks. |
192.168.0.0 β 192.168.255.255 |
256 Class C Networks | 192.168.0.0/16 |
Frequently selected for on-premises branch offices or secondary testing environments. |
3. Cloud Networking Architecture: AWS & Azure (Regional) vs. GCP (Global)
While subnetting mathematics remain consistent, the topological boundary of a Virtual Network differs fundamentally between major cloud providers:
- AWS VPC & Azure VNet (Regional Scope): An AWS VPC or Azure VNet is bound to a single physical geographical region. To link workloads across multiple regions, architects must explicitly create and manage inter-region transit routing via VPC/VNet Peering, AWS Transit Gateway, or Azure Virtual WAN.
- Google Cloud VPC (Global Scope): A GCP VPC is a global software-defined network spanning all Google regions simultaneously. The VPC construct itself has no overarching CIDR block; instead, individual Subnets are Regional. Virtual machines deployed in separate regions inside the same VPC can communicate over Google's global fiber backbone privately out-of-the-box without peering gateways.
Multi-Cloud Virtual Network Comparison Matrix
| Networking Dimension | AWS (Amazon Web Services) | Microsoft Azure | Google Cloud (GCP) |
|---|---|---|---|
| Virtual Network Construct | Amazon VPC | Virtual Network (VNet) | Google Cloud VPC |
| Network Boundary Scope | Regional | Regional | Global (Universal) |
| Subnet Boundary Scope | Zonal (1 Availability Zone) | Regional (Spans AZs) | Regional (Spans Zones) |
| Reserved IPs per Subnet | 5 IPs (.0, .1, .2, .3, .255) | 5 IPs (.0, .1, .2, .3, .255) | 4 IPs (.0, .1, .254, .255) |
| Static Public IP Construct | Elastic IP (EIP) | Standard Public IP | External Static IP |
| Managed NAT Offering | AWS NAT Gateway | Azure NAT Gateway | Cloud NAT (via Cloud Router) |
| Layer 4 Stateful Firewall | Security Groups + Subnet NACLs | Network Security Groups (NSG) | VPC Firewall Rules / Policies |
| Hybrid Cloud Interconnect | Site-to-Site VPN / Direct Connect | VPN Gateway / ExpressRoute | Cloud VPN / Cloud Interconnect |
4. Private Subnet to Internet Flow: How NAT Gateways Work
In production environments, backend compute nodes and databases must never hold direct public IP addresses. To facilitate outbound software patching, container pulling, or external API consumption, traffic is routed through a managed Network Address Translation (NAT) Gateway.
Architectural Comparison of Outbound NAT Flows
[1] AWS Outbound Flow (Public Subnet Proxy Model):
Private EC2 (10.0.2.15)
βββΊ Private Route Table (0.0.0.0/0 -> nat-gw-id)
βββΊ NAT Gateway (Placed in Public Subnet + Elastic IP attached)
βββΊ Public Route Table (0.0.0.0/0 -> igw-id)
βββΊ Internet Gateway (IGW) βββΊ Public Internet
[2] Azure Outbound Flow (Direct Subnet Attachment Model):
Private VM (10.1.1.10)
βββΊ Azure NAT Gateway (Directly associated with the Subnet + Standard Public IP attached)
βββΊ Azure Edge Fabric (No Public Subnet or manual User-Defined Routes required!)
[3] GCP Outbound Flow (Software-Defined Gateway Model):
Regional VM (10.2.0.5 - No External IP)
βββΊ Cloud NAT + Cloud Router (Kernel-level Software Defined + External Static IP)
βββΊ Default Internet Gateway Route βββΊ Public Internet
Deep Dive: AWS NAT Gateway & Elastic IP Rules
Implementing an AWS NAT Gateway involves strict architectural rules:
| Operational Aspect | Design Requirement | Architectural Rationale |
|---|---|---|
| Traffic Direction | Strictly Egress (Outbound) Only | Allows instances in private subnets to initiate sessions externally; unsolicited inbound connections from the internet are dropped statefully. |
| Cost Profile | Hourly Provisioning + Data Processing Fee | Incurs an hourly fixed fee per NAT Gateway plus per-GB data processing fees for all transit traffic across the gateway. |
| Subnet Placement | Must reside in a Public Subnet | In AWS, the NAT Gateway itself requires a direct route to an Internet Gateway (igw-xxxx) to reach public destinations. |
| High Availability Design | 1 NAT Gateway per Availability Zone | Because AWS NAT Gateways are zonal constructs, enterprise architectures deploy independent NAT Gateways across multiple AZs to prevent single points of failure. |
5. Multi-Cloud Production Pitfalls & Troubleshooting Guide
Operating hybrid or multi-cloud topologies introduces subtle routing and transport layer failure modes. Here are the three most frequent production bottlenecks and their remedies:
1. CIDR Overlap in Cloud Interconnects
When peering an AWS VPC with an Azure VNet or on-premises datacenter, IP spaces must never overlap. If both networks declare 10.0.0.0/16, routing engines cannot determine the next hop, causing dropped packets.
Remedy: If IP reallocation is impossible, implement Bidirectional NAT (Private NAT) using tools like AWS Private NAT Gateway, Azure Private Link, or an intermediate proxy pool to translate overlapping subnets into unique virtual IP ranges.
2. SNAT Port Exhaustion
A single public IP assigned to a NAT Gateway provides approximately 64,000 concurrent Source Network Address Translation (SNAT) ports. When thousands of container pods or lambda functions open high-frequency microservice connections concurrently to the same external IP, SNAT ports deplete, resulting in connection timeouts.
Remedy: In Azure and GCP, associate multiple public IP addresses (up to 16 in Azure) to the NAT Gateway to scale total port capacity. In AWS, deploy secondary private NATs or use VPC Interface Endpoints (AWS PrivateLink) to keep internal AWS API calls completely off the NAT Gateway.
3. MTU / MSS Clamping Mismatches (Packet Fragmentation)
Standard Ethernet frames use an MTU of 1500 bytes. However, when traffic traverses an encrypted IPSec VPN tunnel between AWS and Azure, tunnel headers (ESP and UDP encapsulation) consume additional bytes. If the Maximum Transmission Unit (MTU) remains at 1500, oversized packets get fragmented or silently dropped if the Don't Fragment (DF) flag is set.
Remedy: Configure MSS (Maximum Segment Size) Clamping to 1360 or 1380 bytes on your transit gateway or border firewalls, ensuring TCP sessions dynamically negotiate segment sizes that fit inside the encrypted tunnel overhead without fragmentation.