Guest

Cisco IOS Software Releases 12.3 T

Configurable DHCP Client

Table Of Contents

Configurable DHCP Client

Contents

Information About Configurable DHCP Client

DHCP Client Operation

Design of the Configurable DHCP Client Feature

How to Configure the DHCP Client

Configuring the DHCP Client

Prerequisites

Troubleshooting Tips

Configuration Examples for the Configurable DHCP Client

Configurable DHCP Client: Example

Additional References

Related Documents

Standards

MIBs

RFCs

Technical Assistance

Command Reference

ip address dhcp

ip dhcp client class-id

ip dhcp client client-id

ip dhcp client hostname

ip dhcp client lease

ip dhcp client request


Configurable DHCP Client


The Configurable DHCP Client feature provides the flexibility to include various configuration options for the Dynamic Host Configuration Protocol (DHCP) client. A DHCP client is defined as an Internet host using DHCP to obtain configuration parameters such as an IP address.

Feature History for the Configurable DHCP Client Feature

Release
Modification

12.3(2)XF

This feature was introduced.

12.3(8)T

This feature was integrated into Cisco IOS Release 12.3(8)T.

12.2(27)SBA

This feature was integrated into Cisco IOS Release 12.2(27)SBA.


Finding Support Information for Platforms and Cisco IOS Software Images

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.

Contents

Information About Configurable DHCP Client

How to Configure the DHCP Client

Configuration Examples for the Configurable DHCP Client

Additional References

Command Reference

Information About Configurable DHCP Client

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

DHCP Client Operation

Design of the Configurable DHCP Client Feature

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.

Design of the Configurable DHCP Client Feature

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

How to Configure the DHCP Client

This section contains the following procedure:

Configuring the DHCP Client

Configuring the DHCP Client

Perform this task to configure the DHCP client.

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

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

Specifies the class identifier.

Step 6 

ip dhcp client lease days [hours] [minutes]

Example:

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

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

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

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.

Configuration Examples for the Configurable DHCP Client

This section provides the following configuration example:

Configurable DHCP Client: 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

Additional References

The following sections provide references related to the Configurable DHCP Client feature.

Related Documents

Related Topic
Document Title

DHCP commands

Cisco IOS IP Command Reference, Volume 1 of 4: Addressing and Services, Release 12.3 T

DHCP configuration tasks

Cisco IOS IP Configuration Guide


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

Technical Assistance Center (TAC) home page, containing 30,000 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/public/support/tac/home.shtml


Command Reference

This section documents modified commands. All other commands used with this feature are documented in the Cisco IOS Release 12.3 T command reference publications.

ip address dhcp

ip dhcp client class-id

ip dhcp client client-id

ip dhcp client hostname

ip dhcp client lease

ip dhcp client request

ip address dhcp

To acquire an IP address on an interface from the Dynamic Host Configuration Protocol (DHCP), use the ip address dhcp command in interface configuration mode. To remove any address that was acquired, use the no form of this command.

ip address dhcp [client-id interface-name] [hostname host-name]

no ip address dhcp [client-id interface-name] [hostname host-name]

Syntax Description

client-id

(Optional) Specifies the client identifier. By default, the client identifier is an ASCII value. The client-id interface-name option sets the client identifier to the hexadecimal MAC address of the named interface.

interface-name

(Optional) The interface name from which the MAC address is taken.

hostname

(Optional) Specifies the hostname.

host-name

(Optional) Name of the host to be placed in the DHCP option 12 field. This name need not be the same as the hostname entered in global configuration mode.


Defaults

The hostname is the globally configured hostname of the router.
The client identifier is an ASCII value.

Command Modes

Interface configuration

Command History

Release
Modification

12.1(2)T

This command was introduced.

12.1(3)T

The client-id keyword and interface-name argument were added.

12.2(3)

The hostname keyword and host-name argument were added. The behavior of the client-id interface-name option changed. See the "Usage Guidelines" section for details.

12.2(8)T

The command was expanded for use on PPP over ATM (PPPoA) interfaces and certain ATM interfaces.

