CCNA 200-301

CCNP Enterprise

CCNP Security

CCIE Enterprise Lab

CCIE Security Lab

CCNP Service Provider

CCNP Data Center

CCNP Collaboration

CCIE DC Lab

Whether isolating an infected host, stopping an unauthorized device from accessing sensitive subnets, or mitigating Layer 2 attacks like ARP spoofing, blocking traffic by Media Access Control (MAC) address is a core operational task for network administrators. Cisco IOS and Cisco IOS-XE switches provide multiple native mechanisms to discard or filter frames based on hardware addresses.

Depending on your network topology and security goals, you can enforce MAC-level blocks globally within a broadcast domain, at specific physical ingress ports, or proactively through dynamic port security. Understanding the distinct operational characteristics of each method ensures you choose the right approach without disrupting legitimate traffic or exhausting switch hardware resources.

Evaluating Layer 2 MAC Blocking Methods: Comparison and Trade-Offs

Cisco Catalyst switches process Layer 2 frame forwarding through hardware Application-Specific Integrated Circuits (ASICs) and Content Addressable Memory (CAM) tables. Choosing the correct blocking method depends on whether you require an immediate reactive quarantine, fine-grained interface filtering, or proactive edge perimeter defense.

MethodFiltering ScopeEnforcement MechanismHardware Resource UsagePrimary Use Case
Static MAC Table DropBroadcast Domain (VLAN)Replaces dynamic CAM entry with a static drop target; discards frames matching source or destination MAC.CAM / MAC Address TableEmergency network-wide blackholing of a specific rogue hardware address.
Layer 2 MAC Access-List (PACL)Physical Port or EtherChannelInspects frame headers against defined access control entries (ACEs) on ingress.Ternary CAM (TCAM)Granular filtering on shared uplinks or access ports (blocking specific addresses while permitting others).
Cisco Port SecurityAccess or Trunk PortWhitelists allowed MAC addresses per port; triggers violation action when unauthorized MAC is detected.Port Security Hardware Table / Port RegistersEdge defense against rogue endpoints, unauthorized switches, or MAC flooding attacks.

Selecting the Optimal Method

  • Use Static MAC Table Drop when a rogue device is actively communicating across multiple switchports in the same VLAN and you need an instantaneous, switch-wide blackhole.
  • Use Layer 2 MAC Access-Lists when you need rule-based filtering applied selectively to specific interface boundaries without altering port state.
  • Use Port Security when hardening access-layer ports against unknown devices plugging into wall jacks.

Dropping a Specific MAC Address with Static MAC Table Entries

The static MAC address drop command instructs the switch forwarding engine to discard all Layer 2 frames associated with a target hardware address in a designated VLAN. This action prevents the switch from forwarding frames sourced from or destined to that device.

Step 1: Identify the Offending MAC Address and VLAN

Obtain the target device’s 48-bit hardware address formatted in standard Cisco dot-notation (hhhh.hhhh.hhhh) and verify the active VLAN where the device resides:

Switch# show mac address-table address 0011.2233.4455
          Mac Address Table
-------------------------------------------
Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
  10    0011.2233.4455    DYNAMIC     Gi1/0/12

Step 2: Access Global Configuration Mode

Enter privileged configuration mode on the switch:

Switch# configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#

Step 3: Apply the Static Drop Command

Execute the static entry command, appending the drop keyword to designate the address for immediate discard:

Switch(config)# mac address-table static 0011.2233.4455 vlan 10 drop

(Note: On legacy Cisco Catalyst software versions prior to Cisco IOS 12.2, the command uses a hyphen: mac-address-table static 0011.2233.4455 vlan 10 drop.)

Step 4: Verify Hardware Table Enforcement

Confirm that the entry was converted from a dynamic learning state to a static drop entry:

Switch(config)# end
Switch# show mac address-table static vlan 10
          Mac Address Table
