After port security is enabled, the switch converts MAC addresses learned by an interface into secure MAC addresses, and stops learning new MAC addresses after the maximum number of learned MAC addresses is reached. In this case, the switch can only communicate with devices with learned MAC addresses. If a network has unstable access users, you can restart the switch or configure the aging time of secure MAC addresses to update MAC address entries. If a network has stable access users, you can enable the sticky MAC address function on an interface, so that MAC address entries of these users will not be updated or deleted.
An interface that has the sticky MAC address function enabled takes the same protection actions as an interface that has port security enabled. For details, see the following table.
Action |
Description |
---|---|
restrict |
Discards packets with a nonexistent source MAC address and generates a trap. This action is recommended. |
protect |
Discards packets with a nonexistent source MAC address but does not generate a trap. |
shutdown |
Sets the interface state to error-down and generates a trap. By default, an interface in error-down state can only be restored using the restart command in the interface view. To enable an interface in error-down state to automatically go Up after a period of time, run the error-down auto-recovery cause port-security interval interval-value command in the system view. In this command, interval-value specifies the period of time after which an interface can automatically go Up. |
The sticky MAC address function usually applies to networks where terminal users seldom change.
The system view is displayed.
The interface view is displayed.
Port security is enabled.
By default, port security is disabled on an interface.
The sticky MAC address function is enabled on the interface.
By default, the sticky MAC address function is disabled on an interface.
The maximum number of sticky MAC addresses is set.
By default, an interface enabled with the sticky MAC address function can learn only one sticky MAC address.
A port security action is configured.
By default, the restrict action is used.
A sticky MAC address entry is configured.
After the sticky MAC address function is enabled on an interface: