BuildTheNet

Opening your workspace

Your learning content and tools are loading.

Port Security

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   : 0

Reference output: hand-written in standard Cisco IOS format for this example network, not captured from a device.

Useful variants

What each column or field means

FieldMeaning
Port SecurityEnabled only after switchport port-security is entered on its own; setting a maximum alone does not enable it.
Port StatusSecure-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 ModeShutdown (the default), Restrict or Protect.
Aging Time / Aging TypeHow long secure addresses are kept (0 means they never age out) and whether the timer is Absolute or Inactivity.
Maximum MAC AddressesThe limit for this port.
Total MAC AddressesSecure addresses currently on the port: configured, sticky and dynamic together.
Configured MAC AddressesAddresses typed in with switchport port-security mac-address <mac>.
Sticky MAC AddressesHow 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:VlanThe source MAC and VLAN of the last frame received on the port. After a violation, this is usually the offending device.
Security Violation CountViolations 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

Try it yourself

Learn it in the CCNA path

Topic

Port Security — Limit which MAC addresses an access port accepts, choose a violation action, learn sticky addresses and recover err-disabled ports.

All 57 commands