How DHCP Works (Dynamic Host Configuration Protocol)

DHCP (Dynamic Host Configuration Protocol) is a network management protocol used to automatically assign IP addresses and essential configuration parameters to devices on a network.

It operates on a client-server model, where the DHCP server maintains a pool of IP addresses and dynamically leases them to clients (like laptops, phones, printers).

DHCP Process – DORA

The DHCP workflow follows a four-step sequence known as DORA:

  1. Discover – Client → Server
  2. Offer – Server → Client
  3. Request – Client → Server
  4. Acknowledge – Server → Client

1. DHCP Discover

When a device joins the network and needs an IP, it sends a DHCP Discover broadcast to find available DHCP servers.

  • Source IP: 0.0.0.0 (no IP yet)
  • Destination: 255.255.255.255 (broadcast)

2. DHCP Offer

DHCP servers respond with a DHCP Offer containing:

  • Proposed IP address
  • Subnet mask
  • Default gateway
  • DNS server(s)
  • Lease duration

3. DHCP Request

The client selects one Offer (if multiple) and broadcasts a DHCP Request to formally request the offered IP. Broadcasting ensures all servers know which offer was accepted.

4. DHCP Acknowledge

The selected server responds with a DHCP ACK to finalize the lease. If the server declines, it sends a DHCP NAK and the client must restart the process.

DHCP Lease Renewal Process

DHCP leases are temporary and clients must renew them to continue using the IP:

  • T1 Timer (50%): Client sends a unicast DHCP Request to the original server to renew the lease.
  • T2 Timer (87.5%): If no response, client broadcasts the Request to any available DHCP server.
  • Expiration: If no server responds, the lease expires and the client starts the DORA process again.

DHCP Relay Agent (ip helper-address)

In large networks, clients and DHCP servers may be in different subnets. Since broadcast messages don’t cross routers, a DHCP Relay Agent is used to forward these messages.

Example:
On an interface:
ip helper-address 192.168.20.10
This forwards client DHCP Discover packets to the DHCP server at 192.168.20.10.

Benefits of DHCP

  • ✅ Eliminates manual IP configuration
  • ✅ Prevents IP conflicts
  • ✅ Simplifies DNS, gateway, and subnet changes
  • ✅ Supports dynamic and reserved/static assignments

Real-Life Example – Home Network

  1. Your laptop joins a Wi-Fi network → Sends DHCP Discover
  2. Home router (DHCP server) replies with Offer (e.g., 192.168.1.10)
  3. Laptop sends DHCP Request to accept
  4. Router replies with DHCP ACK → IP assigned

Conclusion

DHCP significantly simplifies IP address management by dynamically allocating IPs and ensuring efficient, error-free configuration. The DORA process ensures a reliable handshake, while lease renewals maintain long-term connectivity.

DHCP Tutorial Quiz

Correct answer is A. DHCP stands for Dynamic Host Configuration Protocol, which automatically assigns IP addresses and network settings.

2. Which message is sent first by a client in the DHCP DORA process?

Correct answer is B. The client first sends a DHCP Discover message to find available DHCP servers.

3. What is the source IP address used by a client when sending the DHCP Discover message?

Correct answer is C. Since the client does not have an IP yet, it uses 0.0.0.0 as the source IP address.

4. Which DHCP message contains the proposed IP address from the server?

Correct answer is C. The DHCP Offer contains the IP address and other configuration details offered to the client.

5. Why does the DHCP Request message get broadcasted?

Correct answer is A. Broadcasting the DHCP Request informs all DHCP servers about the chosen offer so others can release their offered IPs.

6. What happens if a DHCP server sends a DHCP NAK?

Correct answer is B. DHCP NAK means the IP is not available or invalid; the client restarts the DORA process.

7. At what point does a DHCP client try to renew its IP lease by unicasting to the original server?

Correct answer is B. The client sends a unicast DHCP Request at T1, which is 50% of the lease time, to renew the lease.

8. What role does a DHCP Relay Agent play in a network?

Correct answer is B. DHCP Relay Agent forwards DHCP messages across subnet boundaries where the DHCP server is on a different subnet.

9. Which of the following is NOT a benefit of DHCP?

Correct answer is D. DHCP supports dynamic and reserved IPs, but permanent static IP assignment without server control is NOT a benefit.

10. In the example of a home network, which device typically acts as the DHCP server?

Correct answer is B. The home router generally acts as the DHCP server, assigning IPs to devices like laptops.

← Back to Home