IP Addressing, Subnets, and CIDR Notation
IP Addressing, Subnets, and CIDR Notation
Understanding IP addressing and subnetting is fundamental for any developer working with networks, cloud infrastructure, or DevOps.
IPv4 Basics
An IPv4 address is 32 bits, written as four octets: 192.168.1.100. Each octet ranges from 0 to 255.
CIDR Notation
CIDR (Classless Inter-Domain Routing) replaced the old class-based system. A CIDR block like 10.0.0.0/24 means the first 24 bits are the network prefix, leaving 8 bits for host addresses.
Common CIDR Blocks
| CIDR | Subnet Mask | Hosts | Use Case |
|------|-------------|-------|----------|
| /32 | 255.255.255.255 | 1 | Single host |
| /24 | 255.255.255.0 | 254 | Small network |
| /16 | 255.255.0.0 | 65,534 | Medium network |
| /8 | 255.0.0.0 | 16M+ | Large network |
Calculating Subnets
For a /24 network (e.g., 192.168.1.0/24):
Use our CIDR Calculator tool to compute these values instantly for any CIDR block.
Private IP Ranges
Reserved for internal networks (RFC 1918):
Cloud VPC Design
When designing cloud VPCs, plan your CIDR blocks carefully:
VPC: 10.0.0.0/16 (65k addresses)
├── Public Subnet: 10.0.1.0/24 (254 hosts)
├── Private Subnet: 10.0.2.0/24 (254 hosts)
├── Database Subnet: 10.0.3.0/24 (254 hosts)
└── Reserved: 10.0.4.0/22 (future growth)
Leave room for growth. It's painful to re-address a VPC later.
IPv6
IPv6 uses 128-bit addresses written in hex: 2001:0db8:85a3::8a2e:0370:7334. The vast address space eliminates the need for NAT, but adoption is still ongoing.
Conclusion
CIDR notation is the language of modern networking. Understand how prefix lengths map to subnet sizes, plan your address spaces with growth in mind, and use calculators to avoid off-by-one errors.