ensp 做 DHCP snooping防护

前言

1,DHCP Snooping是DHCP的一种安全特性,通过截获DHCP Client和DHCPServer之间的DHCP报文并进行分析处理,可以过滤不信任的DHCP报文并建立和维护一个DHCP Snooping绑定表。
2,该绑定表包括MAC地址、IP地址、租约时间、绑定类型、VLAN ID、接口等信息。
3,DHCP Snooping通过记录DHCPClient的IP地址与MAC地址的对应关系,保证合法用户能访问网络,作用相当于在DHCP Client和DHCPServer之间建立一道防火墙。
4,DHCP Snooping可以解决设备应用DHCP时遇到DHCP DoS(Denial ofService)攻击、DHCP Server仿冒攻击、DHCP仿冒续租报文攻击等问题。

如图所示,在这里我们模拟把PC3作为客户端,路由器AR1作为真的DHCP服务器,路由器AR2作为假的服务器(做为“黑客”服务器)。交换机LSW1应用在用户网络PC3和DHCP服务器的网络之间,为防止 jia DHCP Server仿冒(AR2)攻击,要求在LSW1上的GE 0/0/2端口应用DHCP Snooping功能,把用户侧的接口配置为Untrusted模式,把运营商网络侧的接口配置为Trusted模式,同时配置DHCP Reply报文丢弃告警功能。

实验拓扑图
在这里插入图片描述
(注意:12.1.1.0/24和13.1.1.0/24网段任意配置做实验)

AR1-real DHCP server的配置:(真服务器)

[ar1-real-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[ar1-real-GigabitEthernet0/0/0]dhcp select global
[ar1-real]dhcp enable
[ar1-real]ip pool dhcp
[ar1-real-ip-pool-dhcp]network 12.1.1.0  mask 255.255.255.0
[ar1-real-ip-pool-dhcp]gateway-list 12.1.1.1
[ar1-real-ip-pool-dhcp]dns-list 12.1.1.1

PC3获取的ip地址为:(此时的PC3客户端是从AR1真的DHCP服务器获取到的IP地址)

在这里插入图片描述
AR2-jia DHCP server 的配置:

[ar2-jia]int g0/0/0
[ar2-jia-GigabitEthernet0/0/0]ip address 13.1.1.1 24
[ar2-jia-GigabitEthernet0/0/0]dhcp select interface

PC3重新获取ip地址为:
此时的PC3获取到的IP地址不稳定,可能是从仿冒者那里获取的13.1.1.0/24网段的IP地址

在这里插入图片描述
抓包查看:
在这里插入图片描述

然后我们在LSW1连接AR1 real dhcp server 的接口做snooping功能。

LSW1交换机开启snooping功能:

[LSW1]dhcp enable
[LSW1]dhcp snooping enable

[LSW1-vlan1]dhcp snooping enable

配置指定接口为Trusted模式
[LSW1]int g0/0/2
[LSW1-GigabitEthernet0/0/2]dhcp snooping trusted

同时开启DHCP Reply报文丢弃告警功能
[LSW1-GigabitEthernet0/0/2]dhcp snooping alarm dhcp-reply enable threshold 120

PC3重新获取IP地址(多次执行ipconfig /renew发现没有获取仿冒者的IP地址段)
在这里插入图片描述
查看LSW1的mac绑定列表

[LSW1-GigabitEthernet0/0/2]dis dhcp snooping user-bind vlan 1
在这里插入图片描述
此时PC3的mac被绑定在LSW1的GE 0/0/2接口上了
这样就简单实现了DHCP snooping防护

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夏日的清晨

谢谢,只求点赞哟

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值