Subnetting is a core skill for network engineers, system administrators, and DevOps professionals. Whether you are segmenting a corporate network, configuring cloud VPCs, or setting up firewall rules, understanding how IP subnets work is essential. This guide covers CIDR notation, subnet masks, and practical subnetting with real-world examples.
Subnetting divides a large IP network into smaller, more manageable sub-networks (subnets). Each subnet has its own range of IP addresses and acts as a logical network segment. Benefits include:
CIDR (Classless Inter-Domain Routing) notation combines an IP address with a prefix length that indicates how many bits define the network portion. The format is IP/prefix:
192.168.1.0/24
| |
| +-- 24 bits for network, 8 bits for hosts
+-------------- Network base address
10.0.0.0/8 = 10.0.0.0 - 10.255.255.255 (16M addresses)
172.16.0.0/12 = 172.16.0.0 - 172.31.255.255 (1M addresses)
192.168.0.0/16 = 192.168.0.0 - 192.168.255.255 (65K addresses)
A subnet mask is a 32-bit number that separates the network portion from the host portion of an IP address. The mask has consecutive 1-bits for the network part and 0-bits for the host part:
CIDR Subnet Mask Binary
/8 255.0.0.0 11111111.00000000.00000000.00000000
/16 255.255.0.0 11111111.11111111.00000000.00000000
/24 255.255.255.0 11111111.11111111.11111111.00000000
/25 255.255.255.128 11111111.11111111.11111111.10000000
/26 255.255.255.192 11111111.11111111.11111111.11000000
/27 255.255.255.224 11111111.11111111.11111111.11100000
/28 255.255.255.240 11111111.11111111.11111111.11110000
/30 255.255.255.252 11111111.11111111.11111111.11111100
/32 255.255.255.255 11111111.11111111.11111111.11111111
| Address | Description | Example (/24) |
|---|---|---|
| Network Address | First address, identifies the subnet | 192.168.1.0 |
| First Usable | First host address | 192.168.1.1 |
| Last Usable | Last host address | 192.168.1.254 |
| Broadcast Address | Last address, broadcasts to all hosts | 192.168.1.255 |
Formula: Total addresses = 2^(32 - prefix). Usable hosts = total - 2 (network and broadcast addresses).
| CIDR | Mask | Total IPs | Usable Hosts | Use Case |
|---|---|---|---|---|
| /32 | 255.255.255.255 | 1 | 1 | Single host (loopback, ACL) |
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point links |
| /28 | 255.255.255.240 | 16 | 14 | Small office, DMZ |
| /24 | 255.255.255.0 | 256 | 254 | Standard LAN segment |
| /20 | 255.255.240.0 | 4,096 | 4,094 | Medium VPC subnet |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Large network / VPC |
Suppose you have 192.168.1.0/24 and need four equal subnets:
Original: 192.168.1.0/24 (256 IPs, 254 usable)
Split into /26 subnets (64 IPs each, 62 usable):
Subnet 1: 192.168.1.0/26
Network: 192.168.1.0
Range: 192.168.1.1 - 192.168.1.62
Broadcast: 192.168.1.63
Subnet 2: 192.168.1.64/26
Network: 192.168.1.64
Range: 192.168.1.65 - 192.168.1.126
Broadcast: 192.168.1.127
Subnet 3: 192.168.1.128/26
Network: 192.168.1.128
Range: 192.168.1.129 - 192.168.1.190
Broadcast: 192.168.1.191
Subnet 4: 192.168.1.192/26
Network: 192.168.1.192
Range: 192.168.1.193 - 192.168.1.254
Broadcast: 192.168.1.255
When designing AWS, GCP, or Azure VPCs, plan your subnets carefully:
# Typical AWS VPC layout
VPC: 10.0.0.0/16 (65,534 IPs)
Public subnets:
us-east-1a: 10.0.1.0/24 (254 IPs)
us-east-1b: 10.0.2.0/24 (254 IPs)
Private subnets:
us-east-1a: 10.0.10.0/24 (254 IPs)
us-east-1b: 10.0.11.0/24 (254 IPs)
Database subnets:
us-east-1a: 10.0.20.0/24 (254 IPs)
us-east-1b: 10.0.21.0/24 (254 IPs)
Use the Subnet Calculator to quickly compute address ranges when planning VPC architectures. Verify your DNS records point to the correct subnets after deployment.
| Range | CIDR | Addresses | Common Use |
|---|---|---|---|
| 10.0.0.0 - 10.255.255.255 | 10.0.0.0/8 | 16.7M | Cloud VPCs, large enterprises |
| 172.16.0.0 - 172.31.255.255 | 172.16.0.0/12 | 1M | Docker default networks |
| 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 | 65K | Home/office LANs |
They mean the same thing. /24 is CIDR notation (24 network bits), while 255.255.255.0 is the dotted-decimal subnet mask. CIDR is more compact and is the modern standard.
The network address (all host bits = 0) identifies the subnet itself. The broadcast address (all host bits = 1) is used to send packets to all hosts on the subnet. Assigning either to a device would break routing.
Count the number of segments (departments, availability zones, environments) and add room for growth. A common practice is to allocate twice as many addresses as currently needed.
Try Subnet Calculator Now →DevToolKit — 42+ Free Online Developer Tools