命令行下查看出口IP
你想知道你的公网IP地址是多少,通常的做法是去百度输入IP就会显示你的公网IP地址和IP归属地,但我今天遇到一个问题:命令下如何查看电脑的公网IP?以下分享解决这个问题的方法。
http://www.cip.cc/
# curl cip.cc ------------------------------------------- IP : 115.148.41.67 地址 : 中国 江西 吉安 运营商 : 电信 数据二 : 江西省吉安市 | 电信 数据三 : 中国江西省吉安市 | 电信 URL : http://www.cip.cc/115.148.41.67
国外 https://ipinfo.io/
# curl ipinfo.io ------------------------------------------- { "ip": "115.148.41.67", "city": "Tiantuo", "region": "Jiangxi", "country": "CN", "loc": "26.8994,116.5700", "org": "AS4134 CHINANET-BACKBONE" }
https://www.ipip.net/
# curl myip.ipip.net ------------------------------------------- 当前 IP:115.148.41.67 来自于:中国 江西 吉安 电信
国外 https://ifconfig.me/
# curl ifconfig.me ------------------------------------------- 115.148.41.67
curl ifconfig.io
# curl ifconfig.io ------------------------------------------- 115.148.41.67
curl httpbin.org/ip
# curl httpbin.org/ip ------------------------------------------- { "origin": "115.148.41.67, 115.148.41.67" }
curl http://members.3322.org/dyndns/getip
# curl http://members.3322.org/dyndns/getip ------------------------------------------- 115.148.41.67
PS:当然还有一些其他网站也提供相关服务,以上是我使用过的几个命令。