A DHCP lease temporarily assigns a host an IP address and related settings such as a netmask, default gateway, and DNS server. DHCP replaces per-host manual configuration with a stateful client–server process in which the server tracks leased addresses. section 4.4
Follow the four-message DORA exchange when a client first connects or needs network configuration:
- DISCOVER: the client broadcasts to locate DHCP servers and announces that it needs an address. section 4.1.1
- OFFER: a server offers an IP address and other configuration parameters. section 4.1.1
- REQUEST: the client accepts an offer, normally choosing the first offer received when multiple servers respond. section 4.4
- ACK: the server confirms and finalizes the lease; the client can then use the assigned parameters. section 4.4
Configure and verify a Cisco IOS lease
Reserve addresses for statically configured hosts, then create a pool for clients: R1(config)# ip dhcp excluded-address 10.0.0.2 10.0.0.5 R1(config)# ip dhcp pool POOL1 R1(dhcp-config)# network 10.0.0.0 /24 R1(dhcp-config)# default-router 10.0.0.1 R1(dhcp-config)# dns-server 10.0.0.1 8.8.8.8 R1(dhcp-config)# domain-name jeremysitlab.com R1(dhcp-config)# lease 0 5 30 The pool leases addresses from 10.0.0.0/24, supplies gateway, DNS, and domain parameters, and sets a lease time of five hours and thirty minutes. Verify active assignments with show ip dhcp binding; for example, 10.0.0.6 and 10.0.0.7 appear as Automatic bindings for two clients.
DHCP uses UDP 67 for server messages and UDP 68 for client messages. When Cisco IOS detects that a candidate address is already in use, it can ping the address, mark it conflicted, and report it with show ip dhcp conflict. section 4.1.1
