目录

eNSP实战配置交换机端口安全

目录

【eNSP实战】配置交换机端口安全

拓扑图

https://i-blog.csdnimg.cn/direct/9d6e73c32f254a619563563fff927239.png

目的:让交换机端口与主机mac绑定,防止私接主机。

主机PC配置不展示,按照图中配置即可。

开始配置之前,使用PC1 ping 一遍PC2、PC3、PC4、PC5,让交换机mac地址表刷新一下记录。

LSW1查看mac地址表

https://i-blog.csdnimg.cn/direct/b06aea816f3647e3a0e5ac7ae6e2dc1b.png

LSW1配置端口安全,将1-3口与主机PC1、PC2、PC3进行绑定

[LSW1]port-group eth1to3    # 添加端口组eth1to3
[LSW1-port-group-eth1to3]group-member Ethernet 0/0/1 to Ethernet 0/0/3    # 添加组成员
[LSW1-port-group-eth1to3]port-security enable    # 启动端口安全
[LSW1-port-group-eth1to3]port-security protect-action shutdown    # 违反安全规定,关闭端口
[LSW1-port-group-eth1to3]port-security max-mac-num 1        # 设置最大mac数量
[LSW1-port-group-eth1to3]port-security mac-address sticky    # 将现有端口与mac地址绑定
[LSW1-port-group-eth1to3]quit

配置完成后,再使用PC1 ping 一遍其他PC,使LSW1交换机刷新MAC地址表。

再次查看LSW1的mac地址表

https://i-blog.csdnimg.cn/direct/2791fd0a21294843a7bad7978595201c.png

可以看到 1 到 3 口都与主机mac地址绑定了,type 类型也指定了sticky。LSW2配置与之差不多,自信配置即可。