快速獲取外網 IP

簡介

現在很多雲主機都是使用 nat,沒有在機器上直接添加外網 IP 了。這時候要獲取到外網 IP 就需要一些服務的支持。



有哪些網站可以獲取到呢



IPIP.NET https://www.ipip.net/ip.htmlIPCN https://ip.cn/搜狐 http://pv.sohu.com/cityjsonIP138 https://www.ip138.com/Ping, mtr, dig and TCP port check from multiple locations http://ping.pe/icanhazip.com http://icanhazip.com/Comprehensive IP address data, IP geolocation API and database - IPinfo.io https://ipinfo.io/IP Address Lookup / IPv4 / IPv6 - IP.SB https://ip.sb/



命令行直接獲取

很多服務器都是Linux,沒有安裝圖形界面,就需要直接通過命令行去獲取了

<code>curl https://ip.cn
/<code>

<code>curl http://pv.sohu.com/cityjson 2>> /dev/null | awk -F '"' '{print $4}'
/<code>

<code>curl icanhazip.com
/<code>

<code>curl ipv4.icanhazip.com
/<code>

<code>curl ipinfo.io/ip
/<code>

<code>curl ip.sb
/<code>

<code>curl ifconfig.me/<code>