The Cisco IOS DHCP server can allocate dynamic IP addresses based on the relay information option (option 82) sent by the
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 are also called options. Option 82 is organized as a single DHCP option that contains information known by the relay
Automatic DHCP address allocation is based on an IP address. This IP address can either be the gateway address (giaddr field
of the DHCP packet) or the IP address of an incoming interface. 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 DHCP relay agent can include additional
information about itself when forwarding client-originated DHCP packets to a DHCP server. The Cisco IOS DHCP server can also
use option 82 to provide additional information to properly allocate IP addresses to DHCP clients. The information sent via
option 82 is used to identify the port where the DHCP request arrives. Automatic DHCP address allocation does not parse out
the individual suboptions contained in option 82. Rather, the address allocation is done by matching a configured pattern
byte by byte.
This 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.
For example, DHCP clients are connected to two ports of a single switch. Each port can be configured to be a part of two
VLANs: VLAN1 and VLAN2. DHCP clients belong to either VLAN1 or VLAN2 and 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) have the giaddr field set to the same value indicating the subnet of the VLAN.
Problems can occur while allocating IP addresses to DHCP clients that are connected to different ports of the same VLAN.
These IP addresses must be part of the same subnet but the range of IP addresses must be different. In the preceding example,
when a DHCP client that is connected to a port of VLAN1 must be allocated an IP address from a range of IP addresses within
the VLAN’s subnet, whereas a DHCP client connecting to port 2 of VLAN1 must be allocated an IP address from another range
of IP addresses. The two range of IP addresses are part of the same subnet (and have the same subnet mask). Generally, during
DHCP address allocation, the DHCP server refers only to the giaddr field and is unable 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 inspects both the giaddr field and the inserted option 82 during the
address selection process.
When you enable option 82 on a device, the following
sequence of events occurs:
- The host (DHCP client) generates a DHCP request and
broadcasts it on the network.
- When the device receives the DHCP request, it
adds the option 82 information in the packet. The option 82
information contains the device MAC address (the remote ID
suboption) and the port identifier, vlan-mod-port, from which the
packet is received (the circuit ID suboption).
- The device adds the IP address of the relay agent to
the DHCP packet.
- The device forwards the DHCP request that includes the
option 82 field to the DHCP server.
- The DHCP server receives the packet. If the server is
option 82 capable, it uses the remote ID, the circuit ID, or
both to assign IP addresses and implement policies, such as
restricting the number of IP addresses that can be assigned to a
single remote ID or circuit ID. The DHCP server echoes the
option 82 field in the DHCP reply.
- The DHCP server unicasts the reply to the device
if the request is relayed to the server by the device. The
device verifies that it originally inserted the option 82 data by
inspecting remote ID and possibly circuit ID fields. The device removes the option 82 field and forwards the packet to
the interface that connects to the DHCP client that sent the DHCP
The Cisco software refers to a pool of IP addresses (giaddr or incoming interface IP address) and matches the request to
a class or classes configured in the pool in the order the classes are specified in the DHCP pool configuration.
When a DHCP address pool is configured with one or more DHCP classes, the pool becomes a restricted access pool, which means
that no addresses are allocated from the pool unless one or more classes in the pool matches. This design allows DHCP classes
to be used either for access control (no default class is configured on the pool) or to provide further address range partitions
within 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 supported for DHCP class-based address allocation:
Specifying the full relay agent information option value as a raw hexadecimal string by using the
hex command in new relay agent information configuration mode.
Support for bit-masking the raw relay information hexadecimal value.
Support for a wildcard at the end of a hexadecimal string specified by the
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
trusted command. This configuration prevents the server from dropping the DHCP message.