Explore the options for setting port security on interface Fast Ethernet 0/1:
S1#configure terminal
S1(config)#interface fastethernet 0/1
S1(config-if)#switchport port-security ?
aging Port-security aging commands
mac-address Secure mac address
maximum Max secure addresses
violation Security violation mode
<cr>

Notice the last option is a carriage return, <cr>, which means the command switchport
port-security can be entered without specifying any additional options. In fact, you must
enter the switchport port-security command before port security is active and any
remaining port security commands are evaluated by the IOS.
In addition, a port must be in access mode before you can enable port security. Otherwise,
you will get the following error message:
S1(config)#interface fastethernet 0/1
S1(config-if)#switchport port-security
Command rejected: FastEthernet0/1 is a dynamic port.
S1(config-if)#switchport mode access
S1(config-if)#switchport port-security
S1(config-if)#switchport port-security maximum 2
S1(config-if)#switchport port-security mac-address sticky
S1(config-if)#switchport port-security violation protect
S1(config-if)#exit

CCNA Classes in Dubai – CCNAGuru (Cisco Expert Trainer)
Join CCNA classes in Dubai by CCNAGuru, led by a Cisco-certified expert. Available for in-person and online classes with real lab practice, exam-focused training, and career guidance.
Introduction to Networks
Switching, Routing & Wireless
Enterprise Networking & Security
CCNA Training Across U.S. States
Explore CCNA Training Centers and Certification Courses across every U.S. state.
Connect with me: FB X IN YT TT WA
*All U.S. state pages are part of CCNAGuru.com's training network.