Pcornel
H3 · Practical network exams · Cisco IOS / IOS XE

Port Security · Finals

Configuration first, verification second, theory third. Reference templates require task-specific adaptation.

Content version 1.1-draft

Keyboard shortcuts

/ Finals search · Ctrl K global command palette · Alt E Exam Mode · Alt G Golden Scripts · Alt T Exam Topics · Alt V Verify · Esc close dialog.

Skills Exam

Quick explanation

Port Security restricts source MAC addresses on an access port. Dynamic, static and sticky learning can be combined with a maximum address count and a violation action.

Configuration

Replace highlighted placeholders. Configure only the variants required by the task.

Prerequisites and dependency links
  • Use a supported static access port.
  • Choose maximum and violation mode according to the task; inspect attached devices.
Sticky MAC – protect Recommended / essential starting point
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: port-security-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

enable
configure terminal
interface [INTERFACE]
 switchport
 switchport mode access
 switchport access vlan [VLAN-ID]
 switchport port-security
 switchport port-security maximum [MAX-MAC]
 switchport port-security mac-address sticky
 switchport port-security violation protect
 no shutdown
 exit
end
Command parameters
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[VLAN-ID]
VLAN identifier.
[MAX-MAC]
Maximum secure MAC addresses.
Sticky MAC – restrict Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: port-security-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

enable
configure terminal
interface [INTERFACE]
 switchport
 switchport mode access
 switchport access vlan [VLAN-ID]
 switchport port-security
 switchport port-security maximum [MAX-MAC]
 switchport port-security mac-address sticky
 switchport port-security violation restrict
 no shutdown
 exit
end
Command parameters
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[VLAN-ID]
VLAN identifier.
[MAX-MAC]
Maximum secure MAC addresses.
Sticky MAC – shutdown Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: port-security-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

enable
configure terminal
interface [INTERFACE]
 switchport
 switchport mode access
 switchport access vlan [VLAN-ID]
 switchport port-security
 switchport port-security maximum [MAX-MAC]
 switchport port-security mac-address sticky
 switchport port-security violation shutdown
 no shutdown
 exit
end
Command parameters
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[VLAN-ID]
VLAN identifier.
[MAX-MAC]
Maximum secure MAC addresses.
Statically allowed MAC Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: port-security-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

enable
configure terminal
interface [INTERFACE]
 switchport
 switchport mode access
 switchport access vlan [VLAN-ID]
 switchport port-security
 switchport port-security maximum [MAX-MAC]
 switchport port-security mac-address [MAC-ADDRESS]
 no shutdown
 exit
end
Command parameters
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[VLAN-ID]
VLAN identifier.
[MAX-MAC]
Maximum secure MAC addresses.
[MAC-ADDRESS]
MAC address in Cisco dotted hexadecimal notation.
Dynamic secure MAC learning Task-specific configuration — essential if selected
Start in privileged EXEC; block enters and exits configuration mode. Section link

Alternative group: port-security-method. Select the applicable method; do not apply mutually exclusive variants in sequence.

enable
configure terminal
interface [INTERFACE]
 switchport
 switchport mode access
 switchport access vlan [VLAN-ID]
 switchport port-security
 switchport port-security maximum [MAX-MAC]
 no shutdown
 exit
end
Command parameters
[INTERFACE]
Local interface name including type and number, or an SVI as appropriate.
[VLAN-ID]
VLAN identifier.
[MAX-MAC]
Maximum secure MAC addresses.

Show / Verify

Primary verification Section link
show port-security interface [INTERFACE]
Example output
Port Security : Enabled
Port Status : Secure-up
Violation Mode : Restrict

Check state, violation action, maximum and counters.

Detailed verification Section link
show port-security address
Example output
10  0011.2233.4455  SecureSticky  Gi0/1

Verify learned or configured secure MACs.

Detailed verification Section link
show interfaces status err-disabled
Example output
Gi0/1  err-disabled  psecure-violation

Shutdown mode may disable the port; resolve the cause before recovery.

Connectivity verification

Layer 2 endpoint test

After sending traffic between the intended hosts, verify that the expected MAC addresses are learned on the correct VLAN and interface.

show mac address-table vlan [VLAN-ID]
show interfaces [INTERFACE] switchport

Common mistakes

  • Maximum too low for attached devices.
  • Wrong port type.
  • Sticky addresses not saved when persistence is needed.
  • Recovering without resolving the violation.

Quick reference and default values

Port Security violation modes
ModeAction
ProtectDrop unauthorized frames
RestrictDrop and report/count violations
ShutdownErr-disable interface (default commonly)

Configuration comparison

Protect vs restrict vs shutdown — All deny unauthorized MAC traffic; restrict reports/counts violations, shutdown err-disables the port.

Remove configuration — separate, potentially disruptive actions

Disable Port Security on a port

Removes the enforcement policy; assess the security effect.

enable
configure terminal
interface [INTERFACE]
 no switchport port-security
 exit
end

Related reference

Networking technical reference · Interface types · Connectivity verification

Reset checklist?

Command block

Back to Top

Confirmation

Confirm action

Continue?