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
Case Skills Exam · Supporting reference, not an additional exam objective
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 Show / Verify Common Mistakes Back to topics
Copy Topic
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.
Copy
Fullscreen
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.
Copy
Fullscreen
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.
Copy
Fullscreen
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.
Copy
Fullscreen
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.
Copy
Fullscreen
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 Copy Verify
show port-security interface [INTERFACE]
Example output
Port Security : Enabled
Port Status : Secure-up
Violation Mode : Restrict
Check state, violation action, maximum and counters.
show port-security address
Example output
10 0011.2233.4455 SecureSticky Gi0/1
Verify learned or configured secure MACs.
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.
Copy
Fullscreen
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
Mode Action
Protect Drop unauthorized frames Restrict Drop and report/count violations Shutdown Err-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.
Copy
Fullscreen
enable
configure terminal
interface [INTERFACE]
no switchport port-security
exit
end