Skip to main content
Change cloud server DNS servers
Last update:

Change cloud server DNS servers

Selectel's DNS servers are automatically writed in the cloud server settings: and

You can change the DNS servers in different ways depending on whether you want to disable network configuration via cloud-init:

The network settings are synchronized using the cloud-init utility, so if you change the DNS servers in the network settings configuration files, the Selectel DNS servers will be specified again when the cloud server is rebooted.

Change DNS servers on the private subnet

After changing the DNS servers, cloud-init will automatically write the new DNS servers in all cloud server configuration files on the private subnet. New DNS servers will automatically be specified for all new cloud servers on this private subnet.

If the subnet where the cloud server resides is part of a global router network, create a ticket to change the DNS servers.

  1. Open OpenStack CLI.

  2. Delete Selectel DNS server information:

    openstack subnet set --no-dns-nameservers <subnet_id>

    Specify <subnet_id> — private subnet ID, can be viewed with openstack subnet list

  3. Install new DNS servers:

    openstack subnet set <subnet_id> --dns-nameserver <dns_1> --dns-nameserver <dns_2>

    Specify <dns_1> and <dns_2> as the new DNS servers.

  4. Look at the subnet properties and verify that the DNS server information has been updated:

    openstack subnet show <subnet_id>
  5. Perform a soft reboot of the cloud server.

Disable DNS configuration via cloud-init

cloud-init will continue to configure the network, but will not configure DNS servers.

  1. Open the /etc/systemd/resolved.conf file:

    nano /etc/systemd/resolved.conf
  2. Install new DNS servers:

    DNS=<dns_1> <dns_2>

    Specify <dns_1> and <dns_2> as the new DNS servers.

  3. Create a symbolic link to the file:

    ln -svi /run/system/resolve/resolv.conf /etc/resolv.conf
  4. Enable the system-resolved service (DNS resolver):

    systemctl enable system-resolved
  5. Perform a soft reboot of the cloud server.

  6. Verify that the DNS server information is updated in the /etc/resolv.conf file:

    system-resolve --status

Disable network configuration via cloud-init

You can disable configuring network settings (including DNS) via cloud-init and set all settings manually.

For your information

In the instructions, we look at an example for Ubuntu.

  1. Create a file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the contents "network: {config: disabled}":

    echo "network: {config: disabled}" > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
  2. Set up the network manually. Replace DNS servers or other parameters with the desired ones manually in the /etc/network/interfaces file or use the configuration that was previously created via cloud-init:

    mv /etc/network/interfaces.d/50-cloud-init.cfg /etc/network/interfaces
  3. Perform a soft reboot of the cloud server.