Examples:

…

Use it to pick a safe static IP for your server (stay outside your router's DHCP pool) or to work out what a Docker network like 172.17.0.0/16 actually covers. Prefixes /31 and /32 are special-cased: they have no separate network and broadcast addresses.

How CIDR subnet maths works

An IPv4 address has 32 bits. The CIDR suffix (like /24) tells you how many leading bits identify the network, leaving 32 − prefix bits for hosts. For /24, 32 − 24 = 8 host bits give 2^8 = 256 addresses. Two addresses are always reserved—the first is the network address and the last is the broadcast address—leaving 254 usable IPs.

At home you run into subnets in two places: picking static server IPs outside your router's DHCP pool, and defining custom Docker bridge or WireGuard networks so routes never overlap.

Step-by-step example: isolating a Docker stack and a static server IP

Your home router uses 192.168.1.1 with DHCP handing out .100–.254, and you also want a custom Docker network that never clashes with common office LANs.

  1. Test 192.168.1.20/24: usable hosts span 192.168.1.1 through 192.168.1.254, confirming .20 is valid and safely below the DHCP pool.
  2. Now enter 172.28.10.0/24 to plan an isolated Docker Compose bridge network.
  3. Copy the usable host range (172.28.10.1–172.28.10.254) and set gateway 172.28.10.1 in your Compose ipam config.

Result: Your server keeps a conflict-free static LAN IP, and up to 253 containers on that Docker network stay separated from 192.168.1.x and office VPN ranges.

Frequently Asked Questions

What is the practical difference between /24 and /16?

A /24 subnet mask (255.255.255.0) holds 254 usable devices—ideal for one home LAN or VLAN. A /16 mask (255.255.0.0) holds 65,534 hosts and is rarely needed at home unless you run huge segmented labs.

Why do Docker subnets sometimes break VPN connections?

Docker assigns 172.17.0.0/16 by default and steps up through 172.18–172.31 for custom networks. If your work VPN uses the same 172.x range, routing conflicts drop traffic until you assign an unused subnet.

Which IPv4 ranges are safe to use for private home networks?

Stick strictly to RFC 1918 private blocks: 10.0.0.0/8, 172.16.0.0/12 (172.16.0.0 to 172.31.255.255), and 192.168.0.0/16. Never invent public IP addresses inside your LAN.