Table Of Contents
Information About DHCP—Static Mapping
How to Configure DHCP—Static Mapping
Configuring the DHCP Server and the Text File URL
Configuration Examples for DHCP—Static Mapping
Configuring the DHCP Server and the Static-Binding File URL: 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
Release Modification12.3(11)T
This feature was introduced.
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 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 and DHCP Server
DHCP Database and DHCP Server
A DHCP database contains an external file that is configured by a DHCP server. The file contains the mappings between a client IP address and the hardware address. There are two types of bindings: manual bindings that are special address pools stored in NVRAM, and automatic bindings that are assigned from an address pool by the DHCP server. Automatic bindings are stored on a remote host called the database agent and are saved as text records for easy maintenance. Both manual and automatic bindings are static.
The DHCP—Static Mapping feature enables the capability of reading the static bindings in a separate text file (similar in format to the DHCP database file) and configuring special pools to store bindings read from the files. The static-binding files are read when the existing database files are read, for example, when a router reloads or the service restarts. The files are read-only.
The read automatic 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 are also displayed by using the show ip dhcp binding static command.
How to Configure DHCP—Static Mapping
This section contains the following procedure:
•Configuring the DHCP Server and the Text File URL (required)
Configuring the DHCP Server and the Text File URL
Perform this task to configure the DHCP server and text file URL. 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 or the number of address pools. The file format has the following elements:
•IP address
•Hardware type
•Hardware address
•Lease expiration
Legal values are defined in the ARP section of the Dynamic Host Configuration Protocol, RFC 2131. There is also a special type ID that indicates that a field is a DHCP client identifier. A sample file is as follows:
*time* January 21 2005 03:52 PM*version* 2!IP address Type Hardware address Lease expiration2.0.0.4 /24 1 0090.bff6.081e Infinite2.0.0.5 /28 id 00b7.0813.88f1.663.0.0.2 /21 1 0090.bff6.081d Infinite*end*If the subnet mask is not specified, a natural mask is assumed depending on the IP address.
Prerequisites
The administrator should create the static-binding 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.
In the static-binding text file, there must be a space between the IP address and mask.
Restrictions
The bindings must not be deleted when a DHCPRELEASE is received or must not be timed out by the DHCP timer. The automatic 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 what has been configured:
Router# show ip dhcp binding
00: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-binding text file:
*time* January 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 bindings from the TFTP server:
Router# debug ip dhcp server
Loading 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 and the Static-Binding File URL: Example
Configuring the DHCP Server and the Static-Binding File URL: Example
The following example shows how to restart the DHCP server, configure the pool, and specify the URL at which the static-binding file is stored:
no service dhcpservice dhcpip dhcp pool abcpoolorigin file tftp://10.1.0.1/staticfilenameAdditional 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, defaults, usage guidelines, and examples
Cisco IOS IP Command Reference, Volume 1 of 4: Addressing and Services, Release 12.3 T
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
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 server
Loading 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
Release Modification12.2(8)T
This command was introduced.
12.3(11)T
The file keyword was added.
12.2(27)SBA
This command was integrated in to Cisco IOS Release 12.2(27)SBA.
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 pre-configured 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.
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, 2005 Cisco Systems, Inc. All rights reserved.