Configuring a DHCP policy for dynamic address assignment

In a DHCP policy, each DHCP user class has a bound DHCP address pool. Clients matching different user classes obtain IP addresses and other parameters from different address pools. The DHCP policy must be applied to the interface that acts as the DHCP server. When receiving a DHCP request, the DHCP server compares the packet against the user classes in the order that they are configured.

For successful address assignment, make sure the applied DHCP policy and the bound address pools exist.

To configure a DHCP policy for dynamic address assignment:

Step

Command

Remarks

1. Enter system view.

system-view

N/A

2. Create a DHCP user class and enter DHCP user class view.

dhcp class class-name

By default, no DHCP user class exists.

3. Configure a match rule for the DHCP user class.

if-match rule rule-number { hardware-address hardware-address mask hardware-address-mask | option option-code [ ascii ascii-string [ offset offset | partial ] | hex hex-string [ mask mask | offset offset length length | partial ] ] | relay-agent gateway-address }

By default, no match rule is configured for a DHCP user class.

4. Return to system view.

quit

N/A

5. Create a DHCP policy and enter DHCP policy view.

dhcp policy policy-name

By default, no DHCP policy exists.

6. Specify a DHCP address pool for a DHCP user class.

class class-name ip-pool pool-name

By default, no address pool is specified for a user class.

7. Specify the default DHCP address pool.

default ip-pool pool-name

By default, no default address pool is specified.

8. Return to system view.

quit

N/A

9. Enter interface view.

interface interface-type interface-number

N/A

10. Apply the DHCP policy to the interface.

dhcp apply-policy policy-name

By default, no DHCP policy is applied to an interface.