This guide is for learning. Run these commands only on your own lab or servers.

Port security limits the MAC addresses allowed on an access port. It helps stop unknown devices from being plugged into your lab switch.

Configure

interface f0/5
 switchport mode access
 switchport port-security
 switchport port-security maximum 1
 switchport port-security mac-address sticky
 switchport port-security violation restrict

Verify

show port-security interface f0/5
show port-security address

Recover a shutdown port

interface f0/5
 shutdown
 no shutdown

Use violation shutdown only when you are ready to reset the port by hand.

Want the commands on one page? Cisco Networking Guide · $14.99View on Gumroad