Domain 4IP ServicesCORE

Dynamic Host Configuration Protocol (DHCP)

The DHCP DORA process, configuring DHCP servers and clients, and implementing DHCP relay agents for cross-subnet address allocation.

Domain: Domain 4: IP Services•Updated: 2026-08-26
#DHCP#DORA Process#IPAM#DHCP Relay#Address Pool

Dynamic Host Configuration Protocol (DHCP)

Overview and Purpose

  • Concept: DHCP (Dynamic Host Configuration Protocol) allows hosts (clients) to automatically and dynamically learn network configuration parameters without manual static configuration.
  • Details:
    • Parameters Learned: IP address, subnet mask, default gateway, DNS (Domain Name System) server, domain name.
    • Typical Clients: End devices (PCs, smartphones, IP phones).
    • Typical Servers: Windows/Linux servers in enterprise networks; home routers in small networks.
    • Lease Time: The duration a client can use an IP address. Clients must release or renew it upon expiration. Prevents IP exhaustion in transient environments (e.g., cafes, airports).
    • Static vs Dynamic: Network devices (routers, servers) usually require static IPs. DHCP is primarily for client endpoints.

DHCP Ports and Protocol Details

  • Transport Protocol: UDP (User Datagram Protocol)
  • Ports:
    • DHCP Server: UDP Port 67
    • DHCP Client: UDP Port 68
  • Magic Cookie: A specific field in DHCP packets used to identify the protocol and differentiate it from BOOTP (Bootstrap Protocol, DHCP’s predecessor).

DHCP Options

DHCP messages contain “options” that convey specific configuration data to the client.

Option Purpose
53 DHCP Message Type (e.g., Discover, Offer)
51 Lease Time duration
6 Domain Name Server (DNS) IP address
3 Router (Default Gateway) IP address
54 Server Identifier (used in Request to select a specific server)

The DHCP Message Exchange (DORA)

The process a client uses to obtain an IP address is remembered by the acronym DORA.

Message Direction Source IP Dest IP Broadcast/Unicast Purpose
Discover Client ➔ Server 0.0.0.0 255.255.255.255 Broadcast Client looks for available DHCP servers.
Offer Server ➔ Client Server IP Offered IP / 255.255.255.255 Unicast or Broadcast Server offers an IP and configuration parameters.
Request Client ➔ Server 0.0.0.0 255.255.255.255 Broadcast Client accepts the offer (specifies chosen server via Option 54).
Ack Server ➔ Client Server IP Client IP / 255.255.255.255 Unicast or Broadcast Server confirms the lease; client configures the interface.
Release Client ➔ Server Client IP Server IP Unicast Client voluntarily gives up the IP address.

Things to note:

  • Unicast vs Broadcast in Offer/Ack: Depends on the client’s capability. If the client sets the Broadcast Flag in the Bootp flags field to 1, the server must broadcast. If set to 0 (Unicast), the server can send the Offer/Ack directly to the client’s MAC and offered IP.
  • Multiple Servers: If multiple servers respond to Discover, the client accepts the first Offer and broadcasts the Request so all servers know which one was selected.
  • Discover and Request are ALWAYS broadcast messages.
sequenceDiagram
    participant Client
    participant Server
    Client->>Server: DHCP Discover (Broadcast)
    Server->>Client: DHCP Offer (Unicast/Broadcast)
    Client->>Server: DHCP Request (Broadcast)
    Server->>Client: DHCP Ack (Unicast/Broadcast)

DHCP Relay Agent

  • Concept: Routers do not forward broadcast traffic by default. If a centralized DHCP server is on a different subnet, clients cannot reach it via broadcasts.
  • Solution: Configure the router’s interface facing the clients as a DHCP Relay Agent.
  • Mechanism:
    1. Client broadcasts DHCP Discover.
    2. Relay agent intercepts the broadcast and converts it to a Unicast message directed to the centralized DHCP server’s IP.
    3. The source IP of the relayed packet becomes the relay agent’s interface IP.
    4. The server unicasts the Offer back to the relay agent, which forwards it to the client.

Cisco IOS Configuration: DHCP Server

To configure a Cisco router as a DHCP server:

