Specifying a primary subnet and multiple address ranges in a DHCP address pool
About a primary subnet and multiple address ranges in a DHCP address pool
Some scenarios need to classify DHCP clients on the same subnet into different address groups. To meet this need, you can configure DHCP user classes and specify different address ranges for the classes. The clients matching a user class can then get the IP addresses of an address range. In addition, you can specify a common address range for the clients that do not match any user class. If no common address range is specified, such clients fail to obtain IP addresses.
If there is no need to classify clients, you do not need to configure DHCP user classes or their address ranges.
Restrictions and guidelines
If you execute the network or address range command multiple times for the same address pool, the most recent configuration takes effect.
If you execute the forbidden-ip command multiple times, you exclude multiple address ranges from dynamic allocation.
IP addresses specified by the forbidden-ip command are not assignable in the current address pool, but are assignable in other address pools. IP addresses specified by the dhcp server forbidden-ip command are not assignable in any address pool.
You can use class range to modify an existing address range, and the new address range can include IP addresses that are being used by clients. Upon receiving a lease extension request for such an IP address, the DHCP server allocates a new IP address to the requesting client. But the original lease continues aging in the address pool, and will be released when the lease duration is reached. To release such lease without waiting for its timeout, execute the reset dhcp server ip-in-use command.
Procedure
Enter system view.
system-view
Enter DHCP address pool view.
dhcp server ip-pool pool-name
Specify the primary subnet in the address pool.
network network-address [ mask-length | mask mask ]
By default, no primary subnet is specified.
(Optional.) Specify the common address range.
address range start-ip-address end-ip-address
By default, no IP address range is specified.
(Optional.) Specify an IP address range for a DHCP user class.
class class-name range start-ip-address end-ip-address
By default, no IP address range is specified for a user class.
The DHCP user class must already be created by using the dhcp class command.
(Optional.) Set the address lease duration.
expired { day day [ hour hour [ minute minute [ second second ] ] ] | unlimited }
The default setting is 1 day.
(Optional.) Exclude the specified IP addresses in the address pool from dynamic allocation.
forbidden-ip ip-address&<1-8>
By default, all IP addresses in the DHCP address pool are assignable.
(Optional.) Exclude the specified IP addresses from automatic allocation in system view.
Return to system view.
quit
Exclude the specified IP addresses from automatic allocation globally.
dhcp server forbidden-ip start-ip-address [ end-ip-address ] [ vpn-instance vpn-instance-name ]
By default, except for the IP address of the DHCP server interface, IP addresses in all address pools are assignable.