SW1>enable
SW1#configure
terminal
Enter
configuration commands, one per line.
End with CNTL/Z.
SW1(config)#interface
fa0/1
SW1(config-if)#switchport
port-security
SW1(config-if)#switchport
port-security mac sticky
SW1(config-if)#switchport
port-security violation protect
SW1(config-if)#end
To verify
your configuration you can use the following commands shown below;
SW1#show
port-security interface fa0/1
Port
Security : Enabled
Port
Status : Secure-up
Violation
Mode : Restrict
Aging
Time : 0 mins
Aging
Type : Absolute
SecureStatic
Address Aging : Disabled
Maximum MAC
Addresses : 1
Total MAC
Addresses : 1
Configured
MAC Addresses : 0
Sticky MAC
Addresses : 1
Last Source
Address:Vlan : 000f.242e.bf80:1
Security
Violation Count : 0
SW1#show
port-security interface fa0/1 address
Secure Mac Address Table
------------------------------------------------------------------------
Vlan Mac Address Type Ports Remaining Age
1
000f.242e.bf80
SecureSticky
Fa0/1 -
------------------------------------------------------------------------
Total
Addresses: 1
SW1#show run
int fa0/1
Building
configuration...
Current
configuration : 245 bytes
interface
FastEthernet0/1
switchport mode access
switchport port-security
switchport port-security violation restrict
switchport port-security mac-address sticky
switchport port-security mac-address sticky
000f.242e.bf80 vlan access
end
SW1#