Configuration procedure
Configure Router A:
# Specify the IP address of GigabitEthernet 1/0/1.
<RouterA> system-view [RouterA] interface gigabitethernet 1/0/1 [RouterA-GigabitEthernet1/0/1] ip address 10.1.1.1 24 [RouterA-GigabitEthernet1/0/1] quit
# Enable DHCP.
[RouterA] dhcp enable
# Exclude an IP address from dynamic allocation.
[RouterA] dhcp server forbidden-ip 10.1.1.2
# Configure DHCP address pool 0. Specify the subnet, lease duration, DNS server address, and a static route to subnet 20.1.1.0/24.
[RouterA] dhcp server ip-pool 0 [RouterA-dhcp-pool-0] network 10.1.1.0 mask 255.255.255.0 [RouterA-dhcp-pool-0] expired day 10 [RouterA-dhcp-pool-0] dns-list 20.1.1.1 [RouterA-dhcp-pool-0] option 121 hex 181401010A010102
Configure Router B:
# Configure GigabitEthernet 1/0/1 to use DHCP for IP address acquisition.
<RouterB> system-view [RouterB] interface gigabitethernet 1/0/1 [RouterB-GigabitEthernet1/0/1] ip address dhcp-alloc [RouterB-GigabitEthernet1/0/1] quit