Why subnet
One network holds everyone. Why split it?
A subnet is a smaller network cut from a larger block. Broadcasts stay inside it, and traffic between subnets must pass a router.
An office has one network, and two hundred devices on it. It works, so why change it? In one network, every broadcast reaches every device, and nothing stands between a guest’s laptop and the staff machines. Split the devices into two networks with a router between them. Now a broadcast stays in its own half, and anything crossing from one to the other goes through the router, where rules can be applied. These smaller networks are called subnets.
Borrowing a bit
How does one block of addresses become two networks?
Lengthening the mask by one bit splits a block in two: a /24 becomes two /25 subnets of 126 hosts each.
You do not need new addresses to make subnets. You move the mask. A slash twenty-four mask has twenty-four network bits, and leaves eight for hosts. Make it slash twenty-five. One bit that used to number hosts now names the network. That bit is either zero or one, so there are now two networks. The first runs from zero to one hundred and twenty-seven, the second from one hundred and twenty-eight to two hundred and fifty-five. Each keeps one address for the network and one for broadcast, and has one hundred and twenty-six for hosts.
Subnetting
Borrow host bits to cut one network into equal subnets
Two borrowed bits turn 192.168.10.0/24 into four /26 subnets of 62 hosts, starting every 64 addresses.
Subnetting splits one network into several. Start with one nine two dot one six eight dot ten dot zero, slash twenty-four: two hundred and fifty-six addresses. Lengthen the mask by two bits to slash twenty-six, and there are four subnets, starting at zero, sixty-four, one twenty-eight and one ninety-two. Each has sixty-two hosts, a network address and a broadcast. Each borrowed bit doubles the subnets and halves their size.
Subnetting · Going deeper
Every prefix from /24 to /32
Each prefix step halves the block: /25 has 126 hosts, /26 62, /27 30, /28 14, /29 6, /30 2. A /31 serves a point-to-point link.
A worked example
Which subnet holds 192.168.10.77/26?
Block size is 2 to the host bits. Subnets start at multiples of it; the address belongs to the block it falls inside.
Here is the one calculation you will repeat for the rest of your career. Which subnet is this address in? Slash twenty-six leaves six host bits. Two to the power six is sixty-four, so subnets come in blocks of sixty-four. Count up in sixty-fours: zero, sixty-four, one hundred and twenty-eight, one hundred and ninety-two. Seventy-seven lies between sixty-four and one hundred and twenty-seven. So the subnet is the one that starts at sixty-four. The first address after the start is the first host, the last address in the block is the broadcast, and the one before it is the last host.
A worked example · Going deeper
Finding any host’s subnet with the block size
Block size = 256 − the mask’s interesting octet. Count in blocks to find the network; the next block minus one is the broadcast.
VLSM
Size each subnet to its need, largest first
VLSM gives each subnet its own mask: a /25 for 100 users, a /30 for a two-router link.
Equal subnets waste space when needs differ. Variable-length masks let each subnet have its own size. Start with the largest. A hundred users need a slash twenty-five, a hundred and twenty-six hosts. Fifty servers need a slash twenty-six. Twenty guests, a slash twenty-seven. and Each link between two routers needs just two addresses: a slash thirty. The whole plan fits in the first two hundred and thirty-two addresses, with room left over.
Route summarisation
Contiguous, aligned blocks collapse into one route
Four /24s from 10.1.0.0 to 10.1.3.0 share their first 22 bits, so one summary route, 10.1.0.0/22, covers them all.
Subnetting has a reverse, and routers love it. Here are four networks, ten dot one dot zero through ten dot one dot three, written as bits. The first twenty-two bits are identical. Only the last two bits of the third octet change. So a single route, ten dot one dot zero dot zero slash twenty-two, covers all four. A site can advertise one route instead of four, and the rest of the network never needs to hear about the details.