转自http://blog.csdn.net/kerr1992/article/details/36673365
在终端中输入 curl ipinfo.io 或者 curl ifconfig.me 即可通过IP地址检测网站提供的api获得取本机的外网IP,或者以 JSON 格式返回全部结果。
如:
$curl ipinfo.io { "ip": "124.193.193.25", "hostname": "No Hostname", "city": "Beijing", "region": "Beijing Shi", "country": "CN", "loc": "39.9289,116.3883", "org": "AS17816 China Unicom IP network China169 Guangdong province" }
转载于:https://blog.51cto.com/xoyabc/1704976