Skip to content
Related Articles

Related Articles

Working of Dynamic Host Configuration Protocol
  • Last Updated : 11 Aug, 2020
GeeksforGeeks - Summer Carnival Banner

Dynamic Host Configuration Protocol (DHCP) is a network management protocol used in networks to dynamically assign IP addresses & other network configuration information like default gateway, mask, DNS server address etc.

DHCP server automatically assigns IP address to various devices in network. This in turn reduces work of Network Administrator to manually assign IP address to various devices.

Automatic IP address assignment process undergoes four message exchange. These messages are abbreviated as Discover, Offer, Request & Acknowledgement (DORA). The following table gives the detail of these four messages.




MessageDetail
DiscoverThis is message sent by DHCP client to discover a DHCP server.
OfferSent by DHCP server to lease unique IP address and other parameters needed to client.
RequestSent by DHCP client asking server to lease parameters listed in Offer message.
AcknowledgementSent by DHCP server to assign IP address, mask, default router & DNS server address to client.

But there is conflict, DHCP IP address leasing uses layer 3 protocol i.e, Internet Protocol. This means that DHCP uses IP packets. But we know that hosts have no IP address initially then how they form IP packets? Actually they uses two reserved IP address for this purpose.

  1. 0.0.0.0 –
    An IP address reserved to use as sender’s address for hosts that doesn’t have IP address assigned yet.
  2. 255.255.255.255 –
    This is local broadcast IP address. Packets sent to this address are broadcast over local data link. Routers do not forward packet containing this address as destination address.

But, there’s still problem remaining. What if DHCP server is not available on local LAN and present outside of local LAN? DORA messages needs to be exchanged. For this purpose “IP helper address” which is actually IP address of DHCP server, is configured in routers.

Now packets containing 255.255.255.255 are updated to IP helper address as destination address. This helps DORA messages to exchanged outside of the local LAN.


Figure – DHCP messages exchange with help of IP helper address


  1. PC1 sends Discover message but doesn’t find DHCP server in local LAN.
  2. R1 now receive IP packet and change destination address to DHCP server address i.e., 14.0.10.1 and sender address to its own outgoing interface address i.e., Gi0/2 interface address. R1 does this because of configuration of IP helper address.
  3. IP packet forwarded by R1 is received by DHCP server and respond to this Discover message.
  4. Server now send Offer message with source address as its own IP address and destination address as Gi0/2 interface address of R1. Actually it reverse the address of IP packet received.
  5. R1 receive the Offer message and forward it to PC1.
  6. Request and Acknowledge message are also exchanged as discussed in above steps.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :