CCNA online course

Configure a Cisco Router as a DHCP Server

Learn how to configure a Cisco IOS router as an IPv4 DHCP server, design address pools, verify leases, troubleshoot clients, and configure DHCP relay.

Dynamic Host Configuration Protocol (DHCP) automatically supplies IPv4 network settings to clients. Instead of manually entering an IP address, subnet mask, default gateway, and DNS server on every device, a DHCP client requests those settings from a DHCP server.

This lesson shows how to configure a Cisco IOS router as a DHCP server for directly connected LANs, verify address assignment, troubleshoot common failures, and distinguish local DHCP service from DHCP relay.

DHCP fundamentals

DHCP is a client-server protocol that automatically supplies IPv4 configuration information to hosts. A typical lease includes an IP address and subnet mask, but the server can also provide the default gateway, DNS servers, domain name, lease duration, and network-boot options.

Important DHCP terms

  • DHCP client: A host, such as a laptop or printer, that requests network configuration.
  • DHCP server: A device that owns or manages address pools and offers configuration leases. A Cisco IOS router can perform this role.
  • DHCP pool: A named Cisco IOS configuration section defining the subnet and options offered to clients.
  • Lease: The temporary period during which a client may use an assigned address. The client normally renews the lease before it expires.
  • DHCP binding: The server record associating a leased IP address with a client identifier or hardware address.
  • Excluded address: An address that belongs to the DHCP subnet but must not be assigned dynamically.
  • Default gateway: The router address a client uses to reach destinations outside its local subnet.
  • DNS server: A server that resolves hostnames to IP addresses.

The DORA exchange

When a client needs an address, it commonly uses the four-step DORA exchange:

  1. Discover: The client broadcasts a DHCP Discover message to locate DHCP servers.
  2. Offer: A server responds with an available address and configuration options.
  3. Request: The client requests one offered lease and identifies the server it selected.
  4. Acknowledgment: The server confirms the lease and supplies the final options.

The client uses the address for the lease duration. It attempts renewal before expiration, usually by communicating directly with the original server. If renewal fails, the client may continue using the lease temporarily and later restart the discovery process.

How a Cisco router provides DHCP

A Cisco IOS router can act as a DHCP server for LANs connected to its Layer 3 interfaces. The client-facing interface must have an IPv4 address, must be in the same subnet as the pool, and must be operational.

The router interface address is normally also the client default gateway. For example, if the interface is 192.168.10.1/24, clients on that LAN should receive 192.168.10.1 as their default gateway.

Before configuring the pool, verify that the interface has the correct address and is operational. A configured interface that is administratively or physically down cannot serve connected clients.

Example topology and address plan

ItemExample valueReason
Client subnet192.168.10.0/24Network used by the LAN clients
Subnet mask255.255.255.0Defines the /24 client subnet
Router default gateway192.168.10.1Router LAN interface and client gateway
Excluded infrastructure range192.168.10.1 through 192.168.10.20Reserved for the gateway, switches, servers, printers, and other static devices
Dynamic client range192.168.10.21 through 192.168.10.254Addresses available for DHCP clients
DNS server8.8.8.8 and 1.1.1.1Resolvers supplied to clients
Lease duration7 daysExample time before the lease must be renewed

Configure the client-facing interface

Enter global configuration mode, select the LAN interface, assign its IPv4 address, and enable it.

configure terminal
interface gigabitEthernet 0/0
ip address 192.168.10.1 255.255.255.0
no shutdown

Interface names vary by router model. Use the interface available in your device or lab. The interface address and mask must match the subnet used in the DHCP pool.

Exclude reserved addresses

Use excluded addresses for the gateway, infrastructure devices, servers, printers, and any host configured with a static address. Excluding these addresses prevents the DHCP server from offering an address that is already in use.

Configure exclusions before clients request leases:

configure terminal
ip dhcp excluded-address 192.168.10.1 192.168.10.20

The first and last addresses in the command define an inclusive range. To exclude one address, specify the same address twice:

ip dhcp excluded-address 192.168.10.50 192.168.10.50

Do not exclude more addresses than your design requires. An excessively large exclusion range can leave too few addresses for clients.

Create a Cisco IOS DHCP pool

Use ip dhcp pool in global configuration mode to create or enter a named pool. Pool subcommands define the network and the options sent to clients.

