77
# Enable the DHCP relay agent on VLAN-interface 10.
[SwitchA] interface vlan-interface 10
[SwitchA-Vlan-interface10] dhcp select relay
# Specify the IP address of the DHCP server.
[SwitchA-Vlan-interface10] dhcp relay server-address 10.1.1.1
# Configure the handling strategies and padding content of Option 82.
[SwitchA-Vlan-interface10] dhcp relay information enable
[SwitchA-Vlan-interface10] dhcp relay information strategy replace
[SwitchA-Vlan-interface10] dhcp relay information circuit-id string company001
[SwitchA-Vlan-interface10] dhcp relay information remote-id string device001
Example: Configuring DHCP server selection
Network configuration
As shown in Figure 26, the DHCP client and the DHCP servers are in different subnets. DHCP server
1 and DHCP server 2 both have a DHCP address pool that contains IP addresses in subnet
22.22.22.0/24, but neither has DHCP enabled.
Configure the DHCP relay agent for the DHCP client to obtain an IP address in subnet 22.22.22.0/24
and other configuration parameters from a DHCP server. The DHCP relay agent is connected to the
DHCP client through VLAN-interface 2, to DHCP server 1 through VLAN-interface 3, and to DHCP
server 2 through VLAN-interface 4.
Figure 26 Network diagram
Procedure
1. Assign IP addresses to interfaces on the switches. (Details not shown.)
2. Configure Switch B and Switch C as DHCP servers. (Details not shown.)
3. Configure the DHCP relay agent on Switch A:
# Enable DHCP.
<SwitchA> system-view
[SwitchA] dhcp enable
# Enable the DHCP relay agent on VLAN-interface 2.
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] dhcp select relay