Subnetting - Subnets
Subnetting is the technique of dividing an IP network into multiple smaller subnets to optimize IP address usage and improve network management.
What is Subnetting?
Subnetting is the process of taking a large IP network and dividing it into smaller subnets using subnet masks. This allows more efficient use of IP addresses and improves network security and performance.
Fundamental Concepts
Subnet Mask
- Function: Defines which part of the IP is network and which part is host
- Format: 32 bits in IPv4, 128 bits in IPv6
- Notation: Dotted decimal (255.255.255.0) or CIDR (/24)
Network Address
- Function: Identifies the specific subnet
- Calculation: IP AND Subnet mask
- Example: 192.168.1.0/24
Broadcast Address
- Function: Address to send to all hosts in the subnet
- Calculation: Last address of the subnet
- Example: 192.168.1.255/24
Host Addresses
- Function: Addresses assignable to devices
- Range: Between network address and broadcast
- Example: 192.168.1.1 - 192.168.1.254
IPv4 Network Classes
Class A
- Range: 1.0.0.0 - 126.255.255.255
- Default mask: 255.0.0.0 (/8)
- Networks: 126 networks
- Hosts per network: 16,777,214 hosts
Class B
- Range: 128.0.0.0 - 191.255.255.255
- Default mask: 255.255.0.0 (/16)
- Networks: 16,384 networks
- Hosts per network: 65,534 hosts
Class C
- Range: 192.0.0.0 - 223.255.255.255
- Default mask: 255.255.255.0 (/24)
- Networks: 2,097,152 networks
- Hosts per network: 254 hosts
Classes D and E
- Class D: 224.0.0.0 - 239.255.255.255 (Multicast)
- Class E: 240.0.0.0 - 255.255.255.255 (Experimental)
CIDR (Classless Inter-Domain Routing)
CIDR Notation
- Format: IP/number of network bits
- Example: 192.168.1.0/24
- Advantage: Flexibility in subnet size
CIDR Mask Table
| CIDR | Mask | Hosts | Subnets |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | 1 |
| /16 | 255.255.0.0 | 65,534 | 256 |
| /24 | 255.255.255.0 | 254 | 65,536 |
| /25 | 255.255.255.128 | 126 | 131,072 |
| /26 | 255.255.255.192 | 62 | 262,144 |
| /27 | 255.255.255.224 | 30 | 524,288 |
| /28 | 255.255.255.240 | 14 | 1,048,576 |
| /29 | 255.255.255.248 | 6 | 2,097,152 |
| /30 | 255.255.255.252 | 2 | 4,194,304 |
Subnet Calculation
Binary Method
- Convert IP to binary
- Apply subnet mask
- Identify network and host bits
- Calculate valid addresses
Practical Example
Resulting Subnets
VLSM (Variable Length Subnet Masking)
Concept
- Definition: Use of different subnet masks in the same network
- Advantage: Maximum optimization of address space
- Usage: Networks with different subnet sizes
VLSM Example
VLSM Assignment
IPv6 Subnetting
IPv6 Characteristics
- Length: 128 bits
- Notation: Hexadecimal separated by colons
- Subnetting: Simpler than IPv4
- Example: 2001:db8::/64
IPv6 Structure
IPv6 Subnetting
Calculation Tools
Online Calculators
- Subnet Calculator: Automatic calculation
- IP Calculator: Advanced tools
- CIDR Calculator: CIDR conversion
Network Commands
Network Tools
- Wireshark: Traffic analysis
- tcpdump: Packet capture
- ping: Connectivity test
- traceroute: Packet route
Best Practices
Subnet Planning
- Requirements analysis: Number of hosts per subnet
- Future growth: Reserve space for expansion
- Documentation: Maintain assignment records
- Standards: Use naming conventions
Address Assignment
- Hierarchy: Logical address structure
- Aggregation: Facilitate routing
- Reservation: Reserve ranges for services
- DHCP: Automate assignment
Security
- Segmentation: Isolate different traffic types
- Firewalls: Filter between subnets
- VLANs: Logical separation
- Monitoring: Monitor traffic between subnets
Common Use Cases
Corporate Network
Data Center
Home Network
Subnet Troubleshooting
Common Problems
- Incorrect configuration: Misconfigured masks
- IP conflicts: Duplicate addresses
- Routing: Incorrect routes
- DHCP: Misconfigured ranges
Diagnostic Tools
Verification Commands
Related Concepts
- IP Addresses - Addressing concepts
- OSI Model - Network layer (Layer 3)
- Network Protocols - IP protocol
- Networking - General network concepts
- DNS - Name resolution
- Firewall - Filtering between subnets
- VLAN - Logical segmentation
References
- RFC 950 - Subnetting
- RFC 1878 - Variable Length Subnet Table
- RFC 4291 - IPv6 Addressing
- RFC 4291 - IPv6 Address Architecture
Glossary
- CIDR: Classless Inter-Domain Routing
- VLSM: Variable Length Subnet Masking
- EUI-64: Extended Unique Identifier
- SLAAC: Stateless Address Autoconfiguration
- DHCPv6: Dynamic Host Configuration Protocol for IPv6
- NDP: Neighbor Discovery Protocol
- RA: Router Advertisement
- RS: Router Solicitation