SaveMyCert
IPv4 tool

VLSM calculator

Enter an address block and the hosts each subnet needs. The calculator sizes every subnet, places them largest first, and shows the reasoning for each one, so you can check your own working for a CCNA VLSM question.

Subnets and the hosts each needs
192.168.10.0/24, largest subnet first
SubnetHostsNetworkMaskUsable rangeBroadcast
Engineering100 of 126192.168.10.0/25255.255.255.128192.168.10.1 – 192.168.10.126192.168.10.127
Sales50 of 62192.168.10.128/26255.255.255.192192.168.10.129 – 192.168.10.190192.168.10.191
Servers20 of 30192.168.10.192/27255.255.255.224192.168.10.193 – 192.168.10.222192.168.10.223
Router link2 of 2192.168.10.224/30255.255.255.252192.168.10.225 – 192.168.10.226192.168.10.227

Free for later: 192.168.10.228 – 192.168.10.255 (28 addresses).

How it is allocated

  1. Sort the subnets by hosts needed, largest first: Engineering (100), Sales (50), Servers (20), Router link (2). Placing the largest first keeps every later subnet on a valid boundary.
  2. Engineering needs 100 hosts. 7 host bits give 2^7 − 2 = 126 usable, and one bit fewer gives only 62, so it gets a /25 (255.255.255.128). It starts at the next free address, 192.168.10.0, and runs to 192.168.10.127.
  3. Sales needs 50 hosts. 6 host bits give 2^6 − 2 = 62 usable, and one bit fewer gives only 30, so it gets a /26 (255.255.255.192). It starts at the next free address, 192.168.10.128, and runs to 192.168.10.191.
  4. Servers needs 20 hosts. 5 host bits give 2^5 − 2 = 30 usable, and one bit fewer gives only 14, so it gets a /27 (255.255.255.224). It starts at the next free address, 192.168.10.192, and runs to 192.168.10.223.
  5. Router link needs 2 hosts. 2 host bits give 2^2 − 2 = 2 usable, so it gets a /30 (255.255.255.252). It starts at the next free address, 192.168.10.224, and runs to 192.168.10.227.
  6. That leaves 192.168.10.228 – 192.168.10.255 (28 addresses) free for later subnets.

VLSM explained

VLSM (variable length subnet masking) splits one address block into subnets of different sizes, each sized to the hosts it needs. Fixed-length subnetting (FLSM) gives every subnet the same mask, so a two-router link gets as many addresses as a 100-person office; VLSM gives the link a /30 and the office a /25.

The method is always the same: sort the subnets from most hosts to fewest, give each the smallest subnet that holds its hosts (2^h − 2 must be at least the hosts, where h is the number of host bits), and place each one at the next free address. Because the sizes only shrink, each subnet starts on a multiple of its own size, which is what makes the address a valid network address.

Worked example: one /24, three subnets

An office of 120 hosts and two small segments of 8 hosts each, carved from 192.168.1.0/24.

VLSM allocation of 192.168.1.0/24
SubnetHostsNetworkUsable rangeBroadcast
Office120192.168.1.0/25192.168.1.1 – 192.168.1.126192.168.1.127
Lab8192.168.1.128/28192.168.1.129 – 192.168.1.142192.168.1.143
Printers8192.168.1.144/28192.168.1.145 – 192.168.1.158192.168.1.159
  1. Sort the subnets by hosts needed, largest first: Office (120), Lab (8), Printers (8). Placing the largest first keeps every later subnet on a valid boundary.
  2. Office needs 120 hosts. 7 host bits give 2^7 − 2 = 126 usable, and one bit fewer gives only 62, so it gets a /25 (255.255.255.128). It starts at the next free address, 192.168.1.0, and runs to 192.168.1.127.
  3. Lab needs 8 hosts. 4 host bits give 2^4 − 2 = 14 usable, and one bit fewer gives only 6, so it gets a /28 (255.255.255.240). It starts at the next free address, 192.168.1.128, and runs to 192.168.1.143.
  4. Printers needs 8 hosts. 4 host bits give 2^4 − 2 = 14 usable, and one bit fewer gives only 6, so it gets a /28 (255.255.255.240). It starts at the next free address, 192.168.1.144, and runs to 192.168.1.159.
  5. That leaves 192.168.1.160 – 192.168.1.255 (96 addresses) free for later subnets.

Rules that catch people out

  • Allocate largest first. Placing a small subnet first can leave the next free address off a boundary the bigger subnet can start on, which wastes the gap or overlaps.
  • Size by usable hosts, not addresses: 32 hosts do not fit a /27 (30 usable); they need a /26.
  • A subnet must start on a multiple of its block size. A /23 needs an even third octet (10.1.4.0/23 is valid, 10.1.5.0/23 is not), and a /30 in the fourth octet starts on a multiple of 4.
  • Point-to-point router links need 2 hosts: a /30, or a /31 where both ends support RFC 3021.
  • Leave the free space at the end in one piece, so a later subnet or a summary route can still use it.

Practise the method

VLSM: your questions

Because every subnet must start on a multiple of its own size. If you place the biggest first, each later, smaller subnet starts where the previous one ended, which is always a valid boundary for it. Placing small subnets first leaves gaps that a larger subnet cannot start in.