350-401 Security Practice Question
A network engineer is configuring port security on a Cisco switch to prevent unauthorized devices from connecting. The requirement is to allow only the first two MAC addresses learned on the port and to automatically shut down the port if a violation occurs. Which command set should be used?
⚠ Common exam trap
Many exam-takers confuse the violation modes; restrict and protect do not shut down the port, while shutdown does. Also, forgetting to set the maximum to 2 would default to 1, which is not the requirement.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
switchport port-security switchport port-security maximum 2 switchport port-security violation shutdown
Port security is configured by enabling it on the interface, setting the maximum number of allowed MAC addresses, and specifying the violation action. To allow two MAC addresses and shut down on violation, the commands switchport port-security, switchport port-security maximum 2, and switchport port-security violation shutdown are required. This ensures that only two devices can connect and any additional device causes the port to enter err-disabled state.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
switchport port-security switchport port-security maximum 2 switchport port-security violation restrict
Why it's wrong here
The restrict violation mode drops packets from unauthorized MAC addresses and generates a syslog message but does not shut down the port. The requirement specifically states to shut down the port on violation, so this mode does not meet the requirement. Restrict is less disruptive but does not provide the same level of security.
- ✗
switchport port-security switchport port-security violation protect
Why it's wrong here
The protect violation mode silently drops packets from unauthorized MAC addresses without logging or shutting down the port. Additionally, the maximum is not specified, so it defaults to 1. This does not meet the requirement of allowing two MAC addresses and shutting down on violation. Protect mode is the least disruptive but least secure.
- ✗
switchport port-security switchport port-security maximum 1 switchport port-security violation shutdown
Why it's wrong here
This command set sets the maximum to 1, which would only allow one MAC address. The requirement is to allow two MAC addresses, so this configuration is too restrictive and would cause violations when a second device connects. The maximum must be set to 2 to meet the requirement.
- ✓
switchport port-security switchport port-security maximum 2 switchport port-security violation shutdown
Why this is correct
This command set enables port security, sets the maximum number of MAC addresses to 2, and configures the violation action to shutdown the port. This meets the requirement of allowing only two MAC addresses and shutting down on violation. The shutdown violation mode places the port in an err-disabled state when a violation occurs.
Quick reference
Access Control Model Comparison
| Model | Acronym | Who Controls Access? | Best For |
|---|---|---|---|
| Discretionary Access Control | DAC | Resource owner | Small teams, file shares |
| Mandatory Access Control | MAC | System / security labels | Classified govt / military |
| Role-Based Access Control | RBAC | Administrator (via roles) | Enterprise environments |
| Attribute-Based Access Control | ABAC | Policy engine (user + resource attributes) | Fine-grained, dynamic policies |
| Rule-Based Access Control | RuBAC | System rules / ACLs | Firewall rules, network ACLs |
Go deeper
Related to this question
About these practice questions
This 350-401 question is part of Courseiva's 1,923-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Cisco exam blueprint
This 350-401 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 350-401 exam.