A worked example
192.168.10.0/24. The /24 leaves 8 bits for the host part, so the block holds 256 addresses from 192.168.10.0 to 192.168.10.255. The first is the network address and the last is the broadcast, neither of which goes on a device, so 254 are usable: 192.168.10.1 – 192.168.10.254. The mask is 255.255.255.0, and the wildcard an access list wants is 0.0.0.255.
That is the calculation. Everything else on this page is about the decisions it feeds.
Being handed a range for the cameras
This is the usual shape of the job: the client's IT department gives you a block and you have to fit the system into it. 60 cameras need 60 addresses, plus the recorder, plus whatever else sits on that network, and the smallest prefix that holds 60 is a /26 with 62 usable. That is not much headroom, and a system that grows by eight cameras is then a re-addressing job rather than an install.
The other direction is worth checking before you accept a block. A /24 is 254 usable addresses — generous for cameras, and nowhere near enough for a large access control system with a reader and a controller on every door, which is the kind of thing worth saying before the cable goes in rather than after.
Carving a block up
Cameras, access control, intercom and the client's own computers do not want to share a broadcast domain, and keeping them apart is as much a security measure as a performance one: a camera network that cannot reach the finance department is one less path in.
A 10.20.0.0/22 splits into 4 /24 blocks of 254 usable addresses each, which is a workable shape for a mid-size building:
10.20.0.0/24— 10.20.0.1 – 10.20.0.254 — cameras, say10.20.1.0/24— 10.20.1.1 – 10.20.1.254 — access control10.20.2.0/24— 10.20.2.1 – 10.20.2.254 — intercom and audio10.20.3.0/24— 10.20.3.1 – 10.20.3.254 — spare, which is the point of planning it
The split is exact: each block begins where the last one ended, and together they cover the parent with no gap and no overlap. There is a fixture asserting that.
The two prefixes that trip calculators up
Usable addresses are normally the block size minus two, for the network and broadcast addresses. At the short end that formula breaks, and a surprising number of calculators report the broken answer:
- /30 — 4 addresses, 2 usable (10.255.255.1 – 10.255.255.2). The traditional point-to-point link.
- /31 — 2 addresses and 2 usable, not zero. With only two ends there is no broadcast address to reserve, which RFC 3021 makes explicit. Minus two would give 0.
- /32 — one address. A host route or a loopback, not a subnet with a range. Minus two would give −1.
Private, public, and the one that means something broke
Which block you have been given matters as much as its size:
10.0.0.0/8— Private (RFC 1918). Routable only inside the site.172.16.0.0/12— Private (RFC 1918). Routable only inside the site.192.168.0.0/16— Private (RFC 1918). Routable only inside the site.100.64.0.0/10— Carrier NAT (RFC 6598). Not yours to assign; an ISP uses this.169.254.0.0/16— Link-local (RFC 3927). A device that failed to get an address from DHCP.127.0.0.0/8— Loopback. Never leaves the device.224.0.0.0/4— Multicast. Not host addresses.0.0.0.0/8— This network. Not a usable host address.
A camera that has given itself a 169.254 address has not got one from DHCP, which on a new install usually means the wrong VLAN on the port rather than a faulty camera. The calculator above names the range for whatever you give it.
Prefix reference
Every prefix from /8 to /32, with what it holds. Shorter prefixes exist but are route aggregation rather than a network anyone plugs a device into.
| Prefix | Mask | Wildcard | Addresses | Usable |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
What this does not tell you
- IPv4 only. IPv6 subnetting is a different exercise with different conventions, and camera, access control and intercom networks are overwhelmingly v4. Pretending to cover both would be worse than saying so.
- It says nothing about whether a block is free. Overlapping an existing subnet is a conversation with whoever runs the network, not an arithmetic problem.
- Nothing about VLANs as such. A subnet is addressing and a VLAN is a broadcast domain; they usually map one to one by convention rather than by necessity.
- Nothing about routing, DHCP scopes, or what the gateway should be. By convention the gateway is the first or last usable address, but that is a local decision and this does not assume one.
- The reserved ranges listed are the common ones, not every assignment IANA has made.
The network the cameras sit on
Addressing is the easy half. What that network has to carry is the camera bandwidth, what the switch has to power is the PoE budget, and what the recorder has to hold is the storage. Those three decide more installs than the subnet does.
Sources
The arithmetic is the definition of a prefix and needs no source. Two conventions are cited by document rather than stated from memory: the private ranges are RFC 1918, and the two usable addresses on a /31 point-to-point link are RFC 3021. Link-local is RFC 3927 and carrier-grade NAT is RFC 6598.
Full notes and the fixtures: docs/ip-subnet.md in the site's repository.
Working with a client's IT department?
We design camera and access networks to sit alongside an existing one rather than fight it, and we are used to being handed a VLAN and a range and asked to make it work.
Other tools
- Voltage dropHow much voltage a run loses, and how much reaches the device at the end of it.
- Wire sizeThe smallest conductor that still gets the device enough voltage.
- PoE budgetWhat a set of cameras and door controllers asks of the switch feeding them.
- CCTV storageHow much disk a retention period needs, and how long an array will last.
- CCTV bandwidthWhat the cameras ask of the switch, recording and while being watched.
- RAID capacityWhat an array really gives you, and how many disks can fail.
- Conduit fillWhether the cable you are pulling fits the conduit, and how much room is left.
- Resistor colorsWhat the bands mean, and which resistor a supervised zone wants.
- Ohm's lawAny two of volts, amps, ohms and watts give the other two.
- Speaker loadWhether the amplifier covers the taps, with reserve left over.
- Address planThe commissioning address list, before you are up a ladder.
