> For the complete documentation index, see [llms.txt](https://docs.ipwo.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ipwo.net/huan-jing-zhun-bei/ru-he-jian-ce-ben-ji-gong-wang-ip.md).

# 如何检测本机公网IP

在[使用代理](/huo-qu-yu-pei-zhi-dai-li.md)或[配置 IP 白名单](/huo-qu-yu-pei-zhi-dai-li/ip-bai-ming-dan.md)前，建议先确认当前设备的公网 IP。

👉 公网 IP 是当前网络对外访问时显示的 IP 地址，常用于：

* 配置 API 白名单
* 检查代理是否生效
* 验证当前网络环境
* 排查连接问题

***

### 🌐 方法一：通过网页查看（推荐）

直接访问以下网站：

```
https://ipinfo.io
```

或：

```
https://api.ipify.org
```

***

#### 查看结果示例

```
123.123.123.123
```

👉 显示的即为当前公网 IP。

也可以在配置IP白名单时通过IPWO检测到当前IP，直接进行添加。

<figure><img src="/files/OlzfmMnhDHRsfsokTahW" alt=""><figcaption></figcaption></figure>

***

### ⚡ 方法二：使用命令行查看

#### Windows / macOS / Linux

打开终端后执行：

```bash
curl ipinfo.io
```

或：

```bash
curl api.ipify.org
```

***

#### 返回示例

```
123.123.123.123
```

***

### 🔍 如何判断代理是否生效？

#### 未使用代理时

访问 `ipinfo.io`：

👉 显示的是本机公网 IP。

***

#### 使用代理后

执行：

```bash
curl -x "us.ipwo.net:7878" -U "username:password" ipinfo.io
```

***

#### 如果返回：

* 不同于本机的 IP
* 对应代理地区 IP

👉 表示代理已成功生效。

***

### ⚠️ 注意事项

#### 公网 IP ≠ 本地 IP

以下属于本地 / 内网 IP：

```
192.168.x.x
10.x.x.x
172.x.x.x
```

👉 这些不能用于 API 白名单配置。

***

#### 家庭网络公网 IP 可能变化

部分网络环境：

* 家庭宽带
* 动态公网 IP
* 移动网络

公网 IP 可能会变化。

👉 如果 API 白名单频繁失效，建议重新检查公网 IP。

***

### 💡 使用建议

推荐在以下场景先检测公网 IP：

* 配置 API 白名单前
* 使用代理前后
* 更换网络后
* 排查连接问题时

***

### ❗ 常见问题

#### 为什么访问网站显示的 IP 和代理 IP 不一样？

可能原因：

* 请求未走代理
* 浏览器未正确配置代理
* 使用了系统代理或 VPN

***

#### 为什么不同网站显示的 IP 不同？

部分网站：

* 使用缓存
* 使用不同 IP 数据库

👉 一般属于正常情况。

***

#### 为什么我的公网 IP 会变化？

部分网络使用动态公网 IP：

👉 重启网络或切换网络后，公网 IP 可能发生变化。

***

### 总结

检测公网 IP 的推荐方式：

```
访问 ipinfo.io
↓
查看当前公网 IP
↓
配置白名单或验证代理
```

👉 建议优先使用 `ipinfo.io` 进行测试与验证

***


---

# 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.ipwo.net/huan-jing-zhun-bei/ru-he-jian-ce-ben-ji-gong-wang-ip.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.
