Understanding Port Security
A device takes certain actions after the number of secure MAC addresses reaches the limit.
Classification of Secure MAC Addresses
Secure MAC addresses fall into dynamic secure MAC addresses and sticky MAC addresses.
Type |
Description |
Characteristic |
---|---|---|
Dynamic secure MAC address |
MAC addresses that are learned on an interface where port security is enabled but the sticky MAC function is disabled. |
Dynamic secure MAC addresses will be lost after a device restart and need to be learned again. Dynamic secure MAC addresses will never be aged out by default, and can be aged only when an aging time is set for them. Dynamic secure MAC addresses may be aged in two modes: absolute aging and relative aging.
|
Sticky MAC address |
MAC addresses that are learned on an interface where both port security and sticky MAC function are enabled. |
Sticky MAC addresses are not aged out. The sticky MAC addresses that are saved manually are not lost after a device restart. |
- After port security is enabled on an interface, dynamic MAC address entries that have been learned on the interface are deleted and MAC address entries learned subsequently turn into dynamic secure MAC address entries.
- Dynamic MAC addresses on an interface can be only converted into secure dynamic MAC addresses or sticky MAC addresses. After the sticky MAC function is enabled on an interface, existing dynamic secure MAC address entries and MAC address entries learned subsequently on the interface turn into sticky MAC address entries. After the sticky MAC function is disabled on an interface, sticky MAC addresses on the interface turn into dynamic secure MAC addresses.
- After port security is disabled on an interface, existing dynamic secure MAC address entries on the interface are deleted. The interface learns dynamic MAC address entries again.
Action to Take After the Number of Secure MAC Addresses Reaches the Limit
If the switch receives packets with a nonexistent source MAC address after the number of secure MAC addresses reaches the limit, the switch considers that the packets are sent from an unauthorized user and takes the configured action on the interface. By default, the switch discards the packets and generates an alarm in such a situation.
Action |
Description |
---|---|
restrict |
Discards packets with a nonexistent source MAC address and generates an alarm. This action is recommended. |
protect |
Only discards packets with a nonexistent source MAC address but does not generate an alarm. |
error-down |
Sets the interface state to ERROR DOWN(portsec-reachedlimit) and generates an alarm. When the protection action is set to error-down and the number of secure MAC addresses on the interface reaches the limit, the interface enters the Error-Down state. The device records the status of an interface as Error-Down when it detects that a fault occurs. The interface in Error-Down state cannot receive or send packets and the interface indicator is off. You can run the display error-down recovery command to check information about all interfaces in Error-Down state on the device. When the interface is in Error-Down state, check the cause. You can use the following modes to restore the interface status:
|