! Exclude addresses from being handed out (e.g., for static devices)
Router(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10

! Create the DHCP pool
Router(config)# ip dhcp pool MY_POOL
Router(dhcp-config)# network 192.168.1.0 255.255.255.0
Router(dhcp-config)# default-router 192.168.1.1
Router(dhcp-config)# dns-server 8.8.8.8
Router(dhcp-config)# domain-name jeremysitlab.com
Router(dhcp-config)# lease 0 5 30 
! Format: lease [days] [hours] [minutes]. 0 days, 5 hours, 30 mins.
! Can also use 'lease infinite' (not recommended).

Things to note:

  • You must create a separate pool for each subnet the router is serving.
  • ip dhcp excluded-address prevents the router from assigning specific IPs (like the router’s own interface IP or server IPs).

Cisco IOS Configuration: DHCP Relay Agent

To forward DHCP broadcasts to a remote server:

! Enter the interface connected to the DHCP clients
Router(config)# interface GigabitEthernet0/1
Router(config-if)# ip helper-address 192.168.10.10
! 192.168.10.10 is the IP of the centralized DHCP server

Things to note:

  • ip helper-address actually forwards several UDP broadcasts (ports 37, 49, 53, 67, 68, 69, 137, 138), not just DHCP (port 67).
  • Ensure the router has a route to reach the DHCP server’s IP.

Cisco IOS Configuration: DHCP Client

To configure a router interface to obtain an IP via DHCP (rare, but used for internet-facing interfaces or lab environments):

Router(config)# interface GigabitEthernet0/1
Router(config-if)# ip address dhcp

Verification and Troubleshooting Commands

Cisco IOS Commands

! View currently assigned IP addresses and lease expirations
Router# show ip dhcp binding

! View interface configuration and verify if IP is determined by DHCP
Router# show ip interface GigabitEthernet0/1

! View DHCP pool statistics and conflicts
Router# show ip dhcp pool
Router# show ip dhcp server statistics

Windows Command Prompt Commands

:: View full IP configuration including DHCP status, lease obtained/expiration, DNS, Gateway
C:\> ipconfig /all

:: Release the current DHCP-leased IP address (sends DHCP Release message)
C:\> ipconfig /release

:: Request a new IP address (sends DHCP Discover message)
C:\> ipconfig /renew

Exam Insights & Common Misconceptions

  • When to use a Relay Agent: Configure it when the router is not a DHCP server, there are DHCP clients in the router’s connected LAN, and there is no other DHCP server in that connected LAN.
  • Which messages can be Unicast?: DHCP Offer, DHCP Ack, and DHCP Release can be sent using unicast. DHCP Discover and DHCP Request are always broadcast.
  • Bootp Flags: If the broadcast flag in the Bootp flags field is set to 1, the destination IP of the Offer/Ack from the server will be 255.255.255.255.
  • IPCONFIG /RENEW: This command forces the PC to release its current IP and broadcast a new DHCP Discover message to get an IP address.

Summary of Commands

Command Mode Purpose
ip dhcp excluded-address [start] [end] Global Config Reserves IPs from the DHCP pool.
ip dhcp pool [name] Global Config Creates a DHCP pool.
network [ip] [mask] DHCP Config Defines the subnet for the pool.
default-router [ip] DHCP Config Assigns the default gateway to clients.
dns-server [ip] DHCP Config Assigns the DNS server to clients.
domain-name [name] DHCP Config Assigns the domain name to clients.
lease [days] [hours] [minutes] DHCP Config Sets the IP lease duration.
ip helper-address [server-ip] Interface Config Configures the interface as a DHCP Relay Agent.
ip address dhcp Interface Config Configures the interface as a DHCP Client.
show ip dhcp binding Privileged EXEC Displays active DHCP leases.

Complete Command List

ip dhcp excluded-address 192.168.1.1 192.168.1.10
ip dhcp pool MY_POOL
 network 192.168.1.0 255.255.255.0
 default-router 192.168.1.1
 dns-server 8.8.8.8
 domain-name jeremysitlab.com
 lease 0 5 30
interface GigabitEthernet0/1
 ip helper-address 192.168.10.10
interface GigabitEthernet0/1
 ip address dhcp
show ip dhcp binding
show ip interface GigabitEthernet0/1
show ip dhcp pool
show ip dhcp server statistics