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.
If a match is found and the bound address pool has assignable IP addresses, the server assigns an IP address and other parameters from the address pool. If the address pool does not have assignable IP addresses, the address assignment fails.
If no match is found, the server assigns an IP address and other parameters from the default DHCP address pool. If no default address pool is specified or the default address pool does not have assignable IP addresses, the address assignment fails.
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. |