> For the complete documentation index, see [llms.txt](https://docs.ipcheck.ing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ipcheck.ing/knowledge-base/zh/network-tests/proxy-rule-test.md).

# 代理规则测试

## 它的作用

大多数代理和 VPN 客户端通过以下方式路由流量： **规则**：这个域名直连，那个走日本节点，另一个走工作服务器。这通常称为分流路由或基于规则的路由。

问题在于规则是沉默的。没有任何提示告诉你某条规则是否真的匹配了，或者流量是否悄悄落到了你的默认策略上。

**规则测试** — 列为 *代理规则测试* 在本手册中 — 可以解决这个问题。它为你提供： **8 个测试域名**:

```
ptest-1.ipcheck.ing
ptest-2.ipcheck.ing
...
ptest-8.ipcheck.ing
```

你在客户端中把每个域名指向不同的规则组。然后 MyIP 会依次打开这 8 个域名，并显示每个域名出去时使用的出口 IP。每个域名一张卡片，总共 8 张。

{% hint style="info" %}
这个工具适用于使用规则文件的代理或 VPN 客户端。如果你只是使用一个带开关的简单 VPN 应用，就不需要它——请看 [我的 VPN 或代理在工作吗？](/knowledge-base/zh/diagnose/is-my-vpn-working.md) 。
{% endhint %}

## 如何设置

{% stepper %}
{% step %}

### 将规则添加到你的客户端

打开客户端的配置，为每个测试域名添加一条规则，每条都指向不同的策略或代理组。具体语法取决于你的客户端；一种常见格式是 `DOMAIN,ptest-3.ipcheck.ing,POLICY`.

{% code title="代理规则" overflow="wrap" %}

```ini
# 规则测试
DOMAIN,ptest-1.ipcheck.ing,Proxy1
DOMAIN,ptest-2.ipcheck.ing,Proxy2
DOMAIN,ptest-3.ipcheck.ing,Proxy3
DOMAIN,ptest-4.ipcheck.ing,Proxy4
DOMAIN,ptest-5.ipcheck.ing,Proxy5
DOMAIN,ptest-6.ipcheck.ing,Proxy6
DOMAIN,ptest-7.ipcheck.ing,Proxy7
DOMAIN,ptest-8.ipcheck.ing,Proxy8
```

{% endcode %}

替换 `Proxy1` … `Proxy8` 为你实际想测试的策略或组名。你不必使用全部 8 个。
{% endstep %}

{% step %}

### 重新加载配置

规则只有在客户端重新加载后才会生效。重启客户端，或者使用它的重新加载按钮。
{% endstep %}

{% step %}

### 打开工具

打开 **规则测试** 在高级工具中。打开后它会立即开始检查这 8 个域名。使用 **全部刷新** 在更改规则后再次运行它。
{% endstep %}
{% endstepper %}

<details>

<summary>主面板的额外规则</summary>

该项目还建议使用以下规则，这样仪表板就可以并排显示你的真实 IP 和代理后的 IP：

```ini
# IP 测试
IP-CIDR,1.0.0.2/32,Proxy,no-resolve
IP-CIDR6,2606:4700:4700::1111/128,Proxy,no-resolve
DOMAIN,4.ipcheck.ing,DIRECT
DOMAIN,6.ipcheck.ing,DIRECT
```

</details>

## 读取结果

每张卡片显示一个槽位：

| 字段          | 它告诉你什么                       |
| ----------- | ---------------------------- |
| `#1` … `#8` | 该卡片属于哪个测试域名                  |
| 域名          | `ptest-N.ipcheck.ing`，即请求的地址 |
| IP          | 请求实际来自的出口 IP                 |
| ISP         | 拥有该 IP 的公司                   |
| 代理区域        | 出口所在的国家                      |

现在对比这些卡片：

* **卡片之间的 IP 不同** — 每条规则都走向了不同的出口。你的分流路由正常工作。
* **两张卡片显示相同的 IP** — 两条规则最终到了同一个出口。要么这两个策略指向同一个节点，要么其中一条规则根本没有匹配，而是落到了和另一条相同的默认项。
* **一张卡片显示你的家庭 ISP 和你所在的国家** — 这个槽位直连了，没有走代理。如果这是你本来想要的，那就是正确的；如果不是，那就是错误的。
* **一张卡片显示意外的国家** — 那条规则匹配到了与你想法不同的组。检查规则顺序：大多数客户端会应用 *第一个* 匹配到的规则，所以上方较宽泛的规则可能会吞掉下方更具体的规则。

### 状态标签

| 标签        | 含义            |
| --------- | ------------- |
| 等待测试或测试错误 | 检查尚未完成，或者无法完成 |
| 测试错误      | 该域名完全无法访问     |

某张卡片上持续出现错误，通常意味着它所映射到的策略已失效、无法访问，或正在阻止请求。每张卡片都出错，则指向的是你的客户端或连接，而不是规则。

## 需要注意的事项

* 这些是 **域名** 规则。如果你的配置是按 IP 段、GeoIP 或应用程序来路由，那么这里不会触发那些规则。
* 你的客户端可能会缓存 DNS 响应或连接。如果某个更改没有体现出来，请重新加载客户端并按 **全部刷新**.
* 所显示的国家是出口节点看起来所在的国家，这不一定等于服务器物理所在的位置。请看 [GeoIP：IP 定位如何工作](/knowledge-base/zh/concepts/geoip-explained.md).

## 下一步做什么

* 确认代理已应用于普通浏览 → [我的 VPN 或代理在工作吗？](/knowledge-base/zh/diagnose/is-my-vpn-working.md)
* 某个网站看到的 IP 与你预期不同 → [为什么网站看到的 IP 不同？](/knowledge-base/zh/diagnose/why-do-sites-see-a-different-ip.md)
* 检查 DNS 是否走同一路由 → [DNS 泄漏测试](/knowledge-base/zh/connection-tools/dns-leak-test.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.ipcheck.ing/knowledge-base/zh/network-tests/proxy-rule-test.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
