Interview Q&A / Computer Networks

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What is VLSM? Allocate subnets for 100, 50 and 20 hosts from 192.168.5.0/24.

SHORT ANSWER

VLSM (variable length subnet masking) lets each subnet use the mask that fits its size instead of one size for all. Allocate largest first: /25 for 100 hosts, /26 for 50, /27 for 20, and a /30 for a router link.

Explain it simply

If every room in a building were the same size, the seminar hall would be tiny and the store room huge. VLSM lets you cut the floor into rooms of different sizes, each fitted to what goes in it.

Example

text
Need 100 hosts -> 2^7 - 2 = 126 -> /25   192.168.5.0/25     (.0   - .127)
Need  50 hosts -> 2^6 - 2 =  62 -> /26   192.168.5.128/26   (.128 - .191)
Need  20 hosts -> 2^5 - 2 =  30 -> /27   192.168.5.192/27   (.192 - .223)
Router link    -> 2 hosts       -> /30   192.168.5.224/30   (.224 - .227)

Each starts where the previous ended, aligned to its own block size. Remaining space .228 to .255 stays free for later.

With a fixed mask of /25 for everyone, you could fit only two subnets and the link would waste 126 addresses. Allocating the biggest block first avoids alignment gaps, because a block must start at a multiple of its size: a /25 can only begin at .0 or .128.

What to say in the interview

"VLSM uses different prefix lengths in one network to waste fewer addresses. I sort requirements largest first, pick the smallest block that fits each (adding 2 for network and broadcast), and place blocks consecutively on proper boundaries."

Common mistakes

  • Placing a large block after a small one so it starts on a misaligned address.

#vlsm#subnetting#worked-example

Related questions

Practise more Computer Networks questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Computer Networks quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.