The dhcp server mask command sets the subnet mask of IP addresses that a DHCP server pre-allocates to DHCP clients.
The undo dhcp server mask command deletes the configured subnet mask.
By default, the subnet mask of IP addresses that a DHCP server pre-allocates to DHCP clients is not configured.
Parameter | Description | Value |
---|---|---|
mask |
Specifies a subnet mask. |
The value is in decimal dotted notation. |
mask-length |
Specifies the length of the subnet. |
The value is an integer ranging from 0 to 32. |
Usage Scenario
After enabling the DHCP server function on an interface, you can configure the range and subnet mask of IP addresses that a DHCP server pre-allocates to DHCP clients. Run the dhcp server ip-range command to configure the IP address range and run the dhcp server mask command to configure the subnet mask of the IP addresses.
Prerequisites
IP addresses in the interface address pool have been configured using the ip address command.
The DHCP server function has been enabled on the interface using the dhcp select interface command.
# Set the subnet mask of IP addresses that a DHCP server on a VLANIF100 pre-allocates to DHCP clients to 255.255.255.0.
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] interface vlanif 100 [HUAWEI-Vlanif100] ip address 10.1.1.1 24 [HUAWEI-Vlanif100] dhcp select interface [HUAWEI-Vlanif100] dhcp server mask 255.255.255.0
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] undo portswitch [HUAWEI-GigabitEthernet0/0/1] ip address 10.1.1.1 24 [HUAWEI-GigabitEthernet0/0/1] dhcp select interface [HUAWEI-GigabitEthernet0/0/1] dhcp server mask 255.255.255.0