100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

What is DHCP (Dynamic Host Configuration Protocol)?

What is DHCP — the DORA handshake, lease renewal, and automatic IP assignment explained with commands and interview practice.

easyQ12 of 224 in Computer Networks Est. time: 4 minsLast updated:
Open Code Lab

Expected Interview Answer

DHCP (Dynamic Host Configuration Protocol) is a network protocol that automatically assigns IP addresses and other configuration details — like subnet mask, default gateway, and DNS servers — to devices joining a network, removing the need for manual setup.

When a device connects, it broadcasts a DHCP Discover message; a DHCP server responds with an Offer containing an available IP address; the client sends a Request confirming it wants that address; and the server replies with an Acknowledgement, completing the four-step DORA process. Addresses are leased for a limited time and must be renewed before expiry, which allows addresses to be reclaimed and reused as devices join and leave the network. DHCP dramatically simplifies network administration compared to statically configuring every device by hand, and it is how laptops, phones, and IoT devices instantly get usable network settings on any Wi-Fi they join. Interviewers use this question to confirm you understand the DORA handshake and why leases exist.

  • Automatic IP assignment with no manual configuration
  • Reclaims and reuses addresses via time-limited leases
  • Distributes DNS, gateway, and subnet info alongside the IP
  • Reduces address conflicts from manual misconfiguration

AI Mentor Explanation

DHCP is like the equipment manager assigning a locker to every new player who joins the squad — the player asks for a spot, the manager offers an available locker number, the player confirms they will use it, and the manager logs it as taken for the season. When a player leaves the club, or their loan period ends, the locker is reclaimed and given to the next new signing. This automatic assign-and-reclaim cycle is exactly what DHCP does with IP addresses instead of lockers.

Step-by-Step Explanation

  1. Step 1

    Discover

    The client broadcasts a DHCP Discover message looking for a server.

  2. Step 2

    Offer

    A DHCP server responds with an Offer containing an available IP and lease terms.

  3. Step 3

    Request

    The client broadcasts a Request confirming it wants the offered address.

  4. Step 4

    Acknowledge

    The server sends an Acknowledgement, finalizing the lease and configuration.

What Interviewer Expects

  • DHCP as automatic IP address and configuration assignment
  • The DORA process (Discover, Offer, Request, Acknowledge)
  • Understanding of lease duration and renewal
  • Awareness that DHCP also hands out subnet mask, gateway, and DNS info

Common Mistakes

  • Forgetting the four-step DORA handshake and calling it a single request
  • Confusing DHCP with DNS
  • Not knowing that leases expire and must be renewed
  • Assuming DHCP only assigns IP addresses and nothing else

Best Answer (HR Friendly)

DHCP is the protocol that automatically gives your device an IP address and network settings the moment you connect to Wi-Fi, so you never have to type in numbers yourself. It leases that address for a period of time, and reclaims it for other devices once you disconnect or the lease expires.

Code Example

Inspecting and renewing a DHCP lease on Linux
# View current DHCP-assigned IP and lease info
ip addr show eth0

# Release the current DHCP lease
sudo dhclient -r eth0

# Request a new DHCP lease
sudo dhclient eth0

Follow-up Questions

  • What happens if a device does not renew its DHCP lease in time?
  • What is DHCP relay and why is it needed in multi-subnet networks?
  • What is a static DHCP reservation?
  • How does DHCP interact with DNS for name resolution?

MCQ Practice

1. What are the four steps of the DHCP process, in order?

DHCP follows Discover, Offer, Request, Acknowledge (DORA).

2. What happens to an IP address when its DHCP lease expires without renewal?

Expired, unrenewed leases return the address to the pool for reassignment.

3. Besides an IP address, what else does DHCP typically provide?

DHCP delivers full network configuration, not just the IP address itself.

Flash Cards

DHCP in one line?Automatically assigns IP addresses and network config to devices joining a network.

What does DORA stand for?Discover, Offer, Request, Acknowledge.

What is a DHCP lease?A time-limited assignment of an IP address that must be renewed before expiry.

What info besides IP does DHCP assign?Subnet mask, default gateway, and DNS server addresses.

1 / 4

Continue Learning