DHCP - LogeshVel/learning_resources GitHub Wiki

In the DHCP Discover process, the host asks for the Subnet mask, Router(Default Gateway) , Domain Name Server in the OPtions

image

image

image

image

To check whether only that PC has that IP address it will send the ARP request for its own address. If it gets the ARP reply then that Host knows that another host exists with the same ip and it has the duplicate address and it will inform the DHCP server to get the new ip address by Decline and DORA Process.

If there is no response for the ARP request then the client knows that it has the unique IP and it sends out the Gratuitous ARP to say that he has this IP and its mac(just advertising itself)

image

image

Typically, after a client is assigned an address, it will validate that it's the only one with that address by sending out an ARP request for its own address. If it hears back from another device with the same address, it will know that this address is a duplicate, and it will inform the server that it needs a new address. To do this, the client will send a DHCP decline to the server, indicating that the offered address is already in use on the network. The servers should mark this address as assigned and move onto the next one in the dynamic pool.

In the DHCP process, the server will indicate to the client the length of time the address will be assigned. After this amount of time, the IP address will be released back into the dynamic pool for reassignment. At any point during the lease, the client has the ability to renew the lease and keep the same IP address as long as it's still available, or the server can tell the client when to request a renew.

The DHCP sequence is

  • Discover
  • Offer
  • Request
  • Acknowledge

Discover - Broadcast

In this Discover, the Client reaches for the DHCP server via Broadcast.

When a client is trying to set itself up, it know’s NOTHING about the network it is on. Therefore it has to send it’s message by broadcast as it does not know what IP address the DHCP server is currently on.

Therefore it broadcasts the Discover so that any and all DHCP servers on the same LAN segment can offer an IP address.

Likewise at the Request stage, the client still hasn’t finalised it’s network information, so it again has to broadcast the Request packet.

image

*Here the Broadcast flag is not set so it asks the Servers to Unicast the Offer and Acks

Offer - Unicast or Broadcast

The Offer is sent by the DHCP Server. It can be either Unicast or Broadcast, which depends on the Bootp flag set by the Client in the Discover request. If the Broadcast Flag under the Bootp Flags of the Discover request by the client is set then the response (Offer and ACK) from the Server will be Broadcast. If that flag is unset (0) then the Offer and ACK from the DHCP server will be a unicast.

*Here, the DHCP Offer is Unicast. image

Request - Broadcast

Based on the offers from the multiple DHCP servers the Client selects an offer and sends the Request in Broadcast

image

Ack - Unicast or Broadcast

The Server then acknowledges with the DHCP request of the Client either via Unicast or Broadcast depending the Bootp Flag set at the Discover request.

image

DHCP Server Hostname

image