我们的机器很多时候都是通过 NAT 上网的,有时候需要查询出口的 IP。
我会不定时去检测各接口的可用性,本文可能会更新。
在桌面端
在桌面端可以使用浏览器打开 ip.skk.moe、科大反向代理服务器、chaip.org 和 ip111.cn 等网站获得各出口 IP(不是广告)。
在命令行
下面是一些在使用 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
|
su.baidu.com
1 2 3 4 5 6 7
| $ curl su.baidu.com/cdn-cgi/trace s=11213 h=su.baidu.com c=IPRETURN t=2021-02-19 19:56:12 v=HTTP/1.1 ua=curl/7.58.0
|
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
国外
cloudflare
有 cloudflare.com/cdn-cgi/trace
、1.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
|
ipinfo.io
1 2 3 4 5 6 7 8 9 10 11 12
| $ curl ipinfo.io { "ip": "IPRETURN", "hostname": "138019188254.ctinets.com", "city": "Hong Kong", "region": "Central and Western", "country": "HK", "loc": "22.2783,114.1747", "org": "AS9269 Hong Kong Broadband Network Ltd.", "timezone": "Asia/Hong_Kong", "readme": "https://ipinfo.io/missingauth" }%
|
ip.sb
ifconfig.co
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" } }
|
ifconfig.me
1 2
| $ curl ifconfig.me IPRETURN%
|