Get the native extranet IP address using the Linux command line

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.