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 bits from the host part gives subnets, and the remaining host bits are .
How it works
- 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.
- The host ID part is 8 bits, numbered 1 to 8.
- Using 8 bits, the number of IP addresses is and the number of configurable hosts is .
- 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.
- The first half has the chosen bit = 0 as its starting bit; the second half has the chosen bit = 1.
- The remaining 7 bits determine the range of addresses within each half.
- First half range: from all seven zeros (0000000 = 0) up to seven ones (1111111 = 127), so addresses 0 to 127.
- 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
- = total IP addresses in the Class C host part, where = number of host bits ( for Class C) →
- = usable hosts (subtract the network ID and the directed broadcast address) →
- = number of subnets when bits are borrowed (here → 2 subnets)
- = remaining host bits after borrowing (here bits)
Worked examples
Network: 200.1.2.0 (Class C). Network ID = 200.1.2, Host ID = 8 bits.
- Total addresses = ; usable hosts = (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
| Subnet | Subnet bit | Address range (last octet) | Binary range |
|---|---|---|---|
| First | 0 | 0 to 127 | 00000000 to 01111111 |
| Second | 1 | 128 to 255 | 10000000 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 bits from the host part gives subnets; the remaining host bits are .
- 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 = , and normally assignable host addresses = (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 under the modern/CIDR convention (or 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 ' - 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 ; modern CIDR allows both, giving .
Many older GATE/UGC/ISRO questions expect the classical 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 from borrowed bits unless a mask/subnet-bit design is specified.
Asked inGATE 2022