设为首页 收藏本站
查看: 946|回复: 0

[经验分享] 交换机安全 802.1X、port-security、DHCP SNOOP、DAI、VACL、SPAN RSPAN

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-9-17 09:15:57 | 显示全部楼层 |阅读模式
端口和MAC绑定:port-security   

基于DHCP的端口和IP,MAC绑定:ip source guard   

基于DHCP的防止ARP攻击:DAI   

防止DHCP攻击:DHCP Snooping   

cisco所有局域网缓解技术都在这里了!   

常用的方式:   

1、802.1X,端口认证,dot1x,也称为IBNS(注:IBNS包括port-security):基于身份的网络安全; 很多名字,有些烦   

当流量来到某个端口,需要和ACS交互,认证之后得到授权,才可以访问网络,前提是CLIENT必须支持802.1X方式,如安装某个软件   

Extensible Authentication Protocol Over Lan(EAPOL)   使用这个协议来传递认证授权信息   

示例配置:   

Router#configure terminal   

Router(config)#aaa new-model   

Router(config)#aaa authentication dot1x default group radius   

Switch(config)#radius-server host 10.200.200.1 auth-port 1633 key radkey   

Router(config)#dot1x system-auth-control 起用DOT1X功能   

Router(config)#interface fa0/0   

Router(config-if)#dot1x port-control auto   

AUTO是常用的方式,正常的通过认证和授权过程   

强制授权方式:不通过认证,总是可用状态   

强制不授权方式:实质上类似关闭了该接口,总是不可用   

可选配置:   

Switch(config)#interface fa0/3   

Switch(config-if)#dot1x reauthentication   

Switch(config-if)#dot1x timeout reauth-period 7200   

2小时后重新认证   

Switch#dot1x re-authenticate interface fa0/3   

现在重新认证,注意:如果会话已经建立,此方式不断开会话   

Switch#dot1x initialize interface fa0/3   

初始化认证,此时断开会话   

Switch(config)#interface fa0/3   

Switch(config-if)#dot1x timeout quiet-period 45   

45秒之后才能发起下一次认证请求   

Switch(config)#interface fa0/3   

Switch(config-if)#dot1x timeout tx-period 90 默认是30S   

Switch(config-if)#dot1x max-req count 4   

客户端需要输入认证信息,通过该端口应答AAA服务器,如果交换机没有收到用户的这个信息,交换机发给客户端的重传信息,30S发一次,共4次   

Switch#configure terminal   

Switch(config)#interface fastethernet0/3   

Switch(config-if)#dot1x port-control auto   

Switch(config-if)#dot1x host-mode multi-host   

默认是一个主机,当使用多个主机模式,必须使用AUTO方式授权,当一个主机成功授权,其他主机都可以访问网络;   

当授权失败,例如重认证失败或LOG OFF,所有主机都不可以使用该端口   

Switch#configure terminal   

Switch(config)#dot1x guest-vlan supplicant   

Switch(config)#interface fa0/3   

Switch(config-if)#dot1x guest-vlan 2   

未得到授权的进入VLAN2,提供了灵活性   

注意:1、VLAN2必须是在本交换机激活的,计划分配给游客使用;2、VLAN2信息不会被VTP传递出去   

Switch(config)#interface fa0/3   

Switch(config-if)#dot1x default   

回到默认设置   

show dot1x [all] | [interface interface-id] | [statistics interface interface-id] [{ | begin | exclude | include} expression]   

Switch#sho dot1x all   

Dot1x Info for interface FastEthernet0/3   

----------------------------------------------------   

Supplicant MAC 0040.4513.075b   

AuthSM State = AUTHENTICATED   

BendSM State = IDLE   

PortStatus = AUTHORIZED   

MaxReq = 2   

HostMode = Single   

Port Control = Auto   

QuietPeriod = 60 Seconds   

Re-authentication = Enabled   

ReAuthPeriod = 120 Seconds   

ServerTimeout = 30 Seconds   

SuppTimeout = 30 Seconds   

TxPeriod = 30 Seconds   

Guest-Vlan = 0debug dot1x {errors | events | packets | registry | state-machine | all}   

2、端口安全,解决CAM表溢出攻击(有种MACOF的工具,每分钟可以产生155000个MAC地址,去轰击CAM表,从而使合法主机的要求都必须被FLOOD)   

示例配置:   

