Sticky MAC – Topic Checklist
What is Sticky MAC?
Sticky MAC is a Cisco port security feature that enables a switch port to dynamically learn MAC addresses and “stick” (save) them to the switch’s running configuration.
Purpose: Increases security by restricting which devices can connect to a switch port, while offering more flexibility than static MAC address assignments.
How Sticky MAC Differs from Static and Dynamic MAC Addresses
Type | How Learned | Where Stored | Persistence | Flexibility |
---|---|---|---|---|
Static | Manual (by admin) | Startup/running config | Persistent (until deleted) | Low (manual updates) |
Dynamic | Learned by switch, not saved | MAC address table (RAM) | Lost on reload | High (auto-learns, but temporary) |
Sticky | Learned dynamically, saved | Running config (can be saved) | Persistent if saved to startup-config | Best of both: dynamic + persistent |
How Sticky MAC Works
- When sticky MAC is enabled, the switch learns the MAC addresses of connected devices on a port.
- These addresses are saved to the running configuration (not just memory).
- If the running config is saved (
write memory
), sticky MACs persist after a reboot. - If not saved, sticky MAC entries are lost upon reload.
Configuring Sticky MAC
Switch(config)# interface FastEthernet0/10 Switch(config-if)# switchport port-security Switch(config-if)# switchport port-security mac-address sticky Switch(config-if)# switchport port-security maximum 2
Viewing sticky MAC addresses:
show port-security address
show mac address-table sticky
Benefits of Sticky MAC
- Provides enhanced port security with minimal manual intervention.
- Allows legitimate devices to connect and be authorized automatically.
- Combines flexibility (dynamic learning) with persistence (when saved).
Sticky MAC vs. Static MAC
Aspect | Sticky MAC | Static MAC |
---|---|---|
Learning | Dynamically learned & saved | Configured manually |
Persistence | Persist if saved to startup-config | Always persistent |
Management | Easier, less admin effort | More manual admin work |
Sticky MAC and Port Security
- Sticky MAC is a mode of port security on Cisco switches.
- You can set limits on the number of sticky MAC addresses per port (e.g.,
maximum 2
). - Combines with violation actions:
protect
,restrict
, orshutdown
(default).
Aging and Removal of Sticky MAC Addresses
- By default, sticky MAC addresses do not age out.
- You can manually remove them from running-config or clear all learned addresses:
Switch(config-if)# no switchport port-security mac-address sticky Switch# clear port-security sticky interface FastEthernet0/10
Security Implications
- Prevents MAC spoofing by locking a port to specific MACs.
- Stops unauthorized devices from connecting (port can be shut down on violation).
- Limitations: If an attacker replaces a device but uses the same MAC, they may gain access. Combine with 802.1X or physical security for stronger protection.
Troubleshooting Sticky MAC Issues
Symptom | Possible Cause | Solution |
---|---|---|
Port is err-disabled (shut down) | Violation of MAC limit or unauthorized device | Check sticky MAC table, use shutdown/no shutdown to reset port |
Sticky MACs not saved after reboot | Running-config not saved to startup-config | Use write memory or copy run start |
Unable to add new device | MAC address limit reached | Increase max allowed MACs or remove old entries |
Best Practices
- Set the maximum number of sticky MAC addresses appropriate for the port use (e.g., 2 for PC + IP phone).
- Save the configuration after learning sticky MACs (
write memory
). - Monitor with
show port-security
andshow mac address-table sticky
. - Use violation modes restrict or shutdown for better security.
- Document all port security settings for auditing.
Example Scenario:
A switch port (Fa0/10) should only allow a PC and IP phone, and block any other devices.
A switch port (Fa0/10) should only allow a PC and IP phone, and block any other devices.
Switch(config)# interface FastEthernet0/10 Switch(config-if)# switchport port-security Switch(config-if)# switchport port-security maximum 2 Switch(config-if)# switchport port-security mac-address sticky Switch(config-if)# switchport port-security violation shutdownWhen a third device is connected, the port is automatically disabled (err-disabled) until reset.
Key Points and Exam Tips
Key Point | Explanation |
---|---|
Sticky MAC | Dynamically learns and “sticks” MACs to config for port security. |
Persistence | Sticky MACs persist after reload only if saved to startup-config. |
Limits | Set max allowed sticky MACs per port (e.g., 2 for PC+phone). |
Removal | Manually clear with clear port-security sticky if needed. |
Best Practice | Monitor, document, and save configs after learning MACs. |
When and Where to Use Sticky MAC:
Deploy on edge/access ports where you want to lock connectivity to a small set of trusted devices—common in enterprise, schools, and sensitive office areas.
Combine with other security features for stronger protection.
Deploy on edge/access ports where you want to lock connectivity to a small set of trusted devices—common in enterprise, schools, and sensitive office areas.
Combine with other security features for stronger protection.