Introduction
Dynamic Host Configuration Protocol for IPv4 (DHCPv4) automatically provides hosts with IP addressing information. Instead of manually assigning addresses to every device, administrators can configure a DHCP server to lease addresses and related settings.
Learning Goals
By the end of this module, you should be able to:
- Explain the DHCPv4 client-server process.
- Describe how leases are obtained and renewed.
- Configure a Cisco IOS router as a DHCPv4 server.
- Verify DHCPv4 operation.
- Configure DHCP relay for clients on remote networks.
- Configure a router interface as a DHCP client.
DHCPv4 Server and Client
A DHCPv4 client requests addressing information from a DHCPv4 server. A complete DHCP lease can include:
- IPv4 address,
- subnet mask,
- default gateway,
- DNS server address,
- domain name,
- lease duration,
- other optional parameters.
DHCP reduces configuration errors and makes address management easier in changing networks.
Steps to Obtain a Lease
The initial DHCP process is often remembered as DORA:
- Discover: The client broadcasts a message looking for DHCP servers.
- Offer: A server offers an available address and settings.
- Request: The client requests the offered address.
- Acknowledge: The server confirms the lease.
Because a new client may not yet have an IP address or know the server address, early DHCP messages use broadcasts.
Steps to Renew a Lease
A client does not keep a leased address forever. Before the lease expires, it attempts to renew the lease, often by contacting the original DHCP server directly. If renewal fails, the client may eventually broadcast again to find any available DHCP server.
Cisco IOS DHCPv4 Server
A Cisco router can provide DHCPv4 service for a small or lab network. Basic configuration includes:
- excluding addresses that should not be leased,
- creating a DHCP pool,
- defining the network and subnet mask,
- setting the default router,
- setting DNS and other options if needed.
Activity: Configure a Cisco IOS DHCPv4 Server
DHCPv4 Verification
Useful checks include:
- Confirm the router interface facing clients is up and has the correct gateway address.
- Confirm excluded addresses do not overlap incorrectly with the available pool.
- Confirm the pool network matches the client subnet.
- Confirm clients are set to obtain an IP address automatically.
- Check the DHCP binding table after clients request addresses.
Activity: Troubleshoot a DHCP Client
Disable the Cisco IOS DHCPv4 Server
If a router should not provide DHCP service, disable the DHCP service globally.
Activity: Disable DHCP Service
DHCPv4 Relay
DHCP clients use broadcasts at the start of the lease process. Routers do not normally forward broadcasts between networks. If the DHCP server is on a different subnet, configure DHCP relay on the interface that receives client broadcasts.
The relay address points to the DHCP server.
Activity: Configure DHCP Relay
Cisco Router as a DHCPv4 Client
A router interface can also receive an IP address from a DHCP server. This is common on an edge router connected to an ISP or upstream network.
Activity: Configure a Router Interface as a DHCP Client
Summary
DHCPv4 automates IPv4 address assignment. Clients obtain leases through Discover, Offer, Request, and Acknowledge messages. Cisco IOS can act as a DHCP server, relay, or client. Verification commands help confirm pools, bindings, and client leases.