Skip to content

hop 13 of 32 · 6 min

Subnetting, worked properly

A college is given 172.16.0.0/22 and four departments to fit into it. This is the calculation exams are built around, and it is entirely mechanical once you do it in the right order.

How big is the block

A /22 leaves 32 minus 22 = 10 host bits, so 2^10 = 1024 addresses, 1022 usable.

The departments

DepartmentHosts needed
CSE500
ECE250
Mechanical100
Admin50

Total 900. It fits, but only just, and only if each subnet is sized properly.

Size each one first

Hosts plus 2, rounded up to a power of two:

DeptNeedsPlus 2Power of 2Host bitsPrefixUsable
CSE5005025129/23510
ECE2502522568/24254
Mech1001021287/25126
Admin5052646/2662

Lay them out largest first

DeptPrefixRange
CSE172.16.0.0/23172.16.0.0 to 172.16.1.255
ECE172.16.2.0/24172.16.2.0 to 172.16.2.255
Mech172.16.3.0/25172.16.3.0 to 172.16.3.127
Admin172.16.3.128/26172.16.3.128 to 172.16.3.191

The block ends at 172.16.3.255, so 64 addresses are left over. Rounding every department up to a whole /24 would have needed a /21, twice the space.

This is VLSM, variable length subnet masking: different sized subnets in one block. Always allocate largest first, or you strand gaps too small to use.

Subnetting, worked properly