博威---云架构决胜云计算

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: network

DAI施工文件 - 防ARP/MAC等,安全构建网络中关键的第一步: 基础架构的安全

[复制链接]
 楼主| 发表于 2007-12-27 10:16:49 | 显示全部楼层
cisco的DAI技术


ARP防范在全部是Cisco交换网络里,可以通过帮定每台设备的ip和mac地址可以解决。但是这样做比较麻烦,
可以用思科 Dynamic ARP Inspection 机制解决。
防范方法
  思科 Dynamic ARP Inspection (DAI)在交换机上提供IP地址和MAC地址的绑定, 并动态建立绑定关系。
DAI 以 DHCP Snooping绑定表为基础,对于没有使用DHCP的服务器个别机器可以采用静态添加ARP access-list实现。
DAI配置针对VLAN,对于同一VLAN内的接口可以开启DAI也可以关闭。通过DAI可以控制某个端口的ARP请求报文数量。
通过这些技术可以防范“中间人”攻击。
  3.3配置示例
IOS 全局命令:
ip dhcp snooping vlan 100,200
no ip dhcp snooping information option
ip dhcp snooping
ip arp inspection vlan 100,200 /* 定义对哪些 VLAN 进行 ARP 报文检测
ip arp inspection log-buffer entries 1024
ip arp inspection log-buffer logs 1024 interval 10
IOS 接口命令:
ip dhcp snooping trust
ip arp inspection trust /* 定义哪些接口是信任接口,通常是网络设备接口, TRUNK 接口等
ip arp inspection limit rate 15 (pps) /* 定义接口每秒 ARP 报文数量
对于没有使用 DHCP 设备可以采用下面办法:
arp access-list static-arp
permit ip host 10.66.227.5 mac host 0009.6b88.d387
ip arp inspection filter static-arp vlan 201
  3.3配置DAI后的效果:
在配置 DAI技术的接口上,用户端不能采用指定地址地址将接入网络。
由于 DAI检查 DHCP snooping绑定表中的IP和MAC对应关系,无法实施中间人攻击,攻击工具失效。
下表为实施中间人攻击是交换机的警告:
3w0d: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Fa5/16,
vlan 1.([000b.db1d.6ccd/192.168.1.200/0000.0000.0000/192.168.1.2
由于对 ARP请求报文做了速度限制,客户端无法进行认为或者病毒进行的IP扫描、探测等行为,如果发生这些行为,
交换机马上报警或直接切断扫描机器。如下表所示:
3w0d: %SW_DAI-4-PACKET_RATE_EXCEEDED: 16 packets received in 184 milliseconds on Fa5/30. ******报警
3w0d: %PM-4-ERR_DISABLE: arp-inspection error detected on Fa5/30, putting Fa5/ 30 in err-disable state ******切断端口
I49-4500-1#.....sh int f.5/30
FastEthernet5/30 is down, line protocol is down (err-disabled)
Hardware is Fast Ethernet Port , address is 0002.b90e .3f 4d (bia 0002.b90e .3f 4d)
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
I49-4500-1#......
用户获取 IP地址后,用户不能修改IP或MAC,如果用户同时修改IP和MAC必须是网络内部合法的IP和MAC才可,
对于这种修改可以使用下面讲到的 IP Source Guard技术来防范。下表为手动指定IP的报警:
3w0d: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Fa5/30,
vlan 1.([000d.6078.2d95/192.168.1.100/0000.0000.0000/192.168.1.100/01:52:28 UTC Fri Dec 29 2000 ])
 楼主| 发表于 2008-1-2 13:35:24 | 显示全部楼层
在2960交换机上打开DAI的命令
clear ip arp inspection statistics (2960,12.2(50)SE)
debug platform ip arp inspection (2960,12.2(50)SE)
ip arp inspection filter vlan (2960,12.2(50)SE)
ip arp inspection limit (2960,12.2(50)SE)
ip arp inspection log-buffer (2960,12.2(50)SE)
ip arp inspection trust (2960,12.2(50)SE)
ip arp inspection validate (2960,12.2(50)SE)
ip arp inspection vlan (2960,12.2(50)SE)
ip arp inspection vlan logging (2960,12.2(50)SE)
show ip arp inspection (2960,12.2(50)SE)


ip arp inspection vlan vlan-range
ip arp inspection validate {[src-mac] [dst-mac] [ip [allow zeros] ]}
 楼主| 发表于 2008-1-4 20:53:58 | 显示全部楼层
解决IP地址冲突的方法--DHCP SNOOPING  
使用的方法是采用DHCP方式为用户分配IP,然后限定这些用户只能使用动态IP的方式,如果改成静态IP的方式则不能连接上网络;也就是使用了DHCP SNOOPING功能。
例子:
version 12.1
no service pad
service timestamps debug uptime
service timestamps log uptime
no service p assword-encryption
service compress-config
!
hostname C4-2_4506
!
enable password xxxxxxx!
clock timezone GMT 8
ip subnet-zero


no ip domain-lookup
!
ip dhcp snooping vlan 180-181 // 对哪些VLAN 进行限制
ip dhcp snooping
ip arp inspection vlan 180-181
ip arp inspection validate src-mac dst-mac ip




errdisable recovery cause udld
errdisable recovery cause bpduguard
errdisable recovery cause security-violation
errdisable recovery cause channel-misconfig
errdisable recovery cause pagp-flap
errdisable recovery cause dtp-flap
errdisable recovery cause link-flap
errdisable recovery cause l2ptguard
errdisable recovery cause psecure-violation
errdisable recovery cause gbic-invalid
errdisable recovery cause dhcp-rate-limit
errdisable recovery cause unicast-flood
errdisable recovery cause vmps
errdisable recovery cause arp-inspection
errdisable recovery interval 30
spanning-tree extend system-id
!
!

interface GigabitEthernet2/1 // 对该端口接入的用户进行限制,可以下联交换机
ip arp inspection limit rate 100
arp timeout 2
ip dhcp snooping limit rate 100
!



interface GigabitEthernet2/2
ip arp inspection limit rate 100
arp timeout 2
ip dhcp snooping limit rate 100
!
interface GigabitEthernet2/3
ip arp inspection limit rate 100
arp timeout 2
ip dhcp snooping limit rate 100
!
interface GigabitEthernet2/4
ip arp inspection limit rate 100
arp timeout 2
ip dhcp snooping limit rate 100
--More--

编者注:对不需要明确地址的所有人的时候是一个很好的解决办法。另外,可以查看www.cisco.com
IP Source Guard
Similar to DHCP snooping, this feature is enabled on a DHCP snooping untrusted Layer 2 port. Initially, all IP traffic on the port is blocked except for DHCP packets that are captured by the DHCP snooping process. When a client receives a valid IP address from the DHCP server, or when a static IP source binding is configured by the user, a per-port and VLAN Access Control List (PACL) is installed on the port. This process restricts the client IP traffic to those source IP addresses configured in the binding; any IP traffic with a source IP address other than that in the IP source binding will be filtered out. This filtering limits a host's ability to attack the network by claiming neighbor host's IP address.
 楼主| 发表于 2008-1-5 20:11:00 | 显示全部楼层
又一个

思科交换机如何防范典型欺骗和攻击.rar

173.57 KB, 下载次数: 3

 楼主| 发表于 2008-1-30 19:45:46 | 显示全部楼层
发表于 2008-2-20 11:03:19 | 显示全部楼层

内容还没有来的及看完,大概就扫一眼就知道比较经典.

希望孙总经常添加些经典的配置 顶一下.
 楼主| 发表于 2008-2-20 14:05:25 | 显示全部楼层
DHCP SNOOPING总结

在cisco设备中的配置
在cisco网络环境下,boot request在经过了启用DHCP SNOOPING特性的设备上时,会在DHCP数据包中插入option 82的选项(具体见RFC3046),这个时候,boot request中数据包中的gateway ip address:为全0,所以一旦dhcp relay 设备检测到这样的数据包,就会丢弃。
虽然dhcp s nooping是用来防止非法的dhcp server接入的,但是它一个重要作用是一旦客户端获得一个合法的dhcp offer。
启用dhcp snooping设备会在相应的接口下面记录所获得IP地址和客户端的mac地址。
这个是后面另外一个技术ARP inspection检测的一个依据。ARP inspection是用来检测arp请求的,防止非法的ARP请求。
认为是否合法的标准的是前面dhcp snooping时建立的那张表。因为那种表是dhcp server正常回应时建立起来的,
里面包括是正确的arp信息。如果这个时候有arp攻击信息,利用ARP inspection技术就可以拦截到这个非法的arp数据包。
其实利用这个方法,还可以防止用户任意修改IP地址,造成地址冲突的问题。
ip dhcp excluded-address 10.63.150.100 10.63.150.120    不由dhcp分配的地址
!
ip dhcp pool main      定义地址池
     network 10.63.144.0 255.255.255.0       定义地址池做用的网段及地址范围
     default-router 10.63.144.1      定义客户端的默认网关
     domain-name nbyzzj.cn        定义客户端所在域
     netbios-node-type h-node
     //为客户机配置节点模式(影响名称解释的顺利,如h-node等于先通过wins服务器解释)
     dns-server 10.60.12.11        定义客户端的dns
     lease 7      定义地址租约时间为7天
ip dhcp snooping      打开dhcp snooping功能
ip dhcp snooping vlan 10-12,101-108,315     定义snooping作用的vlan
ip dhcp snooping database flash:dhcp-snooping.db      将绑定表保存在flash中,避免重启设备后,重新绑定

ip arp inspection vlan 10-12,101-108,315    定义arp inspection 作用的vlan,它是根据dhcp snooping binding表做判断的
ip arp inspection validate src-mac dst-mac ip     侦测有效客户端须满足src-mac dst-mac ip 均无错
ip arp inspection log-buffer entries 1024 inspection 日志大小
ip arp inspection log-buffer logs 1024 interval 300     inspection 日志刷新时间,interval太小会占用大量cpu时间
!
!
!
errdisable recovery cause udld
errdisable recovery cause bpduguard
errdisable recovery cause security-violation
errdisable recovery cause channel-misconfig
errdisable recovery cause pagp-flap
errdisable recovery cause dtp-flap
errdisable recovery cause link-flap
errdisable recovery cause gbic-invalid
errdisable recovery cause l2ptguard
errdisable recovery cause psecure-violation
errdisable recovery cause dhcp-rate-limit
errdisable recovery cause unicast-flood
errdisable recovery cause vmps
errdisable recovery cause arp-inspection
errdisable recovery interval 30
在开始应用Dynamic ARP Inspection时,交换机会记录大量的数据包,当端口通过的数据包过多时,
交换机会认为遭受DoS攻击,从而将端口自动errdisable,造成通信中断。为了解决这个问题,
我们需要加入命令errdisable recovery cause arp-inspection
no file verify auto
logging on      当logging关闭时会占用大量cpu资源,一定勿忘打开
no spanning-tree loopguard default      最好不要打开
ip source binding 0004.76f6.e3e9 vlan 315 10.63.150.100 interface Gi1/0/11      手动增加静态地址的条目
!
interface GigabitEthernet1/0/11
switchport trunk encapsulation dot1q
switchport mode trunk
ip arp inspection limit none
arp timeout 2
ip dhcp snooping limit rate 100
由于下连设备,为了避免inspection让端口errdisable,所以对arp的侦测不做限制,若直接为接入设备,
可使用ip arp inspection limit rate 100
相关命令:
sh logging       查看Dymatic Arp Inspection (DAI) 是否生效.
sh ip dhcp snooping binding       查看snooping是否生效
sh ip dhcp binding       看dhcp server 是否生效.
sh arp       看arp信息是否与 dhcp snooping binding表一致
下级设备若支持dhcp snooping 可这样配置:
ip dhcp snooping
int g0/1      上行端口
switchport trunk encapsulation dot1q
switchport mode trunk
ip dhcp snooping trust      定义此端口为信任端口,从此口来的dhcp server数据有效,可阻止其它dhcp server发送dhcp数据。
经实验,对于已存在于绑定表中的mac和ip对于关系的主机,不管是dhcp获得,还是静态指定,
只要符合这个表就可以了。如果表中没有就阻塞相应流量。
如果使用了dhcp中继服务,那需要在网关交换机上键入如下命令:
方法一:
    inter vlan10
     ip dhcp relay information trusted
方法二:
    switch(config)# ip dhcp relay information trust-all
发表于 2008-3-4 11:27:48 | 显示全部楼层
太精典了!
 楼主| 发表于 2008-3-25 09:45:15 | 显示全部楼层
具体看附件 目前已施工的部分,满足用户的初步需求: 1. 客户ip不可静态 2. 非法DHCP server不可入网 3. ip + mac绑定并检查 DAI, 来自普通PC的MAC地址欺骗/ARP欺骗可以初步缓解 4. 专用接口如打印,可以排除不使用dhcp
Untitled.jpg

各交换机端口配置.pdf

72.81 KB, 下载次数: 2

DHCP执行-简要-共享版.pdf

423.28 KB, 下载次数: 3

发表于 2008-5-24 21:32:10 | 显示全部楼层
看看~~~~~~~~~~~~~~~~~~~~~········
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|boway Inc. ( 冀ICP备10011147号 )

GMT+8, 2024-4-25 00:07 , Processed in 0.098250 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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