> 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/dai-li-jian-ce-yu-yin-si-an-quan/ru-he-jian-ce-dai-li-shi-fou-sheng-xiao.md).

# 如何检测代理是否生效

在配置代理后，建议第一时间验证：

```
代理是否真正生效
```

否则可能出现：

* 实际仍在使用本机 IP
* 代理配置错误
* 浏览器未走代理
* 程序请求未经过代理

***

### 🌍 一、最简单的检测方法（推荐）

最直接的方法：

👉 检查“当前公网 IP 是否发生变化”

***

### ⚡ 二、使用 curl 快速检测（推荐）

执行以下命令：

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

***

### ✔ 正常返回示例

```json
{
  "ip": "203.0.113.10",
  "city": "Los Angeles",
  "region": "California",
  "country": "US"
}
```

如果返回的 IP：

```
不是你本机公网IP
```

👉 表示代理已经成功生效。

***

### 🌐 三、如何确认国家地区是否正确？

返回结果通常会显示：

* IP 地址
* 国家地区
* 城市
* 网络运营商

***

#### ✔ 示例：

```
country: US
```

说明当前已经获取到美国 IP。

***

### ✔ 如何判断代理已生效？

确认以下几点：

| 检查项       | 正常结果 |
| --------- | ---- |
| IP 是否变化   | ✔    |
| 国家是否正确    | ✔    |
| 请求是否成功返回  | ✔    |
| 是否与目标地区一致 | ✔    |

***

### 🖥 四、浏览器如何检测代理是否生效？

浏览器用户建议：

***

#### 方法1：访问 IP 检测网站

打开：

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

查看：

* 当前 IP
* 国家地区
* ASN 信息

***

#### 方法2：检查浏览器地区

例如：

* Google 搜索地区
* TikTok 推荐内容
* 网站语言变化

通常也能反映代理是否生效。

***

### ⚙️ 五、Python 如何检测代理？

#### 示例代码

```python
import requests

proxies = {
    "http": "http://username:password@us.ipwo.net:7878",
    "https": "http://username:password@us.ipwo.net:7878"
}

response = requests.get(
    "https://ipinfo.io",
    proxies=proxies,
    timeout=10
)

print(response.text)
```

***

### 🔄 六、为什么 IP 没有变化？

可能原因：

***

#### ❌ 代理没有真正生效

例如：

* 浏览器未开启代理
* 程序未读取代理配置
* 系统代理未启用

***

#### ❌ 使用了粘性会话

粘性模式下：

```
同一 Session 会保持同一 IP
```

属于正常现象。

***

#### ❌ 网站缓存导致

部分网站：

* 会缓存 IP 信息
* 不会实时刷新

建议：

* 清理缓存
* 使用无痕模式
* 更换检测网站

***

### 🌍 七、为什么地区和预期不一致？

可能原因：

* 当前 IP 已轮换
* 国家参数填写错误
* 目标网站数据库延迟

***

### ⚠️ 八、代理生效但网页打不开？

说明：

```
代理已连接
但目标网站访问失败
```

可能原因：

* 网站限制
* DNS 问题
* 当前网络环境异常

***

### 🔒 九、推荐使用海外网络环境

部分网络环境下：

* 代理可能无法稳定连接
* 请求可能超时

建议：

```
海外 VPS / 海外云服务器
```

通常更稳定。

***

### 🧪 十、推荐检测顺序（非常重要）

建议按以下顺序排查：

```
1. curl 测试
↓
2. 检查 IP 是否变化
↓
3. 检查国家地区
↓
4. 浏览器测试
↓
5. 正式接入业务
```

***

### 🚀 总结

判断代理是否生效的核心：

```
当前公网IP
是否已变成代理IP
```

***

#### ✔ 推荐最佳实践

* 先 curl 测试
* 再浏览器验证
* 最后接入业务环境

这样更容易定位问题。

***

## 📚 相关阅读

#### 推荐继续阅读：

* [什么是公网 IP](/dai-li-ji-chu-zhi-shi/shen-me-shi-gong-wang-ip.md)
* [如何检测本机公网 IP](/dai-li-ji-chu-zhi-shi/shen-me-shi-gong-wang-ip.md#ru-he-cha-kan-dang-qian-gong-wang-ip)
* [为什么需要海外网络环境](/dai-li-ji-chu-zhi-shi/wei-shen-me-xu-yao-hai-wai-wang-luo-huan-jing.md)
* [如何选择国家地区](/dai-li-ji-chu-zhi-shi/ru-he-xuan-ze-guo-jia-di-qu.md)
* [HTTP 与 SOCKS5 区别](/dai-li-ji-chu-zhi-shi/http-yu-socks5-qu-bie.md)
* [什么是轮换 IP](/dai-li-ji-chu-zhi-shi/shen-me-shi-lun-huan-ip.md)
* [什么是粘性会话](/dai-li-ji-chu-zhi-shi/shen-me-shi-nian-xing-hui-hua.md)
* [如何降低封禁风险](/dai-li-ji-chu-zhi-shi/ru-he-jiang-di-feng-jin-feng-xian.md)
* [IP 不生效](/gu-zhang-pai-chu/ip-bu-sheng-xiao.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.ipwo.net/dai-li-jian-ce-yu-yin-si-an-quan/ru-he-jian-ce-dai-li-shi-fou-sheng-xiao.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.
