π€ What is DHCP? (Basic Idea)
When a device joins a network, it needs:
IP address π§Ύ
Subnet mask
Default gateway
DNS server
π Manually assigning these to every device is difficult and error-prone.
π DHCP automates this entire process.
π§ Simple Definition
π DHCP (Dynamic Host Configuration Protocol) is a network protocol that automatically assigns IP addresses and other network configuration parameters to devices.
π§ Why DHCP is Needed?
Without DHCP β:
Manual IP configuration
IP conflicts
Time-consuming
High chance of errors
With DHCP β :
Automatic configuration
No IP conflicts
Plug-and-play networking
π Thatβs why DHCP is used everywhere (home, office, campus).
π§ Real-Life Analogy
π¨ Hotel Room Allocation
Guest checks in
Hotel assigns room automatically
Room reused when guest leaves
π DHCP:
Device connects
IP assigned
IP reused when device disconnects
π§ Where Does DHCP Work?

DHCP is an Application Layer protocol
Uses UDP (fast & lightweight)
π Ports Used by DHCP
Device | Port |
|---|---|
DHCP Client | 68 (UDP) |
DHCP Server | 67 (UDP) |
π§© Main Components of DHCP

1οΈβ£ DHCP Client β Device requesting IP
2οΈβ£ DHCP Server β Assigns IP & config
3οΈβ£ DHCP Relay Agent β For different networks
π¦ What Information Does DHCP Provide?
DHCP assigns:
IP address
Subnet mask
Default gateway
DNS server
Lease time
π All in one automatic process βοΈ
π How DHCP Works (DORA Process)
DHCP follows 4 simple steps, called DORA:
π Client broadcasts:
βIs there any DHCP server?β
Source IP: 0.0.0.0
Destination IP: 255.255.255.255
π DHCP server replies:
βI can give you this IP.β
Includes:
Offered IP
Configuration info
π Client responds:
βI want to use this IP.β
Confirms selection
π Server confirms:
βIP assigned successfully.β
π Device is now part of network βοΈ
β±οΈ DHCP Lease Time
π IP addresses are assigned for a limited time, called lease.
Can be renewed
Prevents IP wastage
π After lease expires β IP returned to pool.
π§ Types of DHCP IP Allocation
πΉ 1. Dynamic Allocation
IP assigned temporarily
Most common
πΉ 2. Automatic Allocation
Permanent IP after first assignment
πΉ 3. Manual Allocation (Reservation)
Fixed IP based on MAC address
π Used for:
Servers
Printers
π DHCP Relay Agent
π Used when:
Client & server are on different networks
π Relay forwards DHCP messages between them.
π Security Issues with DHCP
Rogue DHCP servers
IP spoofing
Unauthorized access
π Protection methods:
DHCP snooping
Network access control
βοΈ DHCP vs Manual IP Configuration
Feature | DHCP | Manual |
|---|---|---|
IP assignment | Automatic | Manual |
Errors | Very low | High |
Scalability | High | Low |
Management | Easy | Difficult |
π§ Advantages of DHCP
Easy configuration β‘
No IP conflicts
Centralized management
Time saving
β Disadvantages of DHCP
DHCP server failure affects network
Security risks
Less control per device
π§ Memory Tricks
DHCP = Donβt Handle Config Personally π
DORA = Dora the Explorer π§
67 = Server
68 = Client
β One-Line Summary
πΉ DHCP automatically assigns IP addresses and network configuration to devices, enabling easy and error-free networking.