The dhcp policy-vlan port command configures the interface-based DHCP policy VLAN.
The undo dhcp policy-vlan port command deletes the interface-based DHCP policy VLAN.
By default, the function of DHCP policy VLAN based on interfaces is disabled on the device.
dhcp policy-vlan port interface-type interface-number1 [ to interface-number2 ] &<1-10> [ priority priority ]
undo dhcp policy-vlan port interface-type interface-number1 [ to interface-number2 ] &<1-10>
Parameter |
Description |
Value |
---|---|---|
interface-type interface-number1 [ to interface-number2 ] &<1-10> |
Specifies the interface type and interface number.
NOTE:
The interface cannot be a stack interface. |
- |
priority priority |
Specifies the 802.1p priority of DHCP messages. |
The value is an integer that ranges from 0 to 7. The default value is 0. |
Usage Scenario
On a network supporting VLAN assignment based on IP subnets, upon receiving an untagged packet from a host, a switch adds a VLAN ID to the packet based on the source IP address of the packet. A host that accesses the network for the first time does not have a valid IP address. Therefore, the switch cannot add the host to the VLAN and the host cannot obtain a valid IP address or network settings. To make the host obtain a valid IP address from the DHCP server, run the dhcp policy-vlan port command to configure the interface-based policy VLAN.
Prerequisites
DHCP has been enabled globally using the dhcp enable command in the system view.
Precautions
If you run this command on an interface in multiple VLAN views, only the latest configuration takes effect.
The interface-based DHCP policy VLAN takes effect only for hybrid interfaces. If an interface is not hybrid, run the port link-type hybrid command to configure it as a hybrid interface.
# Configure the interface-based DHCP policy VLAN, associate DHCP packets received on GigabitEthernet0/0/1 with VLAN 100, and set the 802.1p priority of the packets to 5.
<HUAWEI> system-view [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI--GigabitEthernet0/0/1] port link-type hybrid [HUAWEI--GigabitEthernet0/0/1] quit [HUAWEI] dhcp enable [HUAWEI] vlan 100 [HUAWEI-vlan100] dhcp policy-vlan port gigabitethernet 0/0/1 priority 5