R0106-HP MSR Router Series Layer 3 - IP Services Configuration Guide(V7)
49
<RouterA> system-view
[RouterA] dhcp enable
# Configure the primary and secondary IP addresses of interface GigabitEthernet 2/1/1, and enable
the DHCP server on GigabitEthernet 2/1/1.
[RouterA] interface gigabitethernet 2/1/1
[RouterA-GigabitEthernet2/1/1] ip address 10.1.1.1 24
[RouterA-GigabitEthernet2/1/1] ip address 10.1.2.1 24 sub
[RouterA-GigabitEthernet2/1/1] dhcp select server
[RouterA-GigabitEthernet2/1/1] quit
# Create DHCP address pool aa.
[RouterA] dhcp server ip-pool aa
# Specify the primary subnet and the gateway for dynamic allocation.
[RouterA-dhcp-pool-aa] network 10.1.1.0 mask 255.255.255.0
[RouterA-dhcp-pool-aa] gateway-list 10.1.1.254
# Specify the secondary subnet and the gateway for dynamic allocation.
[RouterA-dhcp-pool-aa] network 10.1.2.0 mask 255.255.255.0 secondary
[RouterA-dhcp-pool-aa-secondary] gateway-list 10.1.2.254
[RouterA-dhcp-pool-aa-secondary] quit
[RouterA-dhcp-pool-aa]
Verifying the configuration
The DHCP server assigns clients IP addresses and other network configuration parameters from the
secondary subnet in the address pool when no assignable address is available from the primary subnet.
You can use display dhcp server ip-in-use command to display IP addresses assigned to the clients.
DHCP option customization configuration example
Network requirements
As shown in Figure 20, the DHCP client (Router B) obtains its IP address and PXE server addresses from
the DHCP server (Router A). The client IP address belongs to subnet 10.1.1.0/24. The PXE server
addresses are 1.2.3.4 and 2.2.2.2.
The DHCP server assigns PXE server addresses to DHCP clients through Option 43, a custom option. The
formats of Option 43 and PXE server address sub-option are shown in Figure 13 and Figure 15. T
he value
o
f Option 43 configured on the DHCP server in this example is 80 0B 00 00 02 01 02 03 04 02 02 02
02.
• The number 80 is the value of the sub-option type.
• The number 0B is the value of the sub-option length.
• The numbers 00 00 are the value of the PXE server type.
• The number 02 indicates the number of servers.
• The numbers 01 02 03 04 02 02 02 02 indicate that the PXE server addresses are 1.2.3.4 and
2.2.2.2.