Configuring the Cisco IOS XE DHCP Client

Cisco IOS XE Dynamic Host Configuration Protocol (DHCP) client software provides the flexibility to include various configuration options for the DHCP client. A DHCP client is defined as an Internet host using DHCP to obtain configuration parameters such as an IP address. This module describes the concepts and tasks needed to configure the Cisco IOS XE DHCP client.

Feature Information for the Cisco IOS XE DHCP Client

The following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.
Table 1. Feature Information for the Cisco IOS XE DHCP Client

Feature Name

Releases

Feature Configuration Information

DHCP Client

Cisco IOS XE Release 2.3

Cisco IOS XE Release 3.9S

A DHCP client is defined as an Internet host using DHCP to obtain configuration parameters such as an IP address.

The following command was introduced by this feature: ip address dhcp

Configurable DHCP Client

Cisco IOS XE Release 2.3

Cisco IOS XE Release 3.9S

The configurable DHCP client functionality allows a DHCP client to use a user-specified client identifier, class identifier, or suggested lease time when requesting an address from a DHCP server.

The following commands were introduced by this feature: ip dhcp client class-id , ip dhcp client client-id , ip dhcp client hostname , ip dhcp client lease , ip dhcp client request

DHCPv4 Client Options

Cisco IOS XE Fuji 16.9.1

The DHCP Client supports configuration of all 1-254 options.

DHCP Client Options using unicast mode

Cisco IOS XE Amsterdam 17.2.1

Introduces support for unicast mode on DHCP. This helps with splitting the horizon therefore improving security of the network.

Information About the DHCP Client

DHCP Client Operation

When a Dynamic Host Configuration Protocol (DHCP) client requests an IP address from a DHCP server on a Cisco IOS XE platform, the default process includes:

  • DHCPDISCOVERY (broadcast)

  • DHCPOFFER (broadcast)

  • DHCPREQUEST (broadcast)

  • DHCPACK (unicast)

The DHCP on Cisco IOS XE platform supports only broadcast mode with the DHCPOFFER. From Cisco IOS XE Amsterdam Release 17.2, the DHCP on IOS XE platform also supports unicast mode. The DHCP unicast mode helps to split the horizon for security consideration. The DHCP broadcast mode is enabled by default. To enable the DHCP unicast mode, configure the ip dhcp client broadcast-flag clear command on the DHCP client. After configuring the command, the DHCPOFFER is sent as a unicast message.

The DHCP provides a framework for passing configuration information to hosts on a TCP/IP network. A DHCP client is an Internet host using DHCP to obtain configuration parameters such as an IP address. The following figure shows the basic steps that occur when a DHCP client requests an IP address from a DHCP server. The client, Host A, sends a DHCPDISCOVER broadcast message to locate a DHCP server. A DHCP server offers configuration parameters (such as an IP address, a MAC address, a domain name, and a lease for the IP address) to the client in a DHCPOFFER unicast/broadcast message.

Figure 1. DHCP Request for an IP Address from a DHCP Server

A DHCP client may receive offers from multiple DHCP servers. However, it can accept any one of the offers; the client usually accepts the first offer it receives. The offer from the DHCP server is not a guarantee that the IP address is allocated to the client. However, the server usually reserves the address until the client has had a chance to formally request the address .

The client returns a formal request for the offered IP address to the DHCP server in a DHCPREQUEST broadcast message. The DHCP server confirms that the IP address is allocated to the client by returning a DHCPACK unicast message to the client.

DHCP Client Overview

The configurable dynamic host configuration protocol client functionality allows a DHCP client to use a user-specified client identifier, class identifier, or suggested lease time when requesting an address from a DHCP server.

Configuration parameters and other control information are carried in tagged data items that are stored in the options field of the DHCP message. The DHCP client provides flexibility by allowing the following options to be configured for a DHCP client:

  • Option 12—This option specifies the name of the client. The name may or may not be qualified with the local domain.

  • Option 51—This option is used in a client request (DHCPDISCOVER or DHCPREQUEST) to allow the client to request a lease time for the IP address.

  • Option 55—This option allows the DHCP client to request certain options from the DHCP server. The ip dhcp client request command allows the system administrator to turn off some of the requested options, thus removing them from the request list.

  • Option 60—This option allows the user to configure the vendor class identifier string to use in the DHCP interaction.

  • Option 61—This option is used by DHCP clients to specify their unique identifier. DHCP servers use this value to index their database of address bindings. This value is expected to be unique for all clients in an administrative domain.

  • Option 77—This option is used by a DHCP clients to optionally identify the type or category of user or applications it represents. The information contained in this option represents the user class of which the client is a member. Based on this class, a DHCP server selects the appropriate address pool to assign an address to the client and the appropriate configuration parameters.

  • Option 120—This option is used to specify a 32-bit (binary) IPv4 address to be used by the Session Initiation Protocol (SIP) client to locate a SIP server.

  • Option 121—This option is used to configure classless static routes by specifying classless network destinations; that is, each routing table entry includes a subnet mask. Upto ten classless static routes are supported using option 121 on the DHCP client.

    Note


    If a request includes both static routes and classless static routes, the client uses only the classless static routes. If the DHCP server returns both a classless static route option and a router option, the DHCP client ignores the router option.


  • Option 124—This option is used by DHCP clients and servers to exchange vendor-class information.

  • Option 125—This option is used by DHCP clients and servers to exchange vendor-specific information.

