mac-limit (interface view)

Function

The mac-limit command configures a MAC address learning limit rule on an interface to set the maximum number of MAC addresses that can be learned on the interface.

The undo mac-limit command deletes a MAC address learning limit rule on an interface.

By default, no MAC address learning limit rule is configured on an interface.

Format

mac-limit { maximum maxValue [ rate interval ] | action { discard | forward } | alarm { disable | enable } } *

undo mac-limit

Parameters

Parameter Description Value
maximum maxValue

Specifies the maximum number of MAC address that can be learned.

The value is an integer ranging from 0 to 131072.

When the value is 0, no limitation is set on the address learning number.

rate interval

Indicates the interval at which MAC addresses are learned.

The parameter must be configured when configuring the global MAC address learning limit rule.

The value is an integer ranging from 0 to 1000, in milliseconds.

When the value is 0, no limitation is set on the address learning interval.

action

Specifies an action to be taken when the number of MAC address entries in the MAC address table reaches the limit.

-

discard

The packet with the source MAC address not contained in the MAC address table is discarded.

-

forward

The packet with the source MAC address not contained in the MAC address table is forwarded but its MAC address is not recorded.

-

alarm

Specifies whether an alarm is generated when the number of the MAC address entries in the MAC address table reaches the limit.

-

disable

No alarm is generated.

-

enable

An alarm is generated.

-

Views

Layer 2 100GE interface view, 100GE interface view, Layer 2 10GE interface view, 10GE interface view, 25GE-L2 view, 25GE interface view, 400GE-L2 view, 400GE interface view, Layer 2 40GE interface view, 40GE interface view, Layer 2 50GE interface view, 50GE interface view, Eth-Trunk interface view, FlexE interface view, Layer 2 GE interface view, GE optical interface view, GE interface view, GE electrical interface view, Interface group view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
mac write

Usage Guidelines

Usage Scenario

To control the number of users and protect a MAC address table against attacks, you can limit the number of MAC addresses that a device can learn. You can also configure the system to discard packets or generate an alarm to improve network security.

Configuring interface-based MAC address learning limit rule can control the number of access users on an interface. When the number of MAC addresses reaches the limit, no new MAC addresses will be learned. You can also configure the system to discard packets or generate an alarm to improve network security.

Configuration Impact

After a MAC address learning limit rule is configured on an interface using the mac-limit command, a global MAC address learning limit rule cannot be applied on the interface using the mac-limit rule-name command.

Trustworthy MAC addresses may not be recorded after the number of learned MAC addresses reaches the limit. If an enterprise or a family is attacked by different source MAC addresses, only the network of the enterprise or family, not the whole network is affected.

Precautions

Before configuring a MAC address learning limit rule, run the reset mac-address command to clear the learned MAC addresses to ensure that the number of MAC addresses that can be learned is limited accurately.

Before running this command in the tunnel interface view, run the tunnel-protocol command to specify the GRE tunnel mode for the tunnel interface.

Example

# Configure a MAC address learning limit rule on GE 0/1/2 in VLAN scenarios: a maximum of 1000 MAC addresses can be learned; MAC address learning is performed at the interval of 100 ms; when the number of learned MAC addresses reaches the limit, the packet with the destination MAC address not contained in the MAC address table is forwarded.
<HUAWEI> system-view
[~HUAWEI] vlan 100
[*HUAWEI-vlan100] quit
[*HUAWEI] interface GigabitEthernet 0/1/2
[*HUAWEI-GigabitEthernet0/1/2] portswitch
[*HUAWEI-GigabitEthernet0/1/2] port default vlan 100
[*HUAWEI-GigabitEthernet0/1/2] mac-limit action forward alarm enable maximum 1000 rate 100
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >