~/netref / VLSM & Supernetting
##

VLSM & Supernetting

VLSM = right-size each subnet instead of wasting a fixed mask. Always allocate largest requirement first.

// the method, step by step

  1. List every subnet by host count, largest first
  2. For each: hosts needed + 2 → round up to a power of 2
  3. Pick the prefix that fits (32 − log₂ block)
  4. Assign starting at the base address, no overlaps
  5. Leave room — the next block starts after this broadcast

// VLSM example — carving 192.168.1.0/24

NeedCIDRHostsNetworkRangeBroadcast
100 hosts/25126192.168.1.0.1 – .126.127
50 hosts/2662192.168.1.128.129 – .190.191
25 hosts/2730192.168.1.192.193 – .222.223
10 hosts/2814192.168.1.224.225 – .238.239
2 (P2P)/302192.168.1.240.241 – .242.243

// supernetting (route summarization)

192.168.0.0/24 + 192.168.1.0/24  →  192.168.0.0/23
Combine contiguous blocks by shortening the prefix to the common bits. 4× /24 → one /22, 8× → /21, and so on.

// why it works — line up the binary

192.168.0.0 = 11000000.10101000.00000000.00000000
192.168.1.0 = 11000000.10101000.00000001.00000000
First 23 bits match → summary 192.168.0.0/23. The 24th bit differs, so it can't be part of the network mask.
// summary-route quick reference
Contiguous blocksSummaryWhy
2 × /24/23common 23 bits
4 × /24/22common 22 bits
8 × /24/21common 21 bits
16 × /24/20common 20 bits
256 × /24/16one class-B-sized block