How to Configure the DHCP Client

Configuring the DHCP Client

Cisco devices running Cisco software include the Dynamic Host Configuration Protocol (DHCP) server and relay agent software, which are enabled by default. Your device can act as both the DHCP client and the DHCP server. Use the ip address dhcp command to obtain IP address information for the configured interface.

SUMMARY STEPS

  1. enable
  2. configure terminal
  3. interface type number
  4. ip address dhcp
  5. end
  6. debug dhcp detail
  7. debug ip dhcp server packets

DETAILED STEPS

  Command or Action Purpose

Step 1

enable

Example:


Device> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:


Device# configure terminal

Enters global configuration mode.

Step 3

interface type number

Example:


Device(config)# interface GigabitEthernet 0/0/1

Configures an interface type and enters interface configuration mode.

Step 4

ip address dhcp

Example:


Device(config-if)# ip address dhcp

Acquires an IP address on an interface from DHCP.

Step 5

end

Example:


Device(config-if)# end

Returns to privileged EXEC mode.

Step 6

debug dhcp detail

Example:


Device# debug dhcp detail

Displays the DHCP packets that were sent and received.

Step 7

debug ip dhcp server packets

Example:


Device# debug ip dhcp server packets

Displays the server side of the DHCP interaction.

Troubleshooting Tips

To verify the configuration, you can use the debug dhcp detail EXEC command to display the DHCP packets that were sent and received. To display the server side of the DHCP interaction, use the debug ip dhcp server packets command.

Configure Administrative Distance

To configure the default Dynamic Host Configuration Protocol (DHCP) Administrative Distance (AD), use the ip dhcp client default-router distance command in interface configuration or global configuration mode:

Configuration in Interface Configuration Mode:

When you use this command for a interface, AD is applied to the route received in DHCP process of that particular interface.

Router # configure terminal
Router(config)# interface FastEthernet 0/2
Router(config-if)# ip dhcp client default-router distance 2

Configuration in Global Configuration Mode:

Use this command to configure AD is on the route received in DHCP process of any interface.

Router # configure terminal
Router(config)#ip dhcp-client default-router distance 10
Router(config)#interface e0/0
Router(config-if)#ip address dhcp
Router(config-if)#no shut
Router(config-if)#end

To disable the configuration, use the no form of this command.


Note


When you install the ip dhcp client default-router distance command in interface configuration or global configuration mode, default route given by DHCP is installed with specified AD. But, when you use the same command with different AD value, it does not take effect immediately. It takes effect when a new connection is made or when a new Discover-Offer-Request-Ack (DORA) cycle happens. It can be done in any one of the following ways:
  • Bounce the interface, which means execute shutdown followed by no shutdown of the interface.

  • Release (using release dhcp interface ) command and renew DHCP (using renew dhcp interface ) command from exec mode.


Configuration Examples for the DHCP Client

Configuring the DHCP Client Example

The figure below shows a simple network diagram of a DHCP client on an Ethernet LAN.

Figure 2. Topology Showing DHCP Client with GigabitEthernet Interface

On the DHCP server, the configuration is as follows:


ip dhcp pool 1
 network 10.1.1.0 255.255.255.0
 lease 1 6 

On the DHCP client, the configuration is as follows on interface GigabitEthernet 0/0/0:


interface GigabitEthernet 0/0/0
 ip address dhcp

This configuration allows the DHCP client to acquire an IP address from the DHCP server through GigabitEthernet interface 0/0/0.

Customizing the DHCP Client Configuration Example

The following example shows how to customize the DHCP client configuration with various options on GigabitEthernet interface 0/0/1:


interface GigabitEthernet 0/0/1
 ip dhcp client client-id ascii my-test1
 ip dhcp client class-id my-class-id
 ip dhcp client lease 0 1 0
 ip dhcp client hostname sanfran
 no ip dhcp client request tftp-server-address
 ip address dhcp

The following example shows DHCP Client configuration on GigabitEthernet 0/0/1 to generically request options:


