VMware ESXi and vSphere Cluster Management

Configure a Cisco Router as a DHCP Server

Learn how to configure a Cisco IOS router as an IPv4 DHCP server, including address exclusions, pools, gateways, DNS options, leases, verification, and troubleshooting.

Overview

Dynamic Host Configuration Protocol (DHCP) automatically supplies IPv4 configuration parameters to network clients. A Cisco IOS router can act as a DHCP server for clients on a directly connected LAN.

In this design, the router maintains an address pool, gives clients temporary leases, and provides settings such as the subnet mask, default gateway, and DNS server. The router's LAN-facing interface is normally both the DHCP server's connected interface and the clients' default gateway.

How DHCP Works

DHCP is an application-layer protocol that supports IP endpoint configuration. It allows a DHCP client, such as a workstation or phone, to request network settings from a DHCP server.

  • DHCP server: A device that maintains address pools and leases network settings to clients.
  • DHCP client: A host configured to request addressing and related settings automatically.
  • DHCP pool: A named Cisco IOS scope containing a served network and DHCP options.
  • Scope: The network, assignable range, exclusions, and options used for a group of clients.
  • Lease: A time-limited assignment of an IP address and configuration options to a client.
  • Binding: A record associating a leased IP address with a client identifier.

A typical DHCP exchange is often summarized as DORA:

  1. Discover: The client broadcasts a request for DHCP servers.
  2. Offer: A server offers an address and configuration options.
  3. Request: The client requests one offered configuration.
  4. Acknowledge: The server confirms the lease.

Common values delivered by DHCP include the client's IPv4 address, subnet mask, default gateway, DNS server, optional DNS domain name, and lease duration. The default gateway is the router address used to reach remote networks. A DNS server resolves domain names to IP addresses. A DNS domain name is an optional suffix supplied to clients.

Plan the DHCP Scope

Before entering commands, identify the exact Layer 3 subnet that the router will serve. The DHCP pool's network statement must match the subnet used by the client-facing router interface and the clients.

  1. Determine the IPv4 network address and subnet mask.
  2. Identify the router interface address that clients will use as their default gateway.
  3. Reserve the network address, broadcast address, router address, and addresses used by infrastructure, servers, printers, or other static hosts.
  4. Choose DNS server addresses that clients can reach.
  5. Choose an optional DNS domain name.
  6. Choose a lease duration appropriate for the network. IOS uses a normal default lease of 24 hours when no lease command is configured.

DHCP Pool Addressing Plan

Setting | Example Value | Purpose

Network and subnet mask | 192.168.5.0 255.255.255.0 | Defines the client subnet served by the pool.

Excluded address range | 192.168.5.0-192.168.5.25 | Protects the gateway and reserved low-numbered addresses.

Dynamic address range | 192.168.5.26-192.168.5.254 | Addresses that may be leased to clients.

Default gateway | 192.168.5.1 | Router address used to reach remote networks.

DNS server | 192.168.5.1 | DNS address supplied to clients in this example.

Pool name | HQ_DHCP_SERVER | Identifies the Cisco IOS DHCP pool.

Lease duration | 1 day | Optional lease period configured with lease 1.

The network address and broadcast address are not normal host addresses. Excluding a range that includes those addresses is a clear way to reserve them, even though they should not be assigned as ordinary host addresses. Exclusions also protect addresses assigned manually to infrastructure devices.

Configure the Router Interface

The LAN-facing interface must have an IPv4 address in the subnet served by the pool and must be administratively up. Directly connected clients can obtain leases from the router without a DHCP relay.

enable
configure terminal
interface GigabitEthernet0/0
ip address 192.168.5.1 255.255.255.0
no shutdown
end

In this example, the interface address is 192.168.5.1 and the subnet is 192.168.5.0/24. Clients on this LAN will use 192.168.5.1 as their default gateway.

Exclude Addresses from DHCP

Use the global configuration command ip dhcp excluded-address FIRST_IP LAST_IP to prevent addresses from being leased. Excluded addresses inside the pool's network are not offered to clients.

configure terminal
ip dhcp excluded-address 192.168.5.0 192.168.5.25

This reserves addresses from 192.168.5.0 through 192.168.5.25. The range protects the router gateway at 192.168.5.1 and leaves room for other low-numbered infrastructure and static hosts.

Create and Configure the DHCP Pool

Enter global configuration mode and create a named pool with ip dhcp pool NAME. Cisco IOS then enters DHCP pool configuration mode. The options configured in that mode are sent to clients using this pool.

ip dhcp pool HQ_DHCP_SERVER
network 192.168.5.0 255.255.255.0
default-router 192.168.5.1
dns-server 192.168.5.1
domain-name example.local
lease 1
end
  • network 192.168.5.0 255.255.255.0 defines the served subnet.
  • default-router 192.168.5.1 supplies the client default gateway.
  • dns-server 192.168.5.1 supplies a DNS server address.
  • domain-name example.local optionally supplies a DNS domain suffix.
  • lease 1 sets the lease duration to one day.

The domain-name and lease commands are optional. If no lease command is configured, the normal IOS default lease is 24 hours. The exact DHCP command set can vary between Cisco IOS platforms and software releases.

Complete Example

The following example configures a Cisco router as the DHCP server for a small headquarters LAN.

