Octet

How do subnets relate to availability zones, and how many addresses do you lose in each subnet?

Show the answer

Say this first

In AWS a subnet lives in exactly one availability zone, so for high availability you build one subnet per tier per AZ. Azure and GCP subnets are regional and span zones. AWS and Azure reserve 5 addresses in every subnet and GCP reserves 4, so a /28 in AWS gives 11 usable addresses, not 14.

Go deeper

AWS

A subnet is tied to one AZ (us-east-1a, for example). A typical layout for two AZs:

SubnetAZCIDR
public-aus-east-1a10.10.0.0/24
public-bus-east-1b10.10.1.0/24
private-aus-east-1a10.10.10.0/24
private-bus-east-1b10.10.11.0/24

Reserved in 10.10.10.0/24: .0 network, .1 VPC router, .2 Amazon DNS, .3 reserved for future use, .255 broadcast (broadcast is not supported, but the address is still held back). Subnet size is /16 to /28.

Azure

A subnet spans all zones in the region; you pick the zone per VM or per zonal resource. Azure reserves .0 network, .1 default gateway, .2 and .3 for Azure DNS mapping, and the last address. The smallest subnet is /29. Some services need a dedicated subnet with a fixed name, such as GatewaySubnet for VPN and ExpressRoute gateways and AzureFirewallSubnet for Azure Firewall.

GCP

Subnets are regional. GCP reserves the network address, the gateway (.1), the second-to-last address and the broadcast address in the primary range.

Traps

  • Forgetting the 5 reserved addresses when sizing small subnets for load balancers or endpoints.
  • Assuming Azure subnets are zonal like AWS subnets.
How did you do?