Getting Private IP Addresses and Setting DNS

Last updated: 2020-05-06 15:21:29

    This document describes how to obtain the private IP address of the instance and configure the private DNS.

    Obtaining the private IP address of an instance

    Obtaining the private IP address on the console

    1. Log in to the CVM Console.
    2. On the instance management page, select the instance and move the mouse to the Primary IP column to view its private IP, and click </ img> to copy the private IP, as shown below:

    Obtaining the private IP address using API

    Please see DescribeInstances API.

    Obtaining the private IP address using instance metadata

    1. Log in to the CVM.
    2. Access the instance metadata by using the cURL tool or an HTTP GET request.

      The following operations use the cURL tool as an example.

      Execute the following command to obtain the private IP.
      curl http://metadata.tencentyun.com/meta-data/local-ipv4
      The returned information is the private IP address, as shown below:

    For more information about instance metadata, see Instance Metadata.

    Configuring private network DNS

    When a network resolution error occurs, you can manually configure the private network DNS based on your CVM operating system.

    For Linux operating system

    1. Log into the Linux CVM.
    2. Execute the following command to open the /etc/grub.conf file.
      vi /etc/resolv.conf
    3. Press i to switch to the edit mode, and modify the DNS IP according to the corresponding region in the Private Network DNS list.
      For example, change the private network DNS IP to an private network DNS server in the Beijing region.
      nameserver 10.53.216.182
      nameserver 10.53.216.198
      options timeout:1 rotate
    4. Press Esc, enter :wq, save the file and return.

    For Windows operating system

    1. Log in to the Windows CVM.

    2. On the operating system interface, open Control Panel > Network and Sharing Center > Change adapter settings.

    3. Right-click the Ethernet and select Properties to open the “Ethernet Properties” window.

    4. In the “Ethernet Properties” window, double-click IP version 4 (TCP/IPv4), as shown below:

    5. Select [Use the following DNS server address] and modify the DNS IP according to the corresponding region in the Private Network DNS list.

    6. Click OK.

    Was this page helpful?

    Was this page helpful?

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