Configure DNS on the private network of a dedicated server
You can configure DNS on private networks of dedicated servers. This will allow servers on the private network to be addressed by domain names instead of IP addresses.
The Private DNS service is used for configuration. The service works on the basis of cloud platform networks, communication with the networks of dedicated servers is carried out through a global router.
Private DNS is configured via API, and the IAM token for the project is used to authenticate requests. For a complete list of API methods for working with the service, see Private DNS API.
- Configure private DNS on the cloud platform network.
- Link your dedicated server network and cloud platform network through a global router.
- Specify the IP addresses of the DNS servers on the dedicated servers.
1. Configure private DNS on the cloud platform network
-
If you do not already have a private network in your 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.
-
In the dashboard, on the top menu, click Products and select Cloud Servers.
-
Go to the Private DNS section.
-
On the DNS Zones tab, click Create DNS Zone.
-
Select a pool.
-
Enter the zone domain. The domain can contain numbers, Latin letters and hyphens. The domain cannot be first level, for
example example. -
Optional: Enter the TTL in seconds or leave the default value. TTL is the time for which the zone's resource entries in the NS server's cache are considered up-to-date and do not need to be re-cached. The zone TTL will be applied to entries that do not have their own TTL specified.
-
Select the network you want to add to the zone.
-
Connect the network to the DNS resolver by marking the network.
-
Optional: add records to the zone, to do this click Add Record and fill in the fields depending on the type of record you want. You can add, modify and delete records at any time after the zone is created.
A or AAAA
CNAME
MX
TXT
10.1.Select the type of recording - 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 automatically added to it.
10.3.Enter the IP addresses to be associated with the domain name: for A record - IPv4 addresses, for AAAA record - IPv6 addresses. You can specify a maximum of 100 IP addresses. Specify addresses with commas or spaces, or each address on a new line.
10.4.Enter the TTL of the recording in seconds. To apply TTL zones, enter
-1or click Use TTL Zones.10.5.Click Add.
10.6.To add another record, click Add Record and repeat steps 10.1-10.5.
10.1.Select the record type - CNAME.
10.2.Enter a domain alias - a domain name that should translate to the target domain. The domain of the zone in which you are creating the record will be automatically appended to it.
10.3.Enter the target domain name to which the alias should translate. This can be any domain name in FQDN format, with a dot at the end.
10.4.Enter the TTL of the recording in seconds. To apply TTL zones, enter
-1or click Use TTL Zones.10.5.Click Add.
10.6.To add another record, click Add Record and repeat steps 10.1-10.5.
10.1.Select MX as the recording type.
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 automatically added to it.
10.3.Enter the priority and mail server name with a space, for example
10 mail.example.com. Priority is a number between 0 and 65,535, the lower the number the higher the priority. The mail server name must be in the zone domain.10.4.Optional: To add another mail server, press + and enter the priority and server name. You can add a maximum of 100 mail servers.
10.5.Enter the TTL of the recording in seconds. To apply TTL zones, enter
-1or click Use TTL Zones.10.6.Click Add.
10.7.To add another record, click Add Record and repeat steps 10.1-10.6.
10.1.Select TXT as the record type.
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 automatically added to it.
10.3.Enter the record value - any text up to 255 characters.
10.4.Optional: to add another value, press + and enter the value of the entry. You can add a maximum of 100 values.
10.5.Enter the TTL of the recording in seconds. To apply TTL zones, enter
-1or click Use TTL Zones.10.6.Click Add.
10.7.To add another record, click Add Record and repeat steps 10.1-10.6.
-
Click Create DNS zone.
2. Link the dedicated server network and the cloud platform network through a global router
Link the dedicated server network and the cloud platform network through a global router, use the instructions Link products and services through a global router.
3. Specify IP addresses of DNS servers on dedicated servers
On each of the dedicated servers on the network that you have linked to the cloud platform network, you must specify private DNS servers-the DNS resolver IP addresses from the cloud network.
Ubuntu
Debian
CentOS
Windows
-
Open the
netplanutility configuration file with thevitext editor:vi /etc/netplan/<netcfg>.yamlSpecify
<netcfg>is the name of thenetplanutility configuration file, such as50-cloud-init.yamlor01-netcfg.yaml. -
Specify DNS servers for the network interface of the private network that you linked to the cloud platform network. To do this, in the desired interface block, add a
nameserversblock with the DNS resolver IP addresses. 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>as the DNS resolver IP addresses. DNS resolver IP addresses can be copied in the control panel: in the top menu, click Products → Cloud Servers → Private DNS → DNS Resolvers tab → click in the network line in the DNS Resolver field. -
Press ESC.
-
Exit the
vitext editor with your changes saved::wq -
Apply the configuration:
netplan apply -
Optional: reboot the server.
-
Open the network interfaces configuration file with the
vitext editor:vi /etc/network/interfaces.d/50-cloud-init -
Specify the DNS servers for the network interface of the private network that you linked to the cloud platform network. To do this, in the desired interface block, add the string
dns-nameserverswith the DNS resolver IP addresses. For example:auto eth0
iface eth0 inet static
address 192.168.0.3
dns-nameservers <dns_server_ip_address_1> <dns_server_ip_address_2>Specify
<dns_server_ip_address_1>and<dns_server_ip_address_2>as the DNS resolver IP addresses. DNS resolver IP addresses can be copied in the control panel: in the top menu, click Products → Cloud Servers → Private DNS → DNS Resolvers tab → click in the network line in the DNS Resolver field. -
Press ESC.
-
Exit the
vitext editor with your changes saved::wq -
Restart the network:
service networking restart -
Optional: reboot the server.
-
Get the name of the network interface of the private network for which you want to specify DNS servers, for this purpose, print the information about the network interfaces:
ip address -
Create or open the private network interface configuration file with the
vitext editor:vi /etc/sysconfig/network-scripts/ifcfg-<eth_name>Specify
<eth_name>is the name of the private network interface that you obtained in step 2. -
Specify DNS servers for the network interface of the private network that you linked to the cloud platform network. To do this, in the desired interface block, add lines with the DNS resolver IP addresses. For example:
NAME="eth0"
ONBOOT=yes
BOOTPROTO=none
IPADDR="192.168.0.3"
DNS1=<dns_server_ip_address_1>
DNS2=<dns_server_ip_address_2>Specify
<dns_server_ip_address_1>and<dns_server_ip_address_2>as the DNS resolver IP addresses. DNS resolver IP addresses can be copied in the control panel: in the top menu, click Products → Cloud Servers → Private DNS → DNS Resolvers tab → click in the network line in the DNS Resolver field. -
Press ESC.
-
Exit the
vitext editor with your changes saved::wq -
Restart the network:
systemctl restart network -
Optional: reboot the server.
-
Open Windows Settings.
-
Open Network & Internet.
-
Open the Network and Sharing Center.
-
Open the network interface of the private network.
-
Click Properties.
-
From the list, select Internet Protocol version 4 (TCP/IPv4).
-
Click Properties.
-
Select Use the following DNS server addresses.
-
In the Preferred DNS server and Alternate DNS server fields, enter the IP addresses of the DNS resolver. You can view the addresses in the control panel: in the top menu, click Products → Cloud Servers → Network → Private Networks tab → open the Network page → Ports tab → in the port card labeled DNS Resolver, view the IP addresses.
-
Press OK.
-
Optional: reboot the server.