Port Security for CCNA: Limit MAC Addresses and Violation Modes

Port security limits which MAC addresses can use an access port and what to do on a violation. It protects against unauthorized devices and MAC table flooding attacks. It is typical layer 2 security in the CCNA.

Exam domain: Security Fundamentals · Level: Intermediate · Updated on October 17, 2026 · 2 min read

Topology diagram “Port Security for CCNA: Limit MAC Addresses and Violation Modes” with 4 devices and 3 links
Topology: Port Security for CCNA: Limit MAC Addresses and Violation Modes

Edit this template Download .json

Learning objectives

Devices and addressing

DeviceTypeDetails
PC-OKPC / user0050.7966.6801
Allowed MAC
INTRUDERPC / user00AA.BB11.2233
Unauthorized MAC
SW1SwitchPort security
F0/1 y F0/2 max 1
R1RouterGateway
G0/0 192.168.1.1/24

Reference configuration (Cisco IOS)

SW1

interface range f0/1 - 2
 switchport mode access
 switchport port-security
 switchport port-security maximum 1
 switchport port-security mac-address sticky
 switchport port-security violation shutdown
! Recuperar el puerto
interface f0/2
 shutdown
 no shutdown

Verification commands

CCNA exam tips

It only works on static access or trunk ports, not on dynamic ports.

By default the violation mode is shutdown: the port goes err-disabled.

How to use this template

Press “Edit this template”: the editor opens with the topology loaded and ready to change (undo with Ctrl+Z). You can also copy the JSON and paste it into the editor with File ▸ Import JSON…. Then add devices, change IPs and export to PDF, PNG or SVG.

To practice, rebuild the topology in Cisco Packet Tracer, GNS3 or Cisco Modeling Labs and paste the reference configuration on each device. Addresses and names are examples: change them to create your own variants.

JSON template for the editor

This is the full diagram in JSON format. Paste it into the editor (File ▸ Import JSON…) or press the edit button to load it automatically.

Edit this template

Frequently asked questions

What does restrict mode do?

It drops illegal frames and logs the violation but keeps the port up.

How do I recover an err-disabled port?

With shutdown and no shutdown on the interface, or with errdisable recovery.

CCNA and Cisco are registered trademarks of Cisco Systems, Inc. This site is independent, not affiliated with Cisco and does not provide official exam material: the templates are study examples.

More related pages