12.2(27)SBA

This command was integrated into Cisco IOS Release 12.2(27)SBA.


Usage Guidelines


Note Prior to Release 12.2(8)T, the ip address dhcp command could be used only on Ethernet interfaces.


The ip address dhcp command allows any interface to dynamically learn its IP address by using the DHCP protocol. It is especially useful on Ethernet interfaces that dynamically connect to an internet service provider (ISP). Once assigned a dynamic address, the interface can be used with the Port Address Translation (PAT) of Cisco IOS Network Address Translation (NAT) to provide Internet access to a privately addressed network attached to the router.

The ip address dhcp command also works with ATM point-to-point interfaces and will accept any encapsulation type. However, for ATM multipoint interfaces you must specify Inverse Address Resolution Protocol via the protocol ip inarp interface configuration command and use only the aa15snap encapsulation type.

Some ISPs require that the DHCPDISCOVER message have a specific hostname and client identifier that is the MAC address of the interface. The most typical usage of the ip address dhcp client-id interface-name hostname host-name command is when interface-name is the Ethernet interface where the command is configured and host-name is the hostname provided by the ISP.

A client identifier (DHCP option 61) can be a hexadecimal or an ASCII value. By default, the client identifier is an ASCII value. The client-id interface option overrides the default and forces the use of the hexadecimal MAC address of the named interface.


Note Between Cisco IOS Releases 12.1(3)T and 12.2(3), the client-id optional keyword allowed the change of the fixed ASCII value for the client identifier. After Release 12.2(3), the optional client-id keyword forced the use of the hexadecimal MAC address of the named interface as the client identifier.


If a Cisco router is configured to obtain its IP address from a DHCP server, it sends a DHCPDISCOVER message to provide information about itself to the DHCP server on the network.

Use of the ip address dhcp always results in the DHCP option 12 field (hostname option) being included in the DISCOVER message. By default, the hostname specified in option 12 will be the globally configured hostname of the router. However, you can use the ip address dhcp hostname host-name command to place a different name in the DHCP option 12 field than the globally configured hostname of the router.

The no ip address dhcp command removes any IP address that was acquired, thus sending a DHCPRELEASE message.

You might need to experiment with different configurations to determine the one required by your DHCP server. Table 1 shows the possible configuration methods and the information placed in the DISCOVER message for each method.

Table 1 Configuration Method and Resulting Contents of the DISCOVER Message

Configuration Method
Contents of DISCOVER Messages

ip address dhcp 

The DISCOVER message contains "cisco- mac-address -Eth1" in the client ID field. The mac-address is the MAC address of the Ethernet 1 interface and contains the default hostname of the router in the option 12 field.

ip address dhcp hostname host-name

The DISCOVER message contains "cisco- mac-address -Eth1" in the client ID field. The mac-address is the MAC address of the Ethernet 1 interface, and contains host-name in the option 12 field.

ip address dhcp client-id ethernet 1

The DISCOVER message contains the MAC address of the Ethernet 1 interface in the client ID field and contains the default hostname of the router in the option 12 field.

ip address dhcp client-id ethernet 1 hostname host-name

The DISCOVER message contains the MAC address of the Ethernet 1 interface in the client ID field and contains host-name in the option 12 field.


Examples

In the examples that follow, the command ip address dhcp is entered for the Ethernet interface 1. The DISCOVER message sent by a router configured as shown in the following example would contain "cisco- mac-address -Eth1" in the client-ID field, and the value site 1 in the option 12 field:

hostname site 1
!
interface Ethernet 1
 ip address dhcp

The DISCOVER message sent by a router configured as shown in the following example would contain "cisco- mac-address -Eth1" in the client-ID field, and the value site 2 in the option 12 field:

hostname site 1
!
interface Ethernet 1
 ip address dhcp hostname site 2

The DISCOVER message sent by a router configured as shown in the following example would contain the MAC address of the Ethernet 1 interface in the client-id field, and the value site 1 in the option 12 field:

hostname site 1
!
interface Ethernet 1
 ip address dhcp client-id Ethernet 1

