Subnet Sizing and Planning
You'll learn how to calculate the right subnet size for your workloads and allocate IP addresses effectively.
When you create a subnet, you need to decide how many IP addresses it should contain. Choose too small, and you'll run out of addresses as you grow. Choose too large, and you waste precious private IP space that could be used elsewhere in your network.
Understanding Subnet Sizes with CIDR
Remember CIDR notation from earlier lessons? The number after the slash determines your subnet size:
- /24 = 256 IP addresses (actually 251 usable—cloud providers reserve 5)
- /25 = 128 IP addresses
- /26 = 64 IP addresses
- /27 = 32 IP addresses
- /28 = 16 IP addresses
Each time you increase the CIDR number by 1, you halve the available addresses.
Planning Your Allocation
Think of your virtual network's IP range (like 10.0.0.0/16) as a pizza. Each subnet is a slice. Plan ahead:
- Count your resources: How many VMs, databases, or load balancers will this subnet hold?
- Add growth buffer: Multiply by 2-3x for future expansion
- Account for reserved IPs: Cloud providers always reserve ~5 addresses per subnet
- Document your plan: Keep a spreadsheet showing which subnets use which CIDR blocks
For example, if you need 20 web servers, choose at least a /27 (32 addresses). Need 100? Go with /25 (128 addresses).
Avoid Overlaps
Once you assign 10.0.1.0/24 to one subnet, you can't use 10.0.1.64/26 elsewhere—they overlap! Plan non-overlapping ranges carefully.
Key Takeaway: Proper subnet sizing balances current needs with future growth—choose CIDR blocks that provide enough IP addresses without wasting address space or creating overlaps.