If you are a DevOps engineer, network engineer or someone working with cloud infrastructure, understanding IPv4 CIDR addressing is a must. CIDR (Classless Inter-Domain Routing) is used everywhere cloud networking (AWS, Azure, GCP), Docker, Kubernetes and VPNs.
This blog takes you from beginner to advanced concepts of CIDR addressing in IPv4, so you can design and troubleshoot networks with confidence.
Table of Contents
- What is IPv4?
- What is CIDR?
- Why CIDR Replaced Classes?
- CIDR Notation Explained
- Subnetting with CIDR
- CIDR Examples
- CIDR in DevOps Use Cases
- CIDR Cheatsheet
- Advanced Concepts
- Final Thoughts
What is IPv4?
- IPv4 (Internet Protocol version 4) is the fourth version of IP used to identify devices on a network
- It uses 32-bit addresses, written as four octets (e.g.
192.168.1.1
) - The total number of IPv4 addresses = 2³² = 4,294,967,296
What is CIDR?
CIDR (Classless Inter-Domain Routing) is a method for allocating IP addresses and routing efficiently.
Instead of using fixed class based networks (A, B, C), CIDR allows flexible subnetting.
👉 Example:
- Old class-based:
192.168.1.0
(Class C = 255.255.255.0) - With CIDR:
192.168.1.0/24
Here, /24
means 24 bits for the network and 8 bits for hosts.
Why CIDR Replaced Classes?
Earlier, IP addresses were divided into classes:
- Class A →
/8
(16M hosts) - Class B →
/16
(65K hosts) - Class C →
/24
(256 hosts)
Problem: Too much wastage of IPs
👉 CIDR solved this by allowing variable-length subnet masks (VLSM).
CIDR Notation Explained
CIDR notation = IP address + /prefix length
- Example:
10.0.0.0/16
-
/16
means first 16 bits = network part - Remaining bits = host part
Formula:
- Number of hosts =
2^(32 - prefix) - 2
(subtract 2 for network and broadcast addresses)
Subnetting with CIDR
Subnetting allows dividing a network into smaller parts
Example:
- Network:
192.168.0.0/24
(256 addresses) - Subnet:
192.168.0.0/26
(64 addresses each)
Subnets:
-
192.168.0.0/26
→ 64 IPs -
192.168.0.64/26
→ 64 IPs -
192.168.0.128/26
→ 64 IPs -
192.168.0.192/26
→ 64 IPs
CIDR Examples
CIDR Block | Subnet Mask | Hosts Available | Example Usage |
---|---|---|---|
/8 | 255.0.0.0 | 16M hosts | Large ISPs |
/16 | 255.255.0.0 | 65K hosts | Campus network |
/24 | 255.255.255.0 | 254 hosts | Home/Office LAN |
/30 | 255.255.255.252 | 2 hosts | Point-to-point links |
/32 | 255.255.255.255 | 1 host | Single device (loopback, VPN) |
CIDR in DevOps Use Cases
CIDR is widely used in cloud and DevOps:
-
AWS VPC → Create VPC with
10.0.0.0/16
and subnets/24
-
Kubernetes → Pod networks (
10.244.0.0/16
) -
Docker → Default bridge network uses
172.17.0.0/16
-
VPNs → Assign ranges like
192.168.100.0/24
💡 Always plan CIDR ranges carefully to avoid overlapping networks
CIDR Cheatsheet
CIDR | Hosts Available | Netmask |
---|---|---|
/8 | 16,777,214 | 255.0.0.0 |
/16 | 65,534 | 255.255.0.0 |
/24 | 254 | 255.255.255.0 |
/30 | 2 | 255.255.255.252 |
/32 | 1 | 255.255.255.255 |
Advanced Concepts
- Supernetting → Aggregating multiple subnets into one larger block (useful for ISPs)
- Route Summarization → Reducing routing table entries with CIDR
- Overlapping CIDRs → Avoid in hybrid cloud/VPN setups
- IPv6 CIDR → Works similarly but with 128-bit addresses
Final Thoughts
- CIDR is the foundation of modern networking
- DevOps engineers must master CIDR to manage cloud, Kubernetes, and Docker networks
- From
/8
to/32
, CIDR lets you optimize IP allocation and reduce network waste
👉 Next time you create a VPC, configure Kubernetes or debug a VPN CIDR will be at the heart of it.
If you found this blog helpful, do not forget to 💖 star this repo, share and follow for more DevOps and networking content.
Top comments (0)