158
If the two features are configured together on a port and the port learns the configured
maximum number of MAC address entries, the port processes packets as follows:
{ Forwards only packets matching the MAC address entries learnt by the port.
{ Drops unmatching packets.
• For successful dynamic MAC-based VLAN assignment, use static VLANs when you create
MAC-to-VLAN entries.
• As a best practice, do not use dynamic MAC-based VLAN assignment with MSTP. In MSTP
mode, if a port is blocked in the MSTI of its target VLAN, the port drops the received packets
instead of delivering them to the CPU. As a result, the port will not be dynamically assigned to
the target VLAN.
• As a best practice, do not use dynamic MAC-based VLAN assignment with PVST. In PVST
mode, if the target VLAN of a port is not permitted on the port, the port is placed in blocked state.
The port drops the received packets instead of delivering them to the CPU. As a result, the port
will not be dynamically assigned to the target VLAN.
• As a best practice, do not configure both dynamic MAC-based VLAN assignment and automatic
voice VLAN assignment mode on a port. They can have a negative impact on each other.
Configuration procedure
To configure 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 ]
By default, no MAC-to-VLAN
entries exist.
3. Enter Layer 2 Ethernet
interface view.
interface
interface-type interface-number N/A
4. Set the port link type to
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.
The VLAN assignment for a
port is triggered only when the
source MAC address of its
receiving packet exactly
matches the MAC address in a
MAC-to-VLAN entry.
7. (Optional.) Configure
the system to assign
VLANs based on the
MAC address
preferentially.
vlan precedence mac-vlan
By default, the system assigns
VLANs based on the MAC
address preferentially when
both the MAC-based VLAN and
IP subnet-based VLAN are
configured on a port.
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.