DHCP Snooping + Dynamic ARP Inspection(DAI) 配置

在cisco设备中的配置
在cisco网络环境下,boot request在经过了启用DHCP SNOOPING特性的设备上时,会在DHCP数据包中插入option 82的选项(具体见RFC3046)
这个时候,boot request中数据包中的gateway ip address:为全0,所以一旦dhcp relay 设备检测到这样的数据包,就会丢弃。
虽然dhcp snooping是用来防止非法的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        定义客户端所在域
     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
晚上转载 最近在研究
本文转自 song8575 51CTO博客,原文链接:http://blog.51cto.com/song8575/107192

解决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 password-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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值