The sequence of events for DHCP service using IPv4 is shown in the following diagram. The numbers in circles correlate to the numbered items in the description following the diagram.
Figure 1 Sequence of Events for DHCP Service
The diagram shows the following steps:
The DHCP client discovers a DHCP server by broadcasting a discover message to the limited broadcast address (255.255.255.255) on the local subnet. If a router is present and configured to behave as a BOOTP relay agent, the request is passed to other DHCP servers on different subnets. The client's broadcast includes its unique ID, which in the DHCP implementation in Oracle Solaris is derived from the client's Media Access Control (MAC) address.
DHCP servers that receive the discover message can determine the client's network by looking at the following information:
The network interface on which the request came in. The DHCP server determines whether the DHCP client is on the network to which the interface is connected or is using a BOOTP relay agent connected to that network.
Whether the request include the IP address of a BOOTP relay agent. When a request passes through a relay agent, the relay agent inserts its address in the request header. When the DHCP server detects a relay agent address, the server knows that the network portion of the address indicates the DHCP client's network address because the relay agent must be connected to the client's network.
Whether the DHCP client's network is subnetted. The DHCP server consults the netmasks table to find the subnet mask used on the network indicated by the relay agent's address or by the address of the network interface that received the request. Once the server knows the subnet mask used, it can determine which portion of the network address is the host portion and select an IP address appropriate for the client. See the netmasks(5) man page for information about netmasks.
After the DHCP servers determine the DHCP client's network, each server selects an appropriate IP address and verifies that the address is not already in use. The DHCP servers then respond to the DHCP client by broadcasting an offer message, which includes the selected IP address and information about services that can be configured for the client. Each server temporarily reserves the offered IP address until the client indicates whether it will use the IP address.
The DHCP client selects the best offer based on the number and type of services offered and broadcasts a request that specifies the IP address of the DHCP server that made the best offer. The broadcast indicates to all the responding DHCP servers that the client has chosen a server. The servers that are not chosen can cancel the reservations for the IP addresses that they had offered.
The selected DHCP server allocates the IP address for the DHCP client and stores the information in the DHCP configuration files. The server also sends an acknowledgement message (ACK) to the client. The acknowledgement message contains the network configuration parameters for the client. The client uses the ping utility to test the IP address to make sure no other system is using it. The client then continues to join the network.
The DHCP client monitors the lease time. When a set period of time has elapsed, the client sends a new message to the chosen DHCP server to increase the lease time.
The DHCP server that receives the request extends the lease time if the lease still adheres to the local lease policy set by the administrator. If the server does not respond within 20 seconds, the client broadcasts a request so that one of the other DHCP servers can extend the lease.
When the DHCP client no longer needs the IP address, the client notifies the DHCP server that the IP address is released. This notification can happen during an orderly shutdown and can also be done manually.