ip dhcp lease
Control how long DHCP clients hold an IP address before renewing, balancing pool efficiency with renewal overhead.
Definition: ip dhcp lease is a Cisco IOS dhcp pool config command. Sets the duration of DHCP address leases for a DHCP pool configured on a Cisco IOS router. Default lease time is 1 day if not specified.
Overview
The `lease` command in DHCP pool configuration mode sets the duration for which an IP address is leased to a client. This command is critical for managing IP address allocation in networks where DHCP is used to dynamically assign addresses. The lease duration determines how often clients must renew their IP addresses, balancing network stability with address pool efficiency.
Shorter leases allow for quicker turnover of addresses, which is useful in environments with many transient devices (e.g., guest Wi-Fi). Longer leases reduce renewal traffic and are suitable for stable networks with fixed devices. The command is entered in DHCP pool configuration mode, which is accessed via `ip dhcp pool <name>`.
The lease duration can be specified in days, hours, and minutes. If no lease is configured, the default is one day. The lease time is stored in the running configuration and can be verified with `show ip dhcp binding`.
Understanding lease times is essential for troubleshooting IP address exhaustion, renewal failures, and client connectivity issues. The command interacts with the DHCP server process on the router, which tracks lease expiration and sends renewal offers. In IOS, the lease command is available in all privilege levels that allow configuration, typically privileged EXEC mode (enable) and above.
Changes take effect immediately for new leases; existing leases continue with their original lease time until renewal. The command does not affect the running config until applied, and it is saved to startup config with `copy running-config startup-config`.
lease {days [hours [minutes]] | infinite}When to Use This Command
- Short leases (2-4 hours) for high-turnover environments like conference rooms or public Wi-Fi
- Long leases (7+ days) for stable workstations where frequent renewal is unnecessary
- Infinite lease for static-like DHCP assignments to printers and servers
- Match lease duration to VPN session lifetime for remote access clients
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| days | <0-365> | Specifies the number of days in the lease duration. Valid values range from 0 to 365. A value of 0 means no days are included; you must then specify hours and/or minutes. Common mistake: omitting this parameter when you intend to set only hours/minutes; you must explicitly set days to 0. |
| hours | <0-23> | Specifies the number of hours in the lease duration. Valid values range from 0 to 23. This parameter is required even if set to 0. Common mistake: forgetting to include hours when you want only days and minutes; the command expects all three parameters in order. |
| minutes | <0-59> | Specifies the number of minutes in the lease duration. Valid values range from 0 to 59. This parameter is required even if set to 0. Common mistake: entering a value greater than 59, which is rejected by IOS. |
Command Examples
Configure DHCP pool with 8-hour lease
Router(config)# ip dhcp pool SALES_POOL Router(dhcp-config)# network 192.168.10.0 255.255.255.0 Router(dhcp-config)# default-router 192.168.10.1 Router(dhcp-config)# dns-server 8.8.8.8 Router(dhcp-config)# lease 0 8 Router(dhcp-config)# end
Understanding the Output
lease 0 8 = 0 days, 8 hours. lease 1 = 1 day. lease infinite = no expiry. DHCP clients attempt to renew at 50% of lease time (T1) and at 87.5% (T2). show ip dhcp binding displays current leases with expiry times. show ip dhcp pool shows pool statistics including available vs allocated addresses.
Configuration Scenarios
Configure a 7-day lease for a corporate office DHCP pool
In a corporate office with mostly stationary workstations, a longer lease reduces DHCP renewal traffic and provides stable IP addressing. The goal is to set a 7-day lease for the pool named 'CORP_POOL'.
Topology
R1(Gi0/0)---192.168.1.0/24---(Gi0/0)Client1
R1(Gi0/1)---10.0.0.0/24---(Gi0/0)Client2Steps
- 1.Step 1: Enter global configuration mode: R1# configure terminal
- 2.Step 2: Define the DHCP pool: R1(config)# ip dhcp pool CORP_POOL
- 3.Step 3: Set the network and subnet mask: R1(dhcp-config)# network 192.168.1.0 255.255.255.0
- 4.Step 4: Set the default gateway: R1(dhcp-config)# default-router 192.168.1.1
- 5.Step 5: Set the lease duration to 7 days: R1(dhcp-config)# lease 7 0 0
- 6.Step 6: Exit configuration mode: R1(dhcp-config)# end
! R1(config)# ip dhcp pool CORP_POOL R1(dhcp-config)# network 192.168.1.0 255.255.255.0 R1(dhcp-config)# default-router 192.168.1.1 R1(dhcp-config)# lease 7 0 0 R1(dhcp-config)# end
Verify: Use 'show ip dhcp binding' to see active leases and their expiration times. Expected output shows lease expiration 7 days from assignment. Also use 'show running-config | section ip dhcp pool' to confirm lease setting.
Watch out: If you forget to include the hours and minutes parameters (e.g., 'lease 7'), IOS will reject the command. Always provide all three values.
Configure a 30-minute lease for a guest Wi-Fi DHCP pool
For a guest Wi-Fi network with high device turnover, a short lease ensures addresses are reclaimed quickly. The goal is to set a 30-minute lease for the pool named 'GUEST_POOL'.
Topology
R2(Gi0/0)---172.16.0.0/24---(Wi-Fi AP)---Guest DevicesSteps
- 1.Step 1: Enter global configuration mode: R2# configure terminal
- 2.Step 2: Define the DHCP pool: R2(config)# ip dhcp pool GUEST_POOL
- 3.Step 3: Set the network and subnet mask: R2(dhcp-config)# network 172.16.0.0 255.255.255.0
- 4.Step 4: Set the default gateway: R2(dhcp-config)# default-router 172.16.0.1
- 5.Step 5: Set the lease duration to 0 days, 0 hours, 30 minutes: R2(dhcp-config)# lease 0 0 30
- 6.Step 6: Exit configuration mode: R2(dhcp-config)# end
! R2(config)# ip dhcp pool GUEST_POOL R2(dhcp-config)# network 172.16.0.0 255.255.255.0 R2(dhcp-config)# default-router 172.16.0.1 R2(dhcp-config)# lease 0 0 30 R2(dhcp-config)# end
Verify: Use 'show ip dhcp binding' to verify that leases expire after 30 minutes. Also check 'show ip dhcp pool' to see the lease time configured.
Watch out: A common mistake is entering 'lease 30' thinking it sets 30 minutes; IOS interprets it as 30 days. Always specify days, hours, and minutes explicitly.
Troubleshooting with This Command
When troubleshooting DHCP lease issues, the `lease` command itself is not directly used for diagnosis, but understanding its effect is crucial. Healthy DHCP operation shows clients receiving IP addresses and renewing before lease expiry. Problem indicators include clients failing to obtain addresses (DHCPDISCOVER not answered), frequent IP address conflicts, or clients losing connectivity after a specific time.
Focus on the lease duration in the pool configuration; if it is too short, clients may experience frequent renewals and potential service interruption. Use `show ip dhcp binding` to view active leases and their remaining time. If many leases show 'Expired' or 'Idle', the lease time may be too short or the pool exhausted.
Use `debug ip dhcp server events` to monitor DHCP messages; look for 'DHCPREQUEST' and 'DHCPACK' sequences. If clients send 'DHCPREQUEST' but receive no 'DHCPACK', the server may be out of addresses or the lease time is misconfigured. Also check `show ip dhcp conflict` for address conflicts.
A step-by-step diagnostic flow: 1) Verify pool configuration with `show running-config | section ip dhcp pool`. 2) Check pool utilization with `show ip dhcp pool`. 3) Examine bindings with `show ip dhcp binding`. 4) Enable debug with `debug ip dhcp server events` and reproduce the issue. 5) Look for 'DHCPNAK' messages which indicate the server rejected a renewal, possibly due to lease time mismatch or pool exhaustion. Correlate with `show ip interface brief` to ensure the server interface is up. If clients are on a different subnet, verify `ip helper-address` configuration.
Remember that the lease command only affects future leases; existing leases retain their original duration until renewal. To force a client to obtain a new lease, you can clear the binding with `clear ip dhcp binding *` (use with caution).
CCNA Exam Tips
CCNA exam: know that the default lease is 1 day
The DHCP renew process: client sends DHCPREQUEST as unicast to the server at T1 (50% of lease)
If no response, broadcasts DHCPREQUEST at T2 (87.5%)
If still no response, releases the IP
Lease duration affects pool exhaustion rate — shorter leases free IPs faster
Common Mistakes
Forgetting that lease 0 8 means 0 days 8 hours (first number is days)
Not excluding the default gateway's IP from the pool with ip dhcp excluded-address — the router may assign its own IP to a client
Configuring lease infinite for dynamic clients — pool exhaustion if clients disconnect without releasing
ip dhcp lease vs ip dhcp snooping limit rate
The commands 'ip dhcp lease' and 'ip dhcp snooping limit rate' both influence DHCP behavior on Cisco devices but operate at different layers: one manages DHCP server lease times, the other enforces security on DHCP relay/snooping. They are sometimes compared when designing both DHCP provisioning and protection mechanisms.
| Aspect | ip dhcp lease | ip dhcp snooping limit rate |
|---|---|---|
| Configuration mode | DHCP pool configuration (config-dhcp) | Interface configuration (config-if) |
| Function | Sets lease duration for addresses in a pool | Limits DHCP packet rate on a port |
| Default | 1 day if not configured | No limit (disabled) |
| Scope | Affects a specific DHCP pool | Affects a specific interface |
| Impact | Controls client IP renewal frequency | Protects against DHCP starvation/rogue attacks |
| Persistence | Persists in running-config, no state | Persists in running-config, triggers err-disable |
Use ip dhcp lease when you need to control how long DHCP clients keep their IP addresses from a specific pool.
Use ip dhcp snooping limit rate when you need to protect a VLAN or switch from DHCP-based attacks by rate-limiting DHCP messages on untrusted ports.
Platform Notes
In IOS-XE (e.g., 16.x), the `lease` command syntax is identical to classic IOS. However, IOS-XE may support additional lease options like `infinite` (not available in classic IOS). For NX-OS, the equivalent command is `ip dhcp pool <name>` followed by `lease <days> <hours> <minutes>` but note that NX-OS uses a different DHCP server implementation and may have additional parameters like `renewal` and `rebind` times.
On ASA, DHCP lease configuration is done via `dhcpd lease <seconds>` in global configuration mode, not per-pool. In IOS-XR, DHCP server configuration is different; the lease is set under the `dhcp ipv4` profile using `lease {infinite | <days> <hours> <minutes>}`. For IOS versions 12.x, 15.x, and 16.x, the `lease` command behavior is consistent, but 12.x may not support lease times longer than 365 days.
Always check the specific IOS documentation for your version. On Catalyst switches running IOS, the command is the same as on routers. On IOS-XE, the output of `show ip dhcp binding` may include additional fields like 'State' and 'Lease Expiration' in a different format.
Be aware that on some platforms, the lease time is stored in seconds internally, but the configuration is always in days/hours/minutes.
Related Commands
ip dhcp snooping limit rate
Limits the rate of DHCP packets that can be received on a switch port. Ports exceeding the rate limit are err-disabled automatically, protecting against DHCP starvation attacks and rogue DHCP servers.
show ip dhcp snooping binding
Displays the DHCP snooping binding table showing MAC address to IP address mappings, the VLAN, lease time, and the port each binding is associated with. Used by Dynamic ARP Inspection and IP Source Guard as a trusted source.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions