网络二层安全DHCP snooping

概述:

DHCP Snoop功能主要是应用在较大网络中接入设备较多,人员复杂的环境,存在私接小路由器的情况从而造成地址获取混乱的情况,使用抑制dhcp相应报文的手段去限制只有正确的DHCP下发IP地址,从而保证网络的IP的统一性。

大体就是设置监控接口和信任端口,信任端口可以输入dhcp响应报文,监控端口只允许输入DHCP请求报文。

 

详细案例如下:

 

 

 

 

<HUAWEI> system-view
[HUAWEI] sysname SwitchB
[SwitchB] vlan batch 10
[SwitchB] interface gigabitethernet 0/0/1
[SwitchB-GigabitEthernet0/0/1] port link-type trunk
[SwitchB-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[SwitchB-GigabitEthernet0/0/1] quit
[SwitchB] dhcp enable
[SwitchB] interface vlanif 10
[SwitchB-Vlanif10] ip address 10.1.1.1 255.255.255.0
[SwitchB-Vlanif10] dhcp select interface //使能基于接口地址池分配IP地址功能
[SwitchB-Vlanif10] quit
 
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type trunk
[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[SwitchA-GigabitEthernet0/0/1] quit
[SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GigabitEthernet0/0/2] port link-type access
[SwitchA-GigabitEthernet0/0/2] port default vlan 10
[SwitchA-GigabitEthernet0/0/2] quit
[SwitchA] interface gigabitethernet 0/0/3
[SwitchA-GigabitEthernet0/0/3] port link-type access
[SwitchA-GigabitEthernet0/0/3] port default vlan 10
[SwitchA-GigabitEthernet0/0/3] quit
[SwitchA] dhcp enable
[SwitchA] dhcp snooping enable ipv4 //使能全局DHCP Snooping功能并配置设备仅处理DHCPv4报文,节约设备的CPU利用率
[SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GigabitEthernet0/0/2] dhcp snooping enable //使能用户侧接口的DHCP Snooping功能
[SwitchA-GigabitEthernet0/0/2] quit
[SwitchA] interface gigabitethernet 0/0/3
[SwitchA-GigabitEthernet0/0/3] dhcp snooping enable
[SwitchA-GigabitEthernet0/0/3] quit
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] dhcp snooping trusted //配置为信任接口,使得接入交换机只处理从该接口收到的DHCP服务器响应报文
[SwitchA-GigabitEthernet0/0/1] quit
 
验证命令:
display dhcp snooping configuration
display ip pool interface vlanif10 used
display dhcp snooping user-bind all

整体配置较为简单,也不复杂,注意不同厂家配置命令可能不太一样,但是基本思路是一致的。 遇到的时候可以上网自行搜索案例进行配置。

 

衍生技术

在配置完DHCP Snooping之后再说两个依赖这个技术衍生的技术,用得少但是特殊环境很好用的技术(启用只会有个小缺点就是消耗一些CPU资源)。

1、IPSG:IP源保护,IPSG用于同一个网络中,其他主机盗用自己的IP地址。如果配置了IPSG,那么每个端口只能有一个IP地址,就算你的主机关机了,但是只要别人没有占用你的端口,就不能用你的IP地址。这是一个很好的防止内部网络乱改IP的技术。默认IPSG只以源IP地址为条件过滤IP包,如果加上以源MAC地址为条件过滤的话,必须开启DHCP SNOOPING INFORMAITON OPTION 82功能。

静态绑定IPSG案例:

<HUAWEI> system-view
[HUAWEI] user-bind static ip-address 10.0.0.1 mac-address 0001-0001-0001 //创建静态绑定表项
[HUAWEI] user-bind static ip-address 10.0.0.11 mac-address 0002-0002-0002 //创建静态绑定表项
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] ip source check user-bind enable //使能IP报文检查功能
[HUAWEI-GigabitEthernet0/0/1] ip source check user-bind alarm enable //使能IP报文检查告警功能
[HUAWEI-GigabitEthernet0/0/1] ip source check user-bind alarm threshold 100 //配置IP报文检查告警阈值(100表示每秒的报文数)

动态绑定表IPSG案例:

<HUAWEI> system-view
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] ip source check user-bind enable //使能IP报文检查功能
[HUAWEI-GigabitEthernet0/0/1] ip source check user-bind alarm enable //使能IP报文检查告警功能
[HUAWEI-GigabitEthernet0/0/1] ip source check user-bind alarm threshold 100 //配置IP报文检查告警阈值 (100表示每秒的报文数)

配置ND Snooping功能

<HUAWEI> system-view
[HUAWEI] nd snooping enable //使能全局ND Snooping功能
[HUAWEI] interface gigabitethernet 0/0/1 //进入用户侧接口
[HUAWEI-GigabitEthernet0/0/1] nd snooping enable //使能ND Snooping功能
[HUAWEI-GigabitEthernet0/0/1] quit

[HUAWEI] interface gigabitethernet 0/0/2 //进入直接或间接连接网关的接口
[HUAWEI-GigabitEthernet0/0/2] nd snooping trusted //配置该接口为信任接口

 

 

2、DAI主要是防范中间人攻击的,中间人他并不会抢占别人的IP,而是通过arp欺骗,引导2层数据流从自己这里经过,从而可以截获他人信息。DAI利用snooping表中的端口和MAC项,来过滤非法的ARP应答,保证ARP请求可以得到正确的应答。

生成动态动态绑定表

<HUAWEI> system-view
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] arp anti-attack check user-bind enable                          //使能动态ARP检测功能
[HUAWEI-GigabitEthernet0/0/1] arp anti-attack check user-bind check-item ip-address //配置ARP报文绑定表匹配检查时只检查IP地址
[HUAWEI-GigabitEthernet0/0/1] arp anti-attack check user-bind alarm enable               //使能动态ARP检测丢弃报文告警功能。
[HUAWEI-GigabitEthernet0/0/1] arp anti-attack check user-bind alarm threshold 100    //配置动态ARP检测丢弃报文阈值。(100表示每秒的报文数)

配置端口安全功能

<HUAWEI> system-view
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] port-security enable //使能端口安全功能
[HUAWEI-GigabitEthernet0/0/1] port-security max-mac-num 1 //配置端口安全MAC地址学习限制数
[HUAWEI-GigabitEthernet0/0/1] port-security protect-action restrict //配置端口安全保护动作
[HUAWEI-GigabitEthernet0/0/1] port-security aging-time 100 //配置端口安全动态MAC地址的老化时间

配置端口隔离功能

<HUAWEI> system-view
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] port-isolate enable      //配置该接口的端口隔离功能

 

posted @ 2020-11-10 11:23  大安技术随笔  阅读(1468)  评论(0编辑  收藏  举报