DHCP Server Port-Based Address Allocation

Last Updated: July 04, 2011

First Published: June 4, 2010

Last Updated: Sept 9, 2010

The DHCP Server Port-Based Address Allocation feature provides port-based address allocation support on the Cisco IOS Dynamic Host Configuration Protocol (DHCP) server for the Ethernet platform. The DHCP server provides address assignment support based on the point of attachment of the client network.

Finding Feature Information

Your software release may not support all the features documented in this module. For the latest feature information and caveats, see the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the Feature Information Table at the end of this document.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.

Restrictions for DHCP Server Port-Based Address Allocation

The DHCP Server Port-Based Address Allocation feature does not support Virtual routing and forwarding (VRF) and virtual private network (VPNs).

Information About DHCP Server Port-Based Address Allocation

DHCP Server Port-Based Address Allocation Feature Design

When Cisco industrial Ethernet switches are deployed on the factory floor, they offer connectivity to the directly connected manufacturing devices. A failure manufacturing device must be repaired immediately in the existing network or replaced by a new device. The DHCP protocol recognizes DHCP clients by the client identifier (ID) option in the DHCP packet. Clients who do not include the client ID option are identified by the client hardware address. The DHCP Server Port-Based Address Allocation feature introduces the capability to ensure that the same IP address is always offered to the replacement device as the device being replaced. This IP address is always offered to the same connected port even as the client ID or client hardware address (chaddr) changes in the DHCP messages received on that port.

If this feature is configured, the port name of the interface overrides the information the client sends and the actual point of connection. Then a port on the switch becomes the client ID.

In all cases, if you connect the Ethernet cable to the same port, the same IP address is allocated through the DHCP to the attached device. The figure below shows an industrial Ethernet switch using DHCP to assign one IP address per port to directly connected manufacturing devices.

Figure 1 DHCP Server Port-Based Address Assignment to Directly Connected Manufacturing Devices


How to Configure DHCP Server Port-Based Address Allocation

Automatically Generating a Subscriber Identifier for a DHCP Message Received on a Port

Perform this task to automatically generate a unique ID, called a subscriber ID for a DHCP message received on a port.

If the DHCP Server Port-Based Address Allocation feature is configured, the subscriber ID value is used in place of the client ID to provide stable IP address assignment. The subscriber ID value is based on the short name of the port to which the directly connected device is attached. If this device is removed and replaced with a new device, the new device maintains the same subscriber ID.

The subscriber ID is used at the same point where the client ID or the client MAC address is currently captured during the DHCP IP address assignment process.

SUMMARY STEPS

1.    enable

2.    configure terminal

3.    ip dhcp use subscriber-id client-id

4.    interface type number

5.    ip dhcp server use subscriber-id client-id


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 use subscriber-id client-id


Example:

Router(config)# ip dhcp use subscriber-id client-id

 

Configures the DHCP server to globally use the subscriber ID as the client ID on all incoming DHCP messages.

  • DHCP uses the subscriber ID configured on the interface to generate the client ID. If no subscriber ID is configured then the client ID is automatically generated based on the short name of the interface. The client ID already present in the message is ignored.
  • For port based address allocation, do not configure any subscriber ID on the interface. It must be generated automatically from interface name.
 
Step 4
interface type number


Example:

Router(config)# interface Ethernet 0/0

 

(Optional) Configures an interface and enters interface configuration mode.

 
Step 5
ip dhcp server use subscriber-id client-id


Example:

Router(config-if)# ip dhcp server use subscriber-id client-id

 

(Optional) Configures the DHCP server to use the subscriber ID as the client ID on all incoming DHCP messages on the interface.

 

Troubleshooting Tips

Use the following command to debug any errors that you may encounter when you configure DHCP to automatically generate a unique ID:

  • debug ip dhcp server packets

Preassigning IP Addresses and Associating Them to a Client

Perform this task to preassign an IP address and associate it to a client identified by a client ID or MAC address.

For port-based address assignment, you must perform the task in the Automatically Generating a Subscriber Identifier for a DHCP Message Received on a Port task to associate the client ID with the subscriber ID. The subscriber ID value is based on the short name of the port to which the directly connected device is attached.

Configure a normal DHCP pool by supplying any DHCP options and lease time. Preassigned addresses are automatically excluded from normal dynamic IP address assignment. Preassigned addresses cannot be used in host pools, but there can be multiple preassigned addresses per DHCP address pool.


Note


  • Only one IP address can be assigned per port.
  • Preassigned addresses (also called reserved addresses) cannot be cleared by using the clear ip dhcp binding command.
>
SUMMARY STEPS

1.    enable

2.    configure terminal

3.    ip dhcp pool name

4.    network network-number [mask | / prefix-length]

5.    address ip-address client-id string [ascii]

6.    address ip-address hardware-address mac-address [hardware-number]

7.    end

8.    show ip dhcp pool [name]

9.    show ip dhcp binding


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 pool1

 

Creates a name for the DHCP server address pool and enters DHCP pool configuration mode.

 
Step 4
network network-number [mask | / prefix-length]


