What is Subnetting?
Subnetting is the mathematical and logical process of taking a single, large IP network and dividing it into multiple smaller, manageable networks called subnets.
Instead of having hundreds of devices communicating in one massive network, subnetting allows network administrators to group devices logically. For example, a company can place its Sales, HR, and IT departments into their own isolated subnets. Traffic within a department stays within its own subnet, and routers handle communication between different departments.
The Need for Subnetting
To understand why subnetting is critical, consider a company with a Class C network address of 192.168.1.0/24, which provides 256 total IP addresses. The company has three departments requiring a total of 80 IP addresses.
- Without Subnetting: All three departments share the exact same network. Every broadcast message floods the entire company. Security is poor because any device can freely access any other device. Furthermore, the remaining unused IP addresses are completely wasted.
- With Subnetting: The massive network is sliced into three separate subnets tailored to the size of each department. Broadcast traffic is strictly contained within each department. Security is enhanced because traffic between departments must pass through a router, which can block unauthorized access.
Key Concepts
- Network and Host Portions: Every IP address has two parts. The Network portion identifies the overall network, while the Host portion identifies the specific device inside that network.
- Subnet Mask: A 32 bit number that acts as a filter. It tells devices exactly which part of the IP address is the network and which part is the host.
- CIDR Notation: Instead of writing out a full subnet mask like 255.255.255.0, CIDR notation uses a simple slash followed by the number of network bits. For example, /24 means the first 24 bits belong to the network.
How Subnetting Works
Subnetting works by borrowing bits from the Host portion of the IP address and reassigning them to the Network portion. The more bits you borrow, the more subnets you can create, but the fewer hosts you can have per subnet.
Example: Dividing a Network into Two Subnets
Suppose we have the Class C network 193.1.2.0/24. This network has 8 bits for the host ID. To split this network into two equal halves, we must borrow exactly 1 bit from the host ID. By borrowing 1 bit, the new subnet mask becomes /25, which is 255.255.255.128.
- Subnet 1 (The borrowed bit is 0): The range starts at 193.1.2.0 and ends at 193.1.2.127. The Subnet ID is 193.1.2.0. The Broadcast ID is 193.1.2.127. There are exactly 126 usable hosts in this subnet.
- Subnet 2 (The borrowed bit is 1): The range starts at 193.1.2.128 and ends at 193.1.2.255. The Subnet ID is 193.1.2.128. The Broadcast ID is 193.1.2.255. There are exactly 126 usable hosts in this subnet.
Important Rule: If you borrow 2 bits, you create 4 subnets. If you borrow 3 bits, you create 8 subnets. As the number of subnets mathematically increases, the total number of usable hosts per subnet strictly decreases.
Advantages and Disadvantages
| Aspect | Details |
|---|---|
| Advantages | Improves security by isolating departments. Prioritizes critical traffic. Makes maintaining massive networks significantly easier by compartmentalizing them. |
| Disadvantages | Wastes exactly 2 IP addresses per subnet (for the Subnet ID and Broadcast ID). Increases hardware costs because routers are required to link subnets. Adds complexity to network design. |
