62
<RouterA> system-view
[RouterA] dhcp enable
# Enable DHCP server on interface GigabitEthernet 2/0/1.
[RouterA] interface gigabitethernet 2/0/1
[RouterA-GigabitEthernet2/0/1] dhcp select server
[RouterA-GigabitEthernet2/0/1] quit
# Create DHCP user class ss and configure a match rule to match DHCP requests in which the
hardware address is six bytes long and begins with aabb-aabb.
[RouterA] dhcp class ss
[RouterA-dhcp-class-ss] if-match rule 1 hardware-address aabb-aabb-0000 mask
ffff-ffff-0000
[RouterA-dhcp-class-ss] quit
# Create DHCP address pool aa.
[RouterA] dhcp server ip-pool aa
# Specify the subnet for dynamic allocation.
[RouterA-dhcp-pool-aa] network 10.1.1.0 mask 255.255.255.0
# Enable DHCP user class whitelist.
[RouterA-dhcp-pool-aa] verify class
# Add DHCP user class ss to the DHCP user class whitelist.
[RouterA-dhcp-pool-aa] valid class ss
Verifying the configuration
# Verify that clients matching the DHCP user class can obtain IP addresses on subnet 10.1.1.0/24
from the DHCP server. (Details not shown.)
# On the DHCP server, display the IP addresses assigned to the clients.
[RouterA] display dhcp server ip-in-use
Primary and secondary subnets configuration example
Network requirements
As shown in Figure 28, the DHCP server (Router A) assigns IP addresses to DHCP 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 an IP address from the
secondary subnet when the primary subnet has no assignable addresses.
Router A assigns the following parameters:
• The default gateway 10.1.1.254/24 to clients on subnet 10.1.1.0/24.
• The default gateway 10.1.2.254/24 to clients on subnet 10.1.2.0/24.