Introduction
IP subnetting is a fundamental networking skill. It allows you to divide networks into smaller subnets for better organization, security, and efficiency. This guide explains subnetting with practical examples.
What is Subnetting?
Subnetting divides a network into smaller subnetworks (subnets). Each subnet has its own network address and broadcast address.
Why Subnet?
Benefits:
- Security: Isolate network segments
- Performance: Reduce broadcast traffic
- Organization: Logical grouping
- Efficiency: Better IP address utilization
IP Address Basics
IPv4 Address Structure
IPv4 addresses are 32-bit numbers, typically shown as four octets:
192.168.1.0
β β β β
β β β ββ Host ID (last 8 bits)
β β ββββ Host ID
β ββββββββ Network ID
ββββββββββββ Network ID
Subnet Mask
Subnet mask determines which part is network and which is host:
IP Address: 192.168.1.100
Subnet Mask: 255.255.255.0
βββββββββββββ
Network: 192.168.1.0
Host: 100
CIDR Notation
CIDR (Classless Inter-Domain Routing) uses slash notation:
192.168.1.0/24
β
ββ Number of network bits
Common CIDR Blocks
| CIDR | Subnet Mask | Hosts | Use Case |
|---|---|---|---|
| /32 | 255.255.255.255 | 1 | Single host |
| /30 | 255.255.255.252 | 2 | Point-to-point links |
| /24 | 255.255.255.0 | 254 | Small networks |
| /16 | 255.255.0.0 | 65,534 | Medium networks |
| /8 | 255.0.0.0 | 16M+ | Large networks |
Subnetting Examples
Example 1: /24 Network
Given: 192.168.1.0/24
- Network: 192.168.1.0
- Subnet Mask: 255.255.255.0
- Broadcast: 192.168.1.255
- Usable Hosts: 192.168.1.1 - 192.168.1.254 (254 hosts)
Example 2: Subnetting /24 into /26
Given: 192.168.1.0/24 β Create 4 subnets
Subnets:
192.168.1.0/26(Hosts: 192.168.1.1 - 192.168.1.62)192.168.1.64/26(Hosts: 192.168.1.65 - 192.168.1.126)192.168.1.128/26(Hosts: 192.168.1.129 - 192.168.1.190)192.168.1.192/26(Hosts: 192.168.1.193 - 192.168.1.254)
Each subnet has 64 addresses (62 usable hosts).
Example 3: Variable Length Subnetting (VLSM)
Create subnets of different sizes:
Given: 192.168.1.0/24
Requirements:
- Subnet A: 50 hosts β /26 (64 addresses)
- Subnet B: 25 hosts β /27 (32 addresses)
- Subnet C: 10 hosts β /28 (16 addresses)
Solution:
- Subnet A:
192.168.1.0/26 - Subnet B:
192.168.1.64/27 - Subnet C:
192.168.1.96/28
Calculating Subnets
Number of Hosts
Hosts = 2^(32 - CIDR) - 2
Examples:
/24: 2^8 - 2 = 254 hosts/25: 2^7 - 2 = 126 hosts/26: 2^6 - 2 = 62 hosts/30: 2^2 - 2 = 2 hosts
Number of Subnets
Subnets = 2^(New CIDR - Original CIDR)
Example: Split /24 into /26:
- Subnets = 2^(26 - 24) = 2^2 = 4 subnets
Private IP Ranges
RFC 1918 Private Addresses
| Range | CIDR | Description |
|---|---|---|
| 10.0.0.0 - 10.255.255.255 | 10.0.0.0/8 | Class A private |
| 172.16.0.0 - 172.31.255.255 | 172.16.0.0/12 | Class B private |
| 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 | Class C private |
Use for:
- Internal networks
- NAT environments
- Virtual private clouds
Practical Examples
Home Network Setup
Router: 192.168.1.1/24
ββ Laptop: 192.168.1.100
ββ Phone: 192.168.1.101
ββ TV: 192.168.1.102
Office Network
Main Network: 10.0.0.0/16
ββ Servers: 10.0.1.0/24
ββ Workstations: 10.0.2.0/24
ββ Guest WiFi: 10.0.3.0/24
ββ IoT Devices: 10.0.4.0/24
Tools
Use our tools:
- IP Subnet Calculator - Calculate subnet information
- CIDR Calculator - Calculate CIDR ranges
Conclusion
IP subnetting is essential for network design:
Key concepts:
- CIDR notation
- Subnet masks
- Network and host portions
- Broadcast addresses
Benefits:
- Better organization
- Improved security
- Efficient IP usage
- Scalability
Next Steps
- Calculate subnets with IP Subnet Calculator
- Explore CIDR Notation
- Learn Network Planning