Configuring the Cisco IOS DHCP Client

Table Of Contents

Configuring the Cisco IOS DHCP Client

Contents

Restrictions for Configuring the DHCP Client

Information About the DHCP Client

DHCP Client Operation

DHCP Client Overview

DHCP Client on WAN Interfaces

How to Configure the DHCP Client

Configuring the DHCP Client

DHCP Client Default Behavior

Prerequisites

Troubleshooting Tips

Forcing a Release or Renewal of a DHCP Lease for a DHCP Client

DHCP Release and Renew CLI Operation

Prerequisites

Restrictions

Configuration Examples for the DHCP Client

Configurable DHCP Client: Example

Cisco IOS DHCP Client: Example

ATM Primary Interface (Multipoint) Using aal5snap Encapsulation and Inverse ARP: Example

ATM Point-to-Point Subinterface Using aa15snap Encapsulation: Example

ATM Point-to-Point Subinterface Using aa15nlpid Encapsulation: Example

ATM Point-to-Point Subinterface Using aa15mux PPP Encapsulation: Example

Release DHCP Lease: Example

Renew DHCP Lease: Example

Additional References

Related Documents

Standards

MIBs

RFCs

Technical Assistance

Feature Information for the Cisco IOS DHCP Client


Configuring the Cisco IOS DHCP Client


Cisco IOS 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 DHCP client.

Module History

This module was first published on May 2, 2005, and last updated on February 27, 2006.

Finding Feature Information in This Module

Your Cisco IOS software release may not support all features. To find information about feature support and configuration, use the "Feature Information for the Cisco IOS DHCP Client" section.

Contents

Restrictions for Configuring the DHCP Client

Information About the DHCP Client

How to Configure the DHCP Client

Configuration Examples for the DHCP Client

Additional References

Feature Information for the Cisco IOS DHCP Client

Restrictions for Configuring the DHCP Client

The DHCP client can be configured on Ethernet interfaces and on PPPoA and certain ATM interfaces. The DHCP client works with ATM point-to-point interfaces and will accept any encapsulation type. For ATM multipoint interfaces, the DHCP client is only supported using the aal5snap encapsulation type combined with Inverse ARP. Inverse ARP, which builds an ATM map entry, is necessary to send unicast packets to the server (or relay agent) on the other end of the connection. Inverse ARP is only supported for the aal5snap encapsulation type.

For multipoint interfaces, an IP address can be acquired using other encapsulation types because broadcast packets are used. However, unicast packets to the other end will fail because there is no ATM map entry and thus DHCP renewals and releases also fail.

Information About the DHCP Client

To configure the DHCP client, you must understand the following concepts:

DHCP Client Operation

DHCP Client Overview

DHCP Client on WAN Interfaces

DHCP Client Operation

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. Figure 1 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 message.

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

A DHCP client may receive offers from multiple DHCP servers and can accept any one of the offers; however, the client usually accepts the first offer it receives. Additionally, the offer from the DHCP server is not a guarantee that the IP address will be 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 has been allocated to the client by returning a DHCPACK unicast message to the client.

DHCP Client Overview

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.

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 12This option specifies the name of the client. The name may or may not be qualified with the local domain.

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

Option 55This 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 60This option allows the user to configure the vendor class identifier string to use in the DHCP interaction.

Option 61This 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.

DHCP Client on WAN Interfaces

The DHCP client on WAN interfaces allows a DHCP client to acquire an IP address over PPP over ATM (PPPoA) and certain ATM interfaces. By using DHCP rather than the IP Control Protocol (IPCP), a DHCP client can acquire other useful information such as DNS addresses, the DNS default domain name, and the default route.

The configuration of PPPoA and Classical IP and ARP over ATM already allows for a broadcast capability over the interface (using the broadcast keyword on the ATM interface). Most changes in this feature are directed at removing already existing restrictions on what types of interfaces are allowed to send out DHCP packets (previously, dialer interfaces have not been allowed). This feature also ensures that DHCP RELEASE messages are sent out the interface before a connection is allowed to be broken.

How to Configure the DHCP Client

This section contains the following tasks:

Configuring the DHCP Client

Forcing a Release or Renewal of a DHCP Lease for a DHCP Client

Configuring the DHCP Client

Perform this task to configure the DHCP client.

DHCP Client Default Behavior

Cisco routers running Cisco IOS software include DHCP server and relay agent software, which are enabled by default. Your router can act as both the DHCP client and DHCP server. Use the ip address dhcp interface command to obtain IP address information for the configured interface.