Example:

Router(dhcp-config)# network 10.10.10.0 /24

 

Specifies the subnet network number and mask of the DHCP address pool.

 
Step 5
address ip-address client-id string [ascii]


Example:

Router(dhcp-config)# address 10.10.10.2 client-id Et1/0 ascii

 

Reserves an IP address for a DHCP client identified by the client ID.

  • The string argument can be an ASCII value or a hexadecimal value.
  • For port-based address allocation the string argument must be the name of the port and the ascii keyword must be specified.
 
Step 6
address ip-address hardware-address mac-address [hardware-number]


Example:

Router(dhcp-config)# address 10.10.10.3 hardware-address b708.1388.f166

 

(Optional) Reserves an IP address for a client identified by the hardware address.

  • This command is used for clients identified by the hardware address included in the fixed-size header of the DHCP message.
 
Step 7
end


Example:

Router(dhcp-config)# end

 

Returns to privileged EXEC mode.

 
Step 8
show ip dhcp pool [name]


Example:

Router> show ip dhcp pool

 

(Optional) Displays information about DHCP address pools.

 
Step 9
show ip dhcp binding


Example:

Router> show ip dhcp binding



Example:

 

(Optional) Displays infinite binding for the configured addresses.

 

Preassigning IP Addresses and Associating Them to a Client


Note


Perform this task to restrict address assignments from the DHCP address pool only to preconfigured reservations.

When the DHCP Server Port-Based Address Allocation feature is configured on multiple switches, devices connected to one switch may also receive an IP address assignment from the neighboring switches rather than the local DHCP address pool switch. If you want the switch to serve only the client directly connected to the switch, you can configure a group of switches with pools that share a common IP subnet and ignore the requests from other clients (not connected to this switch).

>
SUMMARY STEPS

1.    enable

2.    configure terminal

3.    ip dhcp pool name

4.    reserved-only


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 pool1

 

Configures a DHCP address pool on a DHCP server and enters DHCP pool configuration mode.

 
Step 4
reserved-only


Example:

Router(dhcp-config)# reserved-only

 

Restricts address assignments from the DHCP address pool only to the preconfigured reservations.

 

Configuration Examples for DHCP Server Port-Based Address Allocation

DHCP Server Port-Based Address Allocation Example

In the following example, a subscriber ID will be automatically generated based on the short name of the interface (port) specified by the address client-id command. The DHCP server will ignore any client ID fields in the DHCP messages and use this subscriber ID as the client ID. The DHCP client is preassigned IP address 10.1.1.7.

!
ip dhcp use subscriber-id client-id
ip dhcp subscriber-id interface-name
ip dhcp excluded-address 10.1.1.1 10.1.1.3
!         
ip dhcp pool dhcppool
 network 10.1.1.0 255.255.255.0
 address 10.1.1.7 client-id Et1/0 ascii

The following example shows that the preassigned address was correctly reserved in the DHCP pool:

Router# show ip dhcp pool dhcppool
Pool test :
 Current index        IP address range                    Leased/Total
 10.1.1.1              10.1.1.1 - 10.1.1.254         0     / 254
 3 reserved addresses are currently in the pool :
Address          Client
 10.1.1.07         Et1/0
 10.1.1.20         xyz
 10.1.1.30         aabb.cc00.1501

Additional References

Related Documents

Related Topic

Document Title

DHCP commands: complete command syntax, command mode, command history, defaults, usage guidelines, and examples

Cisco IOS IP Addressing Services Command Reference

Standards

Standard

Title

No new or modified standards are supported by this feature and support for existing standards has not been modified by this feature.

--

MIBs

MIB

MIBs Link

No new or modified standards are supported by this feature and support for existing standards has not been modified by this feature.

To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found at the following URL:

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

RFCs

RFC

Title

No new or modified RFCs are supported by this feature.

--

Technical Assistance

Description

Link

The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password.

http://www.cisco.com/cisco/web/support/index.html

Feature Information for DHCP Server Port-Based Address Allocation

The following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature.

Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.

Table 1 Feature Information for DHCP Port-Based Address Allocation

Feature Name

Releases

Feature Information

DHCP Server Port-Based Address Allocation

12.2(33)SXI4 Cisco IOS XE 3.1.0SG

The DHCP Server Port-Based Address Allocation feature provides port-based address allocation support on the Cisco IOS DHCP server for the industrial Ethernet platform. The DHCP server provides address assignment support based on the point of attachment of the client to the network.

The following commands were introduced or modified: address client-id, address hardware-address, ip dhcp server use subscriber-id client-id, ip dhcp subscriber-id interface-name, ip dhcp use subscriber-id client-id, reserved-only, and show ip dhcp pool.

Cisco and the Cisco Logo are trademarks of Cisco Systems, Inc. and/or its affiliates in the U.S. and other countries. A listing of Cisco's trademarks can be found at www.cisco.com/go/trademarks. Third party trademarks mentioned 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. (1005R)

Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.