Dynamic Host Configuration Protocol(DHCP)
1. What is DHCP?
DHCP (Dynamic Host Configuration Protocol) is a network management protocol used to automatically
assign IP addresses and other network configuration parameters to devices on a network.
This removes the need for manual IP assignment and reduces configuration errors.
2. Why DHCP Is Needed
Without DHCP, every device must be assigned:
IP address
Subnet mask
Default gateway
DNS
Lease time
Other optional parameters
3. How DHCP Works (Step-by-Step Process)
This is known as DORA:
✔ D: Discover
The client (PC) sends a DHCP Discover message.
It is a broadcast message (because the client doesn’t have an IP yet).
Message:
Source IP: [Link]
Destination IP: [Link]
✔ O: Offer
DHCP server receives the discover.
Server sends a DHCP Offer message containing:
o Available IP address
o Subnet mask
o Gateway
o DNS
o Lease time
✔ R: Request
The client replies with a DHCP Request message:
o Confirms the IP offer
o Broadcast again (to inform other DHCP servers)
✔ A: Acknowledgment
Server sends a DHCP ACK message.
Client now uses the assigned IP configuration.
4. Important DHCP Concepts
a. Lease Time
How long an IP address is valid.
When 50% of lease time passes → client renews it.
b. DHCP Scope
A range of IP addresses the server can assign.
Includes:
IP pool
Subnet mask
Gateway
DNS
Lease time
Excluded addresses (reserved for servers/printers)
c. Reservations
Assign a fixed IP to a device using its MAC address.
Example:
Printer MAC: 00:11:2A:4B:9F:21 → IP: [Link] always.
d. DHCP Relay (ip helper-address)
Used when:
DHCP server is in a different network
Router forwards request to remote DHCP server
Command on router interface:
ip helper-address <DHCP-server-IP>
Note:
Layer-2 switches cannot relay DHCP unless they are multilayer (L3 switches).
5. DHCP Messages (Quick Summary)
Message Purpose
Discover Client searching for server
Offer Server offering IP
Request Client accepting IP
Ack Server confirming IP
Nak Server rejects IP
Release Client releases IP
Decline Client says IP already used
6. Types of DHCP Allocations
1. Dynamic Allocation
IP assigned from pool temporarily
2. Automatic Allocation
Like dynamic but permanent once assigned
3. Static Allocation
Administrator assigns manually or reserves via MAC
7. DHCP Packet Format (Brief)
Includes:
Transaction ID
Client MAC
Offered IP
Server IP
Gateway
Subnet mask
Options field (DNS, domain name, lease time, etc.)
8. DHCP Configuration on Devices
Cisco Router DHCP Server Example
Router(config)# ip dhcp pool LAN-POOL
Router(config-dhcp)# network [Link] [Link]
Router(config-dhcp)# default-router [Link]
Router(config-dhcp)# dns-server [Link]
Router(config-dhcp)# lease 7
Router(config)# ip dhcp excluded-address [Link] [Link]
9. DHCP Problems and Solutions (Common Issues)
Problem 1: IP Conflict
Cause: two servers assigning same IP
Solution: disable rogue DHCP
Problem 2: No IP Assigned
Possible issues:
No DHCP server
Wrong VLAN
Trunk native VLAN mismatch
DHCP pool exhausted
Relay not configured
Switchport not in correct VLAN
10. DHCP in VLAN Environments
DHCP server must serve all VLANs
Use ip helper-address on router interfaces
Example:
interface g0/1
ip address [Link] [Link]
ip helper-address [Link]
NOTE:
L2 switches cannot route, so DHCP cannot reach another VLAN without a router/L3 switch.
11. DHCP vs. Static IPs
DHCP Static
Automatic Manual
Good for clients Good for servers
Low admin work High admin work
Efficient Accurate control
12. DHCP Ports
Protocol Port
DHCP Client UDP 68
DHCP Server UDP 67