DORA process of DHCP, Unicast or Broadcast

Dynamic Host Configuration Protocol (DHCP) provides IP address and other configuration information like subnet mask, default gateway, WINS and DNS server address to network clients. DHCP allocates IP addresses dynamically to the clients, known as a lease for a period called lease period.

DHCP lease-generation is 4 step process called DORA which expands as below:

D – Discover

O – Offer

R – Request

A – Acknowledgement

The working process is as under:

1. The DHCP client broadcasts a DHCPDISCOVER packet in the subnet.

2. Once DHCP Server receives DISCOVER packet, it replies with DHCPOFFER packet. This packet is broadcast and contains a potential IP address for the client.The client might receives DHCPOFFER packet from multiple DHCP servers ( if they exist in subnet).

3. The client then broadcasts a DHCPREQUEST that contains a server identifier. Since this broadcast packet reaches all DHCP servers, they come to know which server’s DHCPOFFER the client has chosen to accept. In case client received multiple DHCPOFFER, it selects the server that made the fastest response to its DHCPDISCOVER which typically is the DHCP server closest to the client.

4. Once DHCP servers receive the DHCPREQUEST they use server identifier to know if their offer is accepted or not. The chosen server stores the IP address client information in the DHCP database and broadcasts DHCPACK message. If for some reason, the DHCP server cannot provide the address that was offered in the initial DHCPOFFER, the DHCP server sends a DHCPNAK message.

I will discuss about conditions resulting DHCPNAK in some other blog.

Let’s discuss these steps in more detail. For sake of clarity I am using diagram below:

a

As per diagram let’s take example of DHCP server whose IP address is A and MAC address is AA (I am using A and AA for sake of simplicity to avoid writing 4 octets of IP and 12 Hexadecimal bits for MAC address). There is a client looking for IP address so don’t have any IP but its MAC address is BB. Steps of DORA process are as under:

1. Client will broadcast DISCOVER packet to 255.255.255.255 which is broadcast IP. It will use 0.0.0.0 as source IP because it doesn’t has any IP yet. On frame it will use broadcast MAC address FF-FF-FF-FF-FF-FF as destination while use its own MAC address as source.

2. Once DHCP server receives DISCOVER packet, it will broadcast OFFER packet on 255.255.255.255 IP as client don’t have any IP. Since server has received MAC address of client from DISCOVER packet it will use it as destination MAC. So, as per our example it will be BB. Hence, OFFER frame is unicast.

With OFFER packet several other information also come as per configuration like DHCP server identifier, potential IP and others

3. Once client receives OFFER it broadcasts REQUEST packet on 255.255.255.255. It uses destination MAC as FF-FF-FF-FF-FF-FF. In case, multiple DHCP servers have sended OFFER packet, REQUEST packet will reach to all of them. This packet has DHCP server identifier which is used by servers to verify whether their IP is chosen or not. However, there is a chance that the transaction related to offer selected by client couldn’t complete successfully. The client then try to send a REQUEST to different Server Identifier.  So, “rejected” servers will wait for a while before offering a previously-offered lease to another client.

4. Once Server receives REQUEST packet, it will send ACK packet to client. In destination address it will use broadcast IP address but unicast MAC address i.e BB as per our example. Hence, will be received by intended client only.

Here is the summary:

                                        DISCOVER          OFFER                   REQUEST               ACK

SOURCE IP                  0.0.0.0                  A                           0.0.0.0                       A

SOURCE MAC              BB                         AA                         BB                              AA

DESTINATION IP          Broadcast          Broadcast           Broadcast             Broadcast

DESTINATION MAC      Broadcast              BB                  Broadcast                 BB

NETWORK LAYER         Broadcast          Broadcast           Broadcast             Broadcast

DATALINK LAYER          Broadcast           Unicast              Broadcast              Unicast

Broadcast IP – 255.255.255.255

Broadcast MAC – FF-FF-FF-FF-FF-FF

So, this is all in this blog. Have a very nice day !!

32 thoughts on “DORA process of DHCP, Unicast or Broadcast

  1. Please clarify: During the DHCP DORA process, I thought that only DHCPDISCOVER was a broadcast. Based on what I thought, DHCPOFFER, DHCPREQUEST and DHCPACK are not broadcasts because when the client initiates the process by sending out a boradcast, the DHCP server responds to the client directly.

    Like

    1. As I have clarified in blog, for understanding complete process subcategories communication on L2 and L3. Entire DORA is broadcast on L3 however Offer and Ack are unicast on L2.

      Like

  2. Please clarify: During the DHCP DORA process, I thought that only DHCPDISCOVER was a broadcast. Based on what I thought, DHCPOFFER, DHCPREQUEST and DHCPACK are not broadcasts because when the client initiates the process by sending out a boradcast, the DHCP server responds to the client directly.

    Like

  3. Wow , I was in seeking of such a well explained, Finally found it.

    Thank You Vinit Sir

    Regards,
    Hekmatullah Hamidy

    Like

    1. There is slight deviation as relay agent acts as mediator between DHCP server and client. Although client will broadcast DISCOVER and REQUEST packet, it will be unicasted to server by relay agent. Similarly, server will unicast OFFER and ACK packet which will be broadcasted to client by relay agent. You may check here for more details. http://www.netmanias.com/en/post/techdocs/6000/dhcp-network-protocol/understanding-dhcp-relay-agents

      Thanks for asking and hope this will help. 🙂

      Like

  4. Hi Vinit ji!! I found this very helpful as I am in learning stage..Thank you very much!! But the above all explanation seems like, keeping switch in mind (unicasting to particular MAC address) What about if there is router in place of switch?

    Like

    1. It needs to broadcast because its possible to have more than one DHCP server in network. To select one of them and to inform others which DHCP server is selected, client need to broadcast. Hope it helps.

      Like

  5. From this, We can clarify that what is DHCP and how its function in networking. DHCP is mostly asking in an interview (Domestic and MNC companies). Thanks for sharing this article with me and whole people.

    Like

  6. Hi Vinit Sir,

    I have below scenario
    Client —Gateway—DHCP Server

    Will my gateway keep Client’s MAC in the header or change it with its own while sending it to DHCP server. If it changes then why DHCP server has MAC of client instead of the Gateway, becasue gateway is the one who is communicating with DHCP for initial process

    Like

    1. Client MAC address is used during communication. Gateway(relay agent) send a unicast packet to DHCP server on behalf of client. In this packet it keeps the client MAC and its downlink IP as relay agent IP. This is how DHCP server has record of client MAC. Hope this helps.

      Like

  7. Could you please explain more about what happens once DORA is completed, so how the client machine will check if there any same IP assigned in the same network or not?

    Like

Leave a comment