Configuring dynamic MAC-based VLAN assignment
Step | Command | Remarks |
---|---|---|
1. Enter system view. | system-view | N/A |
2. Create a MAC-to-VLAN entry. | mac-vlan mac-address mac-address vlan vlan-id [ dot1q priority ] | The VLAN assignment for a port is triggered only when the source MAC address of its receiving packet exactly matches the MAC address in the MAC-to-VLAN entry. |
3. Enter Layer 2 Ethernet interface view. | interface interface-type interface-number | N/A |
4. Configure the link type of the port as hybrid. | port link-type hybrid | By default, all ports are access ports. |
5. Enable the MAC-based VLAN feature. | mac-vlan enable | By default, MAC-based VLAN is disabled. |
6. Enable dynamic MAC-based VLAN assignment. | mac-vlan trigger enable | By default, dynamic MAC-based VLAN assignment is disabled. |
7. (Optional.) Configure VLAN matching order. | vlan precedence { mac-vlan | ip-subnet-vlan } | By default, the system assigns VLANs based on the MAC address preferentially.. As a best practice to ensure the priority of MAC-based VLAN matching, configure the vlan precedence mac-vlan command when you enable dynamic MAC-based VLAN assignment. If you execute the vlan precedence ip-subnet-vlan command, the command will not take effect. |
8. (Optional.) Disable the port from forwarding packets that fail the exact MAC address match in its PVID. | port pvid forbidden | By default, when a port receives packets whose source MAC addresses fail the exact match, the port forwards them in its PVID. |