CCNA Extra Lesson 02: Concept of Switch Port Security in Cisco
Port Security in Cisco Switch
Port Security in a Cisco switch is a feature that helps protect the network by restricting input to an interface and limiting and identifying the MAC addresses of the stations allowed to access the port.
It’s widely used in enterprise and ISP networks to prevent unauthorized devices from connecting to the network.
Ethernet Port Security Use -
- Preventing unauthorized access — stops users from plugging in personal laptops or switches.
- Limit MAC flooding attacks — protects the MAC address table from being overfilled.
- Enforce endpoint control — only pre-approved devices can connect.
When port security is enabled:
- The switch port learns or is configured with allowed MAC addresses
- Any device with an unrecognized MAC address trying to send traffic is blocked or triggers an action.
- You can set how many devices are allowed per port (default: 1).
Port Security Terms
- Static Secure MAC Address -- Manually configured MAC address allowed on the port.
- Dynamic Secure MAC Address -- Learned dynamically, lost after reboot.
- Sticky Secure MAC Address -- Learned dynamically but saved in the running config (can be made permanent).
- Violation Modes -- What the switch will do if an unknown MAC address is detected.
Violation Mode
- Protect -- Discards packets with unknown MAC; no log message.
- Restrict -- Discards packets with unknown MAC and sends log/SNMP trap.
- Shutdown (default) -- Disables the port (err-disabled state) until manually or automatically reset.
How to Configure the Ether Port Security
SW1(config-if)#switchport mode access
SW1(config-if)#switchport port-security
SW1(config-if)#switchport port-security mac-address sticky
SW1(config-if)#switchport port-security maximum 1
SW1(config-if)#switchport port-security violation Shutdown
SW1#show port-security interface fastEthernet0/2
SW1#show port-security address
SW1#show interfaces fa0/2
N:B: By Changing PC one switchport to another, the reflection of configuration will be rectifying simultaneously.