Switch#configure terminal   

Switch(config)#interface fastethernet0/0   

Switch(config-if)#switchport mode access   

Switch(config-if)#switchport port-security   

Switch(config-if)#switchport port-security maximum 20 这里默认是1   

Switch(config-if)#switchport port-security mac-address sticky   

保存学习到的地址到RUN CONFIG文件中,避免手动配置的麻烦,并省去动态学习所消耗的资源   

switchport port-security violation {protect | restrict | shutdown}   

三个参数解释:   

保护:当达到某个设定的MAC数量,后来的未知MAC不再解析,直接丢弃,且不产生通知   

限制:当达到某个设定的MAC数量,后来的未知MAC不再解析,直接丢弃,产生通知,如SNMP TRAP、SYSLOG信息,并增加违反记数;这里有个问题,恶意攻击会产生大量的类似信息,给网络带来不利。   

关闭:当达到某个设定的MAC数量,后来的未知MAC不再解析,直接关闭该端口,除非手动开启,或改变端口安全策略   

端口安全需要全部手动配置,增加工作量,下面的两种方式   

DHCP SNOOP   

如网吧的管理员使用DHCP分配地址的时候执行IP和MAC地址的捆绑   

Switch#configure terminal   

Switch(config)#ip dhcp snooping   

Switch(config)#ip dhcp snooping vlan 34   

Switch(config)#ip dhcp snooping information option   

Switch(config)#interface fa0/0 连接DHCP服务器的接口   

Switch(config-if)#ip dhcp snooping limit rate 70   

Switch(config-if)#ip dhcp snooping trust 指定该接口为信任接口,将获得DHCP服务器所分配的地址,   

其他接口所发生的DHCP行为将被否决   

DAI   

动态ARP审查,调用ACL和DHCP SNOOP的IP-TO-MAC数据库   

Switch#configure terminal   

Switch(config)#ip arp inspection filter这里调用ACL 注意,只能调用ARP ACL,该ACL优先与IP-TO-MAC表被审查,   

也就是说,即使有绑定项存在,如果被ARP-ACL拒绝,也不能通过   

Switch(config)#ip arp inspection vlan 34   

Switch(config)#interface fa0/0   

Switch(config-if)#ip arp inspection trust 连接到DHCP服务器的接口,调用该接口上的DHCP SNOOP的IP-TO-MAC表,   

默认连接到主机的接口都是不信任的接口   

Switch(config-if)#ip arp inspection limit rate 20 burst interval 2   

不信任接口限制为每秒14个ARP请求,信任接口默认不受限制,这里修改为每秒20   

Switch(config-if)#exit   

Switch(config)#ip arp inspection log-buffer entries 64 记录拒绝信息64条   

注意:DHCP SNOOP只提供IP-TO-MAC绑定表,本身不参与流量策略,只是防止DHCP欺骗,而对任何IP和MAC欺骗   

是没有能力阻止的,但是它提供这样一张表给DAI调用,以防止MAC欺骗。   

ip arp-inspection 仅仅对违规的ARP包进行过滤,不对IP包和其他包起作用。   

ip source verify 会对绑定接口的IP或者IP+MAC进行限制   


3、VACL   

Configuring VACLs for Catalyst 6500 Traffic Capture   

Router(Config)# access-list 110 permit tcp any 172.12.31.0.0.0.0.255 eq 80   

Router(config)# vlan access-map my_map   

Router(config-access-map)# match ip address 110   

Router(config-access-map)# action forward capture   

Router(config)# vlan filter my_map 10-12,15   

Router(config)# interface fa 5/7   

Router(config-if) switchport capture allowed vlan 10-12, 15   

4、SPAN、RSPAN   

基于源端口和基于源VLAN的两种监控方式   

RX、TX、BOTH 三种流量方向   

VLAN MONITOR只能监控入站流,即RX,在该源VLAN中的物理端口都将成为源端口向目标端口COPY流   

可以分配多个源端口或VLAN的RX流量到目的端口   

不能监控多个端口的出站流,可以监控单个端口的出站流   

最多只能配置两个监控会话   

源端口和目标端口是分离的   

可以将TRUNK端口配置成源端口,然后使用VLAN过滤想要被分析的流,但是此命令不影响正常的流量转发   

过滤功能不能使用在基于源VLAN的情况下   

目标端口:   

