How to Manage Microsoft DHCP Clients with DHCP Lease Times

Steve Sherry

Read more posts by this author.

Every device these days seems to have an IP address. IP addresses or just “IPs” help billions of devices connect to networks to communicate with others devices.

To manage all of those IPs, network operators tend to dynamically assign IPs according to a set of rules using a protocol called Dynamic Host Configuration Protocol (DHCP). One of those most ubiquitous DHCP components is the lease time or the time in which a device holds an IP.

In this article, you’re going to learn about DHCP lease times, how to find and update the length of the DHCP lease times in a corporate network using Microsoft DHCP.

What’s DHCP?

DHCP is a common protocol used across millions of devices to dynamically assign IP addresses. Many devices can run DHCP services like your home router, your personal ISP, or in a corporate environment as a server.

In a corporate environment, network administrators use DHCP servers hosted on various devices from network switches, routers, Linux, and Windows servers. These DHCP servers hand out or lease IP addresses to devices across different IP ranges or scopes.

Understanding DHCP Lease Times

An important part of DHCP is the lease. A device is known to “lease” an IP address from a DHCP server for a certain period of time (lease time).

Network administrators typically configure DHCP servers to lease IP addresses based on different use cases. For example, for devices on a wired connection that rarely leave the network, administrators may assign a longer lease time like eight days. If the device never leaves the network, it’s not efficient to go through the lease renewal process.

On the other hand, if a wireless device roams on and off the network several times a week, administrators may assign a shorter lease period (12-24 hours) to save available IP addresses for other devices.

Finding DHCP Lease Times

Now that you know that dynamically-assigned IP addresses have lease times, how do you actually discover it on a device? Unfortunately, each operating system (OS) has a different way of exposing the DHCP lease time. Let’s cover all of the major OSes.

Windows 10

In Windows 10, you see your DHCP lease time on the command-line either with the command prompt (cmd.exe) or PowerShell. This tutorial assumes you are an IT pro or fairly tech-savvy so let’s use PowerShell.

1. Click on the Windows Start button, then type PowerShell. You should see the Windows PowerShell application come up. Click on that.

Opening the Windows PowerShell application
Opening the Windows PowerShell application

2. Once in the Windows PowerShell window, type in ipconfig /all and review the output.

3. Inspect the output to find Lease Obtained and Lease Expires. The Lease Obtained field is the exact time the DHCP server assigned the IP address to this device. The Lease Expires field indicates the time the device will ask the DHCP server to renew its lease.

Subtract the Lease Expires value from the Lease Obtained value and you have your DHCP lease time.

lease time from windows 10
lease time from windows 10

macOS

To find your DHCP lease time on macOS is similar to Windows 10 by using the command-line. But instead of PowerShell, the easiest way is to use the macOS Terminal. To do so:

1. Press Cmd + Space on your keyboard to open Spotlight.

2. Type “terminal” to search for for the Terminal application.

3. When you see the Terminal application, click on it or press Enter.

Open the Terminal application on a mac
Open the Terminal application on a mac

4. Next, type ipconfig getpacket en0 (replacing en0 with en1 if you have more than one network card)

This command will returns results including the DHCP lease time in base-16 hexadecimal format as shown below. As shown in this example, the result is 0x15180.

lease time on a macbook
lease time on a macbook

5. Now, convert the hexadecimal value to seconds. The result will be 86400 seconds or 24 hours.

To convert numbers from one format to another quickly use https://www.binaryhexconverter.com/hex-to-decimal-converter.

Ubuntu Linux

Using a Terminal application again, you can find the DHCP lease time in Linux in a similar manner.

1. In Ubuntu, press the Super (Windows) key to bring up a search box and type “terminal“.

2. When you see the Terminal application, click on it.

Find Terminal and open it
Find Terminal and open it

3. Once in the Terminal window, type sudo dhclient -v eth0 (replacing eth0 with your own device name, if different) and review the output.

4. Search through the output to find the line that contains renewal in xxxxx seconds. This line pertains to the DHCP lease time. You’ll see it in the screenshot below 38495 seconds are remaining in the DHCP Lease.

lease time on Ubuntu
lease time on Ubuntu

Understanding Microsoft DHCP

Up until now, the tutorial hasn’t focused on any specific DHCP server. Instead, it’s focused on the client. Let’s now focus on the server-side specifically Microsoft’s implementation of the DHCP server.

Like many other DHCP servers, Microsoft DHCP services consist of various pools of IP addresses. These pools represent all assignable IP addresses for a particular group of devices. In the example below, notice that the DHCP scope for the 10.0.0.0 network has been assigned a pool of 100 IP addresses (10.0.0.100 – 10.0.0.200).

DHCP Address Pool
DHCP Address Pool

DHCP services can only assign one IP address per device. How does the DHCP server know when it can re-use an IP address in the pool? The DHCP lease time.

If a device doesn’t renew its dynamically-assigned IP address within the lease time, the lease expires and is available to other devices to lease.

Setting the Microsoft DHCP Lease Period

As an IT admin, you’ll often be expected to manage the DHCP within an office. Most organizations use a Microsoft Windows Server installed with the DHCP Server service.

To make changes to a Microsoft DHCP server, you must be a member of the DHCP Administrators group or have equivalent rights. This tutorial also assumes you’re in an Active Directory environment on a domain-joined computer.

Let’s now discover how to set the DHCP lease period at the server level for devices.

1. Connect to your DHCP server’s console via Remote Desktop Protocol (RDP) or connect to the server or open the DHCP management console with Windows 10 Remote Server Administration (RSAT).

2. If RDPed to the server, open Server Manager, go to Tools and then DHCP as shown below.

Open the DHCP Service within Windows Server Manager
Open the DHCP Service within Windows Server Manager

3. Once you’re in the DHCP management console, you’ll see at least one DHCP server and at least one DHCP scope. If the DHCP server is not visible, right-click on the DHCP node as shown below and click Add Server….

right-click on the DHCP node and click Add Server
right-click on the DHCP node and click Add Server

4. If you know the server name, click on Browse and search for it. Alternatively, review the list of authorized servers within your environment and choose the one that is relevant. Click OK when done.

review the list of authorized servers
review the list of authorized servers

5. Once you see a DHCP server come up under the DHCP node, expand the server node —> IPv4 to reveal all of the configured scopes.

6. Find the scope containing the IP address pool you’d like to look at, right-click on the scope name, and select Properties.

Display the properties of your DHCP Scope
Display the properties of your DHCP Scope

7. Within the Properties window, you’ll now see a Lease duration for DHCP clients. This setting is the DHCP lease time for all IP addresses in that scope.

The default DHCP lease period on Microsoft DHCP servers is eight days, but it can be updated to any period of time to suit the business needs.

Show the DHCP Lease properties and the DHCP Lease duration
Show the DHCP Lease properties and the DHCP Lease duration

8. Click Cancel to close the Properties box.

9. Optionally, click on the Address Leases node in the scope as shown below. Here you can see all of the existing leases in use inside of this scope.

Display existing DHCP leases in use within your environment
Display existing DHCP leases in use within your environment

Conclusion

DHCP is an extremely common service on today’s networks. If you’re an IT admin, it’s critical you understand, at a basic level, what this service is capable of.

This tutorial covered the basics of DHCP and how Microsoft DHCP works. If you’d like to continue learning, check out this Microsoft article that goes in depth on many interesting DHCP features.

Looks like you're offline!