Configurable DHCP Client
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.
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, page 2
• How to Configure the DHCP Client, page 3
• Configuration Examples for the Configurable DHCP Client, page 5
• Additional References, page 6
• Command Reference, page 7
Corporate Headquarters:
Cisco Systems, Inc., 170 West Tasman Drive, San Jose, CA 95134-1706 USA
DHCPDISCOVER (broadcast)
Host A Cisco IOS
DHCPOFFER (unicast) DHCP server
DHCPREQUEST (broadcast)
DHCPACK (unicast)
32369
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.
Cisco IOS Release: Multiple Releases (see the Feature History table)
2
Configurable DHCP Client
How to Configure the DHCP Client
• 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.
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
Cisco IOS Release: Multiple Releases (see the Feature History table)
3
Configurable DHCP Client
How to Configure the DHCP Client
DETAILED STEPS
Example:
Router# configure terminal
Step 3 interface type number Configures an interface type and enters interface
configuration mode.
Example:
Router(config)# interface Ethernet 1
Step 4 ip dhcp client client-id {interface-name | Specifies the client identifier.
ascii string | hex string}
• When you specify the no form of this command, the
configuration is removed and the system returns to
Example: using the default form. It is not possible to configure
Router(config-if)# ip dhcp client client-id the system to not include a client identifier.
ascii mytest1
Step 5 ip dhcp client class-id {ascii string | hex Specifies the class identifier.
string}
Example:
Router(config-if)# ip dhcp client class-id
ascii my-class-id
Step 6 ip dhcp client lease days [hours] [minutes] Configures the duration of the lease for an IP address that is
requested from a DHCP client to a DHCP server.
Example:
Router(config-if)# ip dhcp client lease 2
Step 7 ip dhcp client hostname host-name Specifies or modifies the host name sent in the DHCP
message.
Example:
Router(config-if)# ip dhcp client hostname
router1
Cisco IOS Release: Multiple Releases (see the Feature History table)
4
Configurable DHCP Client
Configuration Examples for the Configurable DHCP Client
Example:
Router(config-if)# ip address 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.
Cisco IOS Release: Multiple Releases (see the Feature History table)
5
Configurable DHCP Client
Additional References
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 To obtain lists of supported MIBs by platform and Cisco IOS
feature, and support for existing MIBs has not been release, and to download MIB modules, go to the Cisco MIB website
modified by this feature. 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, http://www.cisco.com/public/support/tac/home.shtml
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.
Cisco IOS Release: Multiple Releases (see the Feature History table)
6
Configurable DHCP Client
Command Reference
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
Cisco IOS Release: Multiple Releases (see the Feature History table)
7
Configurable DHCP Client
ip address dhcp
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.
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.
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.
Cisco IOS Release: Multiple Releases (see the Feature History table)
8
Configurable DHCP Client
ip address dhcp
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.
Cisco IOS Release: Multiple Releases (see the Feature History table)
9
Configurable DHCP Client
ip address dhcp
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
Cisco IOS Release: Multiple Releases (see the Feature History table)
10
Configurable DHCP Client
ip dhcp client class-id
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
Cisco IOS Release: Multiple Releases (see the Feature History table)
11
Configurable DHCP Client
ip dhcp client client-id
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.
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
Cisco IOS Release: Multiple Releases (see the Feature History table)
12
Configurable DHCP Client
ip dhcp client client-id
Cisco IOS Release: Multiple Releases (see the Feature History table)
13
Configurable DHCP Client
ip dhcp client hostname
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
Cisco IOS Release: Multiple Releases (see the Feature History table)
14
Configurable DHCP Client
ip dhcp client lease
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.
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.
Cisco IOS Release: Multiple Releases (see the Feature History table)
15
Configurable DHCP Client
ip dhcp client lease
Cisco IOS Release: Multiple Releases (see the Feature History table)
16
Configurable DHCP Client
ip dhcp client request
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.
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
Cisco IOS Release: Multiple Releases (see the Feature History table)
17
Configurable DHCP Client
ip dhcp client request
CCVP, the Cisco logo, and Welcome to the Human Network are trademarks of Cisco Systems, Inc.; Changing the Way We Work, Live, Play, and Learn is
a service mark of Cisco Systems, Inc.; and Access Registrar, Aironet, Catalyst, CCDA, CCDP, CCIE, CCIP, CCNA, CCNP, CCSP, Cisco, the Cisco
Certified Internetwork Expert logo, Cisco IOS, Cisco Press, Cisco Systems, Cisco Systems Capital, the Cisco Systems logo, Cisco Unity,
Enterprise/Solver, EtherChannel, EtherFast, EtherSwitch, Fast Step, Follow Me Browsing, FormShare, GigaDrive, HomeLink, Internet Quotient, IOS,
iPhone, IP/TV, iQ Expertise, the iQ logo, iQ Net Readiness Scorecard, iQuick Study, LightStream, Linksys, MeetingPlace, MGX, Networkers,
Networking Academy, Network Registrar, PIX, ProConnect, ScriptShare, SMARTnet, StackWise, The Fastest Way to Increase Your Internet Quotient,
and TransPath are registered trademarks of Cisco Systems, Inc. and/or its affiliates in the United States and certain other countries.
All other trademarks mentioned in this document or Website are the property of their respective owners. The use of the word partner does not imply a
partnership relationship between Cisco and any other company. (0711R)
Cisco IOS Release: Multiple Releases (see the Feature History table)
18