configure terminal
ip dhcp pool LAN-POOL
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 8.8.8.8 1.1.1.1
domain-name example.local
lease 7

The network command identifies the client subnet, not the first address to allocate. Cisco IOS uses the subnet definition together with excluded addresses and existing bindings to determine which addresses are available.

Cisco IOS DHCP server commands

CommandConfiguration modePurposeExample use
ip dhcp excluded-addressGlobal configurationPrevents one address or a range from being dynamically assignedip dhcp excluded-address 192.168.10.1 192.168.10.20
ip dhcp poolGlobal configurationCreates or enters a named DHCP poolip dhcp pool LAN-POOL
networkDHCP pool configurationDefines the client subnet and masknetwork 192.168.10.0 255.255.255.0
default-routerDHCP pool configurationSupplies the client default gatewaydefault-router 192.168.10.1
dns-serverDHCP pool configurationSupplies one or more DNS server addressesdns-server 8.8.8.8 1.1.1.1
domain-nameDHCP pool configurationSupplies a DNS domain name to clientsdomain-name example.local
leaseDHCP pool configurationSets the lease duration in days, with optional hours and minuteslease 7

DHCP options beyond the address

A usable client configuration often requires more than an IP address and mask:

  • default-router tells the host where to send traffic for other networks.
  • dns-server supplies resolvers for hostname lookups.
  • domain-name supplies the client DNS search or domain information, depending on the client operating system.
  • lease controls how long an address can remain assigned before renewal is required.
  • next-server can identify a TFTP server for network-boot environments.
  • bootfile can identify a boot image or boot file used by network-boot clients.

TFTP and boot-file settings are optional. They are useful for specialized devices such as network-booting phones or thin clients, not for ordinary desktop address assignment.

DHCP pool design

Good address planning prevents conflicts and reduces troubleshooting. The pool network must match the subnet configured on the client-facing Layer 3 interface. The mask must also be correct; using a different mask can cause the router to consider the wrong addresses local or available.

  • Identify the subnet and mask used by the client VLAN or LAN.
  • Reserve the router gateway and addresses needed by infrastructure and static devices.
  • Ensure dynamic addresses do not overlap static assignments or another DHCP service.
  • Leave enough addresses for the expected number of clients, growth, and temporary devices.
  • Use separate pools for separate routed subnets or VLANs.

Two departmental networks

If Sales and Engineering use different VLANs or router interfaces, each subnet needs its own gateway, exclusions, and DHCP pool. For example:

ip dhcp excluded-address 192.168.20.1 192.168.20.10
ip dhcp pool SALES
network 192.168.20.0 255.255.255.0
default-router 192.168.20.1
dns-server 8.8.8.8

ip dhcp excluded-address 192.168.30.1 192.168.30.10
ip dhcp pool ENGINEERING
network 192.168.30.0 255.255.255.0
default-router 192.168.30.1
dns-server 8.8.8.8

A client in the Sales subnet should not receive the Engineering gateway or an address from the Engineering scope.

Verify DHCP operation

After configuration, verify both the router and the client. The router should have an operational interface, a matching pool, and active bindings after clients obtain leases.

show ip dhcp pool
show ip dhcp binding
show ip dhcp server statistics
show running-config | section dhcp
show ip interface brief
CommandWhat it displays or changesWhen to use itCaution
show ip dhcp poolPool names, subnet information, address utilization, and available addressesCheck pool design and exhaustionInterpret availability together with exclusions and bindings
show ip dhcp bindingActive leased addresses and client identifiersConfirm that clients received leasesBindings may remain until leases expire or are cleared
show ip dhcp server statisticsDHCP message counters and server activityDetermine whether requests and replies are being processedCounters alone do not prove Layer 2 connectivity
show running-config | section dhcpDHCP exclusions, pools, and pool options in the running configurationFind missing or incorrect commandsIt shows running configuration, which may not yet be saved
show ip interface briefInterface addresses and statusConfirm the client-facing interface is up/upCorrect addressing does not fix a VLAN or cabling problem
debug ip dhcp server eventsDHCP server processing events in real timeTrace requests in a controlled labDebug output can be noisy and affect production devices
undebug allStops active debuggingImmediately after controlled testingAlways stop debugging when finished
clear ip dhcp binding 192.168.10.21Removes one bindingRetest a specific client leaseThe client may obtain a different address
clear ip dhcp binding *Removes all dynamic DHCP bindingsReset a lab test environmentDisruptive: clients may be forced to obtain new leases

