< Home

mac-address static vlan

Function

The mac-address static vlan command configures a static MAC address entry.

The undo mac-address static vlan command deletes a static MAC address entry.

By default, no static MAC address entry is configured.

Format

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

For details on how to configure a VSI-based static MAC address entry, see mac-address static vlanif and mac-address static vsi.

Parameters

Parameter

Description

Value

mac-address

Specifies the MAC address in a static MAC address entry.

The value is in H-H-H format. An H is a hexadecimal number of 1 to 4 digits. The MAC address cannot be FFFF-FFFF-FFFF, 0000-0000-0000, or a multicast MAC address.

interface-type interface-number

Specifies the outbound interface in a static MAC address entry.

-

vlan vlan-id

Specifies the ID of the VLAN that the outbound interface belongs to.

The value is an integer that ranges from 1 to 4094.

Views

System view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

Static MAC address entries are used for the following purposes:
  • Improve security. The device directly discards packets sent from unauthorized users using authorized users' MAC addresses.
  • Guide unicast forwarding and save bandwidth.

Precautions

  • The VLAN in a static MAC address entry must have been created and the outbound interface in the same static MAC address entry has been added to the VLAN.
  • If you configure a static MAC address entry when the MAC address table is full, the device processes the MAC address entry as follows:
    • If a dynamic MAC address entry with the same MAC address and VLAN ID exists in the MAC address table, the static MAC address entry replaces the dynamic MAC address entry.
    • If no dynamic MAC address entry with the same MAC address exists in the MAC address table, the system deletes one dynamic MAC address entry and adds the static MAC address entry to the MAC address table.
  • You can run the mac-address static command multiple times to configure multiple static MAC address entries.

Example

# Add a static MAC address entry to the MAC address table. In the MAC address entry, the destination MAC address is 0003-0003-0003, the VLAN ID is 4, and the outbound interface is gigabitethernet0/0/2. That is, the device forwards packets with the destination MAC address of 0003-0003-0003 from VLAN 4 through gigabitethernet0/0/2.

<HUAWEI> system-view
[HUAWEI] vlan 4
[HUAWEI-vlan4] quit
[HUAWEI] interface gigabitethernet 0/0/2
[HUAWEI-GigabitEthernet0/0/2] port link-type access
[HUAWEI-GigabitEthernet0/0/2] port default vlan 4
[HUAWEI-GigabitEthernet0/0/2] quit
[HUAWEI] mac-address static 0003-0003-0003 gigabitethernet 0/0/2 vlan 4
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >