Interview Prep/Networking/Addressing, CIDR & Routing

You own 10.0.0.0/16 for a new VPC and need separate /24 subnets for dev, QA and prod across two AZs. How do you carve it up?

BeginnerScenarioAddressing, CIDR & Routing
Answer

Situation read → Classic subnetting question. /16 gives 256 possible /24s, so space is not the issue; the issue is leaving room to grow and keeping the plan readable.

What I'd do →

  1. Give each environment a block of the third octet, for example dev 10.0.0.0/20, QA 10.0.16.0/20, prod 10.0.32.0/20, and leave 10.0.48.0 onward unallocated
  2. Inside each /20 use /24s per AZ and tier, for example 10.0.32.0/24 prod-public-a, 10.0.33.0/24 prod-public-b, 10.0.34.0/24 prod-private-a
  3. Write the plan in a table in the repo and codify it in Terraform with cidrsubnet("10.0.0.0/16", 4, 2)
  4. Check with ipcalc 10.0.32.0/20 that the ranges do not overlap

Why → Aligned blocks summarize cleanly in route tables and security rules (one /20 rule per environment instead of 16 /24 rules), and unallocated space lets you add a region or tier later.

Interview tip → Say you never carve a VPC "as needed" because ad hoc allocation is what produces overlap when you later peer.

All Networking questions Roadmap: Networking for DevOps

More on Addressing, CIDR & Routing