您的位置:首页 > 其它

交换机的端口安全

2012-12-28 10:51 141 查看
1、端口安全主要可以完成一下功能

① 限制接入交换机某个端口的MAC地址最大数量
② 可以限制接入交换机某个端口的MAC地址
③ 对于接入交换机某个端口所发生的违规情况进行处理
④ 防止arp欺骗***
2、端口安全的配置和验证
TP构建的拓扑图及地址分配




(1)设定SwitchA的F0/24端口最多可以接入3个MAC地址,并设定可接入的MAC地址为192.168.1.1--192.168.1.3三台计算机的MAC地址,违背处理为shutdown
Switch(config)#inter fastEthernet 0/24
Switch(config-if)#switchport mode access 端口安全只能在access模式(默认就是)
Switch(config-if)#switchport port-security 启动端口安全功能
Switch(config-if)#switchport port-security maximum 3 最多可以接3个MAC地址
Switch(config-if)#switchport port-security mac-address 0050.0F91.AE40 依次绑定计算机A、B、C的MAC地址
Switch(config-if)#switchport port-security mac-address 0002.1699.9ED3
Switch(config-if)#switchport port-security mac-address 0040.0BC9.A884
Switch(config-if)#switchport port-security violation shutdown 违背处理为shutdown
Switch(config-if)#exit
Switch(config)#exit
Switch#
(2)在SwitchA上使用命令show mac-address-table
Switch#show mac-address-table
Mac Address Table
-------------------------------------------

Vlan Mac Address Type Ports
---- ----------- -------- -----

1 0002.1699.9ed3 STATIC Fa0/24
1 0040.0bc9.a884 STATIC Fa0/24
1 0050.0f91.ae40 STATIC Fa0/24
可以看到端口和MAC地址之间的关系不再是动态的而是静态的
(3)查看f0/24端口的安全特性结果
Switch#show port-security interface fastEthernet 0/24
Port Security : Enabled
Port Status : Secure-up
Violation Mode : Shutdown+
Aging Time : 0 mins
Aging Type : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 3
Total MAC Addresses : 3
Configured MAC Addresses : 3
Sticky MAC Addresses : 0
Last Source Address:Vlan : 0000.0000.0000:0
Security Violation Count : 0
(4)完成上述配置后,192.168.1.1--192.168.1.4之间均能Ping通
(5)将192.168.1.4接入HUB,可以发现Switch的F0/24端口自动shutdown,如果需要恢复该端口,先移除192.168.1.4(如果不移除,过一会还shutdown的)在该端口下先用命令shutdown,再使用no shutdown
(6)将计算机A、B、C任意一台接入到除24端口以外的其他端口,该计算机无法与其他计算机通信。
(7)将192.168.1.4接入F0/1端口,进行静态绑定,绑定之后,192.168.1.4只有连接在f0/1端口可与其他计算机互ping通,连接在其他端口就不·行了。
Switch(config)#mac-address-table static 00D0.D343.3D8A vlan 1 interface fastEthernet 0/1
(8)但是在实际中,采用手工配置MAC地址和端口的静态关系是一项费事费力飞的工作,为了避免上述情况,思科交换机支持端口安全的sticky特性(粘性)如将第一步进行sticky配置如下:
Switch(config-if)#switchport mode access
Switch(config-if)#switchport port-security
Switch(config-if)#switchport port-security maximum 3
Switch(config-if)#switchport port-security mac-address sticky
Switch(config-if)#switchport port-security violation restrict 将违规采用限制的处理方式(即超过3计算机连接此端口,此端口不会关闭了)
Switch(config-if)#exit

以上配置是动态的学习3个MAC地址,并在交换机MAC表中转变为静态类型,多余的将会被拒绝接受。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  交换机 安全