IP Subnetting: the critical facts

Everything you need to read, plan and troubleshoot subnets — IPv4 and IPv6.

What is a subnet?

An IP network is split into subnets so routers know which addresses live together on one link. The prefix length (the /24 in 192.168.1.0/24) says how many leading bits of the address identify the network; the remaining bits identify hosts inside it. Fewer network bits = bigger subnet; more network bits = more, smaller subnets.

The one rule that matters: two devices can talk directly only if they agree they are in the same subnet — same network bits, same mask. Mismatched masks are one of the most common causes of "it pings sometimes" problems.

IPv4 essentials

IPv4 CIDR table

CIDRNetmaskTotal IPsUsable hostsTypical use
/32255.255.255.25511Host route / loopback
/31255.255.255.25422Point-to-point link
/30255.255.255.25242Legacy point-to-point
/29255.255.255.24886Small DMZ / static block from ISP
/28255.255.255.2401614Small office
/27255.255.255.2243230Branch site
/26255.255.255.1926462Department VLAN
/25255.255.255.128128126Larger VLAN
/24255.255.255.0256254The classic LAN
/23255.255.254.0512510Two /24s merged (watch broadcast volume)
/22255.255.252.01,0241,022Campus VLAN / large DHCP scope
/20255.255.240.04,0964,094Site aggregate
/16255.255.0.065,53665,534Organisation aggregate
/8255.0.0.016,777,21616,777,21410.0.0.0/8 private space

Reserved & special IPv4 ranges (memorise these)

RangePurpose
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private addressing (RFC 1918) — never routed on the internet
100.64.0.0/10Carrier-grade NAT (RFC 6598) — seen on ISP connections without a real public IP
127.0.0.0/8Loopback (localhost)
169.254.0.0/16Link-local / APIPA — a device showing this failed to get DHCP
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24Documentation ranges (safe for examples)
224.0.0.0/4Multicast
240.0.0.0/4Reserved / experimental

Subnetting by hand: a 60-second method

  1. Take the prefix, e.g. /27. Host bits = 32 − 27 = 5, so the block size is 25 = 32.
  2. Subnets start at multiples of the block size in the "interesting" octet: .0, .32, .64, .96, .128 …
  3. Your address falls in the block at or below it: 10.1.1.70/27 → network 10.1.1.64, broadcast 10.1.1.95, hosts .65–.94.

Use the calculator to verify your working.

IPv6 essentials

Anatomy of a global unicast address

A typical address splits into three parts. Everything you do when "subnetting IPv6" happens in the middle one:

Global routing prefixSubnet IDInterface ID
Example2001:db8:acad00ff0000:0000:0000:0001
Bits48 (from your provider)16 (yours to plan)64 (identifies the host)
Who controls itISP / RIRYouThe device (SLAAC) or you (static/DHCPv6)

With a /48 allocation you get a 16-bit Subnet ID — 65,536 LANs — and you never think about host counts again: every LAN holds 264 addresses regardless.

Subnet on the nibble

Each hex digit is 4 bits — a nibble. Subnet on nibble boundaries (/48 → /52 → /56 → /60 → /64) and prefixes stay readable: each step changes exactly one hex digit, so you can see subnet membership at a glance and delegate reverse DNS (ip6.arpa) cleanly. A /54 "works" but makes humans and DNS miserable.

Inside a /48You getEach is
split to /5216 blocks4,096 /64s — e.g. one per region or building
split to /56256 blocks256 /64s — e.g. one per site or customer
split to /604,096 blocks16 /64s — e.g. one per small office
split to /6465,536 LANsone VLAN each

Try it live: put 2001:db8::/48 into the calculator and use "Split this subnet".

A worked /48 plan

A common convention: spend the first nibble of the Subnet ID on function, the rest on instance:

PrefixUse
2001:db8:acad:0000::/64Network infrastructure (loopbacks, management)
2001:db8:acad:1xx::/64Staff VLANs (101 = site 1, 102 = site 2…)
2001:db8:acad:2xx::/64Servers / DMZ
2001:db8:acad:3xx::/64Guest / IoT
2001:db8:acad:fxx::/64Labs and testing

Hex digits in prefixes can encode meaning (site number, VLAN id) — something IPv4 never had room for. Many shops simply put the VLAN number in the subnet ID: VLAN 20 → …:20::/64.

How hosts get addresses (and why /64 is sacred)

IPv6 subnetting facts & myths

IPv6 prefix table

PrefixContainsTypical use
/3265,536 /48sISP / LIR allocation
/4865,536 /64sOne site / customer
/56256 /64sResidential / small-business delegation
/6418.4 quintillion addressesOne LAN / VLAN
/1272 addressesRouter-to-router link (RFC 6164)
/1281 addressHost route / loopback

Recognising IPv6 address types at a glance

Starts withTypeMeaning
2xxx: / 3xxx:Global unicast (2000::/3)Public, internet-routable
fe80:Link-local (fe80::/10)Every IPv6 interface has one; valid only on its own link — this is what next-hops and neighbours use
fd (or fc)Unique local, ULA (fc00::/7)The IPv6 analogue of RFC 1918 private space
ffMulticast (ff00::/8)ff02::1 = all nodes, ff02::2 = all routers on link
::1Loopbacklocalhost
2001:db8:Documentation (RFC 3849)Examples only — never configure in production
::ffff:a.b.c.dIPv4-mappedAn IPv4 address represented inside the IPv6 API

Public vs private IP — and "what is my IP?"

Devices on a typical network hold a private address (RFC 1918 for IPv4, ULA for IPv6) and reach the internet through NAT, which rewrites traffic to your router's public address. That public address is what websites — including the "Your public IP" panel on this site — see. If the panel shows an address starting with 100.64–100.127, your ISP is using carrier-grade NAT and you don't have a dedicated public IPv4 address. IPv6 usually skips NAT entirely: your device's global unicast address is public (firewalled, not translated).

Common pitfalls checklist