思科Cisco交换机配置——端口安全配置实验案例图文详解

本文讲述了思科Cisco交换机端口安全配置实验。分享给大家供大家参考,具体如下:

一、实验目的:在交换机f0/1端口上设置安全配置,使PC1和PC2两台机中只有一台机器能够正常通信,另一台通信时端口则会自动关闭

二、拓扑图如下

思科Cisco交换机配置——端口安全配置实验案例图文详解

三、实验步骤:

1、先给各台主机配置IP地址(PC1PC2PC3)记录PC1PC2的其中一台主机的mac地址

思科Cisco交换机配置——端口安全配置实验案例图文详解

思科Cisco交换机配置——端口安全配置实验案例图文详解

思科Cisco交换机配置——端口安全配置实验案例图文详解

2、配置交换机S1

enable  --进入特权模式
config terminal  --进入全局配置模式
hostname S2  --修改交换机名为S1
interface f0/1  --进入到f0/1端口
shutdown  --关闭f0/1端口
switchport mode access  --修改端口模式
switchport port-security  --修改端口为安全模式
switchport port-security maximum 1  --配置mac地址最大数量为1
switchport port-security violation shutdown  --配置违反安全设置后的处理动作为关闭端口
switchport port-security mac-address 0009.7C2D.DC67  --将PC1或PC2其中一台的mac地址与端口绑定
no shutdown  --激活端口
end   --返回特权模式
copy running-config startup-config --保存配置

3、分别测试PC1PC2主机PingPC3主机

PC1:正常PIng通

思科Cisco交换机配置——端口安全配置实验案例图文详解

PC2:不能正常Ping通

思科Cisco交换机配置——端口安全配置实验案例图文详解

违反端口安全导致端口关闭(如下图,),若想再次启动需要进入到f0/1端口先shutdownno shutdown启动:

S1:

enable  --进入特权模式

config terminal  --进入全局配置模式

interface f0/1  --进入f0/1端口

shutdown  --关闭f0/1端口

no shutdown  --激活f0/1端口

思科Cisco交换机配置——端口安全配置实验案例图文详解