On the client, renew the lease using the operating system's network tools, then check the assigned IPv4 address, mask, default gateway, and DNS servers. A successful address assignment does not automatically prove that routing or DNS is working.

Troubleshoot Cisco IOS DHCP

Clients have no address or use a self-assigned address

  • Run show ip interface brief. The client-facing interface should have the expected address and an up/up state.
  • Confirm the switchport is connected to the correct VLAN and that the client is connected to the expected access port or trunk path.
  • Check that a DHCP pool exists and that its network statement and mask match the interface subnet.
  • Check for another DHCP service or filtering that may interfere with the exchange.

Some clients receive addresses, but others do not

Use show ip dhcp pool to inspect utilization and show ip dhcp binding to inspect active leases. The scope may be exhausted, the exclusion range may be too large, or some clients may be connected to a different subnet without a corresponding pool.

Resolve the problem by correcting the address plan, expanding the subnet when appropriate, reducing unnecessary exclusions, or removing stale test bindings. Reducing lease duration can help a temporary lab scope recycle unused addresses, but it is not a substitute for adequate capacity.

Clients receive an address but cannot reach other networks

Inspect the client's default gateway and compare it with the pool's default-router value. The gateway should be the address of the router interface on that client subnet. Also verify that the router has routes to the destination networks. DHCP does not create general routing automatically.

Clients cannot resolve hostnames

Check the pool's dns-server entries and test whether those DNS servers are reachable. If the pool was recently corrected, clients may still have older options in their current leases; renew the leases after making the change.

Use debugging carefully

In a lab or controlled maintenance window, debug ip dhcp server events can show whether the router is seeing and processing DHCP activity. Debugging can generate substantial console output and consume device resources, so do not leave it enabled on a busy production router. Stop it with:

undebug all

DHCP across routed networks

DHCP clients initially use broadcasts, and routers do not forward ordinary broadcasts between subnets by default. Therefore, a client on a subnet without a local DHCP server cannot normally reach a DHCP server on another routed network.

A DHCP relay agent solves this problem. On Cisco IOS, configure ip helper-address on the client-facing interface. The router receives the client broadcast and forwards it toward the remote DHCP server as a relay request.

configure terminal
interface gigabitEthernet 0/1
ip helper-address 10.10.10.10

The remote server must have a scope for the client subnet, and routing and filtering must allow the relay traffic to reach the server and return. The relay router does not need an ip dhcp pool for that subnet when a remote server is providing the leases.

CharacteristicCisco Router as DHCP ServerDHCP Relay to Remote Server
Where leases are createdOn the Cisco IOS routerOn a separate DHCP server
Primary configurationip dhcp pool, exclusions, and pool optionsip helper-address on the client-facing interface
Server locationLocal router, usually on directly connected LANsAnother routed network
Required scopeConfigured in the router's DHCP poolConfigured on the centralized DHCP server
Broadcast behaviorRouter locally receives and answers client requestsRouter converts and forwards requests to the remote server

Save the configuration

The running configuration is held in memory. Save the completed DHCP configuration to startup configuration so it is restored after a reload:

copy running-config startup-config

Before saving on a production device, verify the interface, exclusions, pool options, and expected address capacity. DHCP changes can affect every client on a subnet.

Exam-relevant notes

  • The router's LAN interface address commonly becomes the DHCP client's default gateway.
  • The pool's network statement must match the client-facing subnet and mask.
  • Excluded addresses are not dynamically assigned, even though they belong to the pool's subnet.
  • DORA means Discover, Offer, Request, and Acknowledgment.
  • DHCP broadcasts do not cross routers without a relay function.
  • ip helper-address is used to relay requests to a remote DHCP server; it is not the command that creates a local DHCP pool.
  • show ip dhcp binding displays active lease records, while show ip dhcp pool helps reveal pool utilization.

Summary

To configure a Cisco router as a DHCP server, first configure and enable the client-facing Layer 3 interface. Exclude gateway and infrastructure addresses, create a named pool with the correct network and mask, then define the default gateway, DNS settings, and any optional lease or boot options. Verify interface status, pool utilization, bindings, and server statistics. If the DHCP server is remote, configure a relay with ip helper-address instead of creating a local pool.

For related Cisco IOS configuration practice, see configure NTP on a Cisco device, configure OSPF, and configure passwords in IOS.