Skip to content

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)

CIDRSubnet MaskUsable Hosts
/32255.255.255.2551 (single host)
/24255.255.255.0254
/16255.255.0.065,534
/8255.0.0.016,777,214

Complete CIDR Reference Table

/32 to /24 (Small Networks)

CIDRSubnet MaskWildcard MaskTotal IPsUsable Hosts
/32255.255.255.2550.0.0.011
/31255.255.255.2540.0.0.122*
/30255.255.255.2520.0.0.342
/29255.255.255.2480.0.0.786
/28255.255.255.2400.0.0.151614
/27255.255.255.2240.0.0.313230
/26255.255.255.1920.0.0.636462
/25255.255.255.1280.0.0.127128126
/24255.255.255.00.0.0.255256254

/31 is special: Used for point-to-point links (RFC 3021), no network/broadcast addresses

/23 to /16 (Medium Networks)

CIDRSubnet MaskTotal IPsUsable HostsClass C Equiv
/23255.255.254.05125102
/22255.255.252.01,0241,0224
/21255.255.248.02,0482,0468
/20255.255.240.04,0964,09416
/19255.255.224.08,1928,19032
/18255.255.192.016,38416,38264
/17255.255.128.032,76832,766128
/16255.255.0.065,53665,534256

/15 to /8 (Large Networks)

CIDRSubnet MaskTotal IPsUsable Hosts
/15255.254.0.0131,072131,070
/14255.252.0.0262,144262,142
/13255.248.0.0524,288524,286
/12255.240.0.01,048,5761,048,574
/11255.224.0.02,097,1522,097,150
/10255.192.0.04,194,3044,194,302
/9255.128.0.08,388,6088,388,606
/8255.0.0.016,777,21616,777,214

Private IP Address Ranges

Networks reserved for private use (RFC 1918):

ClassCIDR BlockIP RangeSubnet MaskTotal IPs
A10.0.0.0/810.0.0.0 - 10.255.255.255255.0.0.016,777,216
B172.16.0.0/12172.16.0.0 - 172.31.255.255255.240.0.01,048,576
C192.168.0.0/16192.168.0.0 - 192.168.255.255255.255.0.065,536

Special IP Ranges

RangePurpose
0.0.0.0/8Current network
127.0.0.0/8Loopback (localhost)
169.254.0.0/16Link-local (APIPA)
224.0.0.0/4Multicast
240.0.0.0/4Reserved
255.255.255.255/32Broadcast

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):

  1. 192.168.1.0/26 - IPs: 192.168.1.1 to 192.168.1.62
  2. 192.168.1.64/26 - IPs: 192.168.1.65 to 192.168.1.126
  3. 192.168.1.128/26 - IPs: 192.168.1.129 to 192.168.1.190
  4. 192.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):

  1. 192.168.1.0/25 - IPs: 192.168.1.1 to 192.168.1.126
  2. 192.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) - 2

Examples:

  • /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:

DecimalBinaryCIDR Bits
255111111118
254111111107
252111111006
248111110005
240111100004
224111000003
192110000002
128100000001
0000000000

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.99

Small 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.220

VPN/Remote Access

Main Network: 192.168.1.0/24
VPN Network: 10.8.0.0/24

Container Networks (Docker)

Default Bridge: 172.17.0.0/16
Custom Networks: 172.18.0.0/16, 172.19.0.0/16

Tools and Commands

Linux/macOS

bash
# Calculate subnet information
ipcalc 192.168.1.0/24

# Show network interfaces
ip addr show
ifconfig

# Check routing table
ip route
netstat -rn

Windows

powershell
# Calculate subnet
# (Use online calculator or install ipcalc)

# Show network configuration
ipconfig /all

# Show routing table
route print

Online 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/25

Incorrect 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

CIDRHostsUse Case
/321Single host/firewall rule
/302Point-to-point links
/296Very small networks
/2814Small office branches
/2730Small networks
/2662Medium networks
/24254Standard subnet (Class C)
/1665,534Large corporate networks

See Also

External Resources

Released under the MIT License.