> 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-ip-di-qu.md).

# 如何检测IP地区

在使用代理后，除了确认“IP 是否变化”，更重要的是确认：

```
IP 是否属于目标国家/地区
```

否则可能出现：

* IP 已切换，但国家不对
* 实际走了错误节点
* 平台识别地区异常

***

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

👉 使用 IP 查询接口查看地区信息

***

### ✔ 方法1：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",
  "org": "ISP Network"
}
```

***

### ✔ 判断是否成功

确认以下字段：

| 字段      | 说明             |
| ------- | -------------- |
| country | 国家代码（US/JP/GB） |
| region  | 州 / 省          |
| city    | 城市             |
| ip      | 是否为代理IP        |

***

👉 如果 country 与你设置的地区一致，则说明 IP 地区正确。

***

## 🌐 二、使用浏览器检测 IP 地区

适合非开发用户：

访问以下网站：

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

或：

```
https://whatismyipaddress.com
```

***

### ✔ 页面会显示：

* IP 地址
* 国家
* 城市
* ISP
* 时区

***

### ✔ 判断方法：

```
显示国家 = 代理设置国家 → 成功
```

***

## 🧪 三、Python 检测 IP 地区

```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/json",
    proxies=proxies,
    timeout=10
)

print(response.json())
```

***

## 🌍 四、如何判断 IP 地区是否正确？

建议重点检查：

***

### ✔ 1. 国家是否匹配

```
US / JP / GB / DE / HK
```

必须与配置一致。

***

### ✔ 2. 城市是否合理

例如：

| 国家 | 常见城市                   |
| -- | ---------------------- |
| 美国 | Los Angeles / New York |
| 日本 | Tokyo / Osaka          |
| 英国 | London                 |

***

### ✔ 3. ISP 是否为住宅网络

例如：

* Comcast
* Verizon
* NTT
* SoftBank

👉 表示住宅 IP 更真实

***

## ⚠️ 五、为什么 IP 地区可能不一致？

***

### ❌ 1. 节点切换未生效

可能使用了旧 session。

***

### ❌ 2. 代理配置错误

例如：

* zone 参数错误
* 用户名写错国家

***

### ❌ 3. 使用了轮换 IP

轮换模式可能导致：

```
每次请求国家不同
```

***

### ❌ 4. 网站缓存影响

部分网站会：

* 缓存 IP 信息
* 延迟更新地区

***

## 🔄 六、轮换 IP 下如何判断地区？

如果你使用轮换模式：

👉 每次请求都可能不同 IP

建议：

```
连续请求 3 次以上观察趋势
```

***

## 📌 七、粘性 IP 下如何判断地区？

粘性模式：

```
同一个 session → IP 应保持一致
```

如果变化：

* session 未固定
* 代理未正确配置

***

## 🧭 八、推荐检测流程（非常重要）

建议按顺序检查：

```
1. curl 获取 IP
↓
2. 检查 country 字段
↓
3. 检查 city / ISP
↓
4. 浏览器验证
↓
5. 接入业务
```

***

## 🚀 九、快速判断口诀

```
IP变了 ≠ 成功
国家对了 ≠ 成功
稳定可用 + 地区正确 = 成功
```

***

## 📚 相关文章 / 相关阅读

* [如何检测代理是否生效](/dai-li-jian-ce-yu-yin-si-an-quan/ru-he-jian-ce-dai-li-shi-fou-sheng-xiao.md)
* [什么是公网 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)
* [如何降低封禁风险](/dai-li-ji-chu-zhi-shi/ru-he-jiang-di-feng-jin-feng-xian.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-ip-di-qu.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.
