Subnet Reference (CIDR)
Quick reference for CIDR (Classless Inter-Domain Routing) notation, subnet masks, and IP address calculations.
CIDR Notation Basics
CIDR notation uses the format: IP_ADDRESS/PREFIX_LENGTH
Example: 192.168.1.0/24
- IP Address:
192.168.1.0 - Prefix Length:
/24(number of network bits)
Common CIDR Blocks (from README)
| CIDR | Subnet Mask | Usable Hosts |
|---|---|---|
| /32 | 255.255.255.255 | 1 (single host) |
| /24 | 255.255.255.0 | 254 |
| /16 | 255.255.0.0 | 65,534 |
| /8 | 255.0.0.0 | 16,777,214 |
Complete CIDR Reference Table
/32 to /24 (Small Networks)
| CIDR | Subnet Mask | Wildcard Mask | Total IPs | Usable Hosts |
|---|---|---|---|---|
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2* |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
/31 is special: Used for point-to-point links (RFC 3021), no network/broadcast addresses
/23 to /16 (Medium Networks)
| CIDR | Subnet Mask | Total IPs | Usable Hosts | Class C Equiv |
|---|---|---|---|---|
| /23 | 255.255.254.0 | 512 | 510 | 2 |
| /22 | 255.255.252.0 | 1,024 | 1,022 | 4 |
| /21 | 255.255.248.0 | 2,048 | 2,046 | 8 |
| /20 | 255.255.240.0 | 4,096 | 4,094 | 16 |
| /19 | 255.255.224.0 | 8,192 | 8,190 | 32 |
| /18 | 255.255.192.0 | 16,384 | 16,382 | 64 |
| /17 | 255.255.128.0 | 32,768 | 32,766 | 128 |
| /16 | 255.255.0.0 | 65,536 | 65,534 | 256 |
/15 to /8 (Large Networks)
| CIDR | Subnet Mask | Total IPs | Usable Hosts |
|---|---|---|---|
| /15 | 255.254.0.0 | 131,072 | 131,070 |
| /14 | 255.252.0.0 | 262,144 | 262,142 |
| /13 | 255.248.0.0 | 524,288 | 524,286 |
| /12 | 255.240.0.0 | 1,048,576 | 1,048,574 |
| /11 | 255.224.0.0 | 2,097,152 | 2,097,150 |
| /10 | 255.192.0.0 | 4,194,304 | 4,194,302 |
| /9 | 255.128.0.0 | 8,388,608 | 8,388,606 |
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
Private IP Address Ranges
Networks reserved for private use (RFC 1918):
| Class | CIDR Block | IP Range | Subnet Mask | Total IPs |
|---|---|---|---|---|
| A | 10.0.0.0/8 | 10.0.0.0 - 10.255.255.255 | 255.0.0.0 | 16,777,216 |
| B | 172.16.0.0/12 | 172.16.0.0 - 172.31.255.255 | 255.240.0.0 | 1,048,576 |
| C | 192.168.0.0/16 | 192.168.0.0 - 192.168.255.255 | 255.255.0.0 | 65,536 |
Special IP Ranges
| Range | Purpose |
|---|---|
| 0.0.0.0/8 | Current network |
| 127.0.0.0/8 | Loopback (localhost) |
| 169.254.0.0/16 | Link-local (APIPA) |
| 224.0.0.0/4 | Multicast |
| 240.0.0.0/4 | Reserved |
| 255.255.255.255/32 | Broadcast |
Subnet Calculation Examples
Example 1: /24 Network
Network: 192.168.1.0/24
- Network Address:
192.168.1.0 - Subnet Mask:
255.255.255.0 - First Usable IP:
192.168.1.1 - Last Usable IP:
192.168.1.254 - Broadcast Address:
192.168.1.255 - Total Hosts: 256
- Usable Hosts: 254
Example 2: /28 Network
Network: 192.168.1.0/28
- Network Address:
192.168.1.0 - Subnet Mask:
255.255.255.240 - First Usable IP:
192.168.1.1 - Last Usable IP:
192.168.1.14 - Broadcast Address:
192.168.1.15 - Total Hosts: 16
- Usable Hosts: 14
Example 3: /30 Network (Point-to-Point)
Network: 10.1.1.0/30
- Network Address:
10.1.1.0 - Subnet Mask:
255.255.255.252 - First Usable IP:
10.1.1.1 - Last Usable IP:
10.1.1.2 - Broadcast Address:
10.1.1.3 - Total Hosts: 4
- Usable Hosts: 2
Common use: Router-to-router connections
Subnetting a Network
Divide /24 into /26 Subnets
Starting with: 192.168.1.0/24 (254 hosts)
Divide into 4 subnets with /26 (62 hosts each):
192.168.1.0/26- IPs: 192.168.1.1 to 192.168.1.62192.168.1.64/26- IPs: 192.168.1.65 to 192.168.1.126192.168.1.128/26- IPs: 192.168.1.129 to 192.168.1.190192.168.1.192/26- IPs: 192.168.1.193 to 192.168.1.254
Divide /24 into /25 Subnets
Starting with: 192.168.1.0/24
Divide into 2 subnets with /25 (126 hosts each):
192.168.1.0/25- IPs: 192.168.1.1 to 192.168.1.126192.168.1.128/25- IPs: 192.168.1.129 to 192.168.1.254
Quick Subnet Formulas
Calculate Usable Hosts
Usable Hosts = 2^(32 - prefix) - 2Examples:
- /24: 2^(32-24) - 2 = 2^8 - 2 = 254
- /28: 2^(32-28) - 2 = 2^4 - 2 = 14
- /30: 2^(32-30) - 2 = 2^2 - 2 = 2
Calculate Number of Subnets
Number of Subnets = 2^(new_prefix - old_prefix)Example: Subnet /24 into /26
- 2^(26-24) = 2^2 = 4 subnets
Binary Conversion
Understanding CIDR in Binary
/24 Subnet Mask:
255 .255 .255 .0
11111111.11111111.11111111.00000000
|-------- 24 bits ---------|/28 Subnet Mask:
255 .255 .255 .240
11111111.11111111.11111111.11110000
|-------- 28 bits --------------|Decimal to Binary Conversion
Common subnet octets:
| Decimal | Binary | CIDR Bits |
|---|---|---|
| 255 | 11111111 | 8 |
| 254 | 11111110 | 7 |
| 252 | 11111100 | 6 |
| 248 | 11111000 | 5 |
| 240 | 11110000 | 4 |
| 224 | 11100000 | 3 |
| 192 | 11000000 | 2 |
| 128 | 10000000 | 1 |
| 0 | 00000000 | 0 |
Common Use Cases
Home Network
Network: 192.168.1.0/24
Router: 192.168.1.1
DHCP Range: 192.168.1.100 - 192.168.1.200
Static IPs: 192.168.1.2 - 192.168.1.99Small Office
Network: 192.168.10.0/24
Router: 192.168.10.1
Servers: 192.168.10.10 - 192.168.10.50
Workstations: 192.168.10.100 - 192.168.10.200
Printers: 192.168.10.210 - 192.168.10.220VPN/Remote Access
Main Network: 192.168.1.0/24
VPN Network: 10.8.0.0/24Container Networks (Docker)
Default Bridge: 172.17.0.0/16
Custom Networks: 172.18.0.0/16, 172.19.0.0/16Tools and Commands
Linux/macOS
# Calculate subnet information
ipcalc 192.168.1.0/24
# Show network interfaces
ip addr show
ifconfig
# Check routing table
ip route
netstat -rnWindows
# Calculate subnet
# (Use online calculator or install ipcalc)
# Show network configuration
ipconfig /all
# Show routing table
route printOnline Tools
Common Mistakes
Overlapping Subnets
Wrong:
Network 1: 192.168.1.0/24
Network 2: 192.168.1.128/25 ← Overlaps with Network 1!Correct:
Network 1: 192.168.1.0/25
Network 2: 192.168.1.128/25Incorrect Host Range
Don't use network or broadcast addresses:
192.168.1.0/24:
- Don't use: 192.168.1.0 (network)
- Don't use: 192.168.1.255 (broadcast)
- Use: 192.168.1.1 - 192.168.1.254
Quick Reference Card
Most Common Subnets
| CIDR | Hosts | Use Case |
|---|---|---|
| /32 | 1 | Single host/firewall rule |
| /30 | 2 | Point-to-point links |
| /29 | 6 | Very small networks |
| /28 | 14 | Small office branches |
| /27 | 30 | Small networks |
| /26 | 62 | Medium networks |
| /24 | 254 | Standard subnet (Class C) |
| /16 | 65,534 | Large corporate networks |
See Also
- Cross-Platform Network Commands - Network commands
- SSH Configuration - SSH setup
- Docker Networking - Container networks