IPv4 (Internet Protocol version 4)
IPv4 is the foundational layer 3 protocol that enables packet routing across networks by providing logical addressing and packet forwarding mechanisms.
IPv4 Header Structure
- Version (4 bits): Always set to 4 for IPv4
- IHL (4 bits): Internet Header Length
- Type of Service/DSCP (8 bits): Quality of Service markings
- Total Length (16 bits): Entire packet size
- TTL (8 bits): Time To Live - prevents loops
- Protocol (8 bits): Next layer protocol (TCP=6, UDP=17, ICMP=1)
- Source/Destination IP (32 bits each): Logical addresses for routing
Address Classes and Ranges
| Class | Range | Default Mask | Use Case |
|---|---|---|---|
| A | 1.0.0.0 - 126.255.255.255 | /8 | Large organizations |
| B | 128.0.0.0 - 191.255.255.255 | /16 | Medium organizations |
| C | 192.0.0.0 - 223.255.255.255 | /24 | Small networks |
| D | 224.0.0.0 - 239.255.255.255 | N/A | Multicast |
| E | 240.0.0.0 - 255.255.255.255 | N/A | Reserved |
Private Address Ranges (RFC 1918)
- Class A Private: 10.0.0.0/8
- Class B Private: 172.16.0.0/12
- Class C Private: 192.168.0.0/16
Special Addresses
- Loopback: 127.0.0.0/8
- Link-Local: 169.254.0.0/16 (APIPA)
- Broadcast: All host bits set to 1
- Network: All host bits set to 0
Subnetting Fundamentals
- CIDR Notation: Network address followed by slash and prefix length
- Subnet Formula: 2^n subnets
- Host Formula: 2^h - 2 hosts
- VLSM: Variable Length Subnet Masking for different subnet sizes
Notes
- IPv4 exhaustion drives IPv6 adoption
- TTL prevents infinite loops
- Fragmentation hurts performance
- Practice binary conversion and powers of 2 for subnetting exams