DHCP (Dynamic Host Configuration Protocol)
DHCP (Dynamic Host Configuration Protocol)
1. What Problem DHCP Solves
Before DHCP, networks used manual IP configuration.
That creates real problems:
- Human error (duplicate IPs)
- Poor scalability
- High operational cost
DHCP solves this:
Automatically assigning IP configuration to devices when they join a network.
2. What DHCP Provides
A DHCP server doesn’t just give an IP address. It provides a complete network configuration:
- IP address
- Subnet mask
- Default gateway
- DNS servers
- Lease duration
3. Where DHCP Lives (Protocol Stack)
DHCP operates at the Application Layer, but uses:
- UDP protocol
- Port 67 → Server
- Port 68 → Client
It relies on:
- Broadcast communication (initially)
4. DHCP Operation — The DORA Process
This is fundamental. You must know this cold.
Step-by-step:
- Discover (Client → Broadcast)
- Offer (Server → Client)
- Request (Client → Server)
- Acknowledge (ACK) (Server → Client)
Visual Flow
Breakdown
1. DHCP Discover
- Client has no IP yet
- Sends broadcast:
0.0.0.0 → 255.255.255.255
2. DHCP Offer
- Server proposes:
- IP address
- Configuration
3. DHCP Request
- Client selects one offer
- Broadcasts acceptance
4. DHCP ACK
- Server confirms lease
- Client configures interface
5. DHCP Lease Concept
DHCP does not assign IPs permanently.
Lease = temporary ownership
Example:
- Lease time: 24 hours
Renewal Process:
- At 50% → client tries renewal
- At 87.5% → tries again (rebind)
6. DHCP Message Types
Important for deep understanding:
- DISCOVER
- OFFER
- REQUEST
- ACK
- NAK (negative acknowledgment)
- RELEASE
- INFORM
7. DHCP Packet Structure (Key Fields)
DHCP is based on BOOTP.
Important fields:
- Transaction ID (matches request/response)
- Client MAC address
- Your IP (yiaddr)
- Server IP (siaddr)
- Options field (most important part)
8. DHCP Options (Critical in Real Networks)
Options define behavior.
Examples:
| Option | Purpose |
|---|---|
| 1 | Subnet mask |
| 3 | Default gateway |
| 6 | DNS server |
| 51 | Lease time |
| 54 | DHCP server ID |
9. DHCP Server — Core Components
A DHCP server manages:
1. Scope (IP Pool)
Example:
192.168.1.100 – 192.168.1.200
2. Exclusions
Reserved addresses (e.g., routers, servers)
3. Reservations
Bind IP to MAC address
10. DHCP Relay (Very Important in Real Networks)
Problem:
DHCP uses broadcast → routers don’t forward broadcasts
Solution:
- DHCP Relay Agent
It forwards requests to a DHCP server in another network.
Concept Visualization
11. DHCP in IPv6 (DHCPv6)
IPv6 changes the model.
Two main approaches:
1. SLAAC (Stateless)
- No DHCP needed for IP
- Router assigns prefix
2. DHCPv6
- Provides:
- DNS
- additional config
Modes:
- Stateless DHCPv6
- Stateful DHCPv6
12. Security Issues in DHCP
DHCP is inherently unauthenticated.
Common Attacks:
1. Rogue DHCP Server
Attacker gives wrong gateway → traffic interception
2. DHCP Starvation
Flood server → exhaust IP pool
Mitigation:
- DHCP Snooping (switch feature)
- Port security
- Network segmentation
13. Real-World Deployment
Typical architecture:
- DHCP Server (Windows/Linux/router)
- VLAN-based scopes
- Relay agents on routers
Example:
- VLAN 10 → 192.168.10.0/24
- VLAN 20 → 192.168.20.0/24
Each with its own scope
14. Practical Implementation Examples
Windows Server DHCP
- GUI-based
- Integrated with Active Directory
Linux DHCP (ISC DHCP / Kea)
- Config file-based
- Highly customizable
Router-based DHCP
- Used in small networks
15. Key Engineering Insights
If you want to think like a pro:
- DHCP is state management, not just IP assignment
- Lease tuning affects network performance
- DHCP + DNS integration is critical
- Relay design determines scalability
16. Common Mistakes
- Overlapping scopes
- Too short lease times
- No DHCP redundancy
- Ignoring security (rogue servers)
17. Final Summary
DHCP is:
- A dynamic configuration protocol
- Built on UDP and broadcast discovery
- Driven by the DORA process
- Essential for scalable network management
Without DHCP:
Modern networks simply don’t scale.