!
interface GigabitEthernet 0/0/1
ip dhcp client request option 4 5 7 8 9 10 11 17 18 40 41 42 66 68 69 70 71 72 73 74 75 76 124 138 141 142 160
no ip address
shutdown
!

The following example shows how to configure DHCP Client options with parameters, IP address and string:


!
interface GigabitEthernet 0/0/1
ip dhcp client option 1 ip 10.0.0.1
ip dhcp client option 13 ascii test13
ip dhcp client option 14 ascii test14
ip dhcp client option 16 ip 10.0.0.16
ip dhcp client option 46 ascii test46
ip dhcp client option 47 ascii test47
ip dhcp client option 50 ip 10.0.0.50
ip dhcp client option 51 ascii test51
ip dhcp client option 52 ascii test52
ip dhcp client option 54 ascii test54
ip dhcp client option 58 ascii test58
ip dhcp client option 59 ascii test59
ip dhcp client option 60 ascii test60
ip dhcp client option 61 ascii test61
ip dhcp client option 62 ascii test62
ip dhcp client option 63 ip 10.0.0.63
ip dhcp client option 64 ascii test64
ip dhcp client option 65 ip 10.0.0.65
ip dhcp client option 67 ascii test67
ip dhcp client option 90 ascii test90
ip dhcp client option 116 ascii test116
ip dhcp client option 118 ip 10.0.0.118
ip dhcp client option 220 ip 10.0.0.220
ip dhcp client option 221 ascii test221
ip address dhcp
shutdown
!

The following example shows how to configure DHCP Client options with class:

By default, Option-124 carries the PID of the device. The following example shows the overriding option-124 default value in DHCPv4:

Router(config-if)# ip dhcp client ?
information Configure information refresh option
pd Prefix-Delegation
request Request
vendor-class Configure vendor class data, Product ID by default (Option 124)

The following configuration example overrides PID with mac-address:

Router(config-if)# ip dhcp client vendor-class mac-address

The following configuration example overrides PID with user defined string in ascii format:

Router(config-if)# ip dhcp client vendor-class ascii cisco

The following configuration example overrides PID with user defined string in hex format:

Router(config-if)# ip dhcp client vendor-class hex aabbcc

The following configuration example is used to disable sending option-124 in DHCPv4 messages:

Router(config-if)# ip dhcp client vendor-class disable

Example: Configuring the DHCP Client in Unicast Mode

The following example shows how to configure DHCP Client in unicast mode:

The figure below shows a simple network diagram of a DHCP client in unicast mode.

Figure 3. Topology Showing DHCP Client with GigabitEthernet Interface

Client:

interface GigabitEthernet6
ip address dhcp
ip dhcp client broadcast-flag clear

Relay:

interface GigabitEthernet6
ip address 1.1.1.10 255.255.255.0
ip helper-address 111.111.111.111

!
interface GigabitEthernet5
  ip address 10.10.10.1 255.255.255.0
  
ip route 111.111.111.111 255.255.255.255 GigabitEthernet5
Server:
interface Loopback10
ip address 111.111.111.111 255.255.255.255
no shutdown
!
ip route 0.0.0.0 0.0.0.0 GigabitEthernet5
 
ip dhcp pool Cisco
network 11.11.11.0 255.255.255.0
default-router 11.11.11.1 

Additional References

Related Documents

Related Topic

Document Title

Cisco IOS commands

Cisco IOS Master Command List, All Releases

DHCP commands: complete command syntax, command modes, command history, defaults, usage guidelines, and examples.

Cisco IOS IP Addressing Services Command Reference

DHCP conceptual information

“DHCP Overview” module

DHCP server configuration

“Configuring the Cisco IOS XE DHCP Server” module

DHCP server on-demand address pools

“Configuring the DHCP Server On-Demand Address Pool Manager” module

DHCP relay agent configuration

“Configuring the Cisco IOS XE DHCP Relay Agent” module

DHCP advanced features

“Configuring DHCP Services for Accounting and Security” module

RFCs

RFCs

Title

RFC 2131

Dynamic Host Configuration Protocol

RFC 2132

DHCP Options and BOOTP Vendor Extensions

Technical Assistance

Description

Link

The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password.

http://www.cisco.com/cisco/web/support/index.html

Technical Assistance

Description

Link

The Cisco Support website provides extensive online resources, including documentation and tools for troubleshooting and resolving technical issues with Cisco products and technologies.

To receive security and technical information about your products, you can subscribe to various services, such as the Product Alert Tool (accessed from Field Notices), the Cisco Technical Services Newsletter, and Really Simple Syndication (RSS) Feeds.

Access to most tools on the Cisco Support website requires a Cisco.com user ID and password.

http://www.cisco.com/techsupport