IP & Cloud Networking 6 min read · Last verified 2026-11-19

AWS, Azure & GCP VPC Subnet Math: Why a /28 Gives 11 IPs, Not 14 (and Avoiding Docker/Tailscale Collisions)

Every cloud architect eventually hits the same 2 a.m. incident: a Terraform apply succeeds, autoscaling triggers during a traffic spike, and Kubernetes pods or ALB nodes stall in Pending because a /28 subnet only yielded 11 assignable addressesβ€”or a newly peered VPC collides silently with Docker's default 172.17.0.0/16 bridge pool. This guide walks through the exact binary math, provider-specific IP reservations, and conflict-free CIDR planning workflow.

Primary References: RFC 4632, RFC 1918, RFC 6598, AWS VPC & EKS CNI Docs · Author: NetDevKit Engineering Team

1. Why Standard RFC Subnet Math Fails Inside Public Cloud VPCs

In traditional on-premises Ethernet VLANs governed by RFC 4632, a subnet loses exactly two addresses: the network identifier (all host bits set to 0) and the directed broadcast address (all host bits set to 1). By that textbook formula, a /28 block contains 16 total IPv4 addresses and 14 usable hosts. Copy that textbook number into a public cloud sizing sheet and your capacity plan immediately breaks.

Public cloud software-defined networks (SDNs) reserve extra infrastructure addresses inside every individual subnetβ€”not once per VPC. Both Amazon Web Services (AWS VPC) and Microsoft Azure (Azure VNet) permanently reserve 5 IP addresses per subnet: .0 for the network address, .1 for the VPC router, .2 for the cloud DNS resolver (AmazonProvidedDNS / Azure virtual DNS), .3 for future platform use, and the final address (.15 in a /28) for broadcast. Google Cloud Platform (GCP) reserves 4 IP addresses per subnet: the network address, default gateway (.1), the second-to-last address for internal routing, and the broadcast address.

CIDR Prefix Total IPs Standard RFC (-2) AWS / Azure (-5) GCP (-4) Typical Cloud Role
/28 16 14 11 12 Transit Gateway / PrivateLink ENI attachments
/27 32 30 27 28 NAT Gateway & small bastion tiers
/26 64 62 59 60 Managed RDS / Redis clusters per AZ
/24 256 254 251 252 Standard application tier per AZ
/22 1,024 1,022 1,019 1,020 Medium EKS / AKS worker node subnet
/19 8,192 8,190 8,187 8,188 High-density EKS VPC-CNI pod subnet

2. Worked Example: Sizing a 3-AZ Production VPC Without Exhaustion

Suppose you are provisioning an AWS production VPC from parent block 10.40.0.0/16 (65,536 total addresses) across three Availability Zones (us-east-1a, 1b, 1c). Each AZ requires a public tier for Application Load Balancers and NAT Gateways, a private EKS worker tier expected to peak at 1,200 pod and node IPs per AZ, and an isolated database tier for Aurora and ElastiCache.

Always allocate largest-first using Variable Length Subnet Masking (VLSM) so subnet boundaries stay cleanly bit-aligned for future Terraform cidrsubnet() expressions and route summarization. A /21 provides 2,048 total IPs (2,043 assignable in AWS), leaving comfortable headroom for AWS VPC-CNI warm IP pools and blue/green rolling deployments without triggering FailedCreatePodSandBox errors.

# Parent VPC: 10.40.0.0/16  (65,536 IPs)
# Private EKS Worker Tiers (3 x /21 = 2,043 AWS-usable IPs per AZ)
cidrsubnet("10.40.0.0/16", 5, 0)  # -> 10.40.0.0/21   (us-east-1a)
cidrsubnet("10.40.0.0/16", 5, 1)  # -> 10.40.8.0/21   (us-east-1b)
cidrsubnet("10.40.0.0/16", 5, 2)  # -> 10.40.16.0/21  (us-east-1c)

# Public ALB / NAT Tiers (3 x /24 = 251 AWS-usable IPs per AZ)
cidrsubnet("10.40.0.0/16", 8, 32) # -> 10.40.32.0/24  (us-east-1a)
cidrsubnet("10.40.0.0/16", 8, 33) # -> 10.40.33.0/24  (us-east-1b)
cidrsubnet("10.40.0.0/16", 8, 34) # -> 10.40.34.0/24  (us-east-1c)

# Isolated Data Tiers (3 x /26 = 59 AWS-usable IPs per AZ)
cidrsubnet("10.40.0.0/16", 10, 160) # -> 10.40.40.0/26 (us-east-1a)
cidrsubnet("10.40.0.0/16", 10, 161) # -> 10.40.40.64/26 (us-east-1b)
cidrsubnet("10.40.0.0/16", 10, 162) # -> 10.40.40.128/26 (us-east-1c)

3. EKS Secondary ENI Math: Why an m5.large Node Runs 29 Pods, Not 30

Unlike overlay CNIs (Flannel or VXLAN) that encapsulate pod traffic inside a synthetic address pool, the default AWS VPC CNI assigns real routable VPC IPv4 addresses directly to pods via secondary Elastic Network Interfaces (ENIs). Every EC2 instance family imposes strict hardware ceilings on both ENI count and IPv4 addresses per ENI.

