Explain CIDR notation. What does a /24 mean, and how many hosts does it hold?
What they are really testing: Whether you can do the subnet math that every cloud network design depends on, not just recognize the slash. Sizing subnets wrong causes painful re-architecture.
A real interview question
Explain CIDR notation. What does a /24 mean, and how many hosts does it hold?
What most people say
drag me
“A /24 is a subnet with 256 addresses, the standard size you use for most things.”
It gets the count right but stops there: no host-bit reasoning, no usable-versus-total distinction, and "use it for everything" is how you run out of space or waste it.
The follow-ups they ask next
How many usable hosts in a /28?
32 - 28 = 4 host bits = 16 addresses, minus 2 reserved = 14 usable (11 in AWS after its 5 reserved). Good for a small subnet like a set of NAT or endpoint IPs.
Why not just make every subnet a huge /16?
Wasted address space, weaker isolation, and overlap risk when you later peer or connect networks. Right-size per tier and leave growth room instead.
What the interviewer is listening for
- Reasons from host bits (2^(32-prefix))
- Distinguishes total vs usable
- Knows smaller prefix = bigger network
What sinks the answer
- Memorizes /24 = 256 with no method
- Forgets reserved addresses
- Thinks bigger number = bigger network
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“The slash is [the number of network bits]; a /24 has [8 host bits, so 2^8 = 256 addresses]. Usable is [254 after the network and broadcast are reserved, fewer in cloud]. A [smaller prefix means a bigger block], so I [right-size each subnet with headroom and keep ranges non-overlapping].”
Keep going with networking
Foundation
What is a VPC, and what is a subnet within it? Why split a network into subnets at all?
Foundation
What is the difference between TCP and UDP, and when would you choose each?
Foundation
What happens, step by step, when you type a URL into a browser and press enter?
Foundation
How does DNS resolution actually work, and what is the difference between an A record and a CNAME?
Foundation
What is the difference between IPv4 and IPv6, and why does IPv6 exist?
Junior
An EC2 instance in a private subnet needs to download OS updates from the internet. Walk me through how you make that work, and why.
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free