Table Of Contents
Information About Configurable DHCP Client
Design of the Configurable DHCP Client Feature
How to Configure the DHCP Client
Configuration Examples for the Configurable DHCP Client
Configurable DHCP Client: Example
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
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
Information About Configurable DHCP Client
To configure the DHCP client, you must understand the following concepts:
•
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 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.
How to Configure the DHCP Client
This section contains the following procedure:
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
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 1ip dhcp client client-id ascii my-test1ip dhcp client class-id ascii my-class-idip dhcp client lease 0 1 0ip dhcp client hostname sanfranno ip dhcp client request tftp-server-addressip address dhcpAdditional References
The following sections provide references related to the Configurable DHCP Client feature.
Related Documents
Related Topic Document TitleDHCP 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 TitleNo new or modified standards are supported by this feature, and support for existing standards has not been modified by this feature.
—
MIBs
RFCs
RFCs TitleRFC 2131
Dynamic Host Configuration Protocol
RFC 2132
DHCP Options and BOOTP Vendor Extensions
Technical Assistance
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
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
Defaults
The hostname is the globally configured hostname of the router.
The client identifier is an ASCII value.Command Modes
Interface configuration
Command History
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.
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 1ip address dhcpThe 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 1ip address dhcp hostname site 2The 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 1ip address dhcp client-id Ethernet 1The 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 1ip address dhcp client-id Ethernet 1 hostname site 2Related Commands
Command Descriptionip 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
Defaults
No class identifier is specified.
Command Modes
Interface configuration
Command History
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 1ip dhcp client class-id hex ABCDEF1235Related Commands
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
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
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 1ip dhcp client client-id ascii test-client-idRelated Commands
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
Defaults
The hostname is the globally configured hostname of the router.
Command Modes
Interface configuration
Command History
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 1ip dhcp client hostname hostARelated Commands
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
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
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 1The following example shows a one-hour lease:
ip dhcp client lease 0 1The following example shows a one-minute lease:
ip dhcp client lease 0 0 1Related Commands
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
Defaults
All of the options are requested.
Command Modes
Interface configuration
Command History
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-nameserverRelated Commands
![]()
Copyright © 2003-2005 Cisco Systems, Inc. All rights reserved.