IP addresses that are dynamically allocated by a DHCP server have leases. A DHCP Discover message from a DHCP client can carry an expected lease. When allocating network parameters, the DHCP server compares the expected lease with the specified lease in the address pool and allocates the IP address with the smaller of the two leases to the DHCP client. When the lease expires, the DHCP server reclaims the IP address, which can then be allocated to other clients. This mechanism improves IP address utilization. To continue to use this IP address, the DHCP client must renew its IP address lease.
A lease is the period beginning when a DHCP client obtains an IP address assigned by a DHCP server and ending when the DHCP client stops using the IP address. The DHCP client uses the Lease renewal timer, Rebinding timer, and Lease expiration timer to control leases.
The DHCP server can define a specific lease for each address pool, and addresses in the same DHCP address pool have the same lease.
Table 1 lists timers and their values.
Timer |
Value |
|---|---|
Lease renewal |
50% of the total lease |
Rebinding |
87.5% of the total lease |
Lease expiration |
Total lease. It is configured on a DHCP server and the default value is one day. |
When a DHCP client obtains an IP address and enters the binding status, the three timers take effect as follows:
After the Lease renewal timer expires, the DHCP client must renew its IP address. The DHCP client automatically sends DHCP Request messages to the DHCP server which has ever allocated IP addresses to it and enters the renewing status. If the IP address is valid, the DHCP server replies with a DHCP ACK message to the client to renew the lease. The DHCP client then re-enters the binding status. If the DHCP client receives a DHCP NAK message, it enters the initializing status.
After the DHCP client sends a DHCP Request message to renew the lease, it keeps in the renewing status and waits for the response. After the Rebinding timer expires and the client receives no response, the client considers the original DHCP server to be unavailable and broadcasts a DHCP Request message.
Any DHCP server on the network can respond to the request of the client and send a DHCP ACK or DHCP NAK message to the client.
If the client receives a DHCP ACK message, it enters the binding state and resets the Lease renewal and Rebinding timers.
If the client receives a DHCP NAK message, it enters the initializing state, stops using the existing IP address, and requests a new IP address.
After the Lease expiration timer expires and the client receives no response, it stops using the existing IP address immediately, returns to the initializing state, and requests a new IP address.
Figure 1 shows how a DHCP client renews its IP address lease.
If no response is received when the lease expires, the DHCP client stops using the IP address and sends a DHCP Discover message to apply for a new IP address.
When a DHCP client no longer needs to use the allocated IP address and the lease has not expired, the DHCP client sends a DHCP Release message to the DHCP server to request IP address release. The DHCP server saves the configuration of this DHCP client and records the IP address in the allocated IP address list. The IP address can then be allocated to this DHCP client or other clients.
To request a configuration update, a DHCP client can send a DHCP Inform message to the DHCP server.
Figure 2 shows how a DHCP client renews its IP address lease with a DHCP relay agent deployed.
If no response is received when the lease expires, the DHCP client stops using the IP address and sends a DHCP Discover message to apply for a new IP address.