Introduction: In the current method of acquiring IP, the ifconfig and IP get functions are all intranet IP. Sometimes the need to obtain an external IP, the current practice is to send requests to external servers to resolve the external server response, resulting in their own external network IP. Curl under Linux can do the work for us, of course, not afraid of trouble, you can analyze the HTTP protocol yourself, to achieve the above process. If you're familiar with Python, it's even easier, as we all know, Python always has a library function ready for us to call. A summary of several methods to obtain the external network IP for query, data source Internet.
$ Curl ip.cn
$ Curl Ifconfig.me (currently defunct)
$ Curl ident.me can be subdivided into v4.ident.me and v6.ident.me
$ Curl Icanhazip.com
$ Curl Ipecho.net/plain
$ Curl Whatismyip.akamai.com
$ Curl Myip.dnsomatic.com
$ Curl Icanhazip.com
$ Curl Ip.3322.net
$ Curl Ip.6655.com/ip.aspx
If you need to return IP and region as well as operators, you can use:
$ Curl cip.cc------> Pure IP Words $ curl IP. cip.cc (http://www.cip.cc/) recommended
$ Curl Ip.6655.com/ip.aspx?area=1
Get the native extranet IP address using the Linux command line