Skip to content

Subnetting Guide

Four steps from a single prefix to a plan that gives each LAN a different size. The numbers below come from the same functions the calculators use.

  1. 01

    What is a subnet?

    A subnet is one contiguous run of addresses. Devices in the same subnet share a prefix and can exchange packets without a router hop between them. The prefix length is the boundary: bits to the left name the network, bits to the right name the host.

  2. 02

    Understanding CIDR notation

    CIDR writes the prefix as a slash length. 10.1.2.3/16 does not mean the block is only 10.1.2.3. The /16 keeps the first two octets and clears the rest, so the network is 10.1.0.0 and the block runs through 10.1.255.255.

  3. 03

    How to calculate subnets

    Start with the address and the prefix. Build the mask as that many 1 bits. The network is address AND mask. The broadcast is network OR the inverse of the mask. For /0 through /30, usable hosts sit strictly between those two ends.

Worked example: 192.168.10.42/27

Five host bits remain, so the block holds 32 addresses. 42 sits in the block that starts at 32.

Network 192.168.10.32. Broadcast 192.168.10.63. Mask 255.255.255.224. Usable hosts 192.168.10.33 through 192.168.10.62.

Try it in the calculator, or split a larger block with the subnet splitter.

04

VLSM (Variable Length Subnet Masking)

VLSM assigns a different prefix to each requirement, largest first, so a 100-host LAN does not consume the same block as a 10-host LAN. Each next block starts on its own size boundary, and the blocks must stay inside the parent network.

The classic cut of 192.168.0.0/24 for 100, 50, 20, and 10 hosts is filled in below. Change the numbers to plan a different parent.

Subnet mask

255.255.255.0

Total addresses

256

Addresses left

16

192.168.0.0/24 has 16 addresses left after these blocks.

RequestedSubnetUsable rangeUsable hosts
100192.168.0.0/25192.168.0.1 - 192.168.0.126126
50192.168.0.128/26192.168.0.129 - 192.168.0.19062
20192.168.0.192/27192.168.0.193 - 192.168.0.22230
10192.168.0.224/28192.168.0.225 - 192.168.0.23814

Two hosts receive a /30, the textbook block with two usable addresses. A point-to-point link can instead use a /31 under RFC 3021. One host receives a /32.

Prefix rules follow RFC 4632. Point-to-point /31 links follow RFC 3021. Notation details are also on the CIDR guide.