1. Gyanastra
  2. Computer Networks
  3. VLSM
  4. Worked Example: Dividing a Class C Network into 128/64/64 Subnets
Free lesson, no account needed 6 min read 59 practice questions after it
Asked in past papers1 time
  • GATE CSE2005

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 ss bits gives 2s2^s equal subnets, so it cannot mix a 128-address subnet with 64-address subnets.

How it works

  1. Check total addresses available. The network is 200.1.2.0 (Class C, 8 host-ID bits). The requirement is 128+64+64=256128 + 64 + 64 = 256 addresses; since 64+64=12864 + 64 = 128 and 128+128=256128 + 128 = 256, the network has exactly enough addresses.
  2. 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 26=642^6 = 64 addresses each — a 128-address subnet is impossible this way.
  3. 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 → 27=1282^7 = 128 addresses; bits 10 leave 6 bits → 26=642^6 = 64 addresses; bits 11 leave 6 bits → 26=642^6 = 64 addresses.
  4. 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 128+63=191128 + 63 = 191, 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 ss borrowed bits: 2s2^s
  • Subnet size (addresses per subnet): 2h2^h, where hh = number of bits remaining in the host ID part
  • Last IP of a subnet: subnet ID+(subnet size−1)\text{subnet ID} + (\text{subnet size} - 1)
  • 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:

SubnetFixed host-ID bitsRemaining bitsSizeSubnet IDDirected Broadcast
10727=1282^7 = 128200.1.2.0200.1.2.127
210626=642^6 = 64200.1.2.128200.1.2.191
311626=642^6 = 64200.1.2.192200.1.2.255
  • Subnet 2 last IP check: 128+63=191128 + 63 = 191.
  • Total: 128+64+64=256128 + 64 + 64 = 256 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

MethodBits borrowedSubnet sizesFits 128/64/64?
Fixed-length (equal) subnetting24 subnets of 64 eachNo — no subnet of 128
VLSM (unequal)1 bit, then 1 more bit in one half128, 64, 64Yes

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 128+64+64=256=28128 + 64 + 64 = 256 = 2^8.
  • 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 2h2^{h} addresses provides only 2h−22^{h} - 2 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 2h2^{h} with 2h−2≥N2^{h} - 2 \ge N.
    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 2h2^{h} must start at an address that is a multiple of 2h2^{h} (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 2h2^{h} ends at S+2h−1S + 2^{h} - 1 (its directed broadcast), and the next block may start at S+2hS + 2^{h}; 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
Pages 1–2 of 2