Skip to content

IP Subnetting

What is a Subnet?

A subnet is a logical division of an IP network. All devices in the same subnet can talk directly at Layer 2. Devices in different subnets need a router (or Layer 3 switch) to communicate.

IPv4 Addresses: 32 Bits as Four 8-Bit Octets

An IPv4 address is a 32-bit number, written as four octets (8-bit groups) separated by dots — this is why every part of an IP address falls between 0 and 255: an 8-bit binary number has exactly 2^8 = 256 possible values (0–255).

10       .   0        .   10       .   0
00001010 . 00000000 . 00001010 . 00000000

Each octet's bits have a fixed place value, read left to right:

Bit position 128 64 32 16 8 4 2 1
Example (10) 0 0 0 0 1 0 1 0

To convert binary → decimal, add up the place values where the bit is 1. For 00001010: 8 + 2 = 10. To go decimal → binary, subtract the largest place value that fits, repeat with the remainder — 200 is 128 + 64 + 811001000.

Why This Matters for Subnetting

A subnet mask is also a 32-bit number, written the same way — it just happens to always be a run of contiguous 1 bits followed by 0 bits:

255.255.255.0   = 11111111.11111111.11111111.00000000   (/24 — 24 one-bits)
255.255.255.192 = 11111111.11111111.11111111.11000000   (/26 — 26 one-bits)

The mask's 1 bits mark the network portion of the address; the 0 bits mark the host portion. This is exactly what /24 or /26 is counting — the total number of 1 bits across all four octets, not "24 bits in one octet." A /24 happens to land exactly on an octet boundary (all 8 bits of the 3rd octet are network, all 8 of the 4th are host), which is why /24 subnetting feels simple — but a /26, /27, etc. split a single octet partway through, which is where subnetting starts to feel harder.

Subnetting Within an Octet

When the mask splits an octet partway (anything not /8, /16, or /24), the trick is finding the block size: 256 - <the last non-255, non-zero mask octet value>. Each subnet then starts at a multiple of that block size.

Example: /26 → mask is 255.255.255.192 → block size = 256 - 192 = 64. So the 4th octet's subnets fall on boundaries of 64:

Subnet Network Usable Range Broadcast
1 10.0.10.0/26 10.0.10.1 – 10.0.10.62 10.0.10.63
2 10.0.10.64/26 10.0.10.65 – 10.0.10.126 10.0.10.127
3 10.0.10.128/26 10.0.10.129 – 10.0.10.190 10.0.10.191
4 10.0.10.192/26 10.0.10.193 – 10.0.10.254 10.0.10.255

This is the same math behind VLSM (Variable-Length Subnet Masking) — carving a single /24 into several smaller subnets of different sizes (e.g. a /26 for one office and two /27s for smaller sites) by choosing block sizes to fit each site's host count.

Subnet Mask Notation

10.0.10.0/24
/24 = 24 bits network, 8 bits host
255.255.255.0 = subnet mask
Usable IPs: 10.0.10.1 to 10.0.10.254
Broadcast: 10.0.10.255

The /24 (CIDR notation) tells you how many bits of the 32-bit IP address are the network portion. The remaining bits are host bits — the number of usable addresses is 2^(host bits) - 2 (minus the network address and broadcast address).

Common Subnet Sizes

CIDR Addresses Usable Typical Use
/30 4 2 Point-to-point link
/25 128 126 Small office
/24 256 254 Standard LAN
/22 1,024 1,022 Larger office
/16 65,536 65,534 Enterprise