Guest

Cisco IOS Software Releases 12.3 T

DHCP-Static Mapping

Table Of Contents

DHCP—Static Mapping

Contents

Information About DHCP—Static Mapping

DHCP Database

How to Configure DHCP—Static Mapping

Creating the Static Mapping Text File

Configuring the DHCP Server to Read the Static Mapping Text File

Prerequisites

Restrictions

Examples

Configuration Examples for DHCP—Static Mapping

Configuring the DHCP Server to Read the Static Mapping Text File: Example

Additional References

Related Documents

Standards

MIBs

RFCs

Technical Assistance

Command Reference

debug ip dhcp server

origin

Glossary


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
Modification

12.3(11)T

This feature was introduced.


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

Additional References

Command Reference

Information About DHCP—Static Mapping

To configure this feature, you should understand the following concept:

DHCP Database

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

 
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 

ip dhcp pool name

Example:

Router(config)# ip dhcp pool abcpool

Assigns a name to a DHCP pool and enters DHCP configuration mode.

Note If you have already configured the IP DHCP pool name using the ip dhcp pool command and the static file URL using the origin file command, you must perform a fresh read using the no service dhcp command and service dhcp command.

Step 4 

origin file url

Example:

Router(dhcp-config)# origin file tftp://10.1.0.1/static-bindings

Specifies the URL from which the DHCP server can locate the text file.

Step 5 

exit

Example:

Router(dhcp-config)# exit

Exits to global configuration mode.

Examples

The following example shows the address bindings that have been configured:

Router# show ip dhcp binding

00:05:14:%SYS-5-CONFIG_I: Configured from console by console

Bindings from all pools not associated with VRF:
IP address  Client-ID/            Ls expir   Type    Hw address           User name
10.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 expiration
10.19.9.1 /24    id          0063.6973.636f.2d30.3036.302e.3437
10.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 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 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 dhcp
service dhcp
ip dhcp pool abcpool
 origin 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 Title

DHCP 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
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 locate and download MIBs for selected platforms, Cisco IOS releases, and feature sets, use Cisco MIB Locator found at the following URL:

http://www.cisco.com/go/mibs


RFCs

RFCs
Title

RFC 1700

Assigned Numbers

RFC 2131

Dynamic Host Configuration Protocol

RFC 2132

DHCP Options and BOOTP Vendor Ext


Technical Assistance

Description
Link

The Technical Support & Documentation website contains thousands of 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/techsupport


Command Reference

This section documents modified commands only.

debug ip dhcp server

origin

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

events

Reports server events, such as address assignments and database updates.

packets

Decodes DHCP receptions and transmissions.

linkage

Displays database linkage information, such as parent-child relationships in a radix tree.

class

Displays DHCP class-based information.


Command Modes

Privileged EXEC

Command History

Release
Modification

12.0(1)T

This command was introduced.

12.2(13)ZH

The class keyword was added.

12.3(4)T

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

12.3(8)YA

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

12.3(11)T

The output was enhanced to show the static mappings.


Examples

The following example shows a combination of DHCP server events and decoded receptions and transmissions:

Router# debug ip dhcp server events 
Router# debug ip dhcp server packets 

DHCPD: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 linkage 

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.
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 class

DHCPD:deleting class CLASS1

The following example shows the debug output when the configured pattern does not match:

Router# debug ip dhcp server class 

DHCPD:Searching for a match to 'relay-information
0106000 400020202020800060009e80b8800' in class CLASS1
DHCPD:Searching for a match to 'relay-information 0106000400020202020800060009e80b8800' in 
class CLASS1
DHCPD:Searching for a match to 'relay-information 0106000

The 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 class 

DHCPD:pattern 'relay-information 123456' removed from class CLASS1
DHCPD:Added pattern 'relay-information 010600040002020202 0800060009e80b8800' for class 
CLASS1

The following example shows the debug output when the configured pattern does match:

Router# debug ip dhcp server class 

DHCPD:Searching for a match to 'relay-information
0106000 400020202020800060009e80b8800' in class CLASS1
DHCPD:input pattern 'relay-information 010600040002020202 0800060009e80b8800' matches 
class CLASS1
DHCPD:input matches class CLASS1

The 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

Command
Description

debug dhcp

Displays debugging information about the DHCP client and monitors the status of DHCP packets.

debug ip ddns update

Enables debugging for DDNS updates.

host (host-list)

Specifies a list of hosts that will receive DDNS updates of A and PTR RRs.

ip ddns update hostname

Enables a host to be used for DDNS updates of A and PTR RRs.

ip ddns update method

Specifies a method of DDNS updates of A and PTR RRs and the maximum interval between the updates.

ip dhcp client update dns

Enables DDNS updates of A RRs using the same hostname passed in the hostname and FQDN options by a client on an interface.

ip dhcp-client update dns

Enables DDNS updates of A RRs using the same hostname passed in the hostname and FQDN options by a client.

ip dhcp update dns

Enables DDNS updates of A and PTR RRs for most address pools.

ip host-list

Specifies a list of hosts that will receive DDNS updates of A and PTR RRs.

show ip ddns update

Displays information about the DDNS updates.

show ip ddns update method

Displays information about the DDNS update method.

show ip dhcp server pool

Displays DHCP server pool statistics.

show ip host-list

Displays the assigned hosts in a list.

update dns

Dynamically updates a DNS with A and PTR RRs for some address pools.


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

dhcp

Specifies the Dynamic Host Configuration Protocol (DHCP) as the subnet allocation protocol.

aaa

Specifies authentication, authorization, and accounting (AAA) as the subnet allocation protocol.

ipcp

Specifies the IP Control Protocol (IPCP) as the subnet allocation protocol.

file url

Specifies the external database file that contains the static bindings assigned by the DHCP server. The url argument specifies the location of the external database file.

subnet size initial size

(Optional) Specifies the initial size of the first requested subnet. You can enter size as either the subnet mask (nnnn.nnnn.nnnn.nnnn) or prefix size (/nn). The valid values are /0 and /4 to /30.

autogrow size

(Optional) Specifies that the pool can grow incrementally. The size argument is the size of the requested subnets when the pool requests additional subnets (upon detection of high utilization). You can enter size as either the subnet mask (nnnn.nnnn.nnnn.nnnn) or prefix size (/nn). The valid values are /0 and /4 to /30.


Defaults

The default size value is /0.

Command Modes

DHCP pool configuration

Command History

Release
Modification

12.2(8)T

This command was introduced.

12.3(11)T

The file keyword was added.


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 green
  vrf green
  origin dhcp subnet size initial /24 autogrow /24
  utilization mark high 80
  utilization mark low 20

The following example shows how to configure the location of the external text file:

ip dhcp pool abcpool
 origin file tftp://10.1.0.1/staticbindingfile

Related Commands

Command
Description

show ip dhcp pool

Displays information about the DHCP address pools.


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.