Skip to content
Adam Spera

Dynamic Host Configuration Protocol (DHCP)

DHCP is a critical network service that automates the assignment of IP addresses and other network configuration parameters to hosts. It eliminates the need for manual IP address configuration, especially in large, dynamic networks.

Without DHCP, every device would need to be manually configured with:

  • An IP address
  • Subnet mask
  • Default gateway
  • DNS server(s)

DHCP operates using a four-step process commonly referred to as DORA:

  1. Discover – Client broadcasts to locate available DHCP servers.
  2. Offer – Server responds with an available IP address and configuration options.
  3. Request – Client requests to lease the offered IP address.
  4. Acknowledgment – Server acknowledges and finalizes the lease.

This is all handled using broadcast and unicast messages over UDP port 67 (server) and 68 (client).

  • DHCP Server: Allocates IP addresses from a defined pool and tracks active leases
  • DHCP Client: Dynamically requests IP configuration
  • DHCP Relay Agent: Forwards DHCP packets between clients and servers across different subnets

DHCP is a Layer 7 (application layer) protocol but relies heavily on Layer 2 and 3 broadcast behavior, which is why relay agents (e.g., ip helper-address) are often required in routed environments.

service dhcp
ip dhcp excluded-address 192.168.1.1 192.168.1.10
ip dhcp pool USERS
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 8.8.8.8 1.1.1.1
lease 7
  • excluded-address prevents those IPs from being assigned
  • default-router sets the gateway for clients
  • lease defines the number of days (or optionally hours and minutes)
interface GigabitEthernet0/0
ip address dhcp
debug ip dhcp server packet

Then copy the client-identifier that is outputted when a DHCP message is received. Some devices use the MAC address by default though, including Ubuntu or Linux.

ip dhcp pool STATIC1
host 192.168.1.10 255.255.255.0
client-identifier [...]

The client identifier can be found by running debug dhcp detail on the end host, then wait for it to generate a DHCP Discovery message. Then copy and paste the client-identifier. If the client ID in the running-config is not even 4 char between periods, add leading zeros.

If the DHCP server is on a different subnet, configure a DHCP relay agent using:

interface Vlan10
ip helper-address 192.168.100.10

This command causes the router to:

  • Convert DHCP broadcasts to unicasts
  • Forward them to the server IP
  • Translate replies back to the requesting client

Specifying a VRF in an DHCP pool only works, if the helper address also points to that same VRF locally configured & directly connected.

DHCP options are used to send additional information to the client beyond just an IP address.

ip dhcp pool USERS
option [option-number] [hex | ascii] [value]
OptionPurposeExample
1Subnet MaskAuto-included
3Default Gatewaydefault-router
6DNS Serversdns-server
15Domain Namedomain-name example.com
66TFTP Server Name (VoIP, PXE boot)option 66 ascii tftp-server.local
67Bootfile Name (PXE boot image)option 67 ascii pxelinux.0
82Relay Agent Info (inserted by switch/relay)Controlled via ip dhcp relay information

Options 66 and 67 are frequently tested in PXE boot, IP phone, and controller-based environments.


show ip dhcp binding
show ip dhcp pool
debug ip dhcp server events
debug ip dhcp server packet

These are useful for checking which clients have active leases, what pools exist, and whether DHCP messages are being exchanged.