Prerequisites

You must configure the ip dhcp client commands before entering the ip address dhcp command on an interface to ensure that the DHCPDISCOVER messages that are generated contain the correct option values. The ip dhcp client commands are checked only when an IP address is acquired from DHCP. If any of the ip dhcp client commands are entered after an IP address has been acquired from DHCP, it will not take effect until the next time the router acquires an IP address from DHCP. This means that the new configuration will only take effect after either the ip address dhcp command or the release dhcp and renew dhcp EXEC commands have been configured.

SUMMARY STEPS

1. enable

2. configure terminal

3. interface type number

4. ip dhcp client client-id {interface-name | ascii string | hex string}

5. ip dhcp client class-id {ascii string | hex string}

6. ip dhcp client lease days [hours] [minutes]

7. ip dhcp client hostname host-name

8. [no] ip dhcp client request option-name

9. ip address dhcp

DETAILED STEPS

 
Command or Action
Purpose

Step 1 

enable

Example:

Router> enable

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2 

configure terminal

Example:

Router# configure terminal

Enters global configuration mode.

Step 3 

interface type number

Example:

Router(config)# interface Ethernet 1

Configures an interface type and enters interface configuration mode.

Step 4 

ip dhcp client client-id {interface-name | ascii string | hex string}

Example:

Router(config-if)# ip dhcp client client-id ascii mytest1

(Optional) Specifies the client identifier.

When you specify the no form of this command, the configuration is removed and the system returns to using the default form. It is not possible to configure the system to not include a client identifier.

Step 5 

ip dhcp client class-id {ascii string | hex string}

Example:

Router(config-if)# ip dhcp client class-id ascii my-class-id

(Optional) Specifies the class identifier.

Step 6 

ip dhcp client lease days [hours] [minutes]

Example:

Router(config-if)# ip dhcp client lease 2

(Optional) Configures the duration of the lease for an IP address that is requested from a DHCP client to a DHCP server.

Step 7 

ip dhcp client hostname host-name

Example:

Router(config-if)# ip dhcp client hostname router1

(Optional) Specifies or modifies the host name sent in the DHCP message.

Step 8 

[no] ip dhcp client request option-name

Example:

Router(config-if)# no ip dhcp client request tftp-server-address

(Optional) Configures a DHCP client to request an option from a DHCP server.

The option name can be tftp-server-address, netbios-nameserver, vendor-specific, static-route, domain-name, dns-nameserver, or router. By default, all these options are requested. The no form of the command instructs the system to not request certain options.

Step 9 

ip address dhcp

Example:

Router(config-if)# ip address dhcp

Acquires an IP address on an interface from DHCP.

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.

The following are troubleshooting tips for DHCP clients on WAN interfaces:

An ATM primary interface is always multipoint.

An ATM subinterface can be multipoint or point-to-point.

If you are using a point-to-point interface, the routing table determines when to send a packet to the interface and ATM map entries are not needed. Consequently, Inverse ARP, which builds ATM map entries, is not needed.

If you are using a multipoint interface you must use Inverse ARP to discover the IP address of the other side of the connection.

You can specify Inverse ARP through the protocol ip  inarp interface configuration command. You must use the aal5snap encapsulation type when using Inverse ARP because it is the only encapsulation type that supports Inverse ARP.

Forcing a Release or Renewal of a DHCP Lease for a DHCP Client

Perform this task to force a release or renewal of a DHCP lease for a DHCP client.

Forcing a release or renewal of a DHCP lease for a DHCP client provides the ability to perform two independent operations from the command-line interface (CLI) in EXEC mode:

Immediately release a DHCP lease for a DHCP client.

Force a DHCP renewal of a lease for a DHCP client.

This functionality provides the following benefits:

Eliminates the need to go into the configuration mode to reconfigure the router to release or renew a DHCP lease.

Simplifies the release and renewal of a DHCP lease.

Reduces the amount of time spent performing DHCP IP release and renewal configuration tasks.

DHCP Release and Renew CLI Operation

Release a DHCP Lease

The release dhcp command starts the process to immediately release a DHCP lease for the specified interface. After the lease is released, the interface address is deconfigured. The release dhcp command does not deconfigure the ip address dhcp command specified in the configuration file for the interface. During a write memory or show running configuration file action, or if the router is rebooted, the ip address dhcp command executes to acquire a DHCP address for the interface.

