DHCP client-server interaction

A client gets the DHCP information from the server, and specific messages are sent between the client and the server. DHCP obtains and returns leases.

DHCP provides an automated method for dynamic client configuration. Clients that are DHCP enabled automatically obtain their own IP address and configuration parameters from the 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 DISCOVER message requesting an IP address. The DISCOVER 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 DISCOVER packets to DHCP servers on attached networks.
DHCP server offers information to client: DHCPOFFER
Any DHCP server that receives the DISCOVER message might send an OFFER message in response. The DHCP server might not send an OFFER 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 an OFFER 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 OFFER messages from the DHCP servers that responded to the DISCOVER. The client compares the offers with the settings that it requested, and then selects the server that it wants to use. It sends a REQUEST 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 REQUEST 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 REQUEST 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 RELEASE message to the DHCP server. The server will then return the client's IP address to the available address pool.
Related concepts
Relay agents and routers
Leases
Problem: Clients are not receiving an IP address or their configuration information