enable
configure terminal
interface GigabitEthernet0/0
ip address 192.168.5.1 255.255.255.0
no shutdown
exit
ip dhcp excluded-address 192.168.5.0 192.168.5.25
ip dhcp pool HQ_DHCP_SERVER
network 192.168.5.0 255.255.255.0
default-router 192.168.5.1
dns-server 192.168.5.1
domain-name example.local
lease 1
end

The first eligible dynamic address is 192.168.5.26. Assuming the client requests a lease and no other allocation affects the order, the first client can receive 192.168.5.26. The client should also receive the 255.255.255.0 mask, 192.168.5.1 as its gateway, 192.168.5.1 as its DNS server, the optional example.local domain, and a one-day lease.

Useful Cisco IOS Commands

Configuration Mode | Command | Purpose

Global configuration | ip dhcp excluded-address FIRST_IP LAST_IP | Prevents an address or range from being leased.

Global configuration | ip dhcp pool NAME | Creates or enters a named DHCP pool.

DHCP pool configuration | network NETWORK_ADDRESS SUBNET_MASK | Defines the subnet served by the pool.

DHCP pool configuration | default-router IP_ADDRESS | Supplies the client default gateway.

DHCP pool configuration | dns-server IP_ADDRESS | Supplies one or more DNS server addresses.

DHCP pool configuration | domain-name DOMAIN_NAME | Optionally supplies a DNS domain suffix.

DHCP pool configuration | lease DAYS HOURS MINUTES | Optionally sets the lease duration.

Privileged EXEC | show ip dhcp binding | Displays active leases and client identifiers.

Privileged EXEC | show ip dhcp pool | Displays pool utilization and available addresses.

Privileged EXEC | show running-config | section dhcp | Displays DHCP-related running configuration.

Verify DHCP Operation

Check Active Bindings

Use show ip dhcp binding to display active DHCP leases and their associated client identifiers.

show ip dhcp binding

A binding entry containing 192.168.5.26 confirms that the address has been assigned to a client. The output also identifies the client through information such as a hardware address or client identifier, depending on the platform and client.

Check Pool Utilization

show ip dhcp pool

Inspect the pool name, served network, total addresses, leased addresses, and available addresses. If no usable addresses remain, review the exclusion range and the number of active clients.

Check the Running Configuration

show running-config | section dhcp

Confirm that the exclusion, pool name, network, default gateway, DNS server, and any optional domain or lease settings appear as intended. You can also use show running-config to inspect the complete active configuration.

Command | What to Check | Expected Result

show ip dhcp binding | Assigned addresses and client identifiers | An active client binding, such as 192.168.5.26.

show ip dhcp pool | Pool utilization and available addresses | The pool matches 192.168.5.0/24 and has usable addresses available.

show running-config | Interface, exclusions, and DHCP options | The interface and pool settings match the addressing plan.

Also verify the client itself. Its received IPv4 address must belong to the intended dynamic range, its subnet mask must match the scope, its gateway must be 192.168.5.1, and its DNS setting must match the configured DNS server.

DHCP Server Versus DHCP Relay

A router acting as a DHCP server maintains the pool and answers clients directly. This works for clients on an interface or subnet directly connected to that router.

A DHCP relay is different. A router configured as a relay forwards DHCP requests between a client subnet and a DHCP server located on another subnet. Remote clients cannot normally send their initial broadcast through a router without a relay function, such as an appropriate ip helper-address design. Do not expect this local router-server configuration to serve a different subnet automatically.

Troubleshooting

Clients Do Not Receive an IP Address

  • Run show ip interface brief and confirm that the client-facing interface has the expected IPv4 address and is up/up.
  • Compare the pool's network statement with the LAN interface subnet. They must describe the same client-facing Layer 3 subnet.
  • Run show ip dhcp pool and determine whether exclusions consume all usable addresses.
  • Confirm that the clients are directly connected to the router or that a DHCP relay is configured for a remote client subnet.

Clients Receive an Address but Cannot Reach Remote Networks

  • Inspect the pool and confirm that default-router exists and points to the correct gateway.
  • Verify that the gateway address is assigned to an active router interface.
  • Correct the configuration and renew the client lease.

Clients Cannot Resolve Names

  • Check that the pool contains a correct dns-server statement.
  • Verify that the DNS server is reachable and operating.
  • Renew the client lease after correcting the DNS option.

An Address Conflicts with a Static Device

  • The static address may not have been excluded before the pool was enabled.
  • Add the address or range with ip dhcp excluded-address.
  • Move static devices into a clearly reserved range and review active bindings.

A DHCP Command Is Unavailable

Individual IOS platforms, licenses, and software releases can differ in supported DHCP commands and syntax. Use context-sensitive help, such as ?, to inspect commands supported by the device. Consult platform-specific Cisco IOS documentation and use supported alternatives.

Exam and Operations Notes

  • The DHCP pool network must match the subnet where clients are located.
  • Exclude statically assigned addresses before relying on dynamic allocation.
  • The default-router option is the client gateway, not the DHCP server identifier in every possible design.
  • Without an explicit lease command, IOS normally uses a 24-hour lease.
  • show ip dhcp binding verifies individual leases, while show ip dhcp pool shows pool capacity and utilization.
  • A directly connected client subnet does not need a relay to use the router as its DHCP server.

For the complete local configuration reference, see Configure DHCP Server on a Cisco Router.