Configuring Infinite DHCP Lease Time in ISC DHCP Server: Best Practices and Code Examples


3 views

When working with ISC DHCP server (dhcpd), lease duration is controlled by two key parameters in the configuration file:

default-lease-time [seconds];
max-lease-time [seconds];

While the documentation mentions the possibility of infinite leases (represented by 0), practical implementation reveals some important considerations.

The ISC DHCP server doesn't actually support zero as a valid lease time value. Instead, we need to use the maximum possible 32-bit unsigned integer value:

default-lease-time 4294967295; # Maximum 32-bit unsigned integer
max-lease-time 4294967295;

Here's a fully functional configuration example that implements near-infinite leases:

# Basic DHCP server configuration with infinite leases
authoritative;
ddns-update-style none;

# DNS Configuration
option domain-name-servers 8.8.8.8, 8.8.4.4;

# Lease time settings (approximately 136 years)
default-lease-time 4294967295;
max-lease-time 4294967295;

# Subnet declaration
subnet 192.168.11.0 netmask 255.255.255.240 {
  range 192.168.11.2 192.168.11.14;
  option routers 192.168.11.1;
  option broadcast-address 192.168.11.15;
  option subnet-mask 255.255.255.240;
}

1. The value 4294967295 seconds equals ~136 years - effectively infinite for most practical purposes

2. Some DHCP clients might still attempt to renew leases periodically

3. Consider adding client-specific declarations for devices that need shorter leases

After implementing these changes, verify the leases file to confirm the lease times:

cat /var/lib/dhcp/dhcpd.leases

You should see entries with lease expiration dates far in the future.


The ISC DHCP server's lease duration handling has some important behavioral nuances. While the documentation states leases can range "from zero seconds to infinity", in practice we need to understand how zero values are actually processed:

# Zero values in dhcpd.conf get special handling:
default-lease-time 0;  # Treated as infinite
max-lease-time 0;      # Also treated as infinite

Here's a complete working configuration example that assigns infinite leases:

authoritative;
ddns-update-style none;
log-facility local7;

# Global infinite lease settings 
default-lease-time 0;
max-lease-time 0;

subnet 192.168.100.0 netmask 255.255.255.0 {
  range 192.168.100.50 192.168.100.200;
  option routers 192.168.100.1;
  option domain-name-servers 8.8.8.8, 8.8.4.4;
  option broadcast-address 192.168.100.255;
}

After restarting dhcpd, check leases with:

cat /var/lib/dhcp/dhcpd.leases

You should see entries with "ends never" instead of expiration timestamps.

1. Client-side behavior varies - some clients may still attempt renewals

2. For Windows clients specifically, consider adding:

option dhcp-lease-time 4294967295; # Maximum uint32 value

3. Infinite leases make IP address reclamation impossible without manual intervention

For compatibility with older clients, you might use:

default-lease-time 31536000; # 1 year
max-lease-time 31536000;