The mac-address static command configures a static MAC address entry.
The undo mac-address command deletes the MAC address entry.
mac-address static mac-address interface-type interface-number vlan vlan-id
undo mac-address static [ interface-type interface-number | vlan vlan-id ] *
undo mac-address static mac-address interface-type interface-number vlan vlan-id
undo mac-address [ mac-address [ vlan vlan-id ] ]
undo mac-address [ interface-type interface-number | vlan vlan-id ] *
| Parameter | Description | Value |
|---|---|---|
| static | Indicates the static entry that is not aged. After being configured and saved, the entries cannot be lost after system reset and hot swap of the interface board. | - |
| mac-address | Specifies the unicast MAC address. | MAC address in the format of H-H-H. Each H is a 4-digit hexadecimal number, such as 00e0 and fc01. If an H contains less than four digits, 0s are added ahead. For example, if an H is e0, it is equal to 00e0. FFFF-FFFF-FFFF is an invalid MAC address. |
| interface-type interface-number | Specifies the type and number of an interface. | - |
| vlan vlan-id | Specifies the VLAN ID used after VLAN mapping is performed. | The value is an integer ranging from 1 to 4094. |
# Configure a static MAC address entry. The outbound interface in the entry belongs to a specific VLAN:
When a frame, with the destination MAC address being 0011-2233-4455 and belonging to VLAN 10, is received, it is forwarded through the outbound interfaceGigabitEthernet 0/0/1. is added into VLAN 10 in access mode.
When a frame, with the destination MAC address being 0011-2233-4466 and belonging to VLAN 20, is received, it is forwarded through the outbound interface GigabitEthernet 0/0/2. is added into VLAN 20 in hybrid mode.
<sysname> system-view [sysname] vlan 10 [sysname-vlan-10] quit [sysname] vlan 20 [sysname-vlan-20] quit [sysname] interface GigabitEthernet 0/0/1 [sysname-GigabitEthernet0/0/1] portswitch [sysname-GigabitEthernet0/0/1] port link-type access [sysname-GigabitEthernet0/0/1] port default vlan 10 [sysname-GigabitEthernet0/0/1] quit [sysname] interface GigabitEthernet 0/0/2 [sysname-GigabitEthernet0/0/2] portswitch [sysname-GigabitEthernet0/0/2] port link-type hybrid [sysname-GigabitEthernet0/0/2] port hybrid tagged vlan 20 [sysname-GigabitEthernet0/0/2] quit [sysname] mac-address static 0011-2233-4455 GigabitEthernet 0/0/1 vlan 10 [sysname] mac-address static 0011-2233-4466 GigabitEthernet 0/0/2 vlan 20