DHCP is an application layer protocol.
The process by which a client configured to used DHCP attempts to get network configuration information
DHCP discovery has four steps:
Client sends what’s known as a DHCP discovery message out onto the network. Since the machine doesn’t have an IP and it doesn’t know the IP of the DHCP server, a specially crafted broadcast message is formed instead.
DHCP server listens on the UDP port 67 and HDCP discovery message are always sent from UDP port 68.
This is incapsulated inside of an IP datagram with a destination IP of 255.255.255.255 and a source IP of 0.0.0.0
The response would be sent as a DHCP offer message with a destination port of 68, a source port of 67, a destination broadcast IP of 255.255.255.255, and its actual IP as the source. Since the DHCP Offer is also a broadcast, it would reach every machine on the network.
This is because the DHCP offer has the field that specifies the MAC address of the client that sent the DHCP discover message, The client machine would not process this DHCP offer to see what IP is being offered to it.
Client then would go and send a DHCP request message that sends the IP received from broadcasting to ask for the IP.
Finally ,the DHCP server receives the DHCP request message and respond with a DHCP ACK or DHCP Acknowledgement message. This message is against sent to a broadcast Ip of 255.255.255.255, and with a source IP corresponding to the actual IP of the DHCP server. Again, the DHCP client would recognize that this message was intended for itself by inclusion of its MAC address in one of the message fields.
Everything above is called DHCP lease
A DHCP lease might last for days or only for a short amount of time. Once a lease has expired, the DHCP client would need to negotiate a new lease by performing the entire DHCP discovery process all over again.
A client can also release its lease to the DHCP server, which it would do when it disconnects from the network. This would allow the DHCP server to return the IP address that was assigned to its pool of available IPs