-------------------------------------------
Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
  10    0011.2233.4455    STATIC      Drop

Step 5: Save the Running Configuration

Commit your changes to non-volatile memory:

Switch# copy running-config startup-config

Blocking MAC Addresses Using Layer 2 MAC Access-Lists

For interface-level filtering that does not alter global CAM table behavior across an entire VLAN, implement a Port Access Control List (PACL). A MAC access-list filters frames at interface ingress before forwarding decisions occur.

Single Host Block Template

! Step 1: Define the named MAC access-list
mac access-list extended ACL_BLOCK_ROGUE_MAC
 deny   host 0011.2233.4455 any
 permit any any

! Step 2: Bind the access-list to the target interface
interface GigabitEthernet1/0/12
 mac access-group ACL_BLOCK_ROGUE_MAC in
 exit

Multi-Host and Vendor OUI Filtering Template

! Block multiple specific MACs and an entire vendor OUI (using wildcard mask)
mac access-list extended ACL_BLOCK_MULTIPLE_HOSTS
 deny   host aaaa.bbbb.cccc any
 deny   host 1111.2222.3333 any
 deny   0050.5600.0000 0000.00ff.ffff any
 permit any any

interface GigabitEthernet1/0/14
 mac access-group ACL_BLOCK_MULTIPLE_HOSTS in
 exit

Configuration Notes:
* Every Cisco MAC access-list contains an implicit deny any any rule at the end. You must append an explicit permit any any statement to prevent unintended disruption of all other Layer 2 traffic.
* Standard MAC ACLs evaluate only source MAC addresses; extended MAC ACLs evaluate both source and destination addresses as well as EtherType values.
* Binding is executed on the interface level using the mac access-group [ACL_NAME] in command. Cisco Catalyst switches enforce PACLs exclusively in the inbound (in) direction.


Enforcing Port-Level Access Restrictions with Cisco Port Security

Cisco Port Security protects edge access interfaces by limiting the hardware addresses permitted on a port. If an unapproved device connects, the switch enforces a predefined violation policy.

Step 1: Configure the Target Interface as an Access Port

Port security cannot run on dynamic switchports; you must explicitly define the interface as a static access port:

Switch# configure terminal
Switch(config)# interface GigabitEthernet1/0/5
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 20

Step 2: Enable Port Security and Define Capacity

Activate the feature and set the maximum number of allowable MAC addresses (default is 1):

Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security maximum 1

Step 3: Select and Apply a Violation Mode

Choose an enforcement mode based on the desired level of isolation:

  • Protect: Drops frames from unauthorized MAC addresses silently. Does not generate syslog messages or disable the port.
  • Restrict: Drops frames from unauthorized MAC addresses, increments the security violation counter, and generates an SNMP trap and syslog message.
  • Shutdown (Default): Immediately transitions the interface into an err-disabled state, disables the physical link, and sends an alert.
Switch(config-if)# switchport port-security violation restrict

Step 4: Specify Allowed MAC Addresses

Define the permitted address either statically or dynamically via sticky learning:

! Option A: Static Assignment
Switch(config-if)# switchport port-security mac-address 00aa.bbcc.ddee

! Option B: Sticky Learning (learns and saves the first active MAC connected)
Switch(config-if)# switchport port-security mac-address sticky
Switch(config-if)# end

When an unauthorized device is plugged in, the switch drops traffic according to the configured violation mode, stopping rogue devices before they enter the network.


Verification and Unblocking: Frequently Asked Questions

How do I view and verify active static drop entries?

To display all statically blocked MAC addresses across all active VLANs, execute:

Switch# show mac address-table static | include Drop

To limit output to a specific VLAN:

Switch# show mac address-table static vlan 10 | include Drop

How do I remove a static drop entry and unblock the device?

Negate the drop command using the exact MAC address and VLAN ID configured:

Switch# configure terminal
Switch(config)# no mac address-table static 0011.2233.4455 vlan 10 drop
Switch(config)# end

