抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

我们的机器很多时候都是通过 NAT 上网的,有时候需要查询出口的 IP。

我会不定时去检测各接口的可用性,本文可能会更新。

本文最后更新于 2022/1/14。

在桌面端

在桌面端可以使用浏览器打开 ip.skk.moe科大反向代理服务器ip111.cnchaip.org 等网站获得各出口 IP(不是广告)

以及在 CloudFlare 上的 ip.yyw.moe

在命令行

下面是一些在使用 curl 获得 ip 的接口(使用 IPRETURN 隐藏真实 IP),按个人喜好程度分别降序排列:

国内

myip.ipip.net

1
2
$ curl myip.ipip.net
当前 IP:IPRETURN 来自于:中国 安徽 合肥 教育网

myip.ustclug.org

1
2
$ curl myip.ustclug.org
IPRETURN

home.ustc.edu.cn

1
2
$ curl home.ustc.edu.cn/cgi-bin/myip
document.write('IPRETURN');

cip.cc

1
2
3
4
5
6
7
8
9
10
$ curl cip.cc
IP : IPRETURN
地址 : 中国 安徽 合肥
运营商 : 中国科学技术大学

数据二 : 安徽省合肥市 | 中国科学技术大学

数据三 : 中国安徽合肥 | 教育网

URL : http://www.cip.cc/ip.IPRETURN

想得到纯 ip 可使用: $ curl ip.cip.cc

su.baidu.com(不可用)

返回了内网 IP,已不可用,感觉百度在反向代理上有点问题。

1
2
3
4
5
6
7
$ curl su.baidu.com/cdn-cgi/trace
s=10204
h=su.baidu.com
c=172.17.1.20
t=2022-03-31 19:13:07
v=HTTP/1.1
ua=curl/7.82.0

国外

若对方和你都接入了 CloudFlare 的网络(比如 Argo Tunnel、Warp),那么对面可以用 CloudFlare 的接口获得你真实的 IP。下用「透过 CloudFlare。」表示。

cloudflare

透过 CloudFlare。

cloudflare.com/cdn-cgi/trace1.1.1.1/cdn-cgi/trace

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ curl cloudflare.com/cdn-cgi/trace
fl=23f362
h=cloudflare.com
ip=IPRETURN
ts=1613735825.275
visit_scheme=http
uag=curl/7.58.0
colo=HKG
http=http/1.1
loc=HK
tls=off
sni=off
warp=off
gateway=off

ip.sb

透过 CloudFlare。

1
2
$ curl ip.sb
IPRETURN

还有 {ipv4,ipv6}.ip.sb 可用,指定查询的 IP 类型,以及如下的 GeoIP:

1
2
$ curl https://api.ip.sb/geoip -A 'totoro'
{"organization":"M247 Ltd","longitude":113.9866,"city":"Tuen Mun","timezone":"Asia\/Hong_Kong","isp":"M247 Ltd","offset":28800,"region":"Tuen Mun","asn":9009,"asn_organization":"M247 Ltd","country":"Hong Kong","ip":"IPRETURN","latitude":22.4022,"continent_code":"AS","country_code":"HK","region_code":"NTM"}

ip.yyw.moe

透过 CloudFlare。

可靠性不作保证。

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
$ curl ip.yyw.moe
{
"ASN": "9009",
"Organization": "M247 Ltd",
"Colo": "HKG",
"Country": "HK",
"City": "Central",
"Continent": "AS",
"Latitude": "22.29080",
"Longitude": "114.15010",
"PostalCode": "undefined",
"MetroCode": "undefined",
"Region": "Central and Western District",
"RegionCode": "HCW",
"Timezone": "Asia/Hong_Kong",
"Date": "11/04/2022, 10:44:16",
"Protocol": "HTTP/2",
"tlsCipher": "AEAD-AES256-GCM-SHA384",
"tlsVersion": "TLSv1.3",
"Method": "GET",
"Host": "ip.yyw.moe",
"IP": "IPRETURN",
"UA": "curl/7.74.0",
"Language": "null"
}

ipv4.appspot.com

在 GCP 上,国内不可访问;_ipv4 接口返回了 ipv6 的地址_。

1
2
3
4
$ curl -4 ipv4.appspot.com
IPRETURN
$ curl ipv4.appspot.com
IPRETURN

ip.gs

1
2
$ curl https://ip.gs/json
{"ip":"IPRETURN","ip_decimal":IPRETURN,"country":"Hong Kong","country_iso":"HK","country_eu":false,"region_name":"Central and Western District","region_code":"HCW","city":"Central","latitude":22.2908,"longitude":114.1501,"time_zone":"Asia/Hong_Kong","asn":"AS9009","asn_org":"M247 Ltd","user_agent":{"product":"curl","version":"7.74.0","raw_value":"curl/7.74.0"}}

ipinfo.io

1
2
3
4
5
6
7
8
9
10
11
12
$ curl ipinfo.io
{
"ip": "IPRETURN",
"city": "Buffalo",
"region": "New York",
"country": "US",
"loc": "42.8865,-78.8784",
"org": "AS13335 Cloudflare, Inc.",
"postal": "14202",
"timezone": "America/New_York",
"readme": "https://ipinfo.io/missingauth"
}

ifconfig.co

透过 CloudFlare。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ curl ifconfig.co/json
{
"ip": "IPRETURN",
"ip_decimal": IPRETURN,
"country": "Hong Kong",
"country_iso": "HK",
"country_eu": false,
"region_name": "Yuen Long District",
"region_code": "NYL",
"city": "Yuen Long",
"latitude": 22.4333,
"longitude": 114.0333,
"time_zone": "Asia/Hong_Kong",
"asn": "AS9269",
"asn_org": "Hong Kong Broadband Network Ltd.",
"hostname": "138019188254.ctinets.com",
"user_agent": {
"product": "curl",
"version": "7.58.0",
"raw_value": "curl/7.58.0"
}
}

sspanel.net

国内不可访问,没有对 curl 做适配。

https://sspanel.net/ip.php