Switchport Port-Security Mac-Address
Sets the mac-address(es) that causes port-security violation.
Switch(config-if)#switchport port-security mac-address <h.h.h.h>
Switch(config-if)#switchport port-security mac-address sticky
Use sticky in conjunction with switchport port-security maximum to have the switch learn which mac-addresses to allow. For example,
if you set switchport port-security maximum 5, then the switch will learn and allow the first 5 mac addresses that connect to the interface.
Any new mac addresses beyond 5 will trigger a violation. Also note that, after rebooting, the switch has to relearn those 5 mac addresses.
In this example, the mac-address is set for port-security on int fa0/2.
After connecting a device with a different mac to the interface, port violation is triggered and int fa0/2 is shut down.