The dhcp server force insert option command configures a DHCP server to forcibly insert an Option field specified in the interface address pool to a DHCP Response packet that it sends to a DHCP client.
The undo dhcp server force insert option command deletes the Option field forcibly inserted to a DHCP Response packet that a DHCP server sends to a DHCP client.
By default, a DHCP server does not forcibly insert an Option field to a DHCP Response packet that it sends to a DHCP client.
dhcp server force insert option code &<1-254>
undo dhcp server force insert option code &<1-254>
Parameter |
Description |
Value |
---|---|---|
code |
Specifies the code for a forcibly replied option. You can configure a DHCP server to forcibly reply one or more options. |
The value is an integer that ranges from 1 to 254. |
Usage Scenario
In general, when a DHCP client applies for an IP address from a DHCP server, parameters contained in the DHCP Request packet specify the options the client requires. The DHCP server inserts the required options to a DHCP Response packet.
Sometimes, a device, functioning as a DHCP server, receives a DHCP Request packet that contains no parameter specifying the options the client requires. However, the client still wants to obtain the options configured on the interface address pool. You can run the dhcp server force insert option code &<1-254> command to configure the DHCP server to forcibly insert an Option field to the DHCP Response packet.
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.
The Option field has been configured in the interface address pool using the dhcp server option code [ sub-option sub-code ] { ascii ascii-string | hex hex-string | cipher cipher-string | ip-address ip-address &<1-8> } command in the interface view.
# Configure a DHCP server to forcibly insert Option 4 to a DHCP Response packet on VLANIF100.
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] vlan 100 [HUAWEI-vlan100] quit [HUAWEI] interface vlanif 100 [HUAWEI-Vlanif100] dhcp select interface [HUAWEI-Vlanif100] dhcp server option 4 hex 11 22 [HUAWEI-Vlanif100] dhcp server force insert option 4
<HUAWEI> system-view [HUAWEI] dhcp enable [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] undo portswitch [HUAWEI-GigabitEthernet0/0/1] dhcp select interface [HUAWEI-GigabitEthernet0/0/1] dhcp server option 4 hex 11 22 [HUAWEI-GigabitEthernet0/0/1] dhcp server force insert option 4