The ip address dhcp-alloc command enables the DHCP client function on an interface.
The undo ip address dhcp-alloc command disables the DHCP client function on an interface.
By default, the DHCP client function is disabled on an interface.
Parameter |
Description |
Value |
---|---|---|
unicast |
Indicates that the client requests the server to unicast response packets. |
- |
Usage Scenario
To obtain an IP address, the DHCP client sends a DHCP Request message to the server. After the server receives the DHCP Request message, it sends a DHCP response message to the DHCP client. The DHCP client obtains the assigned IP address from the response message.
Precautions
Interfaces of the device can have IP addresses statically configured using the ip address command or dynamically obtain IP addresses using the ip address dhcp-alloc command. A static IP address takes precedence over a dynamic IP address. If the interface has dynamically obtained an IP address after the ip address dhcp-alloc command is executed, running the undo ip address command deletes the IP address and the ip address dhcp-alloc command. If the interface does not obtain an IP address after the ip address dhcp-alloc command is executed, running the undo ip address command does not delete the ip address dhcp-alloc command.
# Enable the DHCP client function on VLANIF100 to obtain an IP address.
<HUAWEI> system-view [HUAWEI] interface vlanif 100 [HUAWEI-Vlanif100] ip address dhcp-alloc
<HUAWEI> system-view [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] undo portswitch [HUAWEI-GigabitEthernet0/0/1] ip address dhcp-alloc