show port-security interface
Shows one port’s port-security status, violation mode, MAC limits, sticky addresses and last violating source.
Written by a working field network engineer · CCNA, Security+, CySA+
Port security for one port in full. Run it after configuring a port to confirm it is enabled and up, and after a violation to see which MAC address caused it.
Example output
SW1#show port-security interface FastEthernet0/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 : 2
Total MAC Addresses : 1
Configured MAC Addresses : 0
Sticky MAC Addresses : 1
Last Source Address:Vlan : 0050.7966.6817:10
Security Violation Count : 0Reference output: hand-written in standard Cisco IOS format for this example network, not captured from a device.
Useful variants
show port-security interface Fa0/1sh port-sec int fa0/1
What each column or field means
| Field | Meaning |
|---|---|
Port Security | Enabled only after switchport port-security is entered on its own; setting a maximum alone does not enable it. |
Port Status | Secure-up (working), Secure-down (link down) or Secure-shutdown (err-disabled after a violation). Restrict and Protect never err-disable the port, so it stays Secure-up. |
Violation Mode | Shutdown (the default), Restrict or Protect. |
Aging Time / Aging Type | How long secure addresses are kept (0 means they never age out) and whether the timer is Absolute or Inactivity. |
Maximum MAC Addresses | The limit for this port. |
Total MAC Addresses | Secure addresses currently on the port: configured, sticky and dynamic together. |
Configured MAC Addresses | Addresses typed in with switchport port-security mac-address <mac>. |
Sticky MAC Addresses | How many addresses were learned with mac-address sticky. They are written into the running-config, so they survive a reboot only if you save it. show port-security address lists them. |
Last Source Address:Vlan | The source MAC and VLAN of the last frame received on the port. After a violation, this is usually the offending device. |
Security Violation Count | Violations since the port came up. Restrict counts every one; Shutdown stops at 1. |
When it doesn’t look right
Port Status: Secure-shutdown.
A violation err-disabled the port. Find the offending MAC (Last Source Address:Vlan), remove the cause, then shutdown and no shutdown the interface, or configure errdisable recovery cause psecure-violation.
Sticky addresses vanished after a reload.
They were learned into the running-config but never saved. Run copy running-config startup-config after learning.
Related commands
- show port-security
- show port-security address
- show interfaces status err-disabled
- show mac address-table
Try it yourself
- Switchport Port Security (free)
- Sticky MAC Address Learning (Pro)
- Port Security Violation Action (Pro)
Learn it in the CCNA path
- Layer 2 Port Security (5. Security Fundamentals)
- Limit secure MAC addresses and verify sticky learning (5. Security Fundamentals)
- Compare port-security violation modes and recovery (5. Security Fundamentals)
Topic
Port Security — Limit which MAC addresses an access port accepts, choose a violation action, learn sticky addresses and recover err-disabled ports.