online posts 15
networking 101: how computers talk

lesson 3.3 · chapter 3 of 5: addresses · 30 min

Subnetting with VLSM

objective

Cut one block of addresses into subnets of different sizes with VLSM: biggest first, the smallest block that fits, no overlaps, and write down each subnet’s network, hosts and broadcast.

1 explain

Sharing out a block of addresses

Sharing a pizza fairly

Five friends share a big pizza. One is starving, one is quite hungry, and three just want a nibble. If you cut it into five equal slices, the starving one goes hungry and the nibblers leave crusts. If you cut big slices for the hungry ones and small slivers for the rest, everyone gets what they need and there might even be some left over.

in one sentence Give each person the size of slice they need, not the same slice for everyone.

Subnets

A school or company is usually given one block of addresses, like 192.168.10.0/24 (256 addresses: from lesson 3.2). Cutting that block into smaller networks is called subnetting, and each small network is a subnet (sub means under or part of, like a submarine goes under the sea).

Why cut it up?

  • Groups: students, teachers and cameras each get their own subnet, so each can have its own rules.
  • Fewer announcements: each subnet is its own broadcast domain (lesson 2.2), so broadcasts stay smaller.
  • No waste: each group gets the size it needs.

in one sentence Subnetting cuts one block of addresses into smaller networks called subnets.

VLSM: a different size for each

The simple way is to cut equal pieces, but groups aren’t equal: 100 students and 2 addresses for a cable between two routers. Equal pieces big enough for the biggest group would waste nearly all of the small ones.

VLSM stands for Variable Length Subnet Masks. Variable means can change, and the length is the prefix from lesson 3.2. So: each subnet gets its own prefix, just big enough for its group. That’s the pizza cut to fit.

in one sentence VLSM gives each subnet its own prefix, so each group gets the size it needs.

Sizes come in doubles

Subnets can’t be any size: they come in powers of two, numbers you get by doubling, starting from 1: 2, 4, 8, 16, 32, 64, 128, 256. That’s because each host bit doubles the addresses (lesson 3.2). And remember, every subnet loses two addresses: the network address and the broadcast.

Hosts needed (up to)+ 2Block sizePrefix
244/30
688/29
141616/28
303232/27
626464/26
126128128/25
254256256/24

in one sentence A subnet’s size is a power of two, and two of its addresses are always taken.

The recipe

  1. List the groups, biggest first.
  2. For each group, add 2 (for the network address and the broadcast).
  3. Find the smallest power of two that’s at least that number. That’s the block size. Which power it is, is the number of host bits: 64 = 2⁶, so 6 host bits.
  4. The prefix is 32 minus the host bits: 32 − 6 = /26.
  5. Place it at the next free address. A block has to start at a multiple of its own size (a block of 64 starts at 0, 64, 128 or 192). Going biggest first means it always does, with no gaps.
  6. Write down the network (the first address), the hosts (everything between) and the broadcast (the network plus the block size, minus 1).

in one sentence Biggest first, add 2, round up to a power of two, place it at the next free address.

2 show

A school’s network

A school has the block 192.168.10.0/24: 256 addresses. It needs five subnets:

GroupHosts
Students100
Teachers50
Office20
Cameras10
Link between two routers2

With equal pieces, every subnet would have to fit 100 students: a /25 each, 128 addresses. Five of those is 640 addresses, and the school only has 256. It doesn’t fit! With VLSM, it does, with room to spare. Watch.

in one sentence Equal slices don’t fit this school’s 256 addresses; slices cut to size do.

3 follow along

Carve it up, step by step

The bar is the whole block, .0 on the left to .255 on the right. Each step carves out one subnet, and the table fills in. Press Play, or step with → and say each answer out loud before you look.

subnethostsblocknetworkusable hostsbroadcast

Let’s check one by hand, the Office:

  1. 20 hosts + 2 = 22.
  2. The smallest power of two that’s at least 22 is 32 = 2⁵. So 5 host bits.
  3. Prefix: 32 − 5 = /27.
  4. Students used .0 to .127, Teachers .128 to .191. The next free address is .192, and 192 is a multiple of 32. ✓
  5. Network 192.168.10.192/27, hosts .193 to .222, broadcast .192 + 32 − 1 = .223.

Now check the Cameras the same way, then compare with the table.

in one sentence Each subnet takes the smallest power-of-two block that fits its hosts plus two, placed biggest first.

4 challenge

Your turn: a gaming club

A gaming club has the block 172.16.0.0/24. Plan its subnets with VLSM:

GroupHosts
Library25
Gaming lab60
Printers5
Staff12
Router link A2
Router link B2

For each one, write the prefix, network, usable hosts and broadcast. How many addresses are left over?

hint

Sort them first: Gaming lab 60, Library 25, Staff 12, Printers 5, then the two links.

hint

Gaming lab: 60 + 2 = 62, so a block of 64, a /26, starting at 172.16.0.0. Library: 25 + 2 = 27, so a block of 32, a /27, starting at .64.

hint

Each router link is a /30, a block of 4.

show the solution

Here it is, step by step:

subnethostsblocknetworkusable hostsbroadcast
GroupPrefixNetworkUsable hostsBroadcast
Gaming lab/26172.16.0.0.1 – .62172.16.0.63
Library/27172.16.0.64.65 – .94172.16.0.95
Staff/28172.16.0.96.97 – .110172.16.0.111
Printers/29172.16.0.112.113 – .118172.16.0.119
Link A/30172.16.0.120.121 – .122172.16.0.123
Link B/30172.16.0.124.125 – .126172.16.0.127

128 addresses are left over: 172.16.0.128 to 172.16.0.255, a whole /25, ready for whatever the club needs next.

5 check: test yourself

Pick an answer for each question. You'll see straight away whether it's right, and why. Questions marked what happens next? are about the animations.

  1. A subnet needs 20 hosts. What’s the smallest prefix that fits?

  2. Why place the biggest subnets first?

  3. what happens next?In the animation, Students (/25) has just been placed at 192.168.10.0, using .0 to .127. What happens next?

  4. A cable between two routers needs just two addresses. Which prefix?