info Introduction to Subnetting
Subnetting is the process of dividing a large IP network into smaller logical networks called subnets. Each subnet allows devices to communicate efficiently, improving network performance, security, and manageability.
Real World Example
Imagine a Pizza Delivery System. If the entire world was one single zone, a driver in New York might get an order for Tokyo. Chaos!
Instead, we use Zip Codes (Subnets). The hub sends the package to the City (Network ID), then local post office (Subnet), then your house (Host ID).
Why Subnetting is Important
Comparing a flat network vs. a segmented network in a corporate environment.
The Scenario
Consider a company with a Class C network (192.168.1.0/24) having 256 IPs and three departments: Sales, HR, and IT.
- close All departments share the same network.
- close Only 80 IPs used, 176 wasted.
- close Broadcast traffic floods everyone.
- security No security isolation between Depts.
- check Network divided into 3 smaller subnets.
- check Traffic contained within departments.
- check Departments logically isolated (Security).
- check Efficient IP usage with room for growth.
| Department | Devices | IPs Allocated (After Subnetting) |
|---|---|---|
| Sales | 20 | 32 (192.168.1.0/27) |
| HR | 10 | 16 (192.168.1.32/28) |
| IT | 50 | 64 (192.168.1.48/26) |
* Note: Example allocations based on specific requirements.
Key Concepts in Subnetting
IP Addressing
An IPv4 address is a 32-bit value written as four octets (e.g., 192.168.1.1).
Classful Addressing
Subnet Mask & CIDR
The mask (e.g., 255.255.255.0) separates Network vs Host bits.
How Subnetting Works: A Step-by-Step Example
Let's divide a Class C network (First 3 octets are network bits) into two subnets.
Base Network: 193.1.2.0
Subnet 1 (Bit 0)
We choose the first available bit from the host portion as 0.
Range End: 193.1.2.01111111 (.127)
- Subnet ID: 193.1.2.0
- Broadcast ID: 193.1.2.127
- Subnet Mask: 255.255.255.128
- Usable Hosts: 126
Subnet 2 (Bit 1)
We choose the first available bit from the host portion as 1.
Range End: 193.1.2.11111111 (.255)
- Subnet ID: 193.1.2.128
- Broadcast ID: 193.1.2.255
- Subnet Mask: 255.255.255.128
- Usable Hosts: 126
tune Visual Subnet Adjuster
Drag the slider to change the CIDR notation. Watch how the Subnet Mask and number of available Hosts change instantly.
calculate Subnet Calculator
Advantages & Disadvantages
thumb_up Advantages
-
lockImproved Security
Isolates departments (e.g., HR data hidden from Sales).
-
speedTraffic Prioritization
Critical subnets can get higher priority bandwidth.
-
buildEasier Maintenance
Smaller, segmented networks are simpler to troubleshoot.
thumb_down Disadvantages
-
deleteExtra Overhead
Each subnet wastes 2 IPs (Network ID & Broadcast).
-
paymentsHigher Cost
Requires additional devices like routers and switches.
-
psychologyMore Complexity
Requires careful planning and adds steps in communication.
The Interview Cheat Sheet
Interviewer: "Explain Subnetting to me like I'm 5." expand_more
Answer: "Imagine a school. If every student (Host) was in one giant auditorium, it would be impossible to make an announcement to just the 1st graders. It would be too noisy (Broadcast Domain)."
"Subnetting is like building classrooms. We divide the school (Network) into rooms (Subnets). Now, we can talk to just the 1st graders without disturbing the 5th graders. It's faster, safer, and organized."
Interviewer: "How do you calculate the number of hosts for a /20 network?" expand_more
2. Network Bits = 20
3. Host Bits = 32 - 20 = 12
4. Formula: 2^h - 2
5. Calculation: 2^12 = 4096
6. Usable: 4096 - 2 = 4094
Interviewer: "What is the purpose of the Network Address and Broadcast Address?" expand_more
- Network Address: The very first IP. It identifies the subnet itself. No device can use this.
- Broadcast Address: The very last IP. Used to send data to EVERYONE in that subnet simultaneously. No single device can use this.