Reference

Services

DHCP

DHCP automates IPv4 address assignment using the DORA process. IOS routers can act as a DHCP server or client for lab and small-office scenarios.

What you need to know

  • DORA process: Discover, Offer, Request, Acknowledge, all conducted via UDP broadcasts initially.
  • DHCP client uses UDP port 68; DHCP server uses UDP port 67.
  • excluded-address ranges must be configured before the pool to prevent the server from leasing reserved addresses like the default gateway.
  • A DHCP pool defines the network, default-router, dns-server, and lease duration.
  • Default lease time if unspecified is 24 hours (1 day 0 hours 0 minutes).
  • ip dhcp excluded-address is configured globally, not inside the pool.
  • A router interface can obtain its own address via ip address dhcp, making it a DHCP client.

Configuration commands

CommandModePurpose
ip dhcp excluded-address 10.10.10.1 10.10.10.10configReserves addresses the DHCP server should not lease.
ip dhcp pool LAN-POOLconfigCreates a DHCP pool and enters pool configuration mode.
network 10.10.10.0 255.255.255.0config-dhcpDefines the network and subnet mask for the pool.
default-router 10.10.10.1config-dhcpSets the default gateway handed out to clients.
dns-server 8.8.8.8config-dhcpSets the DNS server address handed out to clients.
lease 7config-dhcpSets the lease duration to 7 days.
domain-name example.comconfig-dhcpSets the DNS domain name option for clients.
ip address dhcpconfig-ifConfigures the interface to obtain its IP address from a DHCP server.
ip helper-address 10.10.10.1config-ifForwards broadcast DHCP requests to a remote server (used with relay).

Verify it

  • show ip dhcp binding
  • show ip dhcp pool
  • show ip dhcp conflict
  • show ip dhcp server statistics
  • show ip interface brief
  • debug ip dhcp server events

Common mistakes

  • Forgetting ip dhcp excluded-address before creating the pool, causing the server to offer the router's own gateway address.
  • Configuring the network statement with the wrong mask, shrinking or expanding the usable pool.
  • Not disabling a conflicting DHCP service (ip dhcp conflict logging) when addresses appear double-assigned.
  • Forgetting that pool configuration mode command names differ from global (network vs ip dhcp excluded-address).
  • Leaving default-router unset, so clients get an address but no gateway.

Practise DHCP in a real CLI

Generated labs, graded against the simulated network state.

Start a free lab