1. Gyanastra
  2. Computer Networks
  3. Subnetting
  4. Subnetting a Class C Network Using Subnet ID Bits
Free lesson, no account needed 6 min read 115 practice questions after it
Asked in past papers17 times
  • GATE CSE2026202220192010200820072005
  • ISRO20162014201320092008
  • UGC NET20192017201320062005

Computer Networks · Subnetting

Subnetting a Class C Network Using Subnet ID Bits

Overview

Subnetting divides a single network's address space into smaller sub-networks (subnets). Although it has both advantages and disadvantages, the advantages are more prominent, which is why subnetting is used in practice.
For a Class C network, borrowing bits from the 8-bit host ID splits its 256 addresses into smaller ranges.

Key concepts

  • Subnetting: the process of dividing a single network's address space into smaller sub-networks (subnets).
  • Class C host ID: a Class C network has 8 bits in the host ID part, giving 256 total IP addresses and 254 usable hosts.
  • Network ID and directed broadcast: the first address (all host bits 0) is the network ID and the last address (all host bits 1) is the directed broadcast address; neither is assigned to a host.
  • Borrowed subnet bits: the borrowed bit becomes the subnet ID, and the remaining bits form the new host ID. Borrowing ss bits from the host part gives 2s2^s subnets, and the remaining host bits are h−sh - s.

How it works

  1. Take the Class C network 200.1.2.0. The first three octets (200.1.2) form the network ID, and the last 8 bits form the host ID.
  2. The host ID part is 8 bits, numbered 1 to 8.
  3. Using 8 bits, the number of IP addresses is 28=2562^8 = 256 and the number of configurable hosts is 28−2=2542^8 - 2 = 254.
  4. To divide the 256-address space into two parts, choose 1 bit from the 8 host bits; choosing 1 bit splits the number space into two halves.
  5. The first half has the chosen bit = 0 as its starting bit; the second half has the chosen bit = 1.
  6. The remaining 7 bits determine the range of addresses within each half.
  7. First half range: from all seven zeros (0000000 = 0) up to seven ones (1111111 = 127), so addresses 0 to 127.
  8. Second half range: the chosen bit is 1 and the remaining 7 bits run from 0000000 to 1111111, so the first address is 10000000 = 128, the next is 10000001 = 129, and so on up to 11111111 = 255.

Formulas

  • 2h2^h = total IP addresses in the Class C host part, where hh = number of host bits (h=8h = 8 for Class C) → 28=2562^8 = 256
  • 2h−22^h - 2 = usable hosts (subtract the network ID and the directed broadcast address) → 28−2=2542^8 - 2 = 254
  • 2s2^s = number of subnets when ss bits are borrowed (here s=1s = 1 → 2 subnets)
  • h−sh - s = remaining host bits after borrowing (here 8−1=78 - 1 = 7 bits)

Worked examples

Network: 200.1.2.0 (Class C). Network ID = 200.1.2, Host ID = 8 bits.

  • Total addresses = 28=2562^8 = 256; usable hosts = 256−2=254256 - 2 = 254 (first = network ID, last = directed broadcast).
  • Borrow 1 bit from the 8 host bits to create 2 subnets.
  • Subnet bit = 0 → first half; subnet bit = 1 → second half.
  • First subnet range: 00000000 (= 0) to 01111111 (= 127), i.e. addresses 0 to 127.
  • Second subnet range: 10000000 (= 128) to 11111111 (= 255), i.e. addresses 128 to 255.

Comparison

SubnetSubnet bitAddress range (last octet)Binary range
First00 to 12700000000 to 01111111
Second1128 to 25510000000 to 11111111

Revision summary

  • Class C has 8 host bits → 256 addresses, 254 usable hosts.
  • The first address (all host bits 0) is the network ID; the last address (all host bits 1) is the directed broadcast address; neither is assigned to a host.
  • Borrowing ss bits from the host part gives 2s2^s subnets; the remaining host bits are h−sh - s.
  • Borrowing 1 bit gives 2 subnets: range 0–127 (bit = 0) and 128–255 (bit = 1).
  • The borrowed bit becomes the subnet ID; the remaining bits form the new host ID.

Previous-year exam insights

  • For any IPv4 subnet mask of prefix length /n, host bits h = 32 - n;
    total addresses per subnet = 2h2^{h}, and normally assignable host addresses = 2h−22^{h} - 2 (network address and directed broadcast excluded).
    In classful networks the default host-bit counts are 24 for Class A, 16 for Class B, and 8 for Class C;
    borrowing s subnet bits leaves h = original host bits - s.
    The dotted mask has n leading 1 bits followed by h zero bits.
    Asked inGATE 2026GATE 2008GATE 2005
  • To test whether two IP addresses are in the same subnet, bitwise-AND each address with the given subnet mask and compare the resulting network addresses: equal means same subnet, different means different subnets.
    Asked inGATE 2019GATE 2010
  • A host's default gateway must be an IP address of a router interface that lies in the same subnet as the host; compute the host's subnet using its mask and choose only a router interface IP whose masked network address matches.
    Asked inGATE 2008
  • For subnet design, to support k subnets choose the smallest s such that 2s≥k2^{s} \ge k under the modern/CIDR convention (or 2s−2≥k2^{s} - 2 \ge k under the classical reserved-subnet convention), then new prefix length = original classful prefix + s.
    To support H usable hosts per subnet, choose host bits h' such that 2h2^{h}' - 2 ≥ H.
    Asked inGATE 2005UGC NET 2019
  • Classical classful subnetting sometimes prohibits using the all-zero subnet ID and the all-ones subnet ID, so the maximum usable subnets is 2s−22^{s} - 2; modern CIDR allows both, giving 2s2^{s}.
    Many older GATE/UGC/ISRO questions expect the classical 2s−22^{s} - 2 convention when they say an s-bit subnet number, so check the options and question wording.
    Asked inGATE 2007UGC NET 2017ISRO 2016
  • In a routed enterprise diagram, each LAN segment and each router interface/link that forms a separate broadcast domain normally corresponds to a distinct IP subnet; count the distinct subnets actually needed by the topology, not merely 2s2^{s} from borrowed bits unless a mask/subnet-bit design is specified.
    Asked inGATE 2022
Pages 1–2 of 2