</>
ShikshaCSLearn. Code. Grow.
๐Ÿ”
โ˜• Support Us
ShikshaCSโ€บNotesโ€บComputer Networks
Computer Networks
๐Ÿ•’ 10 min read

Subnetting Explained

Splitting one big network into smaller, organized pieces โ€” with actual math you can follow.

Why Subnet at All?

Without subnetting, an organization with one large network would have all devices in one giant broadcast domain โ€” wasteful and hard to manage. Subnetting divides a large network into smaller logical sub-networks (subnets), improving organization (different departments on different subnets), security (isolating traffic), and efficient use of IP addresses.

The Subnet Mask

A subnet mask (like 255.255.255.0) works alongside an IP address to define which bits represent the network portion and which represent the host portion. Written in CIDR notation, /24 means the first 24 bits are the network portion โ€” this shorthand is much easier to work with than writing out the full mask every time.

How Subnetting Actually Works

To create subnets, you 'borrow' bits from the host portion and give them to the network portion. Borrowing 1 bit doubles the number of subnets (but halves hosts per subnet) โ€” borrowing 2 bits gives you 4 subnets, borrowing 3 bits gives you 8 subnets, and so on (2^n subnets, where n is bits borrowed).

A Worked Example

Take 192.168.1.0/24 (256 total addresses) and split it into 4 equal subnets. Since 2ยฒ = 4, borrow 2 bits, making each subnet a /26 (256 รท 4 = 64 addresses each). The four subnets become: 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26, and 192.168.1.192/26 โ€” each with 64 total addresses, but only 62 usable (1 reserved for the network address, 1 for broadcast).

Calculating Usable Hosts

The formula for usable hosts per subnet is 2^h โˆ’ 2, where h is the number of host bits remaining. For a /26 subnet, there are 32 host bits total minus 26 network bits = 6 host bits, giving 2^6 โˆ’ 2 = 62 usable addresses. The 'โˆ’2' always accounts for the network address (all host bits 0) and broadcast address (all host bits 1), which can't be assigned to actual devices.

๐ŸŒ Real-World Use

A college might subnet its network so the Computer Science lab, the Admin office, and the Library each get their own subnet โ€” this isolates traffic (a virus in one lab doesn't directly flood the whole campus network) and makes troubleshooting far easier since each subnet is a smaller, more manageable chunk.

๐Ÿ’ก Pro Tip

Memorize this single formula and you can solve almost any subnetting question: usable hosts = 2^(host bits) โˆ’ 2. Practice a few examples by hand until the borrowing logic feels automatic โ€” this is one of the most heavily tested calculation-based topics in Computer Networks exams.

๐Ÿงช Quick Self-Test

Check what you just learned โ€” no pressure, just practice.

1. How many usable host addresses does a /26 subnet have?

2. If you borrow 3 bits for subnetting, how many subnets do you create?

3. Why is 2 subtracted when calculating usable hosts per subnet?

โ† Back to all Notes