Configuring port security on a switch helps control access to the network by allowing only authorized devices to connect to specific switch ports. Port security can be configured to restrict access based on MAC addresses, limiting the number of MAC addresses allowed per port, and taking actions such as shutting down the port or sending alerts when security violations occur. Here's a step-by-step guide to configuring port security on a Cisco switch:
1. Access the Switch's CLI:
2. Enter Privileged EXEC Mode:
3. Enter Global Configuration Mode:
4. Select the Interface:
```
switch(config)# interface fastethernet 0/1 ```
5. Enable Port Security:
```
switch(config-if)# switchport port-security ```
6. Configure Port Security Parameters:
```
switch(config-if)# switchport port-security maximum <max-mac-addresses> switch(config-if)# switchport port-security violation {shutdown | restrict | protect} switch(config-if)# switchport port-security aging time <seconds> ```
7. (Optional) Specify Allowed MAC Addresses:
```
switch(config-if)# switchport port-security mac-address <mac-address> ```
8. (Optional) Enable Sticky MAC Addresses:
```
switch(config-if)# switchport port-security mac-address sticky ```
9. Verify Configuration:
```
switch# show port-security interface fastethernet 0/1 ```
10. Save Configuration:
```
switch# copy running-config startup-config ```
Once configured, port security will enforce the specified security policies on the configured switch port(s), allowing only authorized devices to connect and limiting the number of MAC addresses that can access the network through those ports. You can adjust the port security parameters and actions based on your specific security requirements.