The original IP address for the interface must be assigned by the DHCP server. If the interface is not assigned an IP address by the DHCP server, the release dhcp command fails and displays the following error message:

Interface does not have a DHCP originated address


Renew a DHCP Lease

The renew dhcp command advances the DHCP lease timer to the next stage, at which point one of the following occurs:

If the lease is currently in a BOUND state, the lease is advanced to the RENEW state and a DHCP RENEW request is sent.

If the lease is currently in a RENEW state, the timer is advanced to the REBIND state and a DHCP REBIND request is sent.

If there is no response to the RENEW request, the interface remains in the RENEW state. In this case, the lease timer will advance to the REBIND state and subsequently send a REBIND request.

If a NAK response is sent in response to the RENEW request, the interface is deconfigured.

The original IP address for the interface must be assigned by the DHCP server. If the interface is not assigned an IP address by the DHCP server, the renew dhcp command fails and displays the following error message:

Interface does not have a DHCP originated address


Prerequisites

The DHCP client must be assigned an IP address by the DHCP server.

Restrictions

If the DHCP client is not assigned an IP address by the DHCP server, the DHCP release and renew CLI commands will fail.

SUMMARY STEPS

1. enable

2. release dhcp type number

3. renew dhcp type number

DETAILED STEPS

 
Command or Action
Purpose

Step 1 

enable

Example:

Router> enable

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2 

release dhcp type number

Example:

Router# release dhcp ethernet 3/1

Performs an immediate release of the DHCP lease for the interface and deconfigures the IP address for the interface.

Step 3 

renew dhcp type number

Example:

Router# renew dhcp ethernet 3/1

Forces the DHCP timer to advance to the next stage, at which point a subsequent action is taken: a DHCP REQUEST packet is sent to renew or rebind the lease.

Configuration Examples for the DHCP Client

This section provides the following configuration examples:

Configurable DHCP Client: Example

Cisco IOS DHCP Client: Example

ATM Primary Interface (Multipoint) Using aal5snap Encapsulation and Inverse ARP: Example

ATM Point-to-Point Subinterface Using aa15snap Encapsulation: Example

ATM Point-to-Point Subinterface Using aa15nlpid Encapsulation: Example

ATM Point-to-Point Subinterface Using aa15mux PPP Encapsulation: Example

Release DHCP Lease: Example

Renew DHCP Lease: Example

Configurable DHCP Client: Example

The following example shows how to configure the DHCP client with various options on Ethernet interface 1:

interface Ethernet 1
 ip dhcp client client-id ascii my-test1
 ip dhcp client class-id ascii 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

Cisco IOS DHCP Client: Example

Figure 2 shows a simple network diagram of a DHCP client on an Ethernet LAN.

Figure 2 Topology Showing DHCP Client with Ethernet 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 E2:

interface Ethernet2
 ip address dhcp

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

ATM Primary Interface (Multipoint) Using aal5snap Encapsulation and Inverse ARP: Example

In the following example, the protocol ip 255.255.255.255 broadcast configuration is needed because there must be an ATM map entry to recognize the broadcast flag on the permanent virtual circuit (PVC). You can use any ATM map entry. The protocol ip inarp configuration is needed so the ATM Inverse ARP can operate on the interface such that the system on the other side can be pinged once an address is assigned by DHCP.

interface atm0
  ip address dhcp
  pvc 1/100
    encapsulation aal5snap
    broadcast
    protocol ip 255.255.255.255 broadcast
     protocol ip inarp

ATM Point-to-Point Subinterface Using aa15snap Encapsulation: Example

The following example shows an ATM point-to-point subinterface configuration using aa15snap encapsulation:

interface atm0.1 point-to-point
  ip address dhcp
  pvc 1/100
    encapsulation aal5snap
    broadcast

ATM Point-to-Point Subinterface Using aa15nlpid Encapsulation: Example

The following example shows an ATM point-to-point subinterface configuration using aa15nlpid encapsulation:

interface atm0.1 point-to-point
  ip address dhcp
  pvc 1/100
    encapsulation aal5nlpid
    broadcast

ATM Point-to-Point Subinterface Using aa15mux PPP Encapsulation: Example

The following example shows an ATM point-to-point subinterface configuration using aa15mux PPP encapsulation:

interface atm0.1 point-to-point
  pvc 1/100
  encapsulation aal5mux ppp virtual-template1
  broadcast
!
interface virtual-template1
  ip address dhcp

Release DHCP Lease: Example

