BLOG-002
IP subnetting basics
IP Subnetting: In-Depth Explanation
| PublishedAug 07, 2026 | Read time3 min | Views2 | Category ccna, networking, ccnp, subnetting , | Tags — |
Subnetting can seem complex at first, but with a step-by-step approach, it becomes much more manageable. Let’s break it down.
1. Understanding IP Addresses and Classes
IP Address Structure
- IPv4 addresses are 32 bits long, commonly written as four octets (e.g., 192.168.1.1).
- Each octet represents 8 bits, ranging from 0 to 255.
- Example (binary and decimal):
11000000.10101000.00000001.00000001→192.168.1.1
Address Classes
- Class A: 1.0.0.0 – 126.255.255.255 (/8 subnet mask)
- Class B: 128.0.0.0 – 191.255.255.255 (/16 subnet mask)
- Class C: 192.0.0.0 – 223.255.255.255 (/24 subnet mask)
2. Network vs. Host Bits
- Network bits (left): Identify the subnet.
- Host bits (right): Identify a specific device.
- Subnetting takes bits from the host part and assigns them to the network, forming new (smaller) subnets.
Subnet Mask
- Defines how many bits are network (1s) and how many are host (0s).
- Example:
255.255.255.0= 11111111.11111111.11111111.00000000
CIDR Notation
- Shorthand for subnet mask:
/24means 24 bits for network.
3. Subnetting Step by Step
Let’s walk through subnetting a /24 network (e.g., 192.168.1.0/24) into 4 subnets.
Step 1: How many subnets do you need?
- 4 subnets
- Formula:
2^n ≥ number of subnets, wheren= number of bits borrowed.
Step 2: Borrow Host Bits
- From a /24 (255.255.255.0), the default has 8 host bits.
- Need at least 2 borrowed bits:
2^2 = 4subnets
Step 3: New Subnet Mask
- Original: /24 (255.255.255.0)
- New: /26 (255.255.255.192), since 24 + 2 = 26 network bits.
Step 4: Calculate Subnet Ranges
- 8 host bits – 2 borrowed = 6 remaining host bits.
- Host addresses per subnet (formula):
2^host bits - 2(subtract 2 for network & broadcast addresses).2^6 - 2 = 62usable IPs per subnet.
| Subnet Number | Network Address | First Host | Last Host | Broadcast Address |
|---|---|---|---|---|
| 1 | 192.168.1.0 | 192.168.1.1 | 192.168.1.62 | 192.168.1.63 |
| 2 | 192.168.1.64 | 192.168.1.65 | 192.168.1.126 | 192.168.1.127 |
| 3 | 192.168.1.128 | 192.168.1.129 | 192.168.1.190 | 192.168.1.191 |
| 4 | 192.168.1.192 | 192.168.1.193 | 192.168.1.254 | 192.168.1.255 |
4. General Subnetting Formulas
- Number of subnets:
2^n, where n = # of bits borrowed. - Number of hosts per subnet:
2^h - 2, where h = # of host bits left. - New subnet mask: Add n to the network mask.
- Block size (interval between subnets):
256 - value in subnet mask's new octet.
Example Block Sizes
- /26: 255.255.255.192 → Block size: 256 - 192 = 64 (subnets start at .0, .64, .128, .192)
5. Binary Math Trick
Third Subnet Calculation (binary):
192.168.1.128 (Subnet Starts)
192.168.1.191 (Broadcast = 128 + 63)
Hosts: 129-190
Write in binary if you’re stuck—borrowed bits help you spot boundaries!
6. Subnetting for Custom Host/Subnet Needs
Example:
You need at least 30 hosts per subnet on 192.168.10.0/24.
- Hosts per subnet:
2^h - 2 ≥ 302^5 - 2 = 30 ; use 5 host bits → borrow 3 bits (since 8-5=3) - New mask: /27 (255.255.255.224)
- Subnets:
2^3 = 8 - Block size: 256 - 224 = 32
7. CIDR and VLSM
- CIDR: Classless Inter-Domain Routing lets you use mask sizes that don’t fit default classes.
- Example: 10.1.1.0/28
- VLSM (Variable Length Subnet Mask): Allows subnets with different sizes within the same network for efficient IP use.
8. Practice Problem
Subnet 10.0.0.0/16 into 16 subnets.
- Host bits in /16: 16
- Bits to borrow: 4 (2^4 = 16)
- New mask: /20 (16+4=20; 255.255.240.0)
- Block size: 256 - 240 = 16 in the third octet.
- Subnets:
- 10.0.0.0/20
- 10.0.16.0/20
- 10.0.32.0/20
- … up to 10.0.240.0/20
Summary Table
| Term | Description |
|---|---|
| Subnet Mask | Bitmask for dividing IP parts |
| Network Bits | Number of bits in subnet mask |
| Host Bits | Remaining bits for hosts |
| CIDR Notation | Shorthand (e.g., /27 for 255.255.255.224) |
| Block Size | Increment between subnets |
Subnetting is about dividing, organizing, and optimizing address spaces. Practice binary math, use the above formulas, and you’ll become proficient!
If you want to practice with specific scenarios or want more advanced examples (like VLSM or real-world design), just let me know!
// Comments (0)