DHCP client/server interaction

The interaction between Dynamic Host Configuration Protocol (DHCP) clients and servers enables a client to obtain its IP address and corresponding configuration information from a DHCP server.

This process occurs through a series of steps, illustrated in the following figure.

Figure 1. DHCP client-server interaction
DHCP client/server interaction.
Client requests DHCP information: DHCPDISCOVER
First, the client sends out a DHCPDISCOVER message requesting an IP address. The DHCPDISCOVER message contains an identifier unique to the client (typically the MAC address). The message might also contain other requests, such as requested options (for example, subnet mask, domain name server, domain name, or static route). The message is sent out as a broadcast. If the network contains routers, those routers can be configured to forward DHCPDISCOVER packets to DHCP servers on attached networks.
DHCP server offers information to client: DHCPOFFER
Any DHCP server that receives the DHCPDISCOVER message might send a DHCPOFFER message in response. The DHCP server might not send a DHCPOFFER message back to the client for multiple reasons: the most common reasons are that all available addresses are currently leased, the subnet is not configured, or the client is not supported. If the DHCP server sends a DHCPOFFER message in response, the DHCPOFFER will contain an available IP address and any other configuration information that is defined in the DHCP setup.
Client accepts DHCP server offer: DHCPREQUEST
The client receives DHCPOFFER messages from the DHCP servers that responded to the DHCPDISCOVER messages. The client compares the offers with the settings that it requested, and then selects the server that it wants to use. It sends a DHCPREQUEST message to accept the offer, indicating which server it selected. This message is broadcast to the entire network to let all DHCP servers know which server was selected.
DHCP server acknowledges the client and leases the IP address: DHCPACK
If a server receives a DHCPREQUEST message, the server marks the address as leased. Servers that are not selected will return offered addresses to their available pool. The selected server sends the client an acknowledgment (DHCPACK), which contains additional configuration information.

The client might now use the IP address and configuration parameters. It will use these settings until its lease expires or until the client sends a DHCPRELEASE message to the server to end the lease.

Client attempts to renew the lease: DHCPREQUEST, DHCPACK
The client starts to renew a lease when half of the lease time has passed. The client requests the renewal by sending a DHCPREQUEST message to the server. If the server accepts the request, it will send a DHCPACK message back to the client. If the server does not respond to the request, the client might continue to use the IP address and configuration information until the lease expires. As long as the lease is still active, the client and server do not need to go through the DHCPDISCOVER and DHCPREQUEST process. When the lease has expired, the client must start over with the DHCPDISCOVER process.
Client ends the lease: DHCPRELEASE
The client ends the lease by sending a DHCPRELEASE message to the DHCP server. The server will then return the client's IP address to the available address pool.