DHCP, or Dynamic Host Configuration Protocol, is a server service that is responsible for assigning dynamic IP addresses to all network nodes that are registered on the network. DHCP is often confused with DNS but it is a completely different server service but is frequently put on the same server as the DNS. DNS is responsible for resolving domain names to their respective IP address and DHCP is responsible for assigning the dynamic IP addresses to the devices. DHCP can also talk to the DNS server to register the assigned IP address and give it the domain name of the device. For example, the DHCP will discover a computer on the network, assign it a dynamic IP address and then register the domain name and assigned IP address on the DNS server.
DHCP has to give each device on the network a unique IP address, otherwise, network packets won’t know where to go and may get sent to the wrong receiver. Each client in the network will have a client version of DHCP which will communicate with the server version of DHCP. The DHCP process has four main steps. DHCPDiscovery is when the client sends a broadcast message on the network to find any DHCP servers, this will be sent to every device on the network but only responded to by DHCP servers. Any non-DHCP server that receives a DHCPDiscovery message will just ignore it. When the DHCP server receives a DHCPDiscovery message it will send a DHCPOffer message back, which will contain an IP address. The client, upon receiving this offer, will respond with a DHCPRequest, requesting to receive the offered IP address. If a client receives multiple offers it will only respond to the first one it receives. When the DHCPRequest message is received by the server a DHCP Acknowledgment, or DHCPACK, is sent back to the client. The DHCPACK will contain the assigned IP address, the subnet mask, the default gateway, and the DNS server. The DHCP server will keep a record of all assigned IP address along with their lease time, the time that IP address will expire. When an IP address expires this entire process will repeat, even if the computer is online, but you will probably not notice any downtime while this renewal process takes place.
Within most home networks or small LAN networks, the DHCP is built within the router, along with the DNS. In an enterprise or business network, they may have a dedicated server to handle the DHCP. This allows the business more control over the DHCP assignment, such as changing the lease time or reserving IP addresses that shouldn’t be dynamically allocated to the device. If a computer or server is configured with a static IP address, an IP address that won’t change, it will not have to contact the DHCP server and the IP address will never expire unless manually changed.