不能是源端口或反射端口   

不参加二层协议:CDP VTP PAGP LACP DTP STP   

在本地SPAN中,目标端口和源端口是同一交换机   

一次只能参加一个SPAN会话,即不能在一个端口上配置两个SPAN会话   

不能是EC成员   

如果目标端口是一个源VLAN成员,则这个VLAN的流量不能被MONITOR,其他VLAN可以被MONITOR   

802.1X与SWITCHPORT PORT-SECURITY必须在目标端口关闭   

SPAN可以MONITOR二层协议信息,RSPAN则不能   

IDS或IPS设备对流量唯一的影响是:根据IPS IDS策略,对可能的攻击行为做出处理,如RESET TCP连接等;并不去干涉正常流量的转发   

SPAN交换机端口分析,简单的SPAN只需要两个命令即可   

monitor sess 1 sour int f1/4   

monitor sess 1 dest int f1/9   

此例将F1/4的流量发送到F1/9被分析   

Switch(config)# no monitor session 2 删除语法   

Switch(config)# monitor session 2 source vlan 1 - 3 rx   

Switch(config)# monitor session 2 destination interface gigabitethernet0/7   

Switch(config)# monitor session 2 source vlan 10 rx   

Switch(config)# end   

在所有的端口上监控VLAN1-3的收到的流量,发送到G0/7被分析,然后附加VLAN10的流量也被分析   

Switch(config)# monitor session 2 source interface gigabitethernet0/4 rx   

Switch(config)# monitor session 2 filter vlan 1 - 5 , 9   

Switch(config)# monitor session 2 destination interface gigabitethernet0/8   

Switch(config)# end   

监控G0/4上收到的只包括VLAN1-5 VLAN9的流量,发送到G0/8端口被分析   

注意与上例的区别:也就是说在定义源流量的时候是有两种方式的,一种是源端口的流量,一种是VLAN流量   

RSPAN配置:   

第一步:在所有交换机上将一个指定的VLAN提供给远程SPAN使用   

Switch(config)# vlan 901   

Switch(config-vlan)# remote span   

Switch(config-vlan)# end   

第二步,配置源交换机   

Switch(config)# monitor session 1 source interface fastethernet0/10 tx   

Switch(config)# monitor session 1 source interface fastethernet0/2 rx   

Switch(config)# monitor session 1 source interface fastethernet0/3 rx   

Switch(config)# monitor session 1 source interface port-channel 102 rx   

Switch(config)# monitor session 1 destination remote vlan 901 reflector-port   

fastethernet0/1   

Switch(config)# end   

第三步,目标交换机配置   

Switch(config)# monitor session 1 source remote vlan 901   

Switch(config)# monitor session 1 destination interface fastethernet0/5   

Switch(config)# end   

This example shows how to disable received traffic monitoring on port 1, which was configured for   

bidirectional monitoring:   

Switch(config)# no monitor session 1 source interface fastEthernet0/1 rx   

The monitoring of traffic received on port 1 is disabled, but traffic sent from this port continues to be   

monitored.   

远程VLAN的监控   

Switch(config)# no monitor session 2   

Switch(config)# monitor session 2 source vlan 1 - 3 rx   

Switch(config)# monitor session 2 destination remote vlan 902 reflector-port   

gigabitethernet0/7   

Switch(config)# monitor session 2 source vlan 10 rx   

Switch(config)# end   

Switch(config)# no monitor session 2   

Switch(config)# monitor session 2 source interface gigabitethernet0/4 rx   

Switch(config)# monitor session 2 filter vlan 1 - 5 , 9   

Switch(config)# monitor session 2 destination remote vlan 902 reflector-port   

gigabitethernet0/8   

Switch(config)# end   

检查SPAN   

Switch# show monitor session 1   

Session 1   

---------   

Type : Local Session   

Source Ports :   

RX Only : None   

TX Only : None   

Both : Fa0/4   

Source VLANs :   

RX Only : None   

TX Only : None   

Both : None   

Source RSPAN VLAN : None   

Destination Ports : Fa0/5   

Encapsulation: DOT1Q   

Ingress: Enabled, default VLAN = 5   

Reflector Port : None   

Filter VLANs : None   

Dest RSPAN VLAN : None



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-114730-1-1.html 上篇帖子: 组播 下篇帖子: Cisco交换机接口模式精解 交换机
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表