Dynamic Host Configuration Protocol

Feature History for DHCP

This table provides release and platform support information for the features explained in this module.

These features are available in all the releases subsequent to the one they were introduced in, unless noted otherwise.

Table 1. Feature history for DHCP

Release

Feature name and description

Supported platform

Cisco IOS XE 26.2.1ea

DHCP: The DHCP feature support has been introduced.

Cisco C9550 Series Smart Switches

Cisco IOS XE 17.18.1

Dynamic Host Configuration Protocol: DHCP provides configuration parameters to Internet hosts. DHCP consists of two components: a protocol for delivering host-specific configuration parameters from a DHCP Server to a host and a mechanism for allocating network addresses to hosts. DHCP is built on a client/server model, where designated DHCP Server hosts allocate network addresses and deliver configuration parameters to dynamically configured hosts.

Cisco C9350 Series Smart Switches

Cisco C9610 Series Smart Switches

Introduction to DHCP

The Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on Internet Protocol (IP) networks for dynamically distributing network configuration parameters, such as IP addresses, to connected devices. This automation simplifies network administration by eliminating the need for manual IP address assignment and management.

What is DHCP?

DHCP is a client-server protocol that automatically provides an IP host with its IP address and other related configuration information, such as the subnet mask, default gateway, and DNS server addresses. This enables devices to connect to a network without requiring manual configuration, making network management more efficient and less prone to errors.

How DHCP Works

The DHCP process typically involves four main steps, often referred to by the acronym DORA: Discover, Offer, Request, and Acknowledge. This process ensures that a client successfully obtains an IP address and other necessary network configuration from a DHCP server.

Summary

These stages describe how DHCP servers work:

  1. Discover

  2. Offer

  3. Request

  4. Acknowledge

Discover:

  • Actor: DHCP Client

  • Action: The client broadcasts a DHCP Discover message on the network to locate available DHCP servers. This message typically contains the client's MAC address

Offer

  • Actor: DHCP Server

  • Action: Upon receiving a Discover message, the DHCP server responds with a DHCP Offer message. This message includes a proposed IP address for the client, along with other configuration parameters (subnet mask, default gateway, DNS servers, lease time).

Request

  • Actor: DHCP Client

  • Action: The client receives one or more DHCP Offer messages and broadcasts a DHCP Request message. This message explicitly requests the offered IP address from a specific server (if multiple offers were received) and implicitly declines other offers.

Acknowledge

  • Actor: DHCP Server

  • Action: The selected DHCP server receives the DHCP Request message and sends a DHCP Acknowledge (ACK) message to the client. This message confirms the IP address lease and all other configuration parameters, officially assigning the IP address to the client.

Table 2. When the DHCP process completes successfully:
When the DHCP server… Then… And…
receives a DHCP Request message it assigns the IP address to the client from its pool of available addresses it updates its internal database to reflect the assigned IP address and lease time.
fails to receive a DHCP Request message it reclaims the offered IP address it makes the IP address available for other clients.
receives a DHCP Discover message it checks its available IP address pools it sends a DHCP Offer message to the client.

DHCP Components

DHCP client

DHCP relies on the interaction of three primary components: the client, the server, and optionally, the relay agent. Each plays a distinct role in the dynamic IP address assignment process.

A DHCP client is any network-enabled device (e.g., computer, smartphone, printer, router interface) configured to obtain its IP address and other network configuration parameters automatically from a DHCP server.

A DHCP server is a network server that automatically provides and assigns IP addresses, default gateways, and other network parameters to client devices. The server maintains a pool of IP addresses and information about client configurations.

A DHCP relay agent is a network device, such as a router, that forwards DHCP messages between clients and servers when they are not on the same local network segment (broadcast domain). Relay agents are essential in larger networks where DHCP servers are centralized and clients are distributed across multiple subnets.

DHCP Zero Touch

DHCP Zero Touch is a provisioning method that leverages DHCP to automatically configure new devices when they are first connected to the network, minimizing manual intervention.

DHCP Zero Touch streamlines the deployment of network devices by allowing them to automatically discover the network, obtain an IP address via DHCP, and then download their configuration or software image from a centralized server (e.g., TFTP, HTTP) without requiring an administrator to manually configure each device. This process significantly reduces deployment time and human error, especially in large-scale rollouts.

How to Configure DHCP

This section provides basic configuration tasks for DHCPv4 clients, servers, and relay agents.

Configure a DHCPv4 Server

Use this procedure to configure your switch to act as a DHCPv4 server, providing IPv6 addresses to clients within a specified network segment.

This configuration is suitable for providing stateful IPv6 addresses and other parameters to clients.

Before you begin

  • Identify the IP address range for the DHCP pool.

  • Identify the default gateway, DNS servers, and domain name to be provided to clients.

  • Ensure the interface connected to the clients is configured with an IP address withinthe same subnet as the DHCP pool.

Procedure


Step 1

Enter global configuration mode.

Example:

Device# configure terminal

Step 2

Exclude IP addresses from the DHCP pool that should not be assigned to clients.

Example:

