我们的机器很多时候都是通过 NAT 上网的,有时候需要查询出口的 IP。
在桌面端
在桌面端可以使用浏览器打开 chaip、111 和 skk 等网站获得 IP(不是广告)。
在命令行
下面是一些在使用 curl 获得 ip 的接口:
cip.cc(国内)
1 2 3 4 5 6 7 8 9 10
| $ curl cip.cc IP : remove 地址 : 中国 安徽 合肥 运营商 : 中国科学技术大学
数据二 : 安徽省合肥市 | 中国科学技术大学
数据三 : 中国安徽合肥 | 教育网
URL : http://www.cip.cc/ip.remove
|
纯 ip 可使用: $ curl ip.cip.cc
myip.ipip.net(国内)
1 2
| $ curl myip.ipip.net 当前 IP:remove 来自于:中国 安徽 合肥 教育网
|
myip.ustclug.org(国内)
1 2
| $ curl myip.ustclug.org renturned-ip
|
ipinfo.io(国外)
1 2 3 4 5 6 7 8 9 10 11 12
| $ curl ipinfo.io { "ip": "remove", "hostname": "ec2-remove.ap-east-1.compute.amazonaws.com", "city": "Hong Kong", "region": "Central and Western", "country": "HK", "loc": "remove,remove", "org": "AS16509 Amazon.com, Inc.", "timezone": "Asia/Hong_Kong", "readme": "https://ipinfo.io/missingauth" }%
|
ifconfig.me(国外)
1 2
| $ curl ifconfig.me renturned-ip%
|
我会不定时去检测各接口的可用性,本文可能会更新。