Subnet Design and VLSM
Unit 4: IP Addressing and Subnetting. Lesson 14 of 49 in NetPlus Academy.
Real designs work backward: you know how many hosts you need and must pick a mask.
Choosing a mask for a host count
Find the smallest power of two that is at least the host count plus 2. 50 hosts need 52 addresses; 64 is the next power of two, so 6 host bits, mask /26. 200 hosts need 202, next power is 256, 8 host bits, /24. 12 hosts need 14, next power 16, /28. 2 hosts on a router link: /30.
VLSM
Variable length subnet masking means using different mask lengths in the same network so each subnet fits its purpose. Take 192.168.10.0/24: a 100-host LAN gets 192.168.10.0/25 (126 hosts), a 50-host LAN gets 192.168.10.128/26 (62), a 20-host LAN gets 192.168.10.192/27 (30), and router links get /30s starting at 192.168.10.224/30. Allocate largest first so blocks line up on their boundaries.
CIDR and supernetting
Classless inter-domain routing ignores the old classes entirely; any prefix length is valid. Going the other direction, combining several networks into one bigger advertised route is supernetting or route summarization. 10.1.0.0/24 through 10.1.3.0/24 summarize to 10.1.0.0/22. Summaries keep routing tables small.
Alignment rule
A subnet must start on a multiple of its own block size. 192.168.10.64/26 is valid; 192.168.10.96/26 is not, because 96 is not a multiple of 64.
Design sanity checks
- Every host and its gateway share the same network address when you apply the mask.
- No two subnets overlap.
- Leave room to grow; do not size a 50-host LAN as a /26 if it will hit 70 next year.
Subnet Design and VLSM, explained slowly
Working backward from a host count
Real design starts with "I need room for 50 hosts," not with a mask. The recipe:
- Add 2 to the host count (for the network and broadcast addresses).
- Round up to the next power of two.
- The exponent is the number of host bits. Subtract it from 32 for the prefix.
Hosts needed +2 Next power of two Host bits Prefix Usable 2 4 4 2 /30 2 12 14 16 4 /28 14 30 32 32 5 /27 30 31 33 64 6 /26 62 50 52 64 6 /26 62 100 102 128 7 /25 126 200 202 256 8 /24 254
Look at 30 versus 31. Thirty hosts fit a /27 exactly. Thirty-one hosts need 33 addresses, which does not fit in 32, so you must go up to a /26. Questions are built around this off-by-one.
VLSM: different masks in the same network
Old-style subnetting cut a network into equal pieces. Variable length subnet masking cuts pieces of different sizes so nothing is wasted. Given 192.168.10.0/24 and these needs: a 100-host LAN, a 50-host LAN, a 20-host LAN, and two router links.
Allocate the largest first, so each block starts on a clean boundary:
Need Prefix Assignment Usable 100 hosts /25 192.168.10.0/25 126 (.0 to .127) 50 hosts /26 192.168.10.128/26 62 (.128 to .191) 20 hosts /27 192.168.10.192/27 30 (.192 to .223) link 1 /30 192.168.10.224/30 2 (.224 to .227) link 2 /30 192.168.10.228/30 2 (.228 to .231) left over 192.168.10.232 to .255
The alignment rule
A subnet must start on a multiple of its own block size. A /26 has block size 64, so it may start at .0, .64, .128, or .192. 192.168.10.96/26 is invalid: 96 is not a multiple of 64. Allocating largest first is what keeps everything aligned automatically.
CIDR and supernetting
CIDR simply means the prefix can be any length; the old classes are ignored. Going the other way, combining several networks into one bigger advertised route is supernetting or route summarization. The four networks 10.1.0.0/24, 10.1.1.0/24, 10.1.2.0/24, and 10.1.3.0/24 share their first 22 bits, so one route, 10.1.0.0/22, covers all four. Fewer routes means smaller routing tables and faster routers.
Sanity checks for any design
- Apply the mask to a host and to its gateway: they must produce the same network address.
- No two subnets may overlap.
- Leave room to grow. A 50-host LAN that will be 70 next year should get a /25 now.
How the exam asks it
- "Most efficient mask for 30 hosts": /27. For 31 hosts: /26.
- "Which of these subnets is invalid": the one that does not start on its block boundary.
- "Summarize 172.16.4.0/24 through 172.16.7.0/24": 172.16.4.0/22.
What to memorize
- Hosts plus 2, round up to a power of two, that is the host bits.
- Largest subnets first. Blocks start on their own multiples.