network-programmingdhcp

Why request dhcp packet is neccessary?


In DHCP protocol we have 4 packets named DORA.

first of all client send a broadcast Discovery packet for detecting DHCP server.

Then server send a Offer packet contain ip, subnet and many options and waiting for client.

If client find Offer packet suitable, send a broadcast Request and get ACK or NAK.

But why ?

Why we can't ignore Request packet and replace this way to sending 3 packets.

Discovery, Offer and ACK.

client -> Discovery
server -> Offer
client -> ACK

Why this way is not secure or suitable ?


Solution

  • When the client broadcasts the Discover packet, it may get Offer packets from multiple DHCP servers. The purpose of the Request packet is to say to one of the servers, "I want to use the IP address that you offered to me". If that wasn't sent:

    Then the final Acknowledge packet tells the client that the server has gotten the Request, and that the client now has the "lease" on the IP address.

    This is intended to ensure that:


    In the variation that you proposed, suppose that the ACK packet from the client to the server is lost. Now the server won't realize that the client is going to use the Offered IP address. A few minutes later, it could then Offer the same IP address to a different client and ... chaos ensues.


    Please don't imagine that the people who design internet protocols are dullards. They have thought these things through carefully before they write the RFCs. And many other (equally smart) people have gone over the pre-approved RFCs carefully looking for problems. So, if there is something about a standard protocol that you think is wrong, it is likely to be >>you<<, and not the protocol designer who is mistaken. Or, at least, the original "mistake" is understandable in the historic context.