IP Subnetting Guide

A practical reference for CIDR notation, subnet masks, and network division. Learn how to slice address space efficiently and design robust network topologies.

What Is Subnetting?

Subnetting divides a single IP network into smaller, logical subnetworks (subnets). It reduces broadcast domains, improves security, and makes more efficient use of scarce IPv4 address space. Each subnet functions as its own routed segment.

Instead of a flat 192.168.1.0/24 for 254 hosts, you might split it into four /26 subnets — each supporting 62 hosts — isolating departments or environments behind a router.

CIDR Notation

Classless Inter-Domain Routing (CIDR) specifies an IP address and its prefix length: the number of leading 1 bits in the subnet mask.

192.168.1.0/24    →  mask 255.255.255.0    →  24 network bits
10.0.0.0/8        →  mask 255.0.0.0          →   8 network bits
172.16.0.0/12     →  mask 255.240.0.0         →  12 network bits

The prefix length directly tells you how many addresses belong to the network: 2(32 − prefix) total addresses per subnet.

Tip: The first address is the network address (all host bits 0) and the last is the broadcast address (all host bits 1). Usable hosts = total − 2.

Subnet Mask Reference

Every CIDR prefix maps to a dotted-decimal subnet mask. This table covers the most common values:

CIDRMaskHostsUsable
/8255.0.0.016,777,21616,777,214
/12255.240.0.01,048,5761,048,574
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/32255.255.255.25511

Dividing a Network: Step by Step

1. Determine requirements

How many subnets are needed? What is the largest subnet's host count? Always round up to the next power of 2.

2. Calculate borrow bits

If you need N subnets, borrow ⌈log₂(N)⌉ bits from the host portion. The new prefix is original + borrow.

Example: 192.168.1.0/24 needs 4 subnets
borrow = log₂(4) = 2 bits
new prefix = 24 + 2 = /26
Each /26 has 64 addresses, 62 usable.

3. List the subnet ranges

Increment the network address by the block size (2(32 − new_prefix)).

Subnet 0: 192.168.1.0/26    (1.1–1.63)
Subnet 1: 192.168.1.64/26   (1.65–1.127)
Subnet 2: 192.168.1.128/26  (1.129–1.191)
Subnet 3: 192.168.1.192/26  (1.193–1.255)

4. Assign and document

Allocate subnets to VLANs, locations, or functions. Record the subnet, mask, gateway, and DHCP scope in your IPAM.

VLSM — Variable-Length Subnet Masks

Classful subnetting forces every subnet to use the same mask, wasting addresses. VLSM lets you apply different prefix lengths to different subnets, matching host count exactly.

Network: 10.0.0.0/16

Site A  — 500 hosts  →  /23  (512 addr)
Site B  — 250 hosts  →  /24  (256 addr)
Site C  — 60 hosts   →  /26  ( 64 addr)
Site D  — 2 hosts    →  /30  (  4 addr — point-to-point)

Arrange subnets from largest to smallest to avoid overlap. VLSM is fundamental to modern OSPF, EIGRP, and BGP designs.

Remember: Subnets must not overlap. A good IPAM tool or spreadsheet is essential once you go beyond a handful of sites.

Supernetting (Route Summarization)

The inverse of subnetting: combine contiguous subnets into a larger block to reduce routing table entries. Also called route aggregation or prefix summarization.

192.168.0.0/24
192.168.1.0/24
192.168.2.0/24
192.168.3.0/24
→ 192.168.0.0/22  (covers all four)

For summarization, find the common prefix where all networks share identical bits; that becomes the summary route. The remaining bits cover the variation.

Common Pitfalls

  • Forgetting the network and broadcast addresses — never assign them to a host.
  • Overlapping subnets — a classic routing black hole. Double-check your ranges.
  • Too-large subnets — a /24 for a point-to-point link wastes 252 addresses.
  • Not planning for growth — leave headroom; renumbering is painful.
  • Misconfiguring the subnet mask — a single wrong bit can isolate hosts.

Quick Reference — Powers of Two

BitsValueBitsValue
20128256
21229512
2242101,024
2382112,048
24162124,096
25322138,192
266421416,384
2712821532,768

Memorise the /24 through /30 range — it covers 99% of real-world subnetting scenarios.