From 6e8762852e99a731696dd8ef8a777f7295e3318f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=97=AD=E4=B8=9C?= <3228676708@qq.com> Date: Thu, 9 May 2024 14:53:31 +0000 Subject: [PATCH] =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E5=AE=89=E5=85=A8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 马旭东 <3228676708@qq.com> --- ...11\345\205\250\350\256\276\347\275\256.md" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "01\351\251\254\346\227\255\344\270\234/2024.05.08-\347\253\257\345\217\243\345\256\211\345\205\250\350\256\276\347\275\256.md" diff --git "a/01\351\251\254\346\227\255\344\270\234/2024.05.08-\347\253\257\345\217\243\345\256\211\345\205\250\350\256\276\347\275\256.md" "b/01\351\251\254\346\227\255\344\270\234/2024.05.08-\347\253\257\345\217\243\345\256\211\345\205\250\350\256\276\347\275\256.md" new file mode 100644 index 0000000..d1224c5 --- /dev/null +++ "b/01\351\251\254\346\227\255\344\270\234/2024.05.08-\347\253\257\345\217\243\345\256\211\345\205\250\350\256\276\347\275\256.md" @@ -0,0 +1,23 @@ +# 交换机端口安全的配置 + +```js +// 1.选择要进行安全设置的端口 +Switch(config)#int f0/1 +// 2.启用交换机接口的接口安全设置 +Switch(config-if)#switchport port-security // 直接这么写会报提示 +//Command rejected: FastEthernet0/1 is a dynamic port. 因为端口默认是动态的。要改成访问模式access +// 3.改成访问模式access +Switch(config-if)#switchport mode access +Switch(config-if)#switchport port-security // 再次启用交换机接口的接口安全设置 +// 启动安全设置后,还要做三件事,才能生效 +Switch(config-if)#switchport port-security maximum 1 // 设置最大允许连接的终端数量1 +Switch(config-if)#switchport port-security violation shutdown //设置超过最大连接数的违规设备的处理方式 +Switch(config-if)#switchport port-security mac-address sticky //绑定正确的MAC地址 + + +// 如何测试是否生效,前提是交换机要记录到正确的MAC地址 +//为了让交换机记录到第一次正确的MAC地址,需要ping一次, +// 要重新启用被安全规则关闭的端口,先手动关闭一次,再手动开启。 +Switch#clear port-security sticky // 清除交换机已经记录的安全MAC地址,重新开始记录 +``` + -- Gitee