DHCP Reservations – Active or Inactive?

In DHCP servers you can configure IP address reservations, meaning that you statically configure the IP addresses that you want the specific DHCP clients to get. This is sometimes desirable when you know your devices and want to ensure that their DHCP-assigned IP addresses won’t change, because of, you know, reasons. (Printers may or may not be your headache still in 2024.)

The reservation (or lease pinning, or MAC binding, as it’s also called) is usually done based on the client MAC address. Actually it’s about client identifiers, but most often the DHCP clients use the MAC address of the outgoing network interface as the client identifier, so MAC address here it is.

Operationally there are two ways to reserve a DHCP IP address to a client in the DHCP server configuration:

  1. Preconfigure the reservation: First get the MAC address of the client using some external means and then configure the new reservation for a specific available IP address in the DHCP pool for that MAC address
  2. Wait for the DHCP client to have connected to the network and acquired a dynamic IP address, and then fix that lease for that client.

The second way is obviously simplier in the sense that you get the client MAC address automatically in the lease, you don’t have to find it out some other way. The downside is that you don’t get to choose the IP address beforehand, if that’s important to you.

Let’s see how the lease behaves in Microsoft Windows Server 2022 DHCP service before and after the reservation. First I’ll fire up my DHCP client host and get it a DHCP lease:

DHCP client logs:

Apr  6 16:10:50 testclient dhclient[1629]: DHCPDISCOVER on ens192 to 255.255.255.255 port 67 interval 8
Apr  6 16:10:50 testclient dhclient[1629]: DHCPOFFER of 10.0.41.50 from 10.0.41.20
Apr  6 16:10:50 testclient dhclient[1629]: DHCPREQUEST for 10.0.41.50 on ens192 to 255.255.255.255 port 67
Apr  6 16:10:50 testclient dhclient[1629]: DHCPACK of 10.0.41.50 from 10.0.41.20
Apr  6 16:10:50 testclient dhclient[1629]: bound to 10.0.41.50 -- renewal in 60 seconds.

DHCP server leases:

PS C:\> Get-DhcpServerv4Lease -ScopeId 10.0.41.0 | Format-Table -AutoSize

IPAddress  ClientId          HostName   AddressState LeaseExpiryTime
---------  --------          --------   ------------ ---------------
10.0.41.50 00-0c-29-67-42-7a testclient Active       6.4.2024 16.12.50

(Note: In this post I have manually deleted the ScopeId column from all the Get-DhcpServerv4Lease command outputs to fit the columns better in the page. The ScopeId is 10.0.41.0 in all shown commands here.)

From those we can deduce that our DHCP server gives out leases for two minutes, thus the renewal interval is about one minute. This is just my demo environment, usually the lease times are in the order of hours or days, depending on your specific circumstances.

Now we can fix (or reserve) the lease for the client with the Set-DhcpServerv4Reservation PowerShell command:

PS C:\> Set-DhcpServerv4Reservation -IPAddress 10.0.41.50 -Type Dhcp
PS C:\> Get-DhcpServerv4Lease -ScopeId 10.0.41.0 | Format-Table -AutoSize

IPAddress  ClientId          HostName   AddressState        LeaseExpiryTime
---------  --------          --------   ------------        ---------------
10.0.41.50 00-0c-29-67-42-7a testclient InactiveReservation

Here the DHCP server automatically changed the state of the lease from Active to InactiveReservation, and the LeaseExpiryTime column is empty.

(Interestingly, at the same time the DHCP server also logged a Deleted message in the log:

16,04/06/24,16:14:47,Deleted,10.0.41.50,,0029000A01000C2967427A,SERVER1\Administrator,0,6,,,,,,,,,0

Also, the identifier string is not just the MAC address like usually, but:

  • 0029000A = 0x00 0x29 0x00 0x0A = 0.41.0.10 = scope ID 10.0.41.0, reversed
  • 01 = hardware type = Ethernet
  • 000C2967427A = MAC address

But these are just some background details for DHCP protocol nerds.)

Let’s wait for the DHCP client to issue the lease renewal request, and now the lease status has changed to ActiveReservation:

PS C:\> Get-DhcpServerv4Lease -ScopeId 10.0.41.0 | Format-Table -AutoSize

