不管是在家裏還是辦公室,或者是公司的主機,很多時候都是在內網中,也就是說很多都是通過 NAT上網的,有時候需要查詢下出口的公網IP,如果有瀏覽器,可以用百度, google搜 ip 這個關鍵詞得到公網IP,告訴大家幾種命令行查詢IP
[root@pd ~]# curl ipinfo.io
{
"ip": "101.37.145.243",
"city": "",
"region": "",
"country": "CN",
"loc": "34.7725,113.7270",
"org": "AS37963 Hangzhou Alibaba Advertising Co.,Ltd."
}
[root@pd ~]# curl cip.cc
IP : 101.37.145.243
地址 : 中國 浙江 杭州
運營商 : 阿里雲/電信/聯通/移動/鐵通/教育網
數據二 : 浙江省杭州市 | 阿里雲
數據三 : 中國浙江省杭州市 | 阿里雲
URL : http://www.cip.cc/101.37.145.243
[root@pd ~]# curl ip.cn
當前 IP:101.37.145.243 來自:廣東省深圳市 阿里雲
[root@pd ~]# curl myip.ipip.net
當前 IP:101.37.145.243 來自於:中國 浙江 杭州 阿里雲/電信/聯通/移動/鐵通/教育網
[root@pd ~]# curl ifconfig.me
101.37.145.243