IP查询
致力于普及 IPv6 ,推进 IPv6 规模部署和应用
IPv4 查询归属地
IPv6 网络未开启IPv6,查看宽带如何开启IPv6
您的网络 访问优先
提示:手机默认开启 IPv6,宽带开启 IPv6 请参考 文档。
IPv6 地址查询新窗口打开 |
IPv6 Ping 测试新窗口打开 |
IPv6 网站开启检测新窗口打开 |
IPv6 网站测速新窗口打开
# 请勿用于商业用途,仅供个人测试学习之用,请遵守中国法律法规
# 查询本机外网IPv4地址
curl 4.ipw.cn
# 查询本机外网IPv6地址
curl 6.ipw.cn
# 测试网络是IPv4还是IPv6访问优先(访问IPv4/IPv6双栈站点,如果返回IPv6地址,则IPv6访问优先)
curl test.ipw.cn
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
#!/usr/bin/python3
# 请勿用于商业用途,仅供个人测试学习之用,请遵守中国法律法规
# 仅用于个人测试,比如添加服务器安全组白名单等,请勿用于生产环境
import requests
# 获取IPv4地址:https://ipv4.ipw.cn/api/ip/myip
# 获取IPv6地址:https://ipv6.ipw.cn/api/ip/myip
# 确认用户网络是IPv4还是IPv6访问优先:https://test.ipw.cn/api/ip/myip?json
r = requests.get('https://ipv6.ipw.cn/api/ip/myip')
clientIP = r.text
print(clientIP)
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
// 请勿用于商业用途,仅供个人测试学习之用,请遵守中国法律法规
// 仅用于个人测试,比如添加服务器安全组白名单等,请勿用于生产环境
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
// 获取IPv4地址:https://ipv4.ipw.cn/api/ip/myip
// 获取IPv6地址:https://ipv6.ipw.cn/api/ip/myip
// 确认用户网络是IPv4还是IPv6访问优先:https://test.ipw.cn/api/ip/myip?json
responseClient, errClient := http.Get("https://ipv6.ipw.cn/api/ip/myip")
if errClient != nil {
fmt.Printf("获取外网 IP 失败,请检查网络\n")
panic(errClient)
}
defer responseClient.Body.Close()
// 获取 http response 的 body
body, _ := ioutil.ReadAll(responseClient.Body)
clientIP := string(body)
print(clientIP)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!-- 请勿用于商业用途,仅供个人测试学习之用,请遵守中国法律法规 -->
<template>
<div>
访客IP: {{IP}},您的网络 {{IPVersion}} 访问优先 <br />
</div>
</template>
<script>
import Axios from "axios";
export default {
name: "Home",
data(){
return{
IP: "",
IPVersion: "",
}
},
headers:
{
'X-Requested-With': 'XMLHttpRequest',
'Access-Control-Allow-Origin': "*"
},
methods:{
getData(){
var that=this
var api = "https://test.ipw.cn/api/ip/myip?json";
Axios.get(api)
.then(function (res) {
// handle success
console.log(res.data);
console.log(res.data.IPVersion);
that.IP = res.data.IP
that.IPVersion = res.data.IPVersion
})
.catch(function (error) {
// handle error
console.log(error);
})
.then(function () {
// always executed
});
},
},
mounted(){
this.getData();
},
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51