The DISCOVER message sent by a router configured as shown in the following example would contain the MAC address of the Ethernet 1 interface in the client-id field, and the value site 2 in the option 12 field:

hostname site 1
!
interface Ethernet 1
 ip address dhcp client-id Ethernet 1 hostname site 2

Related Commands

Command
Description

ip dhcp pool

Configures a DHCP address pool on a Cisco IOS DHCP and enters DHCP pool configuration mode.

protocol ip inarp

Ensures that the mapping gets done automatically.


ip dhcp client class-id

To specify the class identifier, use the ip dhcp client class-id command in interface configuration mode. To remove the class identifier, use the no form of this command.

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

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

Syntax Description

ascii string

A unique ASCII string.

hex string

A unique hexadecimal value.


Defaults

No class identifier is specified.

Command Modes

Interface configuration

Command History

Release
Modification

12.3(2)XF

This command was introduced.

12.3(8)T

This command was integrated into Cisco IOS Release 12.3(8)T.

12.2(27)SBA

This command was integrated into Cisco IOS Release 12.2(27)SBA.


Usage Guidelines

The ip dhcp client class-id command is checked only when an IP address is acquired from DHCP. If the command is issued 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 take effect only after either the ip address dhcp command or the release dhcp and renew dhcp EXEC commands have been configured.

The class identifier is used by vendors to specify the type of device that is requesting an IP address. For example, docsis 1.0 can be used for a cable modem and Cisco Systems, Inc. IP Phone can be used for a Cisco IP phone.

Examples

The following example configures a class identifier with a hexadecimal string of ABCDEF1235:

interface Ethernet 1
 ip dhcp client class-id hex ABCDEF1235

Related Commands

Command
Description

ip address dhcp

Acquires an IP address on an interface from DHCP.

release dhcp

Performs an immediate release of a DHCP lease for an interface.

renew dhcp

Performs an immediate renewal of a DHCP lease for an interface.


ip dhcp client client-id

To specify a client identifier and override the default client identifier, use the ip dhcp client client-id command in interface configuration mode. To remove the overriding of the client identifier and return to the default form, use the no form of this command.

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

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

Syntax Description

interface-name

The interface name from which the MAC address is taken.

ascii string

A unique ASCII string. The default value is cisco-mac-name where mac is the MAC address of the interface and name is the short form of the interface name.

hex string

A unique hexadecimal value.


Defaults

The client identifier is an ASCII value in the form cisco-mac-name where mac is the MAC address of the interface and name is the short form of the interface name.

Command Modes

Interface configuration

Command History

Release
Modification

12.3(2)XF

This command was introduced.

12.3(8)T

This command was integrated into Cisco IOS Release 12.3(8)T.

12.2(27)SBA

This command was integrated into Cisco IOS Release 12.2(27)SBA.


Usage Guidelines

The ip dhcp client client-id command is checked only when an IP address is acquired from DHCP. If the command is issued 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.

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.

Examples

The following example shows how to configure a client identifier named test-client-id:

interface Ethernet 1
 ip dhcp client client-id ascii test-client-id

Related Commands

Command
Description

ip address dhcp

Acquires an IP address on an interface from DHCP.

release dhcp

Performs an immediate release of a DHCP lease for an interface.

renew dhcp

Performs an immediate renewal of a DHCP lease for an interface.


ip dhcp client hostname

To specify or modify the hostname sent in the Dynamic Host Control Protocol message, use the ip dhcp client hostname command in interface configuration mode. To remove the hostname, use the no form of this command.

ip dhcp client hostname host-name

no ip dhcp client hostname host-name

Syntax Description

host-name

Name of the host.


Defaults

The hostname is the globally configured hostname of the router.

Command Modes

Interface configuration

Command History

Release
Modification

12.3(2)XF

This command was introduced.

12.3(8)T

This command was integrated into Cisco IOS Release 12.3(8)T.

12.2(27)SBA

This command was integrated into Cisco IOS Release 12.2(27)SBA.


Usage Guidelines

