# IP 白名单

IP 白名单让来自登记源 IP 的请求免去 `Proxy-Authorization`——固定出口的服务器接入更简洁。本页讲控制台流程，API 见 [白名单 API](/helodata-zh/api-can-kao/whitelists.md)。

## 白名单作用范围

按产品不同：

| 产品  | 范围       |
| --- | -------- |
| 住宅  | 每**子账号** |
| 移动  | 每**子账号** |
| ISP | 每**批次**  |

同一来源 IP 可独立加入多个白名单，**没有全局白名单**。

## 添加 IP

### 子账号白名单（网关产品）

1. 左导航 → **{产品} → 子账号 → {子账号} → IP 白名单**。
2. **添加 IP**。
3. 填入：
   * **IP** 或 **CIDR**（IPv4 最宽 `/24`，IPv6 最宽 `/64`）
   * **Label**（你的备注，如 `prod-eu-west-1`）
4. **保存**。

60 秒内生效。

\[screenshot: IP 白名单面板带一条已添加条目]

### ISP 批次白名单

1. 左导航 → **ISP → 我的 IP → {批次} → IP 白名单**。
2. **添加 IP** —— 同表单。

批次白名单对该批次的**所有 IP** 生效。

## 删除

点击条目旁的垃圾桶。60 秒内生效。

## CIDR vs 单 IP

最宽 `/24`（IPv4）或 `/64`（IPv6）。

| 来源类型                  | 用法                 |
| --------------------- | ------------------ |
| 单台静态服务器               | 单个 `203.0.113.5`   |
| NAT 后的容器集群            | NAT IP（单条）         |
| Kubernetes 出口         | 集群出口网关的 NAT IP     |
| 同 ISP 多个 IP           | 多条单 IP（连续可用 `/24`） |
| 出口动态（笔记本、无 NAT 的自动扩缩） | **别用白名单**，改用用户名+密码 |

## 上限

| 范围        | 最大条目 |
| --------- | ---- |
| 每子账号（每产品） | 50   |
| 每 ISP 批次  | 50   |

`/24` 算 1 条，网关服务端展开。

## 查找出口 IP

要知道该把哪个 IP 加白名单，**在源机器上**（不走代理）跑：

```bash
curl https://ipv4.icanhazip.com
```

返回的就是源 IP。如果机器在 NAT / 负载均衡后，返回的是**出口** IP——这正是网关看到的。

## 白名单与密码并用

同一子账号下可同时启用两种模式——白名单 IP 免认证，其他来源仍需用户名密码。分阶段迁移到白名单时很有用。

## API 替代

```bash
curl -X POST -H "Authorization: Bearer API_KEY" \
     -d '{
       "subuser":"sub_01HX...",
       "product":"residential",
       "ip":"203.0.113.5",
       "label":"prod-eu-west-1"
     }' \
     https://api.helodata.com/v1/whitelists
```

完整 schema：[白名单 API](/helodata-zh/api-can-kao/whitelists.md)。

## 常见陷阱

* **加错了 IP** — 在笔记本上 `curl ipv4.icanhazip.com` 得到的是笔记本出口，不是生产机。请先 SSH 到生产机再查。
* **CIDR 过宽** — `/16` 不接受，请拆为多个 `/24`，或重新评估是否真需要那么大范围。
* **重新绑定子账号后忘了批次白名单** — ISP 批次换绑子账号不影响批次白名单（它是按批次而非按子账号维度，会保留）。


---

# 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.helodata.com/helodata-zh/kong-zhi-tai/whitelisting-ips.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.
