Sub topic 2
DHCP Leases, Options, and Scopes
Assume you know IPv4 addresses, subnet masks, default gateways, DNS, and basic LAN routing.
Lease renewal at T1, rebinding at T2, and expiry
A DHCP lease is a time-limited permission to use an IP address. The client records the lease duration and two timers:
- T1 is normally 50% of the lease. The client sends a DHCPREQUEST directly to the original server to renew the lease.
- T2 is normally 87.5% of the lease. If renewal failed, the client broadcasts a request so any DHCP server can respond.
- Expiry occurs when the lease ends. If no server renewed it, the client must stop using the address and begin discovery again.
For a 24-hour lease, T1 is 12 hours and T2 is 21 hours.
lease_seconds = 24 * 60 * 60
print("T1:", lease_seconds * 0.50, "seconds")
print("T2:", lease_seconds * 0.875, "seconds")Options given to the client
DHCP options carry network settings along with the address. Common options include:
| Option | Purpose |
|---|---|
| Subnet mask | Defines the local IPv4 network |
| Router | Sets the default gateway |
| DNS server | Identifies servers that resolve names |
| Lease time | Sets how long the address may be used |
| Domain name | Supplies a local DNS search domain |
Scopes, exclusions, and reservations
A scope is a server’s pool of addresses for one subnet. An exclusion prevents selected addresses from being assigned, often because they belong to routers or servers. A reservation maps a device identifier, usually a MAC address, to a consistent address.
interface=eth0
dhcp-range=192.168.1.100,192.168.1.200,255.255.255.0,12h
dhcp-option=option:router,192.168.1.1
dhcp-option=option:dns-server,192.168.1.1
dhcp-host=aa:bb:cc:dd:ee:ff,192.168.1.50The reservation address should be outside the dynamic pool, or the server must explicitly manage that overlap.
Exercise
A client has a 24-hour lease and receives no response at T1. What happens next?
Show answer
It keeps using the address and tries again at T2 by broadcasting to any available DHCP server.