本文共 2565 字,大约阅读时间需要 8 分钟。
Switch(config-if)#switchport port-security maximum 2
设置最大接入MAC地址数为2
Switch(config-if)#switchport port-security mac-address sticky 自动获得接入设备的MAC Switch(config-if)#switchport port-security violation ? 违规处理方式protect Security violation protect mode 保护- 丢弃数据,不告警restrict Security violation restrict mode 抵制 –丢弃数据,发告警shutdown Security violation shutdown mode 关闭- 丢弃数据,发告警并关闭链路Switch(config-if)#switchport port-security violation protect 选择违规处理方式为保护Switch(config-if)#endSwitch#Switch#show port-security address 查看地址表Secure Mac Address TableVlan Mac Address Type Ports Remaining Age
(mins)1 0002.4AA6.D46D SecureSticky FastEthernet0/1 -
1 0010.1108.D197 SecureSticky FastEthernet0/1 -Total Addresses in System (excluding one mac per port) : 1
Max Addresses limit in System (excluding one mac per port) : 1024验证试验,两台先接入的主机可以访问PC3 ,第三台不能访问PC3 说明试验成功 。
Switch#conf t
Switch(config)#Switch(config)#interface f0/1Switch(config-if)#no switchport port-security mac-address sticky 删除动态绑定Switch(config-if)#do show port addSecure Mac Address TableVlan Mac Address Type Ports Remaining Age
1 0002.4AA6.D46D SecureSticky FastEthernet0/1 -
动态绑定的地址还在1 0010.1108.D197 SecureSticky FastEthernet0/1 -Total Addresses in System (excluding one mac per port) : 1
Max Addresses limit in System (excluding one mac per port) : 1024Switch(config-if)#endSwitch#clear port-security sticky 清除动态绑定地址Switch#show port-security address Secure Mac Address TableVlan Mac Address Type Ports Remaining Age
(mins)Total Addresses in System (excluding one mac per port) : 0
Max Addresses limit in System (excluding one mac per port) : 1024Switch#conf t
Switch(config)#interface f0/1Switch(config-if)#switchport port-security mac-address 00D0.FF76.14ED 手动绑定PC的MACSwitch(config-if)#switchport port-security mac-address 0010.1108.D197PC的MAC地址需要你自己在pC 的命令提示符下获取,获取方法:ipconfig /all
验证试验,静态绑定的PC可以访问PC3 ,其他不可以访问PC3 ,证明试验成功 。
转载于:https://blog.51cto.com/ronning/2116012