Table Of Contents
DHCP Address Allocation Using Option 82
Prerequisites for DHCP Address Allocation Using Option 82
Restrictions for DHCP Address Allocation Using Option 82
Information About DHCP Address Allocation Using Option 82
DHCP Address Allocation Using Option 82 Feature Design
Usage Scenario for DHCP Address Allocation Using Option 82
Benefits of DHCP Address Allocation Using Option 82
How to Configure DHCP Address Allocation Using Option 82
Enabling Option 82 for DHCP Address Allocation
Defining the DHCP Class and Relay Agent Information Patterns
Defining the DHCP Address Pool
Configuration Example for DHCP Address Allocation Using Option 82
DHCP Address Allocation Using Option 82: Example
DHCP Address Allocation Using Option 82
The DHCP Address Allocation Using Option 82 feature provides the Cisco IOS Dynamic Host Configuration Protocol (DHCP) server the ability to allocate dynamic IP addresses based on the relay information option (option 82) information sent by the relay agent.
Automatic DHCP address allocation is typically based on an IP address, whether it be the gateway address (giaddr field of the DHCP packet) or the incoming interface IP address. In some networks, it is necessary to use additional information to further determine which IP addresses to allocate. By using option 82, the Cisco IOS relay agent has long been able to include additional information about itself when forwarding client-originated DHCP packets to a DHCP server. The DHCP Address Allocation Using Option 82 feature now allows the Cisco IOS DHCP server to also use option 82 as a means to provide additional information to properly allocate IP addresses to DHCP clients.
Feature History for the DHCP Address Allocation Using Option 82 Feature
Release Modification12.2(13)ZH
This feature was introduced.
12.3(4)T
This feature was integrated.
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
•Prerequisites for DHCP Address Allocation Using Option 82
•Restrictions for DHCP Address Allocation Using Option 82
•Information About DHCP Address Allocation Using Option 82
•How to Configure DHCP Address Allocation Using Option 82
•Configuration Example for DHCP Address Allocation Using Option 82
Prerequisites for DHCP Address Allocation Using Option 82
You must know the format of the option 82 information that will be configured in the DHCP class configuration. This option 82 format may vary from product to product.
Restrictions for DHCP Address Allocation Using Option 82
If the relay agent inserts option 82 but does not set the giaddr field in the DHCP packet, the DHCP server interface must be configured as a trusted interface by using the ip dhcp relay information trusted global configuration command. This configuration prevents the server from dropping the DHCP message.
Information About DHCP Address Allocation Using Option 82
Before you configure the DHCP Address Allocation Using Option 82 feature, you should understand the following concepts:
•DHCP Address Allocation Using Option 82 Feature Design
•Benefits of DHCP Address Allocation Using Option 82
Option 82
DHCP provides a framework for passing configuration information to hosts on a TCP/IP network. Configuration parameters and other control information are carried in tagged data items that are stored in the options field of the DHCP message. The data items themselves are also called options. Option 82 is organized as a single DHCP option that contains information known by the relay agent.
DHCP Address Allocation Using Option 82 Feature Design
This feature is designed to allow the Cisco IOS DHCP server to use option 82 information to help determine which IP addresses to allocate to clients. The information sent via option 82 will be used to identify which port the DHCP request came in on. This feature does not parse out the individual suboptions contained within option 82. Rather, the address allocation is done by matching a configured pattern byte by byte.
The feature introduces a new DHCP class capability, which is a method to group DHCP clients based on some shared characteristics other than the subnet in which the clients reside.
Usage Scenario for DHCP Address Allocation Using Option 82
In an example application, DHCP clients are connected to two ports of a single switch. Each port can be configured to be part of two VLANs: VLAN1 and VLAN2. DHCP clients belong to either VLAN1 or VLAN2 and it is assumed that the switch can differentiate the VLAN that a particular DHCP Discover message belongs to (possibly through Layer 2 encapsulation). Each VLAN has its own subnet and all DHCP messages from the same VLAN (same switch) will have the giaddr field set to the same value indicating the subnet of the VLAN.
The problem is that for a DHCP client connecting to port 1 of VLAN1, it must be allocated an IP address from one range within the VLAN's subnet, whereas a DHCP client connecting to port 2 of VLAN1 must be allocated an IP address from another range. Both these two IP address ranges are part of the same subnet (and have the same subnet mask). In the normal DHCP address allocation, the DHCP server will look only at the giaddr field and thus will not be able to differentiate between the two ranges.
To solve this problem, a relay agent residing at the switch inserts the relay information option (option 82), which carries information specific to the port, and the DHCP server must inspect both the giaddr field and the inserted option 82 during the address selection process.
DHCP Class Capability
There are two ways to use DHCP class: Use it in conjunction with the giaddr field to further refine the granularity of address scoping within a DHCP pool, and use it instead of the giaddr field to select a pool for a client. For the initial release of this feature, only the first method will be implemented.
When a DHCP address pool has been configured with one or more DHCP classes, the pool becomes a restricted access pool, which means that no addresses will be allocated from the pool unless one or more of the classes in the pool is matched. This design allows DHCP classes to be used for either access control (no default class is configured on the pool) or to provide further address range partitions with the subnet of the pool.
Multiple pools can be configured with the same class, eliminating the need to configure the same pattern in multiple pools.
The following capabilities are currently supported for DHCP class-based address allocation:
•Specifying the full relay agent information option value as a raw hexadecimal string by using the relay-information hex command in the new relay agent information configuration mode.
•Support for bitmasking the raw relay information hexadecimal value.
•Support for a wildcard at the end of the hexadecimal string specified by the relay-information hex command.
Benefits of DHCP Address Allocation Using Option 82
The DHCP Address Allocation Using Option 82 feature is designed to be easy to use and integrate with other Cisco IOS features such as the "DHCP Secured Address Assignment" feature introduced in Cisco IOS Release 12.2(15)T.
How to Configure DHCP Address Allocation Using Option 82
This section contains the following procedures:
•Enabling Option 82 for DHCP Address Allocation (optional)
•Defining the DHCP Class and Relay Agent Information Patterns (required)
•Defining the DHCP Address Pool (required)
•Verifying the Configuration (optional)
Enabling Option 82 for DHCP Address Allocation
By default, the Cisco IOS DHCP server can use information provided by option 82 to allocate IP addresses. To reenable this capability if it has been disabled, perform the task described in this section.
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp use class
DETAILED STEPS
Troubleshooting Tips
If DHCP classes are configured in the pool, but the DHCP server does not make use of the classes, verify if the no ip dhcp use class command was configured.
Defining the DHCP Class and Relay Agent Information Patterns
This task shows how to define the DHCP class and relay agent information patterns.
Prerequisites
You must know the hexadecimal value of each byte location in option 82 to be able to configure the relay-information hex command. The option 82 format may vary from product to product. Contact the relay agent vendor for this information.
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp class class-name
4. relay agent information
5. relay-information hex pattern [*] [bitmask mask]
6. Repeat Steps 3 through 5 for each DHCP class you need to configure.
DETAILED STEPS
Troubleshooting Tips
You can enable the debug ip dhcp server class command to display the class matching results.
Defining the DHCP Address Pool
This task shows how to define the DHCP address pool.
SUMMARY STEPS
1. enable
2. configure terminal
3. ip dhcp pool name
4. network network-number [mask | prefix-length]
5. class class-name
6. address range start-ip end-ip
7. Repeat steps 5 and 6 for each DHCP class you need to associate to the DHCP pool.
DETAILED STEPS
Verifying the Configuration
This task shows you how to verify the configuration of the DHCP Address Allocation Using Option 82 feature.
SUMMARY STEPS
1. enable
2. more system: running-config
3. exit
DETAILED STEPS
Configuration Example for DHCP Address Allocation Using Option 82
This section contains the following configuration example:
•DHCP Address Allocation Using Option 82: Example
DHCP Address Allocation Using Option 82: Example
The example configures two DHCP classes. CLASS1 defines the group of DHCP clients whose address requests contain the relay agent information option with the specified hexadecimal values. CLASS2 defines the group of DHCP clients whose address requests contain the configured relay agent information suboptions. CLASS3 has no pattern configured and is treated as a "match to any" class. This type of class is useful for specifying a "default" class.
In the following example, the subnet of pool ABC has been divided into three ranges without further subnetting of the 10.0.20.0/24 subnet. If there is a DHCP Discover message from the 10.0.20.0/24 subnet with option 82 matching that of class CLASS1, an available address in the range from 10.0.20.1 to 10.0.20.100 will be allocated. If there is no free address in CLASS1's address range, the DHCP Discover message will be matched against CLASS2, and so on.
Thus, each class in the DHCP pool will be examined for a match in the order configured by the user. In pool ABC, the order of matching is CLASS1, CLASS2, and finally CLASS3. In pool DEF, class CLASS2 does not have any address range configured. By default, the address range for a particular class is the pool's entire subnet(s). So, clients matching CLASS2 may be allocated addresses from 11.0.20.1 to 11.0.20.254.
Multiple pools can be configured with the same class, eliminating the need to configure the same patterns in multiple pools. In the future, further classification method may be implemented. For example, there may be a need to specify that one or more pools should only be used to service a particular class of devices (for example. cable modems and IP phones).
! Defines the DHCP classes and relay information patternsip dhcp class CLASS1relay agent informationrelay-information hex 01030a0b0c02050000000123relay-information hex 01030a0b0c02*relay-information hex 01030a0b0c02050000000000 bitmask 0000000000000000000000FFip dhcp class CLASS2relay agent informationrelay-information hex 01040102030402020102relay-information hex 01040101030402020102ip dhcp class CLASS3relay agent information! Associates the DHCP pool with DHCP classesip dhcp pool ABCnetwork 10.0.20.0 255.255.255.0class CLASS1address range 10.0.20.1 10.0.20.100class CLASS2address range 10.0.20.101 10.0.20.200class CLASS3address range 10.0.20.201 10.0.20.254ip dhcp pool DEFnetwork 11.0.20.0 255.255.255.0class CLASS1address range 11.0.20.1 11.0.20.64class CLASS2Additional References
The following section provides references related to the DHCP Address Allocation Using Option 82 feature:
Related Documents
Related Topic Document TitleDHCP commands
Cisco IOS IP Command Reference, Volume 1 of 4: Addressing and Services, Release 12.3
DHCP configuration tasks
Cisco IOS IP Configuration Guide, Release 12.2
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 2131
Dynamic Host Configuration Protocol
RFC 2132
DHCP Options and BOOTP Vendor Extensions
RFC 3046
DHCP Relay Agent Information Option
Technical Assistance
Command Reference
This section documents new and modified commands. All other commands used with this feature are documented in the Cisco IOS Release 12.3T command reference publications.
New Commands
Modified Command
address range
To set an address range for a Dynamic Host Configuration Protocol (DHCP) class in a DHCP server address pool, use the address range command in DHCP pool class configuration mode. To remove the address range, use the no form of this command.
address range start-ip end-ip
no address range start-ip end-ip
Syntax Description
start-ip
Starting IP address that defines the range of addresses in the address pool.
end-ip
Ending IP address that defines the range of addresses in the address pool.
Defaults
No default behavior or values
Command Modes
DHCP pool class configuration
Command History
Usage Guidelines
If this command is not configured for a DHCP class in a DHCP server address pool, the default value is the entire subnet of the address pool.
Examples
The following example sets the available address range for class 1 from 10.0.20.1 through 10.0.20.100:
ip dhcp pool ABCnetwork 10.0.20.0 255.255.255.0class CLASS1address range 10.0.20.1 10.0.20.100Related Commands
class
To associate a class with a Dynamic Host Configuration Protocol (DHCP) address pool and enter DHCP pool class configuration mode, use the class command in DHCP pool configuration mode. To remove the class association, use the no form of this command.
class class-name
no class class-name
Syntax Description
Defaults
No default behavior or values.
Command Modes
DHCP pool configuration
Command History
Usage Guidelines
You first define the class using the ip dhcp class global configuration command. If a nonexistent class is named by the class command, the class will be automatically created. Each class in the DHCP pool will be examined for a match in the order configured.
Examples
The following example associates DHCP class 1 and class 2 with a DHCP pool named ABC:
ip dhcp pool ABCnetwork 10.0.20.0 255.255.255.0class CLASS1address range 10.0.20.1 10.0.20.100class CLASS2address range 10.0.20.101 10.0.20.200Related Commands
ip dhcp class
To define a Dynamic Host Configuration Protocol (DHCP) class and enter DHCP class configuration mode, use the ip dhcp class command in global configuration mode. To remove the class, use the no form of this command.
ip dhcp class class-name
no ip dhcp class class-name
Syntax Description
Defaults
No default behavior or values.
Command Modes
Global configuration
Command History
Usage Guidelines
DHCP class configuration provides a method to group DHCP clients based on some shared characteristics other than the subnet in which the clients reside.
Examples
The following example defines three DHCP classes and their associated relay agent information patterns. Note that CLASS3 is considered a "match to any" class because it has no relay agent information pattern configured:
ip dhcp class CLASS1relay agent information! Relay agent information patternsrelay-information hex 01030a0b0c02050000000123relay-information hex 01030a0b0c02*relay-information hex 01030a0b0c02050000000000 bitmask 0000000000000000000000FFip dhcp class CLASS2relay agent information! Relay agent information patternsrelay-information hex 01040102030402020102relay-information hex 01040101030402020102ip dhcp class CLASS3relay agent informationRelated Commands
Command Descriptionrelay agent information
Enters relay agent information option configuration mode.
relay-information hex
Specifies a hexadecimal string for the full relay agent information option.
ip dhcp use class
To control whether the Cisco IOS DHCP server uses Dynamic Host Configuration Protocol (DHCP) classes during address allocation, use the ip dhcp use class command in global configuration mode. To disable the use of DHCP classes during address allocation, use the no form of this command.
ip dhcp use class
no ip dhcp use class
Syntax Description
This command has no arguments or keywords.
Defaults
This command is enabled by default.
Command Modes
Global configuration
Command History
Usage Guidelines
When you use the no ip dhcp use class command, the DHCP class configuration is not deleted.
Examples
The following example shows the DHCP server configured to use the relay agent information option during address allocation:
ip dhcp use classrelay agent information
To enter relay agent information option configuration mode, use the relay agent information command in Dynamic Host Configuration Protocol DHCP class configuration mode. To disable this functionality, use the no form of this command.
relay agent information
no relay agent information
Syntax Description
This command has no arguments or keywords.
Defaults
No default behavior or values
Command Modes
DHCP class configuration
Command History
Usage Guidelines
If this command is omitted for DHCP class-based address allocation, then the DHCP class matches to any relay agent information option, whether it is present or not.
Using the no relay agent information command removes all patterns in the DHCP class configured by the relay-information hex command.
Examples
The following example shows the relay information patterns configured for DHCP class 1.
ip dhcp class CLASS1relay agent informationrelay-information hex 01030a0b0c02050000000123relay-information hex 01030a0b0c02*relay-information hex 01030a0b0c02050000000000 bitmask 0000000000000000000000FFip dhcp class CLASS2relay agent informationRelated Commands
Command Descriptionrelay-information hex
Specifies a hexadecimal string for the full relay agent information option.
relay-information hex
To specify a hexadecimal string for the full relay agent information option, use the relay-information hex command in relay agent information option configuration mode. To remove the configuration, use the no form of this command.
relay-information hex pattern [*] [bitmask mask]
no relay-information hex pattern [*] [bitmask mask]
Syntax Description
pattern
String of hexadecimal values. This string creates a pattern that is matched against the named DHCP class.
*
(Optional) Wildcard character.
bitmask mask
(Optional) Hexadecimal bitmask.
Defaults
No default behavior or values
Command Modes
Relay agent information option configuration mode.
Command History
Usage Guidelines
The relay-information hex command sets a pattern that is used to match against defined DHCP classes. You can configure multiple relay-information hex commands for a DHCP class. This is useful to specify a set of relay information options that can not be summarized with a wildcard or a bitmask.
The pattern itself, excluding the wildcard, must contain a whole number of bytes (a byte is two hexadecimal numbers). For example, 010203 is 3 bytes (accepted) and 01020 is 2.5 bytes (not accepted).
If you omit this command, no pattern is configured and it is considered a match to any relay agent information value, but the relay information option must be present in the DHCP packet.
You must know the hexadecimal value of each byte location in option 82 to be able to configure the relay- information hex command. The option 82 format may vary from product to product. Contact the relay agent vendor for this information.
Examples
The following example shows the configured relay agent information patterns. Note that CLASS 2 has no pattern configured and will "match to any" class.
ip dhcp class CLASS1relay agent informationrelay-information hex 01030a0b0c02050000000123relay-information hex 01030a0b0c02*relay-information hex 01030a0b0c02050000000000 bitmask 0000000000000000000000FFip dhcp class CLASS2relay agent informationdebug 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
Glossary
address pool—The range of IP addresses assigned by the DHCP server. Address pools are indexed by subnet number.
client—A host trying to configure its interface (obtain an IP address) using DHCP or BOOTP protocols.
Dynamic Host Configuration Protocol —DHCP. A protocol that provides a mechanism for allocating IP addresses dynamically so that addresses can be reused when hosts no longer need them.
relay agent—A router that forwards DHCP and BOOTP messages between a server and a client on different subnets.
server—DHCP or BOOTP server.
Note Refer to the Internetworking Terms and Acronyms for terms not included in this glossary.
Copyright © 2003-2005 Cisco Systems, Inc. All rights reserved.