Plesk for Linux works in cooperation with the BIND (or named) domain name server that enables you to run a DNS service on the same machine on which you host websites.

When you add a domain name to Plesk, it automatically generates a zone file for this domain in accordance with the server-wide DNS zone template and registers it in the name server’s database, then instructs the name server to act as a primary (master) DNS server for the zone.

Configuring DNS

You can change the name server settings by editing configuration file /var/named/run-root/etc/named.conf (/etc/named.conf is a soft link to it). This file consists of the following parts:

General Settings containing the following sections:

The Options section contains the directory option referring to /var, which is used as the base directory relative to $ROOTDIR (which is /var/named/run-root by default) for all other files used below. It also sets the location where named will store its PID.

The key and control sections define a shared key for managing named with the rndc utility and access list.

  • The main part contains several zone sections, one for every direct and reverse zone in which the server acts as the primary or a secondary name server. As usual, there is also a root zone section.
    • The root zone section defines the file with the root zone name servers.
    • Reverse local loop zone.
    • A direct zone for every domain and a reverse zone that the server processes as a name server.

The final part containing the acl section, which defines an access control list of name server IP addresses where zone transfers are allowed. By default, the common-allow-transfer ACL is included in every zone section.

Note: If you perform change zone entries in the file manually, Plesk will override them with changes made through the GUI.

Zone files

By default, zone files for domains are stored in the /var/named/run-root/var directory, as defined in the /var/named/run-root/etc/named.conf file. Each zone file has a name identical to the domain name. If you change the zone through the GUI, Plesk rewrites the file.

You can change a zone database by adding or deleting resource records as follows:

  • Using the Plesk GUI. In this case, Plesk increases the Serial field value, which means that the zone transfer operation should be performed to synchronize the zone content with all secondary name servers.

  • Manually editing the file. We do not recommend this approach, since Plesk completely rewrites the zone data from the psa database if any changes are made through the Plesk GUI. Do not forget to increase the Serial field in this file. Otherwise, only this name server will know about the changes made.

  • Manually editing the psa database. To do this, perform the following steps:

    First, you have to insert a corresponding record into the psa.dns_recs table.

    mysql> insert into dns_recs (dom_id,type,host,val) values (2,'A','ws02.domain01.tst.','192.168.1.185');
    Query OK, 1 row affected (0.00 sec)
    

    After that, make Plesk reread the domain information from the psa database in one of the following ways.

    • Through the command line:

      # /usr/local/psa/admin/sbin/dnsmng --update <domain_name>
      
    • Using the Plesk GUI, switch the domain to slave and then back to the master mode. In this case, you do not have to worry about the Serial field as Plesk increases its value while restoring the file.

Access Control Lists

You can restrict the name server to transferring name zones to only the list of explicitly assigned DNS servers. Do this by inserting the DNS server IP addresses into the misc table of the psa database with the following command:

mysql> insert into misc (param, val) values ('DNS_Allow_Transfer1', <dns server>);

for the first DNS server in the list.

mysql> insert into misc (param, val) values ('DNS_Allow_Transfer2', <dns server>);

for the second DNS server, etc.

To transfer the changes made in the database to the DNS configuration file, use the following command:

# /usr/local/psa/admin/sbin/dnsmng --update <domain_name>

The command shown above adds DNS server IP addresses to the common-allow-transfer ACL, which is included in all local name zones. Every domain can have some additional IP addresses in its ACL. Secondary servers are added to the allow-transfer list of a domain by Plesk after adding the corresponding NS records to the domain name zone. In addition, the secondary server must be resolvable and accessible when it is added to the name zone.

DNS logs

The domain name service writes errors log stored in the /var/log/plesk/messages file. The logrotate utility rotates this log on a daily, weekly, or monthly basis. Learn how to configure log rotation in the section Log Rotation.