IPAddress  ClientId          HostName   AddressState      LeaseExpiryTime
---------  --------          --------   ------------      ---------------
10.0.41.50 00-0c-29-67-42-7a testclient ActiveReservation

You can see that the LeaseExpiryTime column is still empty.

Subsequent renewals from the client don’t change anything in the list, the lease stays in ActiveReservation state without expiration time.

The common question is: How do I know if my DHCP reservation is still used, if the lease time is not mentioned in the list anymore?

Before answering that, let’s first make the DHCP client release the lease. Then see how the lease looks like on the server:

PS C:\> Get-DhcpServerv4Lease -ScopeId 10.0.41.0 | Format-Table -AutoSize

IPAddress  ClientId          HostName   AddressState        LeaseExpiryTime
---------  --------          --------   ------------        ---------------
10.0.41.50 00-0c-29-67-42-7a testclient InactiveReservation

The lease has changed to InactiveReservation.

Then make the DHCP client active again, and you will see that the lease state changes to ActiveReservation again (take my word for it).

So, here we have three observations now:

  1. The reservation is in InactiveReservation state if the DHCP client has not yet requested a lease at all (= a newly configured reservation)
  2. The reservation changes to ActiveReservation state as soon as the DHCP client requests the address
  3. The reservation changes again to InactiveReservation if the DHCP client releases the lease.

As mentioned earlier, there are no changes in the lease list when the DHCP client keeps renewing the lease as the lease just stays in ActiveReservation state.

InactiveReservation can mean that the reservation has not been used at all, or that the DHCP client has released the lease (like because of system shutdown).

But what happens if the DHCP client just disappears from the network without releasing the DHCP lease? Well, I tested that as well, and the reserved lease stays at the ActiveReservation state, regardless of the configured lease time of the DHCP scope and the database cleaning processes of the DHCP server (described in my earlier post About Windows DHCP Server Lease Expirations).

So how can I know if the DHCP reservation is really being used? Based on the findings above, it is complicated.

Matching the MAC addresses from the configured DHCP reservations with the MAC addresses seen in the DHCP server logs (C:\Windows\system32\dhcp\DhcpSrvLog-xxx.log in this case) for long enough time period is a way to find out if the reservations are being used or not.

There is a trick though to force the reservations to go to InactiveReservation state until the clients renew their leases (and thus change to ActiveReservation state when renewal happens), if that helps you: reconfigure the reservation type. Even if you configure the reservation type to the existing value (usually Dhcp), if will reset the reservation state to InactiveReservation:

PS C:\> Set-DhcpServerv4Reservation -IPAddress 10.0.41.50 -Type Dhcp
PS C:\> Get-DhcpServerv4Lease -ScopeId 10.0.41.0 | Format-Table -AutoSize

IPAddress  ClientId          HostName   AddressState        LeaseExpiryTime
---------  --------          --------   ------------        ---------------
10.0.41.50 00-0c-29-67-42-7a testclient InactiveReservation

As soon as the DHCP client will renew the lease, the state will change to ActiveReservation again.

This way you can get an indication about the reservation usage: see which leases stay in the InactiveReservation state.

Obviously you will need to wait for all the DHCP clients to have renewed the leases, based on the configured lease times, before checking the states again. And, if some of your DHCP-reserved clients are not used in the network for longer periods of time (like employee workstations during holiday times, or some branch site printers that are only used once a month to print the inventory lists), you need to consider those as well.

It is also possible that the DHCP clients release their IP addresses when shutting down, changing the leases again to InactiveReservation state, so it is necessary to check to lease state several times at different times.

If you want to use this method for all your DHCP reservations across all scopes, you can pipe the reserved IP addresses from the lists of all scopes and reservations:

PS C:\> Get-DhcpServerv4Scope | Get-DhcpServerv4Reservation | Set-DhcpServerv4Reservation -Type Dhcp

Finally, an example of how to show only the leases that currently are in InactiveReservation state in all scopes:

PS C:\> Get-DhcpServerv4Scope | Get-DhcpServerv4Lease | Where-Object { $_.AddressState -eq "InactiveReservation" }

Happy DHCP reservation usage hunting!

Leave a Reply