Computers that are configured to automatically obtain an IP addresses from a DHCP (Dynamic Host Configuration Protocol) server receive an IP address not for permanent use, but for a fixed period of time. This time period is called the DHCP Lease Time. Upon expiration of the lease, this IP address is considered free and can be assigned to another device in the network.
After half (1/2) of the lease time of the IP address has passed, the client tries to extend the lease of the given IP address on the DHCP server. In order to do this, the client sends a DHCPREQUEST request to the server. If the DHCP server can extend the IP address lease, it sends a DHCPACK message with the new lease time and TCP/IP configuration parameters. After receiving confirmation, the DHCP client updates its network configuration. If renewing the IP address lease fails, the DHCP client will try to do it again.
After 87.5% (7/8) of the lease time will expire, the client will send a broadcast DHCPREQUEST packet to communicate with any available DHCP server in the network.
When the lease expires or a DHCPNACK message is received, the DHCP client should immediately release this IP address. After that, he can resume the lease process to obtain a new IP address.
On a Windows device, you can get the current lease time for the assigned IP addresses using the command:
You will see the date of obtaining an IP address, and the expiration time:
Lease Obtained. . . . . . . . . . : Friday, July 5, 2019 4:57:31 PM
Lease Expires . . . . . . . . . . : Saturday, July 13, 2019 4:57:31 PM
How to Change DHCP Lease Time in Windows Server?
By default, the DHCP server on Windows Server uses a lease time—8 days. In most cases, this is the optimal value. However, if there are few free addresses in your IP subnet, you can decrease the Lease Time value so that unused IP addresses are released faster.
Optimal values DHCP lease time for different network types:
- For wired Ethernet networks – 8 days;
- For wireless networks – 1 day;
- For guest Wi-Fi networks – 2-8 hours;
You can change lease time settings for each scope on the DHCP server. In this example, we will show how to reduce DHCP Lease Time from 8 to 2 days on Windows Server 2012 R2.
- Run the DHCP management console—dhcpmgmt.msc;
- Open the properties of the DHCP scope for which you want to reduce the lease time;
- On the “General” tab in the “Lease Duration for DHCP clients” section, in the “Limited to” field, specify a new lease time for clients of this scope (you can even completely disable the lease time, in this case, the IP addresses will be issued to devices permanently);
- Save your changes by clicking OK.
New DHCP lease time settings will apply for DHCP requests from new clients of the DHCP server and on the next renewal of the IP address by old clients.
You can also change the DHCP Lease time for a specific scope using the Set-DHCPServerv4Scope PowerShell cmdlet:
Set-DHCPServerv4Scope ScopeID 10.1.1.0 -LeaseDuration 2.00:00:00
After changing the DHCP scope settings, you can get the current properties with the Get-DHCPServerv4Scope command.