What is CIDR notation?
BeginnerConceptNetworking basics for DevOps
Answer
In one line: CIDR notation writes an IP range as an address plus a slash and a number — like 10.0.0.0/16 — where the number says how many bits are fixed for the network; the smaller the number, the bigger the range.
How to read it:
- An IPv4 address has 32 bits.
/16means the first 16 bits are the network part; the remaining 16 bits are for hosts → 2¹⁶ = 65,536 addresses.- Number of addresses = 2^(32 − prefix).
Common sizes:
| CIDR | Addresses | Typical use |
|---|---|---|
/32 |
1 | A single IP (for example in a firewall rule) |
/28 |
16 | Very small subnet |
/24 |
256 | A typical subnet (e.g. 10.0.1.0/24 = 10.0.1.0–10.0.1.255) |
/20 |
4,096 | Larger subnet (good for EKS node/pod subnets) |
/16 |
65,536 | A typical VPC |
/0 |
All addresses | 0.0.0.0/0 = "anywhere" |
Notes:
- Cloud providers reserve some addresses in every subnet (AWS reserves 5 per subnet), so a
/24gives 251 usable IPs in AWS. - Private IP ranges (RFC 1918):
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16.
Why it matters in DevOps:
- VPC and subnet design — plan ranges so they don't overlap with other VPCs or your office network; overlapping ranges make VPC peering, Transit Gateway and VPNs impossible later.
- Kubernetes IP planning — with the AWS VPC CNI, every pod gets a VPC IP, so small subnets run out of addresses quickly ("insufficient IP addresses" errors).
- Firewall rules —
203.0.113.25/32allows one office IP;0.0.0.0/0allows everyone — use it carefully.
Example plan: VPC 10.20.0.0/16; public subnets 10.20.0.0/24, 10.20.1.0/24, 10.20.2.0/24; private app subnets 10.20.16.0/20, 10.20.32.0/20, 10.20.48.0/20 (lots of room for pods).
Tip for interviews: be able to quickly say how many IPs a /24 or /16 has, and mention avoiding overlapping ranges.
More on Networking basics for DevOps
What happens when you type a URL in the browser and press Enter?BeginnerWhat is DNS, and what are common DNS record types?BeginnerWhat is the difference between TCP and UDP?BeginnerWhat are ports, and which common ports should a DevOps engineer know?BeginnerWhat is the difference between a forward proxy and a reverse proxy?BeginnerWhat is a CDN, and how does it help applications?Beginner