Dynamic Host Configuration Protocol (DHCP) is a network management protocol for dynamic and centralized IP address allocation and management.
DHCP was first defined in October 1993 based on BOOTP. As defined in RFC 2131, DHCP operates based on the client–server model. A DHCP client applies to a DHCP server for network parameters, such as the IP address, subnet mask, default gateway address, and DNS server address. The DHCP server then replies with the configuration parameters to the client so the client can communicate with other IP networks.
Why Do We Need DHCP?
On an IP network, each device connected to the Internet must be assigned a unique IP address. DHCP helps network administrators to monitor and assign IP addresses in a centralized manner. It can automatically assign a new IP address to a computer when it is moved to another location. DHCP automates the process of allocating IP addresses, which reduces the time required for device configuration and deployment, as well as the possibility of configuration errors. In addition, a DHCP server can manage the configurations of multiple network segments. When the configuration of a network segment changes, an administrator only needs to update the corresponding configuration on the DHCP server.
DHCP offers the following advantages:
Reliable IP address configuration: The IP address configuration parameters must be exact. It is easy to make a mistake when dealing with inputs such as 192.168.XXX.XXX. Typographical errors are typically very difficult to troubleshoot and the use of a DHCP server minimizes such errors.
Reduced IP address conflicts: Each connected device must have an IP address. However, each IP address can be used only once. If an IP address conflict occurs between two devices, one or both of the devices cannot be connected. This can happen when IP addresses are allocated manually, particularly when there are a large number of endpoints that only connect periodically, such as mobile devices. The use of DHCP ensures that each IP address is used only once.
Automatic IP address management: In any network without DHCP, network administrators need to manually assign and withdraw IP addresses. Keeping track of which device has what IP address can be an exercise in futility as it is nearly impossible to understand when devices require access to the network and when they leave. DHCP allows this to be automated and centralized so network professionals can manage all locations from a single location.
Efficient change management: The use of DHCP makes it very simple to change addresses, scopes, or endpoints. For example, an organization may want to change its IP addressing scheme from one range to another. The DHCP server is configured with the new information and the information will be propagated to the new endpoints. Similarly, if a network device is upgraded and replaced, no network configuration is required.
How Does DHCP Work?
DHCP uses User Datagram Protocol (UDP), as its transport protocol. A DHCP client sends messages to a DHCP server through UDP port 68, and a DHCP server sends messages to a DHCP client through UDP port 67.
Only the DHCP server on the same network segment as a DHCP client can receive the DHCPDISCOVER message broadcast by the client. If a DHCP client and server are on different network segments, a DHCP relay agent must be deployed to forward DHCP messages between them. For DHCP clients, the DHCP relay agent is the DHCP server; for the DHCP server, the DHCP relay agent is a DHCP client.
DHCP Client Accessing the Network for the First Time Without a DHCP Relay Agent
As shown in the following figure, when no DHCP relay agent is deployed, the newly connected DHCP client and server exchange DHCP messages through four stages.

Message exchange between the newly connected DHCP client and server
For more information, see DHCP

