DHCP (Dynamic Host Configuration Protocol) is a network protocol that provides quick, automatic, and central management for the distribution of IP addresses within a local network. It’s also used to configure the subnet mask, default gateway, and DNS server information on the device.
A DHCP server issues unique IP addresses and automatically configures other network information. In most homes and small businesses, the wireless router also acts as the DHCP server. In large networks with multiple clients connecting and disconnecting all the time, a separate computer might take on the role of a DHCP server.
DHCP works by having a device (the client) request an IP address from a router (the host). Then, the host assigns an available IP address so that the client can communicate on the network. When a device is turned on and connected to a network that has a DHCP server, it sends a request to the server, called a DHCPDISCOVER request.
After the DISCOVER packet reaches the DHCP server, the server holds on to an IP address that the device can use, then offers the client the address with a DHCPOFFER packet.
Once the offer has been made for the chosen IP address, the device responds to the DHCP server with a DHCPREQUEST packet to accept it. Then, the server sends an ACK to confirm that the device has that specific IP address and to define the amount of time that the device can use the address before getting a new one. If the server decides that the device cannot have the IP address, it will send a NACK.