Course outline · 0% complete

0/30 lessons0%

Course overview →

VLSM, splitting a block into unequal subnets

lesson 4-4 · ~13 min · 12/30

Equal subnets waste addresses

Lesson 4-3 always cut the block into equal pieces, which is easy and wrong for most real networks. Real requirements are lopsided:

SegmentHosts needed
Sales floor500
Engineering200
Operations60
Guest Wi-Fi12
Router to router link2

Suppose you hold 10.20.0.0/22, which is 1,024 addresses. Cut it into 5 equal pieces and each must be a /25 with 126 usable, so Sales does not fit at all. Size every subnet for the biggest requirement and you need 5 × 512 = 2,560 addresses, two and a half times what you have.

VLSM (variable length subnet masking) is the fix: give each segment a prefix sized for its own requirement. It is not a new protocol, it is just doing Lesson 4-3's arithmetic several times with different prefixes inside one parent block. Every router since the mid 1990s supports it, because CIDR made prefix length explicit in every route advertisement.

The algorithm

Follow this order strictly. Doing it out of order creates overlaps that are painful to unwind.

1. Sort the requirements from largest to smallest. 2. For each, find the smallest prefix whose usable count covers it. Remember to add 2 for the network and broadcast addresses before rounding up to a power of two. 3. Allocate from the lowest free address, walking upward. 4. Each subnet must start on a multiple of its own block size, which is automatic when you allocate largest first, and is exactly what breaks when you do not. 5. Record the network, first host, last host, and broadcast for each. 6. Sum the block sizes and confirm the total fits inside the parent.

Step 1 is the part people skip. Placing the /30 link first would put a 4 address subnet at 10.20.0.0, and then the 512 address subnet cannot start at 10.20.0.0 or 10.20.0.4, because neither leaves it aligned. The next legal start would be 10.20.2.0, wasting half the parent block.

The plan, worked out

Parent block: 10.20.0.0/22, addresses 10.20.0.0 through 10.20.3.255.

Sizing each requirement first:

SegmentNeedsPlus 2Round upPrefixBlock size
Sales500502512/23512
Engineering200202256/24256
Operations606264/2664
Guest Wi-Fi121416/2816
Router link244/304

Now allocate from 10.20.0.0 upward, largest first.

SegmentNetworkFirst hostLast hostBroadcast
Sales10.20.0.0/2310.20.0.110.20.1.25410.20.1.255
Engineering10.20.2.0/2410.20.2.110.20.2.25410.20.2.255
Operations10.20.3.0/2610.20.3.110.20.3.6210.20.3.63
Guest Wi-Fi10.20.3.64/2810.20.3.6510.20.3.7810.20.3.79
Router link10.20.3.80/3010.20.3.8110.20.3.8210.20.3.83

Check the alignment column by column. 0 is a multiple of 512. 512, which is 10.20.2.0 counted from the start of the block, is a multiple of 256. 768 is a multiple of 64. 832 is a multiple of 16. 848 is a multiple of 4. Every subnet is legal.

Check the sum:

512 + 256 + 64 + 16 + 4 = 852 addresses used
1024 - 852 = 172 addresses free
free space: 10.20.3.84 through 10.20.3.255

That leftover is contiguous and aligned enough to carve a /26 and a /28 later, which is exactly why you allocate upward and keep the tail free.

10.20.0.0/22 · 1,024 addressesSales /23 · 512Eng /24 · 256/26/28 and /3010.20.0.010.20.2.0free172 addresses left for growth, from 10.20.3.84
VLSM inside 10.20.0.0/22. Largest subnet first, each starting on a multiple of its own block size, with the tail left free for growth.

Point to point links, and going back up

Two habits follow from the plan above.

Use /30 or /31 for links between routers. A link with exactly two ends needs exactly two addresses. Burning a /24 on it, which people do, wastes 252 addresses per link, and a network with 40 links wastes 10,000 addresses for nothing.

Summarize on the way out. VLSM splits a block downward. Supernetting, also called route aggregation, is the same arithmetic upward: describe several adjacent subnets with one shorter prefix. Our entire plan lives inside 10.20.0.0/22, so the router that owns it advertises exactly one route to the rest of the network instead of five.

10.20.0.0/23   \
10.20.2.0/24    \
10.20.3.0/26     >  all covered by  10.20.0.0/22
10.20.3.64/28   /
10.20.3.80/30  /

Aggregation only works when the subnets are contiguous and aligned, which is the deeper reason the allocation order in this lesson matters. A tidy address plan makes small routing tables, and small routing tables make fast routers. Lesson 5-1 shows the table itself, and why the router picks the longest matching prefix rather than the first one it sees.

One planning tip that costs nothing. Reserve a whole block per site or per purpose, even if you only use a slice of it today. Renumbering a live network is one of the least popular tasks in the profession, and a plan with room in it is the way to avoid ever doing it.