Switch Port Security
Switch port security is a network security feature that allows you to control and restrict access to a switch port based on the MAC (Media Access Control) address of the devices connected to it. This feature helps prevent unauthorized devices from connecting to the network and can be particularly useful in securing physical access to network ports. Below are the steps to configure and verify switch port security on a Cisco switch:
Configuration Steps:
Access Configuration Mode:
- Access the switch's command-line interface (CLI) and enter configuration mode.
bashSwitch> enable Switch# configure terminalEnable Port Security on an Interface:
- Navigate to the interface that you want to configure port security for.
bashSwitch(config)# interface interface_type interface_number- For example, to configure port security on GigabitEthernet 0/1:
bashSwitch(config)# interface GigabitEthernet0/1Enable Port Security on the Interface:
- Enable port security on the selected interface.
bashSwitch(config-if)# switchport port-securitySet the Maximum Number of Allowed MAC Addresses:
- Specify the maximum number of allowed MAC addresses on the interface. The default is usually 1.
bashSwitch(config-if)# switchport port-security maximum max_addresses- For example, to allow up to 2 MAC addresses:
bashSwitch(config-if)# switchport port-security maximum 2Configure the Port Security Violation Mode:
- Specify how the switch should react when a violation occurs (e.g., when an unauthorized device is connected). Common violation modes are "shutdown," "restrict," or "protect."
bashSwitch(config-if)# switchport port-security violation {shutdown | restrict | protect}- For example, to shut down the port when a violation occurs:
bashSwitch(config-if)# switchport port-security violation shutdownSet the Allowed MAC Addresses (Optional):
- If necessary, you can manually configure the allowed MAC addresses for the port.
bashSwitch(config-if)# switchport port-security mac-address mac_address- This is useful if you want to explicitly allow specific devices to connect to the port.
Verify the Port Security Configuration:
- To verify the port security configuration on the switch, use the following command:
bashSwitch# show port-security interface interface_type interface_number- This command displays information about the configured port security settings on the selected interface.
Verification Steps:
After configuring port security, you can verify its operation to ensure that it is correctly restricting access to the switch port. Here's how to do that:
Check Port Security Status:
- Use the following command to check the port security status and violations on the interface:
bashSwitch# show port-security interface interface_type interface_number- This command provides information about the current status of port security on the interface.
Monitor Violation Counts:
- You can monitor violation counts to see how many times the port security violation action has been triggered:
bashSwitch# show port-security- This command displays information about all interfaces with port security enabled.
Port security helps enhance network security by controlling the devices that can access a switch port. Unauthorized devices are prevented from connecting, and violation actions can be configured to respond to security breaches.
Comments
Post a Comment