Skip to main content

Configure DNS in the private network of a dedicated server

Last update:

You can configure DNS in the private networks of dedicated servers. This allows you to address servers in the private network using domain names instead of IP addresses.

The Private DNS service is used for configuration. The service runs on cloud platform networks, and connection to dedicated server networks is established via the global router.

Private DNS configuration is performed via API; an IAM token for a project is used for request authentication. For a full list of API methods for working with the service, see the Private DNS API.

  1. Configure private DNS in a cloud platform network.
  2. Connect the dedicated server network and the cloud platform network via the global router.
  3. Specify the DNS server IP addresses on dedicated servers.

1. Configure private DNS in a cloud platform network

  1. If you do not already have a private network in the cloud platform, create a private network. The network must be in the same project as the dedicated servers for which you want to use private DNS.

  2. In the Control panel, on the top menu, click Products and select Cloud Servers.

  3. Go to the Private DNS section.

  4. On the DNS Zones tab, click Create DNS zone.

  5. Select a pool.

  6. Enter the zone domain. The domain can contain digits, Latin letters, and hyphens. The domain cannot be a top-level domain, for example example.

  7. Optional: enter the TTL in seconds or leave the default value. TTL is the time that zone resource records are considered up-to-date in the NS server cache and do not require re-caching. The zone TTL will be applied to records that do not have their own TTL specified.

  8. Select a network to add to the zone.

  9. Connect the network to the DNS resolver by checking the network box.

  10. Optional: add records to the zone by clicking Add record and filling in the fields depending on the required record type. You can add, edit, and delete records at any time after creating the zone.

    10.1. Select the record type — A or AAAA.

    10.2. Enter the domain name for which the record will be created. The domain of the zone in which you are creating the record will be added to it automatically.

    10.3. Enter the IP addresses to be associated with the domain name: for an A record, IPv4 addresses; for an AAAA record, IPv6 addresses. You can specify a maximum of 100 IP addresses. Enter the addresses separated by a comma or space, or on a new line.

    10.4. Enter the record TTL in seconds. To apply the zone TTL, enter -1 or click Use zone TTL.

    10.5. Click Add.

    10.6. To add another record, click Add record and repeat steps 10.1–10.5.

  11. Click Create DNS zone.

2. Connect the dedicated server network and the cloud platform network via the global router

Connect the dedicated server network and the cloud platform network via the global router; to do this, use the Connect products and services via global router guide.

3. Specify the DNS server IP addresses on dedicated servers

On each dedicated server in the network that you have connected to the cloud platform network, you need to specify private DNS servers — IP addresses of the DNS resolver from the cloud network.

  1. Connect to the server via SSH or via the KVM console.

  2. Open the netplan utility configuration file with the vi text editor:

    vi /etc/netplan/<netcfg>.yaml

    Specify <netcfg> — the name of the netplan utility configuration file, for example 50-cloud-init.yaml or 01-netcfg.yaml.

  3. Specify DNS servers for the private network interface that you have connected to the cloud platform network. To do this, add the nameservers block with the DNS resolver IP addresses in the block for the required interface. For example:

    id1:
    addresses:
    - 192.168.0.3/24
    routes:
    - to: 172.16.0.0/24
    via: 192.168.0.1
    nameservers:
    addresses:
    - <dns_server_ip_address_1>
    - <dns_server_ip_address_2>

    Specify <dns_server_ip_address_1> and <dns_server_ip_address_2> — the DNS resolver IP addresses. You can copy the DNS resolver IP addresses in the Control panel: on the top menu, click ProductsCloud ServersPrivate DNSDNS resolvers tab → in the network row, in the DNS resolver field, click .

  4. Press ESC.

  5. Exit the vi text editor with your changes saved:

    :wq
  6. Apply the configuration:

    netplan apply
  7. Optional: reboot the server.