port-security enable
Function
The port-security enable command enables the port security function on an interface.
The undo port-security enable command disables the port security function on an interface.
By default, port security is disabled on an interface.
Usage Guidelines
Usage Scenario
After port security is enabled on an interface, MAC address entries learned by the interface are stored in the MAC address table as secure dynamic MAC address entries. By default, secure dynamic MAC addresses will not be aged out. After the device restarts, secure dynamic MAC address entries are lost and need to be relearned.
Port security has the following functions:
- Prevent unauthorized users from using their computers to connect to an enterprise network.
- Prevent employees of a company from moving their computers without permission.
Precautions
The protection action, maximum number of learned secure MAC address entries, and sticky MAC function can be configured only after port security is enabled.
The port-security enable and mac-limit maximum cannot be used on the same interface.
If port security is enabled after MAC address learning is disabled using the mac-address learning disable command, the port security function does not take effect. If port security is enabled before MAC address learning is disabled on an interface, the device no longer learns MAC addresses on the interface, but secure MAC addresses that have been learned are reserved.