How many usable IP addresses does a /24 subnet in an AWS VPC have?
A /24 has 256 addresses, but AWS reserves five in every subnet, so 251 are usable. The reserved ones are the network address, VPC router, DNS, one for future use, and the broadcast address.
Explain it simply
A /24 is like a lane of 256 numbered houses. In a normal network two are special: the first is the lane's name and the last is the loudspeaker for everyone. AWS keeps three more for its own use, so five houses can never be given to your servers.
Example
Subnet 10.0.1.0/24 -> 256 addresses (2^(32-24) = 2^8)
10.0.1.0 network address
10.0.1.1 VPC router
10.0.1.2 DNS server (VPC base address + 2)
10.0.1.3 reserved for future use
10.0.1.255 broadcast (not supported, still reserved)
Usable: 256 - 5 = 251
/28 subnet (smallest allowed): 16 - 5 = 11 usable
/16 VPC (largest allowed): 65,536 addresses in totalFormula: addresses = 2^(32 - prefix length), usable = that minus 5.
VPC CIDR blocks can range from /16 to /28. Plan the ranges before creating them, because overlapping CIDRs prevent VPC peering later, and a VPC range is hard to change. Leave room for more subnets across several AZs, and avoid ranges that clash with your office or on-premises network.
What to say in the interview
"A /24 has 256 addresses and AWS reserves five per subnet, leaving 251 usable. VPCs range from /16 to /28. I choose non-overlapping CIDRs up front so peering and VPN connections stay possible later."
Common mistakes
- Forgetting the five reserved addresses when sizing small subnets.