The deterministic formula published in AWS's amazon-vpc-cni-k8s eni-max-pods table is max_pods = ENIs x (IPv4_per_ENI - 1) + 2. One IP on every ENI is consumed by the interface primary address, and +2 accounts for host-network system pods (kube-proxy and aws-node). For an m5.large instance (3 ENIs, 10 IPs per ENI), that yields 3 x (10 - 1) + 2 = 29 podsβ€”not 30. Enabling IPv4 Prefix Delegation attaches /28 blocks (16 IPs) per slot instead of single secondary IPs, raising pod density up to 110 pods per node while requiring contiguous /28 free blocks in the subnet to avoid fragmentation failures.

4. Hidden CIDR Collisions: Docker, Tailscale, Kubernetes & Corporate VPNs

The second most costly IPAM mistake is choosing a clean-looking RFC 1918 block that overlaps default infrastructure ranges on developer laptops or container hosts. Docker Engine dynamically allocates bridge subnets starting at 172.17.0.0/16 and walks up through 172.31.0.0/16 for Docker Compose stacks. If your staging VPC lives inside 172.16.0.0/12 and an engineer connects over WireGuard or OpenVPN, local docker0 routes silently hijack corporate API calls.

Before locking any multi-cloud IP plan, audit all candidate VPC, pod, and office LAN ranges against four universal exclusion zones: Docker's 172.17.0.0/16–172.31.0.0/16 default pools, Tailscale's RFC 6598 CGNAT space (100.64.0.0/10), Kubernetes' default service cluster CIDR (10.96.0.0/12), and consumer Wi-Fi router defaults (192.168.0.0/24 and 192.168.1.0/24). Carving distinct non-overlapping slices out of 10.x.0.0/16 per environment (for example, 10.40.0.0/16 for prod, 10.41.0.0/16 for staging, 10.42.0.0/16 for dev) guarantees trouble-free VPC peering and Transit Gateway attachment years later.

5. Verification Checklist Before Running Terraform Apply

F

i

r

s

t

,

v

a

l

i

d

a

t

e

y

o

u

r

p

a

r

e

n

t

b

l

o

c

k

a

n

d

e

a

c

h

t

i

e

r

u

s

i

n

g

A

W

S

/

A

z

u

r

e

(

-

5

)

o

r

G

C

P

(

-

4

)

m

o

d

e

r

a

t

h

e

r

t

h

a

n

s

t

a

n

d

a

r

d

R

F

C

(

-

2

)

m

a

t

h

,

p

a

y

i

n

g

s

p

e

c

i

a

l

a

t

t

e

n

t

i

o

n

t

o

A

W

S

'

s

/

2

8

m

i

n

i

m

u

m

s

u

b

n

e

t

f

l

o

o

r

a

n

d

A

L

B

r

e

c

o

m

m

e

n

d

a

t

i

o

n

s

(

A

W

S

r

e

c

o

m

m

e

n

d

s

a

t

l

e

a

s

t

/

2

7

w

i

t

h

8

+

f

r

e

e

I

P

s

p

e

r

A

Z

f

o

r

l

o

a

d

b

a

l

a

n

c

e

r

s

c

a

l

i

n

g

)

.

S

e

c

o

n

d

,

r

u

n

a

f

u

l

l

c

o

l

l

i

s

i

o

n

c

h

e

c

k

a

c

r

o

s

s

p

r

o

d

u

c

t

i

o

n

,

s

t

a

g

i

n

g

,

p

e

e

r

e

d

p

a

r

t

n

e

r

V

P

C

s

,

a

n

d

d

e

v

e

l

o

p

e

r

V

P

N

s

u

b

n

e

t

s

.

T

h

i

r

d

,

s

u

m

m

a

r

i

z

e

c

o

n

t

i

g

u

o

u

s

p

r

i

v

a

t

e

t

i

e

r

s

b

e

f

o

r

e

w

r

i

t

i

n

g

S

e

c

u

r

i

t

y

G

r

o

u

p

o

r

N

e

t

w

o

r

k

A

C

L

r

u

l

e

s

s

o

y

o

u

s

t

a

y

w

e

l

l

b

e

l

o

w

A

W

S

'

s

p

e

r

-

E

N

I

r

u

l

e

q

u

o

t

a

s

.

Companion Offline NetDevKit Calculators

Apply the formulas from this guide immediately in your browser with zero server uploads:

Frequently Asked Questions

Why does AWS reserve 5 IP addresses in every VPC subnet?

AWS permanently reserves .0 (network address), .1 (VPC router), .2 (AmazonProvidedDNS), .3 (reserved for future AWS features), and the final address (broadcast), leaving 2^(32-prefix) - 5 assignable host IPs.

What is the smallest subnet size allowed in AWS VPC versus Google Cloud?

AWS VPC and Azure VNet enforce a minimum subnet prefix of /28 (16 total IPs, 11 usable). Google Cloud allows subnets down to /29 (8 total IPs, 4 usable).

Why do Docker Compose networks break corporate VPN connections?

Docker creates local bridge interfaces in 172.17.0.0/16 through 172.31.0.0/16 by default. If your remote VPN or cloud VPC also uses 172.16.0.0/12, the host kernel routes packets to the local Docker bridge instead of the VPN tunnel.

More Engineering Guides

Copied to clipboard