Computer Networks · VLSM
Worked Example: Dividing a Class C Network into 128/64/64 Subnets
Overview
VLSM (Variable Length Subnet Masking) divides a network into subnets of different sizes, each with its own subnet mask.
This example splits the Class C network 200.1.2.0 into three subnets of 128, 64 and 64 addresses, showing why equal-length subnetting cannot do this and how fixing host-ID bits one at a time produces the required sizes.
Key concepts
- Variable Length Subnet Masking (VLSM): subnetting in which the subnets have different (unequal) sizes; because each subnet has a different size, each gets a different subnet mask — hence variable length.
- Subnet ID: the first IP address of a subnet.
- Directed broadcast address: the last IP address of a subnet.
- Host ID part: for the Class C network 200.1.2.0, 8 bits.
- Fixed-length subnetting: borrowing bits gives equal subnets, so it cannot mix a 128-address subnet with 64-address subnets.
How it works
- Check total addresses available. The network is 200.1.2.0 (Class C, 8 host-ID bits). The requirement is addresses; since and , the network has exactly enough addresses.
- Show why fixed-length subnetting fails. With 8 host bits, 1 borrowed bit gives 2 subnets and 2 borrowed bits give 4 subnets, so at least 2 bits must be borrowed to get 3 subnets.
With 2 bits borrowed, 6 bits remain, giving subnet size addresses each — a 128-address subnet is impossible this way. - Apply the VLSM method (divide like class-based addressing). Take the 8 host-ID bits.
- First split: fix the first bit. This divides all addresses into two halves — one with 0 in that bit, one with 1.
- Second split: in the half where the first bit is 1, fix the second bit, giving 0 for one subnet and 1 for the other.
- Result: first bit 0 leaves 7 bits → addresses; bits 10 leave 6 bits → addresses; bits 11 leave 6 bits → addresses.
- Find the subnet ID and range of each subnet. The subnet ID is the first IP address; the last IP is the directed broadcast address.
- Subnet 1 (first bit 0): remaining 7 bits run from all zeros to all ones. First IP 200.1.2.0 (subnet ID), last IP 200.1.2.127 (seven ones = 127, directed broadcast), 128 addresses.
- Subnet 2 (bits 10): remaining 6 bits run from all zeros to all ones.
First IP is 1 followed by 7 zeros = 128, so 200.1.2.128 (subnet ID);
last IP , so 200.1.2.191 (directed broadcast), 64 addresses. - Subnet 3 (bits 11): first IP 200.1.2.192 (subnet ID), last IP 200.1.2.255 (directed broadcast), 64 addresses.
Formulas
- Number of subnets from borrowed bits:
- Subnet size (addresses per subnet): , where = number of bits remaining in the host ID part
- Last IP of a subnet:
- Directed broadcast address = last IP address of the subnet
- Subnet ID = first IP address of the subnet
Worked examples
Network 200.1.2.0, requirement 128 / 64 / 64:
| Subnet | Fixed host-ID bits | Remaining bits | Size | Subnet ID | Directed Broadcast |
|---|---|---|---|---|---|
| 1 | 0 | 7 | 200.1.2.0 | 200.1.2.127 | |
| 2 | 10 | 6 | 200.1.2.128 | 200.1.2.191 | |
| 3 | 11 | 6 | 200.1.2.192 | 200.1.2.255 |
- Subnet 2 last IP check: .
- Total: addresses, matching the Class C host space.
- In prefix notation: 200.1.2.0/25 (0–127), 200.1.2.128/26 (128–191), 200.1.2.192/26 (192–255).
Comparison
| Method | Bits borrowed | Subnet sizes | Fits 128/64/64? |
|---|---|---|---|
| Fixed-length (equal) subnetting | 2 | 4 subnets of 64 each | No — no subnet of 128 |
| VLSM (unequal) | 1 bit, then 1 more bit in one half | 128, 64, 64 | Yes |
Revision summary
- VLSM means subnets of different sizes, hence a different subnet mask per subnet.
- Always first verify the total requirement fits the available host bits: here .
- Equal subnetting with 2 borrowed bits gives only 4 × 64 and cannot satisfy a 128-address subnet.
- VLSM trick: fix bits one at a time — first bit 0 gives the 128-size block; in the 1-half, the second bit (0 or 1) gives two 64-size blocks.
- Subnet ID = first IP address; directed broadcast = last IP address of each block.
- This arrangement is not necessarily the only possible answer — other valid VLSM layouts can also exist.
Previous-year exam insights
- A subnet of block size addresses provides only usable host addresses, because the first address (subnet/network ID) and the last address (directed broadcast) are reserved; so a host requirement of N needs the smallest with .
Asked inGATE 2005 - The subnet mask for a prefix /p is p leading 1-bits followed by 0s;
for a Class C network the last octet is /25 = 255.255.255.128, /26 = .192, /27 = .224, /28 = .240, /29 = .248, /30 = .252 (i.e. 256 − block size).
Asked inGATE 2005 - A block of size must start at an address that is a multiple of (alignment): a /25 block can only start at .0 or .128 of the last octet, a /26 block only at .0, .64, .128 or .192, and so on.
Asked inGATE 2005 - In VLSM the largest subnet should be allocated first, then the next largest, and so on; this guarantees each block's start address is properly aligned and prevents a large block from being blocked by earlier small allocations.
Asked inGATE 2005 - Subnets must be disjoint and contained in the given network: a block starting at S with size ends at (its directed broadcast), and the next block may start at ; ranges must never overlap.
Asked inGATE 2005 - With ordinary fixed-length (classful) subnetting all subnets derived from one network share the same mask; a set of subnets having different masks is only possible under VLSM/CIDR.
Asked inGATE 2005