The mac-vlan mac-address command associates a MAC address with a VLAN.
The undo mac-vlan mac-address command cancels the association between MAC addresses and VLANs.
By default, the MAC addresses are not associated with VLANs.
mac-vlan mac-address mac-address [ mac-address-mask | mac-address-mask-length ] [ priority priority ]
undo mac-vlan mac-address { all | mac-address [ mac-address-mask | mac-address-mask-length ] }
Parameter |
Description |
Value |
---|---|---|
mac-address |
Specifies the MAC address to be 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 less 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. |
mac-address-mask |
Specifies the mask of a MAC address. |
The value is in H-H-H format. H is a hexadecimal number of 1 to 4 digits. The default value is FFFF-FFFF-FFFF. |
mac-address-mask-length |
Specifies the length of a MAC address mask. |
The value is an integer that ranges from 1 to 48. The default value is 48. |
priority priority |
Specifies the 802.1p priority of the VLAN to be associated with a MAC 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 |
Specifies all the MAC addresses associated with a VLAN. |
- |
Usage Scenario
If user devices move frequently on a network, you can use the mac-vlan mac-address command to associate MAC addresses with VLANs. The switch then assigns VLANs to packets based on source MAC addresses of packets. Before forwarding a packet, the switch tags the packet with the VLAN associated with the source MAC address. When a user device moves, you do not need to assign a VLAN to the user device again. This improves security and access flexibility on the network.
You can specify the 802.1p priority of the VLAN to be associated with the specific MAC address. In this manner, when the switching device is congested, the switching device preferentially sends frames with high priorities.
Follow-up Procedure
Add an interface to the VLAN and enable MAC address-based VLAN assignment on the interface.
Precautions
When the mac-vlan mac-address command with the same MAC address specified is executed multiple times, MAC-VLAN entries take effect according to the longest match principle. On the S5720-EI, S6720-EI, and S6720S-EI, MAC-VLAN entries take effect according to the longest match principle only when the subnet mask has 47 bits or less than 47 bits. A MAC-VLAN entry with a 48-bit subnet mask has the lowest priority.
After a MAC address is associated with a VLAN, it cannot be associated with other VLANs.
If you run the mac-vlan mac-address command multiple times in the same VLAN view, all the specified MAC addresses are associated with the VLAN.