Help Center> Virtual Private Cloud> FAQ> VPC and Subnet> How Do I Switch to a Private DNS Server?

How Do I Switch to a Private DNS Server?

Private DNS servers are configured for VPC subnets by default. ECSs in the subnets can use private DNS servers to access internal addresses of other cloud services, such as OBS and SMN, without going through the Internet, and to request domain names on the Internet.

For VPCs created earlier, a public DNS server (114.114.114.114) is configured. To allow ECSs in these VPCs to access private domain names, you can change the public DNS server to the private ones for the VPC subnets. For instructions about how to obtain a private DNS server address, see What Are the Private DNS Server Addresses Provided by the DNS Service?

To switch the DNS server of an ECS to a private DNS server, you need to check the DNS server addresses of the ECS, change the DNS servers for the VPC subnet where the ECS resides, and update the DNS server addresses of ECS.

Checking the DNS Server Addresses of an ECS

  1. Log in to the management console.
  2. In the Computing category, click Elastic Cloud Server.

    The Elastic Cloud Server page is displayed.

  3. In the ECS list, click the ECS name.
  4. On the ECS details page, click the VPC name.

    The Virtual Private Cloud page is displayed.

  5. Locate the target VPC and click the number in the Subnets column.

    The Subnets page is displayed.

  6. Click the name of the target subnet.

    In the Gateway and DNS Information area, view the DNS server addresses used by the ECS.

Changing the DNS Server Addresses for a VPC Subnet

If the subnet of the ECS is not using a private DNS server address, you need to do as follows:

  1. In the Gateway and DNS Information area, click next to DNS Server Address.
  2. Change the DNS server addresses of the subnet to private DNS server addresses.

    For example, in the CN North-Beijing1 region, you need to change the DNS server addresses of a VPC subnet to 100.125.1.250 and 100.125.21.250.

Updating the DNS Server Addresses for the ECS

After you change the DNS server addresses of the subnet, the DNS server addresses of the ECS are not updated immediately.

You can use either of the following methods to update the DNS server address:
  • Restart the OS. The ECS will then obtain the new DNS server addresses from the DHCP server.

    Restarting the OS will interrupt services on the ECS. Therefore, perform this operation during off-peak hours.

    Alternatively, wait for the DHCP lease time to end, which lasts for 24 hours by default. The ECS will then update the IP address and DNS server addresses with the DHCP server.

  • Manually change DNS configurations of the ECS.

    If the DHCP function is disabled on the ECS, you need to manually update DNS configurations.

    For example, in a Linux OS, change DNS configurations in the /etc/resolv.conf file.