The ip dhcp client hostname command is checked only when an IP address is acquired from DHCP. If the command is issued 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 take effect only after either the ip address dhcp command or the release dhcp and renew dhcp EXEC commands have been configured.

Examples

The following example specifies the hostname of the DHCP client to hostA:

interface Ethernet 1
 ip dhcp client hostname hostA

Related Commands

Command
Description

ip address dhcp

Acquires an IP address on an interface from DHCP.

release dhcp

Performs an immediate release of a DHCP lease for an interface.

renew dhcp

Performs an immediate renewal of a DHCP lease for an interface.


ip dhcp client lease

To configure the duration of the lease for an IP address that is requested from a Dynamic Host Control Protocol client to a DHCP server, use the ip dhcp client lease command in interface configuration mode. To disable the client time limit and use the server settings, use the no form of this command.

ip dhcp client lease days [hours] [minutes]

no ip dhcp client lease

Syntax Description

days

Specifies the duration of the lease in days.

hours

(Optional) Specifies the number of hours in the lease. A days value must be supplied before you can configure an hours value.

minutes

(Optional) Specifies the number of minutes in the lease. A days value and an hours value must be supplied before you can configure a minutes value.


Defaults

A default lease time is not included in the DHCP DISCOVER messages sent by the client. The client accepts the lease time that the DHCP server sends.

Command Modes

Interface configuration

Command History

Release
Modification

12.3(2)XF

This command was introduced.

12.3(8)T

This command was integrated into Cisco IOS Release 12.3(8)T.

12.2(27)SBA

This command was integrated into Cisco IOS Release 12.2(27)SBA.


Usage Guidelines

The ip dhcp client lease command is checked only when an IP address is acquired from DHCP. If the command is issued 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 take effect only after either the ip address dhcp command or the release dhcp and renew dhcp EXEC commands have been configured.

Examples

The following example shows a one-day lease:

ip dhcp client lease 1

The following example shows a one-hour lease:

ip dhcp client lease 0 1

The following example shows a one-minute lease:

ip dhcp client lease 0 0 1

Related Commands

Command
Description

ip address dhcp

Acquires an IP address on an interface from DHCP.

lease

Configures the duration of the lease for an IP address that is assigned from a DHCP server to a DHCP client.

release dhcp

Performs an immediate release of a DHCP lease for an interface.

renew dhcp

Performs an immediate renewal of a DHCP lease for an interface.


ip dhcp client request

To configure a Dynamic Host Configuration Protocfol client to request an option from a DHCP server, use the ip dhcp client request command in interface configuration mode. To remove the request for an option, use the no form of this command.

ip dhcp client request option-name

no ip dhcp client request option-name

Syntax Description

option-name

The option name can be one of the keywords tftp-server-address, netbios-nameserver, vendor-specific, static-route, domain-name, dns-nameserver, or router. By default, all these options are requested.


Defaults

All of the options are requested.

Command Modes

Interface configuration

Command History

Release
Modification

12.3(2)XF

This command was introduced.

12.3(8)T

This command was integrated into Cisco IOS Release 12.3(8)T.

12.2(27)SBA

This command was integrated into Cisco IOS Release 12.2(27)SBA.


Usage Guidelines

Because all options are requested, the usual form of the command is the no form. The options specified by the no form are removed from the DHCP originated address for the interface.

You can reinsert an option in the list of options requested by using the same command without the no keyword. Multiple options can be specified on one configuration line. However, each option will appear on a separate line in the running configuration.

The ip dhcp client request command is checked only when an IP address is acquired from DHCP. If the command is issued 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 take effect only after either the ip address dhcp command or the release dhcp and renew dhcp EXEC commands have been configured.

Examples

The following example shows how to configure the DHCP client to remove the domain name server from the options requested from the DHCP server:

no ip dhcp client request dns-nameserver

Related Commands

Command
Description

ip address dhcp

Acquires an IP address on an interface from DHCP.

release dhcp

Performs an immediate release of a DHCP lease for an interface.

renew dhcp

Performs an immediate renewal of a DHCP lease for an interface.