Once removed, normal dynamic address learning resumes for that MAC address on the next transmitted frame.

How do I verify if a MAC ACL is active and dropping frames?

Check the hit counters on the access-list:

Switch# show access-lists ACL_BLOCK_ROGUE_MAC
Extended MAC access list ACL_BLOCK_ROGUE_MAC
    deny   host 0011.2233.4455 any (1452 matches)
    permit any any (89431 matches)

To remove the filter entirely from a port:

Switch(config)# interface GigabitEthernet1/0/12
Switch(config-if)# no mac access-group ACL_BLOCK_ROGUE_MAC in
Switch(config-if)# end

How do I recover a port placed into an err-disabled state by Port Security?

If an unauthorized MAC address caused an interface to enter the err-disabled state under shutdown violation mode:

  1. Confirm the error state:
    text
    Switch# show interfaces status err-disabled
  2. Disconnect the offending device, then bounce the interface manually:
    text
    Switch# configure terminal
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# shutdown
    Switch(config-if)# no shutdown
    Switch(config-if)# end
  3. Alternatively, enable automatic recovery so the port resets after a set timer:
    text
    Switch(config)# errdisable recovery cause psecure-violation
    Switch(config)# errdisable recovery interval 300

Cisco Catalyst Platform Specifications and Architecture Reference

Feature availability, command syntax, and hardware scale for Layer 2 filtering vary by hardware generation and Cisco IOS/IOS-XE release.

Command Syntax Differences by OS

  • Cisco IOS-XE (Catalyst 9200, 9300, 9400, 9500, 9600 Series):
    Uses the space-separated syntax exclusively:
    mac address-table static [mac-address] vlan [vlan-id] drop
  • Classic Cisco IOS (Catalyst 2960-X, 3560, 3750, 3850 running legacy releases):
    May support either mac address-table or the hyphenated mac-address-table syntax depending on maintenance train. Both variants manipulate the hardware forwarding database identically.

Hardware TCAM Allocation

  • PACL Processing: Applied directly at interface ingress through the Port Access Control Processor. MAC ACL rules consume Layer 2 TCAM entries. If TCAM capacity is exhausted, additional access-groups cannot be applied to physical interfaces.
  • PACL vs. IP Traffic: On Cisco Catalyst platforms, MAC access-lists filter non-IP traffic by default. When filtering IPv4 or IPv6 traffic via MAC ACLs, verify that your specific switch model supports Layer 2 protocol filtering for IP packets in hardware, or use a VLAN Access Map (VACL) instead.

Topology and Interface Boundaries

  • Port Security Restrictions:
  • Supported on Layer 2 switchports only. Port security cannot be configured on Layer 3 routed interfaces (no switchport), EtherChannel bundle members, or SPAN destination ports.
  • While supported on trunk ports on select platforms, maximum MAC thresholds apply across all carried VLANs unless specifically configured per-VLAN using switchport port-security maximum [value] vlan [vlan-list].
  • Static Drops and Multicast: The drop keyword cannot be combined with multicast or broadcast MAC address strings (ffff.ffff.ffff or addresses beginning with 0100.5e).

Official Technical Resources

For platform-specific TCAM limits and comprehensive configuration matrices, consult the following official Cisco Systems documentation:
* Cisco Catalyst 9000 Series Switches Security Configuration Guide (Layer 2 Security)
* Cisco IOS-XE Command Reference: Interface and Hardware Commands
* Cisco Catalyst Switch Port Security Configuration and Troubleshooting Guides


By matching the appropriate filtering mechanism to your operational scenario—using static drop commands for rapid quarantine, MAC access-lists for granular port-level rules, or port security for persistent edge defense—you can maintain tight control over hardware access across your Cisco switching infrastructure.

Please follow and like us:
Last modified: November 16, 2026

Author

Comments

Write a Reply or Comment

Your email address will not be published.