Table Of Contents
Information About DHCP—Static Mapping
How to Configure DHCP—Static Mapping
Creating the Static Mapping Text File
Configuring the DHCP Server to Read the Static Mapping Text File
Configuration Examples for DHCP—Static Mapping
Configuring the DHCP Server to Read the Static Mapping Text File: Example
DHCP—Static Mapping
The DHCP—Static Mapping feature enables assignment of static IP addresses without creating numerous host pools with manual bindings by using a customer-created text file that the DHCP server reads. The benefit of this feature is that it eliminates the need for a long configuration file and reduces the space required in NVRAM to maintain address pools.
Feature History for the DHCP—Static Mapping 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 DHCP—Static Mapping
•
How to Configure DHCP—Static Mapping
•
Configuration Examples for DHCP—Static Mapping
Information About DHCP—Static Mapping
To configure this feature, you should understand the following concept:
DHCP Database
A DHCP database contains the mappings between a client IP address and hardware address, referred to as a binding. There are two types of bindings: manual bindings that map a single hardware address to a single IP address, and automatic bindings that dynamically map a hardware address to an IP address from a pool of IP addresses. Manual (also known as static) bindings can be configured individually directly on the router or, by using the DHCP—Static Mapping feature, these static bindings can be read from a separate static mapping text file. The static mapping text files are read when a router reloads or the DHCP service restarts. These files are read-only.
The read static bindings are treated just like the manual bindings, in that they are:
•
Retained across DHCPRELEASEs from the clients.
•
Not timed out.
•
Deleted only upon deletion of the pool.
•
Provided appropriate exclusions for the contained addresses, which are created at the time of the read.
Just like automatic bindings and manual bindings, the static bindings from the static mapping text file are also displayed by using the show ip dhcp binding command.
How to Configure DHCP—Static Mapping
This procedure contains the following tasks:
•
Creating the Static Mapping Text File (required)
•
Configuring the DHCP Server to Read the Static Mapping Text File (required)
Creating the Static Mapping Text File
Perform this task to create the static mapping text file. You will input your addresses in the text file, which is stored in the DHCP database for the DHCP server to read. There is no limit on the number of addresses in the file. The file format has the following elements:
•
Time the file was created
•
Database version number
•
IP address
•
Hardware type
•
Hardware address
•
Lease expiration
•
End-of-file designator
See Table 1 for more details about the format of the text file.
The following is a sample static mapping text file:
*time* Jan 21 2005 03:52 PM
*version* 2
!IP address Type Hardware address Lease expiration
10.0.0.4 /24 1 0090.bff6.081e Infinite
10.0.0.5 /28 id 00b7.0813.88f1.66 Infinite
10.0.0.2 /21 1 0090.bff6.081d Infinite
*end*
Table 1 Static Mapping Text File Field Descriptions
Field Description*time*
Specifies the time the file was created. This field allows DHCP to differentiate between newer and older database versions when multiple agents are configured. The valid format of the time is Mmm dd yyyy hh:mm AM/PM.
*version* 2
Database version number.
IP address
Static IP address. If the subnet mask is not specified, a natural mask is assumed depending on the IP address. There must be a space between the IP address and mask.
Type
Specifies the hardware type. For example, type "1" indicates Ethernet. The type "id" indicates that the field is a DHCP client identifier. Legal values can be found online at http://www.iana.org/assignments/arp-parameters in the "Number Hardware Type" list.
Hardware address
Specifies the hardware address.
When the type is numeric, it refers to the hardware media. Legal values can be found online at http://www.iana.org/assignments/arp-parameters in the "Number Hardware Type" list.
When the type is"id", this means that we are matching on the client identifier.
For more information about the client identifier, please see RFC 2132, DHCP Options and BOOTP Vendor Extensions, section 9.14, located at http://www.ietf.org/rfc/rfc2132.txt
or the client-identifier command reference page located at http://www.cisco.com/univercd/cc/td/doc/product/software/ios124/124tcr/tiad_r/adr_a1ht.htm#wp1125872
If you are unsure what client identifier to match on, use the debug dhcp detail command to display the client identifier being sent to the DHCP server from the client.
Lease Expiration
Specifies the expiration of the lease. "Infinite" specifies that the duration of the lease is unlimited.
*end*
End of file. DHCP uses the *end* designator to detect file truncation.
Configuring the DHCP Server to Read the Static Mapping Text File
Perform this task to configure the DHCP server to read the static mapping text file.
Prerequisites
The administrator should create the static mapping text file in the correct format and configure the address pools before performing this task.
Before editing the file, you must disable the DHCP server using the no service dhcp command.
Restrictions
The static bindings must not be deleted when a DHCPRELEASE is received or must not be timed out by the DHCP timer. The static bindings should be treated just like manual bindings created by using the ip dhcp pool command.
SUMMARY STEPS
1.
enable
2.
configure terminal
3.
ip dhcp pool name
4.
origin file url
5.
exit
DETAILED STEPS
Examples
The following example shows the address bindings that have been configured:
Router# show ip dhcp binding00:05:14:%SYS-5-CONFIG_I: Configured from console by consoleBindings from all pools not associated with VRF:IP address Client-ID/ Ls expir Type Hw address User name10.9.9.4/8 0063.7363.2d30.3036. Infinite Static 302e.3762.2e39.3634. 632d.4574.8892.10.9.9.1/24 0063.6973.636f.2d30. Infinite Static 3036.302e.3437.3165. 2e64.6462.342d.The following sample shows each entry in the static mapping text file:
*time* Jan 21 2005 22:52 PM!IP address Type Hardware address Lease expiration10.19.9.1 /24 id 0063.6973.636f.2d30.3036.302e.343710.9.9.4 id 0063.7363.2d30.3036.302e.3762.2e39.3634.632d Infinite*end*The following sample debug output shows the reading of the static mapping text file from the TFTP server:
Router# debug ip dhcp serverLoading abc/static_pool from 10.19.192.33 (via Ethernet0):[OK - 333 bytes]*May 26 23:14:21.259: DHCPD: contacting agent tftp://10.19.192.33/abc/static_pool (attempt 0)*May 26 23:14:21.467: DHCPD: agent tftp://10.19.192.33/abc/static_pool is responding.*May 26 23:14:21.467: DHCPD: IFS is ready.*May 26 23:14:21.467: DHCPD: reading bindings from tftp://10.19.192.33/abc/static_pool.*May 26 23:14:21.707: DHCPD: read 333 / 1024 bytes.*May 26 23:14:21.707: DHCPD: parsing text line*time* Apr 22 2002 11:31 AM*May 26 23:14:21.707: DHCPD: parsing text line ""*May 26 23:14:21.707: DHCPD: parsing text line!IP address Type Hardware address Lease expiration*May 26 23:14:21.707: DHCPD: parsing text line"10.9.9.1 /24 id 0063.6973.636f.2d30.3036.302e.3437"*May 26 23:14:21.707: DHCPD: creating binding for 10.9.9.1*May 26 23:14:21.707: DHCPD: Adding binding to radix tree (10.9.9.1)*May 26 23:14:21.707: DHCPD: Adding binding to hash tree*May 26 23:14:21.707: DHCPD: parsing text line"10.9.9.4 id 0063.7363.2d30.3036.302e.3762.2e39.3634.632d"*May 26 23:14:21.711: DHCPD: creating binding for 10.9.9.4*May 26 23:14:21.711: DHCPD: Adding binding to radix tree (10.9.9.4)*May 26 23:14:21.711: DHCPD: Adding binding to hash tree*May 26 23:14:21.711: DHCPD: parsing text line "Infinite"*May 26 23:14:21.711: DHCPD: parsing text line ""*May 26 23:14:21.711: DHCPD: parsing text line!IP address Interface-index Lease expiration VRF*May 26 23:14:21.711: DHCPD: parsing text line "*end*"*May 26 23:14:21.711: DHCPD: read static bindings from tftp://10.19.192.33/abcemp/static_pool.Configuration Examples for DHCP—Static Mapping
This section contains the following configuration example:
•
Configuring the DHCP Server to Read the Static Mapping Text File: Example
Configuring the DHCP Server to Read the Static Mapping Text File: Example
The following example shows how to restart the DHCP server, configure the pool, and specify the URL at which the static mapping text file is stored:
no service dhcpservice dhcpip dhcp pool abcpoolorigin file tftp://10.1.0.1/staticfilename
Note
The static mapping text file can be copied to flash memory on the router and served by the routers tftp process. In this case, the IP address in the origin file line must be an address owned by the router and one additional line of configuration is required on the router:
tftp-server flash staticfilename
Additional References
The following sections provide references related to the DHCP—Static Mapping feature.
Related Documents
Related Topic Document TitleDHCP overview and configuration
Cisco IOS IP Configuration Guide, Release 12.3
DHCP commands: complete command syntax, command mode, command history, defaults, usage guidelines, and examples
Cisco IOS IP Command Reference, Volume 1 of 4: Addressing and Services, Release 12.3T
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 1700
Assigned Numbers
RFC 2131
Dynamic Host Configuration Protocol
RFC 2132
DHCP Options and BOOTP Vendor Ext
Technical Assistance
Command Reference
This section documents modified commands only.
debug ip dhcp server
To enable Cisco IOS Dynamic Host Configuration Protocol (DHCP) server debugging, use the debug ip dhcp server command in privileged EXEC mode. To disable DHCP server debugging, use the no form of this command.
debug ip dhcp server {events | packets | linkage | class}
no debug ip dhcp server {events | packets | linkage | class}
Syntax Description
Command Modes
Privileged EXEC
Command History
Examples
The following example shows a combination of DHCP server events and decoded receptions and transmissions:
Router# debug ip dhcp server eventsRouter# debug ip dhcp server packetsDHCPD:DHCPDISCOVER received from client 0b07.1134.a029 through relay 10.1.0.253.DHCPD:assigned IP address 10.1.0.3 to client 0b07.1134.a029.DHCPD:Sending DHCPOFFER to client 0b07.1134.a029 (10.1.0.3).DHCPD:unicasting BOOTREPLY for client 0b07.1134.a029 to relay 10.1.0.253.DHCPD:DHCPREQUEST received from client 0b07.1134.a029.DHCPD:Sending DHCPACK to client 0b07.1134.a029 (10.1.0.3).DHCPD:unicasting BOOTREPLY for client 0b07.1134.a029 to relay 10.1.0.253.DHCPD:checking for expired leases.The following example shows database linkage information:
Router# debug ip dhcp server linkageDHCPD:child pool:10.1.0.0 / 255.255.0.0 (subnet10.1)DHCPD:parent pool:10.0.0.0 / 255.0.0.0 (net10)DHCPD:child pool:10.0.0.0 / 255.0.0.0 (net10)DHCPD:pool (net10) has no parent.DHCPD:child pool:10.1.0.0 / 255.255.0.0 (subnet10.1)DHCPD:parent pool:10.0.0.0 / 255.0.0.0 (net10)DHCPD:child pool:10.0.0.0 / 255.0.0.0 (net10)DHCPD:pool (net10) has no parent.The following example shows when a DHCP class is removed:
Router# debug ip dhcp server classDHCPD:deleting class CLASS1The following example shows the debug output when the configured pattern does not match:
Router# debug ip dhcp server classDHCPD:Searching for a match to 'relay-information0106000 400020202020800060009e80b8800' in class CLASS1DHCPD:Searching for a match to 'relay-information 0106000400020202020800060009e80b8800' in class CLASS1DHCPD:Searching for a match to 'relay-information 0106000The following example shows the debug output when you unconfigure a DHCP pattern in a DHCP class and then configure the pattern in the DHCP class:
Router# debug ip dhcp server classDHCPD:pattern 'relay-information 123456' removed from class CLASS1DHCPD:Added pattern 'relay-information 010600040002020202 0800060009e80b8800' for class CLASS1The following example shows the debug output when the configured pattern does match:
Router# debug ip dhcp server classDHCPD:Searching for a match to 'relay-information0106000 400020202020800060009e80b8800' in class CLASS1DHCPD:input pattern 'relay-information 010600040002020202 0800060009e80b8800' matches class CLASS1DHCPD:input matches class CLASS1The following example shows the debug output when static mappings are configured:
Router# debug ip dhcp serverLoading abc/static_pool from 10.19.192.33 (via Ethernet0): ![OK - 333 bytes]*May 26 23:14:21.259: DHCPD: contacting agent tftp://10.19.192.33/abc/static_pool (attempt 0)*May 26 23:14:21.467: DHCPD: agent tftp://10.19.192.33/abc/static_pool is responding.*May 26 23:14:21.467: DHCPD: IFS is ready.*May 26 23:14:21.467: DHCPD: reading bindings from tftp://10.19.192.33/abc/static_pool.*May 26 23:14:21.707: DHCPD: read 333 / 1024 bytes.*May 26 23:14:21.707: DHCPD: parsing text line "*time* Apr 22 2002 11:31 AM"*May 26 23:14:21.707: DHCPD: parsing text line ""*May 26 23:14:21.707: DHCPD: parsing text line!IP address Type Hardware address Lease expiration.*May 26 23:14:21.707: DHCPD: parsing text line"10.9.9.1/24 id 0063.6973.636f.2d30.3036.302e.3437"*May 26 23:14:21.707: DHCPD: creating binding for 10.9.9.1*May 26 23:14:21.707: DHCPD: Adding binding to radix tree (10.9.9.1)*May 26 23:14:21.707: DHCPD: Adding binding to hash tree*May 26 23:14:21.707: DHCPD: parsing text line"10.9.9.4 id 0063.7363.2d30.3036.302e.3762.2e39.3634.632d"*May 26 23:14:21.711: DHCPD: creating binding for 10.9.9.4*May 26 23:14:21.711: DHCPD: Adding binding to radix tree (10.9.9.4)*May 26 23:14:21.711: DHCPD: Adding binding to hash tree*May 26 23:14:21.711: DHCPD: parsing text line "Infinite"*May 26 23:14:21.711: DHCPD: parsing text line ""*May 26 23:14:21.711: DHCPD: parsing text line!IP address Interface-index Lease expiration VRF.*May 26 23:14:21.711: DHCPD: parsing text line "*end*"*May 26 23:14:21.711: DHCPD: read static bindings from tftp://10.19.192.33/smith/static_pool.Related Commands
origin
To configure an address pool as an on-demand address pool (ODAP) or static mapping pool, use the origin command in DHCP pool configuration mode. To disable the ODAP, use the no form of this command.
origin {dhcp | aaa | ipcp | file url} [subnet size initial size [autogrow size]]
no origin {dhcp | aaa | ipcp | file url} [subnet size initial size [autogrow size]]
Syntax Description
Defaults
The default size value is /0.
Command Modes
DHCP pool configuration
Command History
Usage Guidelines
If you do not configure the pool as an autogrow pool, the pool will not request additional subnets if one subnet is already in the pool.
Use the dhcp keyword to obtain subnets from DHCP, the aaa keyword to obtain subnets from the AAA server, and the ipcp keyword to obtain subnets from IPCP negotiation. If you expect that the utilization of the pool may grow over time, use the autogrow size option.
If a pool has been configured with the autogrow size option, ensure that the source server is capable of providing more than one subnet to the same pool. Even though the Cisco IOS software specifies the requested subnet size, it can accept any offered subnet size from the source server.
Examples
The following example shows how to configure an address pool named green to use DHCP as the subnet allocation protocol with an initial subnet size of 24 and an autogrow subnet size of 24:
ip dhcp pool greenvrf greenorigin dhcp subnet size initial /24 autogrow /24utilization mark high 80utilization mark low 20The following example shows how to configure the location of the external text file:
ip dhcp pool abcpoolorigin file tftp://10.1.0.1/staticbindingfileRelated Commands
Glossary
address binding—A mapping between the client IP and hardware addresses. The client IP address may be preconfigured by the administrator (manual address allocation) or assigned from a pool by the Dynamic Host Configuration Protocol (DHCP) server (automatic address allocation).
address pool—The range of IP addresses assigned by the DHCP server. The pool may also store client parameters, such as default router and DNS servers.
client identifier—A DHCP option that allows clients to be identified with a unique opaque identifier, instead of relying on the hardware address.
database agent—Any host storing the DHCP bindings database.
DHCP client—Any host requesting configuration parameters.
DHCP database—An external file configured in a DHCP server, which stores automatic bindings from the server.
DHCP server—Any host providing configuration parameters.
Note
Refer to Internetworking Terms and Acronyms for terms not included in this glossary.
Copyright © 2004 Cisco Systems, Inc. All rights reserved.

