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 an interface, and to disable the interface if a violation occurs. Which configuration achieves this?
Trap 1: switchport port-security maximum 2 switchport port-security…
The command 'switchport port-security violation err-disable' is invalid on Cisco IOS because the violation mode parameter only accepts the keywords 'shutdown', 'protect', or 'restrict'. The err-disable state is not a configurable mode; it is a condition that results from entering the 'shutdown' violation mode when an unauthorized MAC address appears. Therefore, this option would be rejected by the CLI and cannot be applied to the interface.
Trap 2: switchport port-security maximum 2 switchport port-security…
This option incorrectly uses the 'protect' violation mode, which does not disable the interface. When the configured maximum of 2 MAC addresses is exceeded, the port continues to operate normally for permitted addresses, and frames from unknown MAC addresses are silently dropped. Because the interface remains up and forwarding, it fails the explicit requirement that the port be disabled when a violation occurs.
Trap 3: switchport port-security maximum 2 switchport port-security…
The 'restrict' violation mode drops frames from unauthorized MAC addresses and increments a violation counter, but it does not place the port in an err-disabled state. Even after the maximum of 2 addresses is exceeded, the interface stays operational and continues forwarding traffic for the already-learned secure MAC addresses. This behavior does not meet the requirement to disable the interface, making the option incorrect.
- A
switchport port-security maximum 2 switchport port-security violation err-disable
Why wrong: The command 'switchport port-security violation err-disable' is invalid on Cisco IOS because the violation mode parameter only accepts the keywords 'shutdown', 'protect', or 'restrict'. The err-disable state is not a configurable mode; it is a condition that results from entering the 'shutdown' violation mode when an unauthorized MAC address appears. Therefore, this option would be rejected by the CLI and cannot be applied to the interface.
- B
switchport port-security maximum 2 switchport port-security violation shutdown
This is the correct configuration. It sets the maximum number of secure MAC addresses to 2 and also specifies the violation action as 'shutdown'. When a third MAC address attempts to use the port, the switch places the interface in an err-disabled state, which completely disables the port and blocks all traffic, satisfying the requirement to disable the interface upon a violation.
- C
switchport port-security maximum 2 switchport port-security violation protect
Why wrong: This option incorrectly uses the 'protect' violation mode, which does not disable the interface. When the configured maximum of 2 MAC addresses is exceeded, the port continues to operate normally for permitted addresses, and frames from unknown MAC addresses are silently dropped. Because the interface remains up and forwarding, it fails the explicit requirement that the port be disabled when a violation occurs.
- D
switchport port-security maximum 2 switchport port-security violation restrict
Why wrong: The 'restrict' violation mode drops frames from unauthorized MAC addresses and increments a violation counter, but it does not place the port in an err-disabled state. Even after the maximum of 2 addresses is exceeded, the interface stays operational and continues forwarding traffic for the already-learned secure MAC addresses. This behavior does not meet the requirement to disable the interface, making the option incorrect.