How the planner allocates
Each network gets the smallest block that holds its devices, a gateway, and the network and broadcast addresses. The planner sorts networks from largest to smallest (networks of the same size keep the order you entered them) and places each one right after the last. Placing big blocks first keeps every block aligned on a multiple of its own size and leaves the free space in one run at the end.
Formula
- Prefix
- 32 − ⌈log2(devices + 3)⌉
- Block size
- 2(32 − prefix)
The 3 is the gateway plus the network and broadcast addresses. One device still gets a /30: the device and its gateway.
Worked example
Trusted needs 100 devices. 100 + 3 = 103, and the next power of two is 128, so it gets a /25 at 10.0.0.0. IoT needs 60: 63 rounds up to 64, a /26, which starts at the next 64-address boundary, 10.0.0.128. The whole plan uses 304 of 512 addresses in 10.0.0.0/23.
Gateways and DHCP
The gateway goes on the first usable address by default, the convention in Cisco's design guides and training labs, the major cloud providers and most home routers. Pick “Last IP” if your network uses the top address instead. The DHCP range is every other usable address; carve out room for printers, servers and other fixed addresses in your DHCP server if you need it.
VLAN IDs
An 802.1Q tag has a 12-bit VLAN ID. 0 and 4095 are reserved, so switches accept 1 to 4094. VLAN 1 is the default VLAN on most switches, and many networks keep it unused. Cisco Catalyst switches also reserve 1002–1005. The planner accepts any ID from 1 to 4094, notes those two cases, and flags a repeated ID.
References
- RFC 4632, Classless Inter-domain Routing (CIDR); RFC 1878, Variable Length Subnet Table for IPv4.
- IEEE 802.1Q, Table 9-2 Reserved VID values; Cisco Catalyst, Juniper, Arista and MikroTik VLAN configuration guides.
- Cisco, IP Addressing and Subnetting for New Users (VLSM example); Cisco Networking Academy VLSM lab 11.10.2.
- RFC 4180, Common Format for Comma-Separated Values; GitHub Flavored Markdown spec, tables.