# 4.ARP网关保护功能

## 1.配置ARP网关保护功能

标签：

\#网关保护 #非法网关 #网关冲突

### 1.1 ARP网关保护功能简介

在设备上不与网关相连的接口上配置此功能，可以防止伪造网关攻击。

在接口上配置此功能后，当接口收到ARP报文时，将检查ARP报文的源IP地址是否和配置的被保护网关的IP地址相同。如果相同，则认为此报文非法，将其丢弃；否则，认为此报文合法，继续进行后续处理。

### 1.2 配置ARP网关保护功能

配置ARP网关保护功能，需要注意：

· **每个接口最多支持配置8个被保护的网关IP地址**。

· 不能在同一接口下同时配置命令**arp filter source**和**arp filter binding**。

· 本功能与ARP Detection功能配合使用时，先进行本功能检查，本功能检查通过后才会进行ARP Detection功能的处理。

表1-12 配置ARP网关保护功能

| 操作                       | 命令                                              | 说明                    |
| ------------------------ | ----------------------------------------------- | --------------------- |
| 进入系统视图                   | **system-view**                                 | -                     |
| 进入二层以太网接口/二层聚合接口视图       | **interface** *interface-type interface-number* | -                     |
| 开启ARP网关保护功能，配置被保护的网关IP地址 | **arp filter source** *ip-address*              | 缺省情况下，ARP网关保护功能处于关闭状态 |

### 1.3 ARP网关保护功能配置举例

#### **1. 组网需求**

与AC相连的无线客户端Client 2进行了仿造网关Switch（IP地址为10.1.1.1）的ARP攻击，导致与AC相连的设备与网关Switch 通信时错误发往了错误的Client 2。

要求：通过配置防止这种仿造网关攻击。

#### **2. 组网图**

图1-5 配置ARP网关保护功能组网图

![img](https://typore-img.oss-cn-beijing.aliyuncs.com/Typecho/img/2022/20220531115059.png)

#### **3. 配置步骤**

\# 在AC上配置ARP网关保护功能。

```
<AC> system-view
[AC] interface gigabitethernet 1/0/1
[AC-GigabitEthernet1/0/1] arp filter source 10.1.1.1
[AC-GigabitEthernet1/0/1] quit
[AC] interface gigabitethernet 1/0/2
[AC-GigabitEthernet1/0/2] arp filter source 10.1.1.1
```

完成上述配置后，对于Client 2发送的伪造的源IP地址为网关IP地址的ARP报文将会被丢弃，不会再被转发。

引用：

{% embed url="<http://www.h3c.com/cn/d_202006/1299786_30005_0.htm#_Toc41904141>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chjina.com/it-zhi-shi-ku/lu-you-jiao-huan/hua-san/4.arp-wang-guan-bao-hu-gong-neng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
