51
Configuration procedure
1. Specify IP addresses for interfaces on DHCP server and DHCP relay agent. (Details not shown.)
2. Configure DHCP services:
# Enable DHCP and configure the DHCP server to handle Option 82.
<SwitchB> system-view
[SwitchB] dhcp enable
[SwitchB] dhcp server relay information enable
# Enable DHCP server on VLAN-interface10.
[SwitchB] interface vlan-interface 10
[SwitchB-Vlan-interface10] dhcp select server
[SwitchB-Vlan-interface10] quit
# Create DHCP user class tt and configure a match rule to match client requests with Option 82.
[SwitchB] dhcp class tt
[SwitchB-dhcp-class-tt] if-match option 82
[SwitchB-dhcp-class-tt] quit
# Create DHCP address pool aa, specify the address range for the address pool and the address
range for user class tt. Specify gateway and DNS server address.
[SwitchB] dhcp server ip-pool aa
[SwitchB-dhcp-pool-aa] network 10.10.1.0 mask 255.255.255.0
[SwitchB-dhcp-pool-aa] address range 10.10.1.2 10.10.1.100
[SwitchB-dhcp-pool-aa] class tt range 10.10.1.2 10.10.1.10
[SwitchB-dhcp-pool-aa] gateway-list 10.10.1.254
[SwitchB-dhcp-pool-aa] dns-list 10.10.1.20
Verifying the configuration
After the preceding configuration is complete, clients in a specific user class in subnet 10.10.1.0/24 can
obtain IP addresses and other configuration parameters from the DHCP server (Switch B). You can use
the display dhcp server ip-in-use command to display the IP address assigned by the DHCP server.
Primary and secondary subnets configuration example
Network requirements
As shown in Figure 20 , the DHCP server (Switch A) dynamically assigns IP addresses to clients in the
LAN.
Configure two subnets in the address pool on the DHCP server: 10.1.1.0/24 as the primary subnet and
10.1.2.0/24 as the secondary subnet. The DHCP server selects IP addresses in the secondary subnet
when the primary subnet has no assignable addresses.
S w i t c h A a s s i g n s t h e d e f a u l t g a t e w a y 10 .1.1. 25 4 / 24 t o c l i e n t s i n s u b n e t 10 .1.1. 0 / 24 a n d a s s i g n s t h e
default gateway 10.1.2.254/24 to clients in subnet 10.1.2.0/24.