、限制流量) 直接丢弃不符合绑定关系的报文,端口状态不变 配置灵活性 需分步骤配置端口安全与ARP静态映射,联动性较弱 提供一体化命令,支持批量绑定和动态学习转换 典型应用命令 switchport port-security 1 // 进入目标端口 Switch(config-if)# switchport mode access // 配置为接入端口 Switch(config-if)# switchport port-security // 启用端口安全 Switch(config-if)# switchport port-security mac-address sticky // 自动学习并固化端口MAC // 或手动指定 MAC:switchport port-security mac-address 0001.0203.0405 Switch(config-if)# switchport port-security maximum 1 // 限制端口最大MAC数量为1 Switch(config-if)# switchport port-security violation shutdown // 违规时关闭端口 (2)静态
SW-A(config-if-range)#switchport port-security maximum 2 SW-A(config-if-range)#switchport port-security max SW-B(config-if-range)#switchport port-security maximum 2 SW-B(config-if-range)#switchport port-security 开启端口安全 switchport port-security ! 设置最大Mac学习数为2 switchport port-security maximum 2 ! 设置超过措施:关闭端口 switchport port-security violation shutdown ! 开启端口安全 switchport port-security ! 设置最大Mac学习数为2 switchport port-security maximum 2 !
aging time { time } //time参数范围是1~1440分钟,默认为0表示不删除 Switch(config-if)#switchport port-security aging //启用端口安全 Switch(config-if)#switchport port-security maximum 1 //设置端口活跃 MAC 地址数量为1个 Switch(config-if )#switchport port-security aging time 1 //配置老化时间1分钟 Switch(config-if)#switchport port-security violation switchport port-security violation restrict switchport port-security mac-address 00E0.8F34.5B4D switchport port-security aging time 1
[H3C]port-security enable 第二步:配置端口允许最大安全的MAC地址数,端口安全允许某个端口下有多个用户通过认证,但是允许的用户数不能超过规定的最大值。 [H3C]port-security enable #系统模式下打开端口安全 [H3C]int G1/0/1 [H3C-GigabitEthernet1/0/1]port-security [H3C-GigabitEthernet1/0/1]undo port-security port-mode [H3C-GigabitEthernet1/0/1]port-security port-mode [H3C-GigabitEthernet1/0/1]undo port-security port-mode [H3C-GigabitEthernet1/0/1]port-security max-mac-count 64 [H3C-GigabitEthernet1/0/1]port-security port-mode autolearn [H3C-GigabitEthernet1/0/1]port-security
0/1----进入接口 switchport protected----将接口配置为保护口 switchport port-security----开启接口的端口安全功能 switchport port-security mac-address 0050.56c0.0008----配置绑定的mac地址 switchport port-security maximum 10----设置接口上安全地址的最大个数 switchport port-security violation ----设置处理违例的方式 protect
/0/1]port-security protect-action restrict //以上配置接口安全保护动作为restrict 进入接口视图,执行【port-security enable】命令, (可选)执行【port-security max-mac-num 1】命令,配置接口安全动态MAC学习限制数量。默认时,接口学习的MAC地址限制数量为1。 (可选)执行【port-security protect-action { protect | restrict | shutdown }】命令,配置接口安全保护动作。 /0/1]port-security protect-action restrict //以上配置接口安全保护动作为restrict [S1-GigabitEthernet0/0/1]port-security 执行【port-security mac-address sticky】命令,使能接口自动Sticky MAC功能。默认情况下,接口未使能Sticky MAC功能。
0/1 2、接口设为access模式 Switch(config-if)#switchport mode access 3、启用安全端口 Switch(config-if)#switchport port-security (查看mac-address绑定的几种方式,分别为静态绑定和粘滞绑定) Switch(config-if)#switchport port-security mac-address ? Switch(config-if)#switchport port-security mac-address 0001.C94E.1321 设置完成后,用主机pc0 ping pc2,然后可以在特权模式下通过以下命令查看以下 (ctrl+z,快速回到特权模式下) Switch#show port-security address 若将pc0与端口1的连线断掉,改用pc3接端口1。
1.0, (Cpld)4.0 [SLOT 1]RADIO1/0/1 (Hardware)Ver.E, (Driver)1.0, (Cpld)4.0 配置步骤 1,启用 port-security port-security enable 2, 配置无线接口,认证方式为 PSK interface WLAN-BSS2 # 配置无线端口 WLAN-BSS2 的端口安全模式为 psk。 port-security port-mode psk # 在接口 WLAN-BSS2 下使能 11key 类型的密钥协商功能。 port-security tx-key-type 11key # 在接口 WLAN-BSS2 下配置预共享密钥为 12345678。 port-security preshared-key pass-phrase 12345678 3, 配置无线服务模板(下面的 RSN 即 WPA2) # 创建一个 crypto 类型的服务模板 2。
sw: int gi0/0/1 port-security enable 开启端口安全,该接口就只允许一个mac地址通信 port-security mac-address sticky 开启mac地址自动粘贴 ,第一个用户的mac地址会自动被粘贴到该接口 port-security protect-action shutdown 将动作改为shutdown (可选) ?
五、端口安全配置 1、启用和禁用端口安全功能: 启用: Switch(config-if)# switchport port-security 禁用: Switch(config-if)# no switchport port-security 2、设置接口上安全地址的最大个数(1~128) Switch(config-if)#switchport port-security maximum 1 3、设置处理违例的方式 Switch(config-if)#switchport port-security violation shutdown //当发生端口安全违规时,交换机会采取的动作是将违规的接口关闭(shutdown ) 4、手工配置接口上的安全地址 Switch(config-if)#switchport port-security mac-address 00d0.d373.B060 //命令用于手工配置接口上的静态安全 5、查看安全配置: Switch#show port-security 六、设置广播风暴抑制功能 Switch(Config)#broadcast-suppression 参数:代表每秒钟允许通过的广播数据报的个数
maximum 2 // 配置最大允许2台设备接入 Switch0(config-if)# switchport port-security mac-address 0001.4272.5EE7 // 绑定MAC地址 Switch0(config-if)# switchport port-security mac-address 00D0.589B.0C35 Switch0(config-if)# switchport port-security violation shutdown // 配置违规后关闭指定端口 Switch0(config-if maximum 2 // 配置最大接入MAC地址为2 Switch0(config-if)# switchport port-security mac-address sticky // 自动获取接入设备 Switch0(config-if)# switchport port-security violation shutdown // 对违规设备拒绝服务 Switch0
group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/8 //创建端口组,成员端口1-3,命令都是一样的,所以3个端口弄成一个组,命令打一遍就行了,偷个懒; port-security enable //开启端口安全; port-security max-mac-num 1 //接口学习的安全MAC地址限制数量为1,就是一个接口只允许一个设备的意思; port-security mac-address sticky //开启接口Sticky MAC功能; port-security protect-action shutdown //发现非法接入设备,直接关闭端口,并上报告警。
端口安全与MAC地址绑定 interface GigabitEthernet 0/0/2 port-security enable # 开启端口安全 port-security max-mac-num 2 # 限制最大MAC地址数为2(防私接设备) port-security mac-address sticky # 自动绑定首次接入的MAC地址 三、链路聚合与负载均衡
MSW1(config-if)#int f0/3 MSW1(config-if)#sw mo acc MSW1(config)#int f0/2 MSW1(config-if)#switchport port-security //开启端口安全 MSW1(config-if)#switchport port-security maximum 1 //最大链接数为1 MSW1(config-if)#switchport port-security violation sh //违反模式为restrict MSW1(config-if)#switchport port-security mac-address 0001
1.可以在攻击机所连接端口配置Port Security特性,阻止攻击机发起的mac泛洪攻击 CS6200-28X-EI(config-if-ethernet1/0/5)#sw port-security #开启端口安全性 CS6200-28X-EI(config-if-ethernet1/0/5)#sw port-security maximum 5 #设置接口允许接入的最大MAC地址数量为5 CS6200-28X-EI(config-if-ethernet1/0/5)#sw port-security mac-address 00-0c-29-b0-81-4f #绑定指定的mac地址,并添加到交换机的运行配置中 ,交换机的端口收到源mac数据帧与设置的mac地址进行比较,如果一致则会转发,如果不一致,则会丢弃源mac的数据帧 DCRS(config-if-ethernet1/0/5)#sw port-security 有关其他安全违规操作可以使用DCRS(config-if-ethernet1/0/5)#sw port-security violation ?
] port-security aging-time 300 // 配置老化时间300s [Huawei-port-group] quit #----查询MAC地址绑定与分配 mac-address sticky 5489-9887-165B vlan 1 // 绑定指定的MAC地址 [Huawei] port-security protect-action shutdown mac-address sticky 5489-98B4-3791 vlan 1 [Huawei] port-security protect-action shutdown [Huawei] quit [Huawei] interface GigabitEthernet 0/0/3 [Huawei] port-security mac-address sticky 5489-98E3-0DCA vlan 1 [Huawei] port-security protect-action shutdown [Huawei] quit #----查询端口绑定情况-----------------------
] port-security aging-time 300 // 配置老化时间300s [Huawei-port-group] quit #----查询MAC地址绑定与分配 mac-address sticky 5489-9887-165B vlan 1 // 绑定指定的MAC地址 [Huawei] port-security protect-action shutdown mac-address sticky 5489-98B4-3791 vlan 1 [Huawei] port-security protect-action shutdown [Huawei] quit [Huawei] interface GigabitEthernet 0/0/3 [Huawei] port-security mac-address sticky 5489-98E3-0DCA vlan 1 [Huawei] port-security protect-action shutdown [Huawei] quit #----查询端口绑定情况-----------------------
一开始由于交换机提示的问题以为在全局上只能启用MAC地址认证或者802.1x其中的一种,后来尝试只需全局启用 # port-security enable # 就同时开启了MAC地址认证和802.1x 2.架构 (1)交换机端口设定801.1x和MAC auth的port-security方式,交换机会按 PAP的MAC地址 -> EAP的802.1x 顺序给RADIUS Server发送请求报文,
启用端口安全: interface GigabitEthernet0/1 switchport port-security # 启用端口安全 switchport port-security maximum 1 # 限制每个端口仅允许1个MAC switchport port-security violation shutdown # 违规时关闭端口 5.
# access-list 100 permit tcp 192.168.1.0 0.0.0.255 any eq 80 端口安全 Switch(config-if)# switchport port-security # 启用端口安全 Switch(config-if)# switchport port-security maximum 1 # 限制 MAC 数量 Switch(config-if )# switchport port-security violation shutdown # 违规关闭端口 六、IP 服务 NAT 配置 R1(config)# ip nat inside