Getting Public IP Addresses

Last updated: 2020-11-02 15:18:13

    Scenario

    This document describes how to obtain the public IP address through console, API, or Instance metadata.

    Directions

    Obtaining the public IP address on the console

    1. Log in to the CVM Console.
    2. On the instance management page, move the mouse to the primary IP column, and </ img> appears, as shown below:
    3. Click to copy the IP address.

      Note:

      The public IP address is mapped to the private IP address through NAT. If you view the network interface attributes from within the instance (such as by using commands such as ifconfig (Linux) or ipconfig (Windows)), the public IP address is not displayed. To obtain the public IP from within the instance, please see Obtaining a Public IP Address of the Instance Using Instance Metadata.

    Obtaining the public IP address using API

    Please see DescribeInstances.

    Obtaining the public IP address using instance metadata

    1. Log in to the CVM instance.
      For more information, please see Log in to Linux Instance and Log in to Windows Instance.
    2. To obtain the public IP address, you can access the metadata by using the cURL tool or an HTTP GET request.
      curl http://metadata.tencentyun.com/meta-data/public-ipv4
      If the returned value is in the following structure, you can view the public IP address:

      For more information, see Instance Metadata.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help