CIDR in five minutes
An IPv4 address is 32 bits, and CIDR notation simply says where to cut them:
192.168.1.0/24 means the first 24 bits name the network and the
remaining 8 identify hosts inside it. The netmask is the same cut written as an
address — 24 one-bits then zeros gives 255.255.255.0 — and the wildcard mask is its
inverse. Every prefix you shorten doubles the network: a /24 holds 256 addresses, a /23 holds 512,
and a /8 holds 16.7 million.
Two addresses in every ordinary subnet are spoken for: the all-zeros host part is the network
address that names the subnet, and the all-ones host part is the broadcast address. That's why a
/24 gives you 254 usable hosts, not 256. The deliberate exception is the /31:
RFC 3021 noticed that a point-to-point link between two routers has no use for a broadcast
address, so both addresses of a /31 are usable — halving the address burn of the /30s those links
used to get. A /32 goes one step further and is just a route to a single host.
If your network uses addresses starting 10., 172.16–31. or 192.168., that's by design: RFC 1918
reserves
10.0.0.0/8,
172.16.0.0/12 and
192.168.0.0/16 for
private use, never routed on the public internet. Carving those blocks into subnets is how most
internal networks are planned — and once the ranges are drawn, the practical question becomes
whether the services living in them still answer. Our guide to
TCP port monitoring covers watching
exactly that, port by port.
IPv6 makes the arithmetic absurd on purpose. A single
/64 — the standard subnet
size, and the one SLAAC autoconfiguration expects — holds 2
64 addresses, more than four
billion complete IPv4 internets. You still subnet, though, just not to save addresses: you subnet
to give sites, VLANs and security zones clean boundaries. Convention is to split on
nibble boundaries (/48, /52, /56, /60, /64), because each hex digit of an IPv6
address is exactly 4 bits — subnets then align with the written address and with reverse-DNS zone
cuts instead of straddling a digit. And since the names pointing into your ranges are a failure
domain of their own, it's worth reading up on
choosing a DNS provider and building in redundancy.
A subnet plan is a map, and maps go stale the day something on them stops responding. If the hosts
in these ranges matter to you,
put them under continuous monitoring, free — so the first
sign of trouble is an alert, not a user.