In the following example, a DHCP release is performed on an interface that was originally assigned an IP address by the DHCP server.

Router# release dhcp ethernet 3/1

In the following example, an attempt is made to release the DHCP lease on an interface that was not originally assigned an IP address by the DHCP server.

Router# release dhcp ethernet 3/1

Interface does not have a DHCP originated address


In the following example, the release dhcp command is executed without specifying the type and number arguments.

Router# release dhcp

Incomplete command.

Renew DHCP Lease: Example

In the following example, the DHCP lease is renewed on an interface that was originally assigned an IP address by the DHCP server.

Router# renew dhcp ethernet 3/1

In the following example, an attempt is made to renew the DHCP lease on an interface that was not originally assigned an IP address by the DHCP server.

Router# renew dhcp ethernet 3/1

Interface does not have a DHCP originated address


In the following example, the renew dhcp command is executed without specifying the type and number arguments.

Router# renew dhcp

Incomplete command.


Additional References

The following sections provide references related to the DHCP client.

Related Documents

Related Topic
Document Title

DHCP commands

Cisco IOS IP Addressing Services Command Reference, Release 12.4 T

DHCP conceptual information

"DHCP Overview" module

DHCP server configuration

"Configuring the Cisco IOS 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 DHCP Relay Agent" module

DHCP advanced features

"Configuring DHCP Services for Accounting and Security"module

DHCP enhancements for edge-session management

"Configuring DHCP Enhancements for Edge-Session Management" module


Standards

Standards
Title

No new or modified standards are supported by this feature, and support for existing standards has not been modified by this feature.


MIBs

MIBs
MIBs Link

No new or modified MIBs are supported by this feature, and support for existing MIBs has not been modified by this feature.

To obtain lists of supported MIBs by platform and Cisco IOS release, and to download MIB modules, go to the Cisco MIB website on Cisco.com at the following URL:

http://www.cisco.com/public/sw-center/netmgmt/cmtk/mibs.shtml


RFCs

RFCs
Title

RFC 2131

Dynamic Host Configuration Protocol

RFC 2132

DHCP Options and BOOTP Vendor Extensions


Technical Assistance

Description
Link

The Cisco Technical Support & Documentation website contains thousands of pages of searchable technical content, including links to products, technologies, solutions, technical tips, and tools. Registered Cisco.com users can log in from this page to access even more content.

http://www.cisco.com/techsupport


Feature Information for the Cisco IOS DHCP Client

Table 1 lists the features in this module and provides links to specific configuration information. Only features that were introduced or modified in Cisco IOS Release 12.2(1) or a later release appear in the table.

Not all commands may be available in your Cisco IOS software release. For details on when support for a specific command was introduced, see the command reference documentation.

For information on a feature in this technology that is not documented here, see the "DHCP Features Roadmap".

Cisco IOS software images are specific to a Cisco IOS software release, a feature set, and a platform. Use Cisco Feature Navigator to find information about platform support and Cisco IOS software image support. Access Cisco Feature Navigator at http://www.cisco.com/go/fn. You must have an account on Cisco.com. If you do not have an account or have forgotten your username or password, click Cancel at the login dialog box and follow the instructions that appear.


Note Table 1 lists only the Cisco IOS software release that introduced support for a given feature in a given Cisco IOS software release train. Unless noted otherwise, subsequent releases of that Cisco IOS software release train also support that feature.


Table 1 Feature Information for the Cisco IOS DHCP Client 

Feature Name
Releases
Feature Configuration Information

Configurable DHCP Client

12.3(8)T

12.2(28)SB

The Configurable DHCP Client feature 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.

The following sections provide information about this feature:

Configuring the DHCP Client

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

DHCP Release and Renew CLI in EXEC Mode

12.3(4)T

12.2(28)SB

This feature provides the ability to perform two independent operations from the CLI: (1) immediately release a DHCP lease for a DHCP client, and (2) force a DHCP renewal of a lease for a DHCP client.

The following section provides information about this feature:

Forcing a Release or Renewal of a DHCP Lease for a DHCP Client

The following commands were introduced by this feature: release dhcp and renew dhcp.

DHCP Client on WAN Interfaces

12.2(8)T

12.2(28)SB

The DHCP Client on WAN Interfaces feature extends the DHCP to allow a DHCP client to acquire an IP address over PPP over ATM (PPPoA) and certain ATM interfaces.

The following section provides information about this feature:

DHCP Client on WAN Interfaces

No commands were introduced or modified by this feature.