The policy-vlan command configures policy-based VLAN assignment by associating a MAC address and IP address binding policy to a VLAN and setting the 802.1p priority of the VLAN.
The undo policy-vlan command disassociates a MAC address and IP address binding policy from a VLAN.
By default, a VLAN is not associated with any MAC address and IP address binding policy.
policy-vlan mac-address mac-address ip ip-address [ interface interface-type interface-number ] [ priority priority ]
undo policy-vlan { all | mac-address mac-address ip ip-address [ interface interface-type interface-number ] }
Parameter |
Description |
Value |
---|---|---|
mac-address mac-address |
Specifies the source MAC address associated with a VLAN. |
The value is in H-H-H format. H is a hexadecimal number of 4 digits, for example, 00e0 and fc01. If you enter fewer than four digits, 0s are prefixed to the input digits. For example, if you enter e0, the system changes e0 to 00e0. The MAC address cannot be 0000-0000-0000, FFFF-FFFF-FFFF, or a multicast MAC address. |
ip ip-address |
Specifies the IP address associated with a VLAN. |
The value is in dotted decimal notation. |
interface interface-type interface-number |
Specifies the interface where the MAC address and IP address
binding policy is applied.
If this parameter is not specified, the binding policy is applied to all the interfaces in the VLAN. If this parameter is specified, the binding policy is applied to the specified interface. |
- |
priority priority |
Specifies the 802.1p priority of the VLAN associated with the MAC address and IP address. |
The value is an integer that ranges from 0 to 7. A larger value indicates a higher priority. The default value is 0. |
all |
Disassociates all MAC address and IP address binding policies from a VLAN. |
- |
Usage Scenario
Policy-based VLAN assignment is a method to assign VLANs based on source MAC addresses and IP addresses of packets. This method is applicable to networks where high security is required and user devices move frequently.
When receiving an untagged packet, an interface matches the source IP address and source MAC address of the packet with the entries in the policy-based VLAN table.
Policy-based VLAN assignment takes effect only for untagged packets, whereas tagged packets are forwarded based on port-based VLANs.
Precautions
On the S2720-EI, S5720I-SI, S5720-LI, S5720S-LI, S5720S-SI, and S5720-SI, when the ip error-packet-check disable command is used to disable IP packet check, IP subnet-based VLAN assignment and policy-based VLAN assignment do not take effect.
After a MAC address or IP address is associated with a VLAN, it cannot be associated with other VLANs.
If you run the policy-vlan command multiple times in the same VLAN view, all the specified IP addresses and MAC addresses are associated with the VLAN.