转载自:https://www.ruijie.com.cn/fw/wt/32507/

一、组网需求

在DHCP自动获取的环境下,要求配置arp欺骗
要求服务器是手工配置静态ip地址,而且可以正常通信

二、组网拓扑

20138225662891.jpg

三、配置要点

动态防arp欺骗方案必须是在内网客户机绝大部分是自动获取的环境下实施的
内网如果有傻瓜交换机做接入,那么arp欺骗会在傻瓜交换机上扩散,但不会扩散到其他交换机上。

  1. 配置DHCP服务
  2. 配置ip dhcp snooping
  3. 配置 ip 源防护+arp-check 或 DAI,两种方案不能同时使用,推荐使用ip 源防护+arp-check的方案

下联客户端(电脑)必须是自动获取IP地址
不同的产品型号功能支持情况不一样

四、配置步骤

注意:配置之前建议使用 Ruijie#show interface status查看接口名称,常用接口名称有FastEthernet(百兆)、GigabitEthernet(千兆)和TenGigabitEthernet(万兆),以下配置以百兆接口为例

1)配置DHCP功能,如果DHCP不在此设备上的话,那么可以跳过这步配置。

参考 DHCP章节

2)配置ip dhcp snooping

Ruijie>enable 
Ruijie#configure terminal
Ruijie(config)#ip dhcp snooping   ------>全局开启DHCP snooping 功能
Ruijie(config)#interface FastEthernet 0/24    ------>上联接口或者连接DHCP 服务器接口
Ruijie(config-if-FastEthernet 0/24)# ip dhcp snooping trust

3)配置允许部分客户机手工配置静态ip地址

Ruijie(config)#ip dhcp snooping binding 0003.1111.1111 vlan 1 ip 192.168.1.3

方法一:ip 源防护+arp-check

4)配置ip 源防护+arp-check

10.2(5)之前版本的配置命令:

Ruijie(config)#interface FastEthernet 0/1
Ruijie(config-if-FastEthernet 0/1)# ip dhcp snooping address-bind  ------> 打开接口的DHCP snooping绑定功能
Ruijie(config-if-FastEthernet 0/1)#arp-check  auto   ------>开启防arp功能
Ruijie(config)#interface FastEthernet 0/2
Ruijie(config-if-FastEthernet 0/2)# ip dhcp snooping address-bind  ------> 打开接口的DHCP snooping绑定功能
Ruijie(config-if-FastEthernet 0/2)#arp-check  auto

10.2(5)以后版本的配置命令:

Ruijie(config)#interface FastEthernet 0/1
Ruijie(config-if-FastEthernet 0/1)#ip verify source port-security ------>开启防止客户端手动配置IP地址功能
Ruijie(config-if-FastEthernet 0/1)#arp-check      ------>开启防arp功能
Ruijie(config)#interface FastEthernet 0/2
Ruijie(config-if-FastEthernet 0/2)#ip verify source port-security------>开启防止客户端手动配置IP地址功能
Ruijie(config-if-FastEthernet 0/2)#arp-check

注:接服务器的端口不用配置

方法二:DAI

4)配置DAI

Ruijie(config)#ip arp inspection vlan 1   ------>在vlan 1 里开启动态arp检测(DAI)
Ruijie(config)#interface FastEthernet 0/24    ------>上联接口或者连接DHCP 服务器接口
Ruijie(config-if-FastEthernet 0/24)#ip arp inspection trust   ------>设置端口是可信任的,不检测arp

5)保存配置

Ruijie(config)#end
Ruijie#write                 ------>  确认配置正确,保存配置

五、验证命令

Ruijie#show ip dhcp snooping binding    查看DHCP Snooping 绑定数据库的用户信息
Total number of bindings: 0
MacAddress         IpAddress       Lease(sec)   Type          VLAN  Interface
------------------ --------------- ----------
Ruijie#show ip source binding 查看通过DHCP Snooping 用户绑定数据库和静态绑定表项
MacAddress         IpAddress       Lease(sec)   Type          VLAN  Interface
------------------ --------------- ----------
Total number of bindings: 0

方法一验证命令:

Ruijie#show ip verify source   查看IP Source Guard 过滤表项
Interface            Filter-type Filter-mode Ip-address      Mac-address    VLAN
-------------------- ----------- -----------
FastEthernet 0/1     ip+mac      active      deny-all        deny-all

方法二验证命令:

Ruijie(config)# show ip arp inspection vlan
Vlan     Configuration
----     -------------
1         Enable