The port-security max-mac-num command sets the maximum number of secure MAC addresses that can be learned by an interface.
By default, an interface can learn only one MAC address.
Parameter |
Description |
Value |
---|---|---|
max-number |
Specifies the maximum number of secure MAC addresses that can be learned by an interface. |
The value is an integer that ranges from 1 to 64. |
Usage Scenario
After enabling port security on an interface, you can run the port-security max-mac-num command to limit the number of MAC addresses that can be learned by the interface. After the number of secure MAC addresses reaches the limit, the switch considers that packets with nonexistent source MAC addresses as attack packets regardless of whether the packets have destination MAC addresses. The device then takes the action specified using the port-security protect-action command to protect the interface. This prevents STAs with untrusted MAC addresses from communicating with the switch through this interface, improving security of the device and network.
Prerequisites
The port security function has been enabled using the port-security enable command on the interface.
Precautions
If the sticky MAC function is disabled, max-number limits the number of secure dynamic MAC addresses learned by the interface.
If the sticky MAC function is enabled, max-number limits the number of sticky MAC addresses learned by the interface.
If you run the port-security max-mac-num command multiple times in the same interface view, only the latest configuration takes effect.
# Set the maximum number of MAC addresses that can be learned by an AP's wired interface to 5.
<HUAWEI> system-view [HUAWEI] wlan [HUAWEI-wlan-view] wired-port-profile name wire1 [HUAWEI-wlan-wired-port-wire1] mode endpoint Warning: If the AP goes online through a wired port, the incorrect port mode con figuration will cause the AP to go out of management. This fault can be recovere d only by modifying the configuration on the AP. Continue? [Y/N]:y Warning: This action will take effect after resetting AP. [HUAWEI-wlan-wired-port-wire1] port-security enable [HUAWEI-wlan-wired-port-wire1] port-security max-mac-num 5