Device(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10

Note

 

These are typically static assignments for network devices like routers, servers, or other switches

Step 3

Create a DHCP pool and enter DHCP pool configuration mode.

Example:

Device(config)# ip dhcp pool VLAN10_POOL
Device(config-dhcpv6)#

Note

 

Replace VLAN10_POOL with a descriptive name for your DHCP pool

Step 4

Specify the network address for the DHCP pool.

Example:

Device(dhcp-config)# Device(dhcp-config)# network 192.168.1.0 255.255.255.0

Step 5

Configure the default gateway for clients.

Example:

Device(dhcp-config)# default-router 192.168.1.1

Step 6

Configure the DNS servers for clients.

Example:

Device(dhcp-config)# dns-server 8.8.8.8 8.8.4.4

Step 7

Configure the domain name for clients (optional).

Example:

Device(dhcp-config)# domain-name example.com

Step 8

Exit DHCP pool configuration mode and global configuration mode.

Example:

Device(dhcp-config)# exit
Device(dhcp-config)# end

What to do next

Verify DHCP server operation using commands like show ip dhcp binding and show ip dhcp pool.

.

Configure a DHCPv4 client

Use this procedure to configure a network interface on your switch to obtain its IPv4 address and other network parameters dynamically from a DHCP server.

This configuration is typically applied to interfaces that need to receive dynamic IP addresses, such as a management interface or an interface connecting to an ISP.

Before you begin

Ensure the interface is physically connected and administratively up.

Follow these steps to configure a DHCPv4 client:

Procedure


Step 1

Enter global configuration mode.

Example:

Device# configure terminal

Step 2

Enter interface configuration mode for the desired interface.

Example:

Device(config)# interface GigabitEthernet1/0/1

Step 3

Configure the interface to obtain an IP address via DHCP.

Example:

Device(config-if)# ip address dhcp

Step 4

Exit interface configuration mode.

Example:

Device(config-if)# end

What to do next

Verify the IP address assignment using the show ip interface brief command.

Configure a DHCPv4 Relay Agent

Use this procedure to configure your switch to act as a DHCPv4 relay agent, forwarding DHCP requests from clients to a DHCP server located on a different subnet.

This configuration is crucial in larger networks where a centralized DHCP server serves multiple VLANs or subnets.

Before you begin

  • Identify the IP address of the DHCP server(s).

  • Ensure the switch has IP connectivity to the DHCP server.

  • Ensure the interface connected to the clients is configured with an IP address.

Follow these steps to configure a DHCPv4 relay agents.

Procedure


Step 1

Enter global configuration mode.

Example:

Device# configure terminal

Step 2

Enter interface configuration mode for the interface connected to the DHCP clients.

Example:

Device(config)# interface Vlan10

Step 3

Configure the IP helper address to forward DHCP requests to the DHCP server.

Example:

Device(config-if)# ip helper-address 10.0.0.10

Note

 
Replace 10.0.0.10 with the actual IP address of your DHCP server. You can configure multiple helper addresses for redundancy.

Step 4

Exit interface configuration mode.

Example:

Device(config-if)# end

What to do next

Verify relay agent operation by checking DHCP server logs or by observing client IP address assignments.

Configure a DHCPv6 Server

Use this procedure to configure your switch to act as a DHCPv6 server, providing IPv6 addresses to clients within a specified network segment.

This configuration is suitable for providing stateful IPv6 addresses and other parameters to clients.

Before you begin

  • Identify the IPv6 address range for the DHCPv6 pool.

  • Ensure the interface connected to the clients is configured with an IPv6 address.

Procedure


Step 1

Enter global configuration mode.

Example:

Device# configure terminal

Step 2

Create a DHCPv6 pool and enter DHCPv6 pool configuration mode.

Example:

Device(config)# ipv6 dhcp pool VLAN20_IPV6_POOL
Device(config-dhcpv6)#

Note

 

Replace VLAN20_IPV6_POOL with a descriptive name for your DHCPv6 pool.

Step 3

Specify the address prefix for the DHCPv6 pool.

Example:

DDevice(config-dhcpv6)# address prefix 2001:DB8:0:1::/64 lifetime infinite infinite
Device(config-dhcpv6)#

Step 4

Configure the DNS servers for clients.

Example:

Device(config-dhcpv6)# dns-server 2001:4860:4860::8888

Step 5

Configure the domain name for clients (optional).

Example:

Device(config-dhcpv6)# domain-name example.com

Step 6

Exit DHCPv6 pool configuration mode and global configuration mode.

Example:

Device(config-dhcpv6)# exit
Device(config)# end

Step 7

Enable the DHCPv6 server on the relevant interface.

Example:

Device# configure terminal
Device(config)# interface Vlan20
Device(config-if)# ipv6 dhcp server VLAN20_IPV6_POOL
Device(config-if)# end

Note

 

This is typically a VLAN interface (SVI).


What to do next

Verify DHCPv6 server operation using commands like show ipv6 dhcp binding and show ipv6 dhcp pool .

Configure a DHCPv6 Client

Use this procedure to configure a network interface on your switch to obtain its IPv6 address and other network parameters dynamically from a DHCPv6 server.

This configuration is applied to interfaces that need to receive dynamic IPv6 addresses, often in conjunction with IPv6 stateless autoconfiguration (SLAAC).

Before you begin

Ensure the interface is physically connected and administratively up.

Procedure


Step 1

Enter global configuration mode.

Example:

Device# configure terminal

Step 2

Enter interface configuration mode for the desired interface.

Example:

Device(config)# interface GigabitEthernet1/0/1

Step 3

Configure the interface to obtain an IPv6 address via DHCP.

Example:

Device(config-if)# ipv6 address dhcp

Step 4

Exit interface configuration mode.

Example:

Device(config-if)# end

What to do next

Verify the IPv6 address assignment using the show ipv6 interface brief command.

Configure a DHCPv6 Relay Agent

Before you begin

Procedure


Example:

Table 3.

If...

Then...


What to do next