Slave DNS and Plesk

Updated: April 2021

Preface

There are several reasons why you might need at least two DNS servers for serving your sites:

  • You purchased a domain name from a domain registrar. To delegate the domain, many registrars require the domain zone to be served by at least two name servers residing in different IP subnets.
  • You have several hosting servers, and you have not grown enough to use the products like PPA or PA, but you want to use a single set of name servers for all the domains you host.
  • You want to have your own name servers and not depend on third parties.
  • You want the WHOIS records for your domains to list your name servers.

Usually you would set up a couple of name servers in the Master/Slave mode. Then you create domain zones on both servers, but administer resource records of the domain zones only on the master server. The secondary (slave) server automatically downloads the changes from the master. Thus, you always have two active name servers with the same set of domain zones and resource records.

The only trifle annoyance is that you have to create and delete each zone on both servers. This does not happen automatically. That’s why you create a domain zone on the master, and then you create this domain zone on the slave and specify the master server’s address. After that, when you add the domain resource records on the master, you can be sure that your slave server will automatically get them from the master.

For many years, integration of Plesk with a slave DNS server has not been obvious. A Plesk server is supposed to be the master. In Plesk, we have the slave and master modes for a domain zone and the list of IP addresses that can retrieve domain zones. But there is no mechanism for creation of new domain zones on the slave server. And it will never appear, because Plesk’s concept presumes automation of hosting operations on a single server. For integration of several servers that are dedicated to running individual services, Parallels offers PPA and PA.

Still there are a lot of Plesk users for whom PPA or PA are more than they actually need. They just want integration with a slave name server. Previously, to solve this problem, each Plesk administrator had to write their own scripts, purchase commercial ones, or manually created and deleted domain zones on the slave server.

Seemingly, there are no complications. Plesk has got its local name server – let it be the master, and there is a system of event triggers – let us associate our script execution with the events “DNS zone creation” and “DNS zone deletion”. The problem will be solved. Unfortunately, Plesk does not support such events.

Not only Plesk software engineers develop Plesk, but they also use the product they develop. That’s why we created an extension that allows Plesk users to integrate Plesk with an external slave name server running BIND9. You can download this extension here.

How it works

Plesk uses BIND as a local name server. It can be managed remotely with the native rndc utility. There’s no reason why we could not install BIND on a remote server and manage it with rndc. Plesk 11.5 introduced the “Custom DNS backend” mechanism. It can be used to connect an external DNS service, for example AWS Route53. You can learn more in our doc.

Briefly, this feature allows us to register a script with Plesk. The script will receive a DNS zone description in JSON format with instructions what to do to a zone upon creation, modification, and deletion of any DNS zone in Plesk. That’s all we need. While implementing this feature, we assumed that you would use an external DNS service instead of installing the BIND server with Plesk. However, you do not necessarily have to delete the local BIND. The script can operate concurrently with a local DNS service. This is the idea that our extension uses.

Important note: The extension does not support an environment where Plesk servers use the same set of secondary DNS servers. We strongly recommend using separate secondary DNS servers for each Plesk server for security reasons.

The extension works according to the following algorithm:

  1. It registers a slave server in the extension settings.
  2. The slave server’s IP address is automatically added to the list of addresses allowed to transfer domain zones from the Plesk server.
  3. When you create, modify, or delete an active domain zone in Plesk, Plesk creates, modifies, or deletes the domain zone in the local DNS service.
  4. Then the script starts and receives the domain name and the command to create, modify, or delete.
  5. The script initiates the rndc command for each connected slave server.
  6. Slave servers synchronize domain zones with the ones on the Plesk server.

Thus, we get a simple and very reliable scheme of working with slave name servers. All issues with zone files format, connection, and service restart are handled by the DNS service. The administrator should set up a slave server to work with an external Plesk only once. After that you can go to the registrar and say that the Plesk server and the slave server are name servers for your domains. Thus, we resolved all the issues stated at the beginning of the article.

Now we will describe more technical details of the process

To set up a slave name server, using the example of a server with Debian 7:

  • Install BIND.
apt-get install bind9
  •  Allow creating new zones with rndc. In the /etc/bind/named.conf.options file, in the options {} directive, type:
allow-new-zones yes;
  •  Specify the IP address from which control instructions should be accepted and set BIND to listen on all accessible network interfaces. Specify rndc key which will used by Plesk. In the /etc/bind/named.conf.local file, type:
key "plesk-key" {
   algorithm hmac-md5;
   secret "vwOxonI4n4CVRUhKAOAAIA==";
};
controls {
    inet * port 953 allow { <plesk_ip>; <another_plesk_ip>; 127.0.0.1; } keys {"rndc-key", "plesk-key"; };
};
  •  That’s it, the slave name server is set up.

After that, install the extension on the Plesk server. In the extension settings, add the slave server and specify its IP address and the pass key. The extension will create a configuration file with the slave server settings for the rndc utility. From now on, Plesk will automatically transfer all created, modified, and deleted zones to the slave server by executing the following command for each slave server:

# Creation
/usr/sbin/rndc -c slave.config addzone example.com '{ type slave; file "example.com"; masters { <plesk_ip>; }; };'

# Modification
/usr/sbin/rndc -c slave.config refresh example.com

# Deletion
/usr/sbin/rndc -c slave.config delzone example.com

Now, when you add a domain in Plesk, a DNS zone is automatically created on the slave server as well as on the master server.

Extension is available for download direct by link Slave DNS manager.

Parallels does not provide technical support services for this Plesk extension. The extension is intended to serve as example of how certain technical tasks can be accomplished.

56 Comments

  1. Thank you! I think this could be very helpful

  2. Or you could get Parallels Business Automation Standard and let it manage your Plesk server and all DNS servers.
    If you are a Parallels partner, you can get it for free + get free 2 days training + free 5 CT PCS license, using “Pay-As-You-Grow” program.
    More information: http://www.parallels.com/landingpage/grow-with-pbas/

  3. need a way to do this with simpleDNS as the slave server!

  4. Is this extension compatible with Plesk for Windows?

  5. A more detailed doc on this extension would be helpful? We have had mixed results with implementing it on various OS’s
    Maybe Parallels should do what cPanel did with cPanel ‘DNS Only” and build a cut down version of Plesk for use as slave nodes which would make customer deployment a lot more straight forward and allow providers to build provisioning templates to rapidly roll out slave nodes.

    Comprehensive slave name server support is the missing link in the Plesk offering. This extension does go a long way towards bridging the gap and providing for a greater level of automation but I think more could be done without a huge dev investment by Parallels.

  6. Hi,

    Great extension, but how can we change of the domain zones on our slave dns server from /var/lib/bind/ to something other? We use CentOS on our slave DNS server and the zone file are stored in /var/named/chroot/var/named/slaves.

    Thanks!

  7. Hello,
    How can we test if this actually works on our server?
    which log file should we monitor?

    • Lefteris,

      Sorry for long time before answer. Which log file used depends on your linux distributive on remote slave dns server. In case of Debian/Ubuntu is /var/log/syslog. There are logged all rndc calls from remote Plesk. Also you can see script calls which produced by Plesk in /usr/local/psa/admin/logs/panel.log:
      2014-03-27T12:07:27+07:00 INFO (6) [panel]: Executing /opt/psa/admin/plib/modules/slave-dns-manager/scripts/slave-dns.php done.

  8. Hi,

    Great – Finally something that works without much configuration change! Is it possible to push all existing domains to the slave? At the moment it is only pushing domains that have changes made or new domains?

    Cheers

  9. Muchas gracias:
    Me fue de mucha utilidad.
    Saludos

  10. Hello,

    What for when the extension for Plesk 12 will be available?

    a greeting

  11. Remember to open port 953 TCP-IN and TCP-OUT if you are using a firewall.

  12. Just installed this on a clean setup of plesk 12. I’ve configured a slave though the plesk interface and it’s listed but there’s a red exclamation mark before it. When I hover with the mouse it says ‘Error code 1: rndc: /usr/local/psa/var/modules/slave-dns-manager/slave_.conf does not exist’ where ” is the configured ip for the slave. When I check the server using ssh I can see the file is present. Also, when I click the slave server item a new screen with the contents of the mentioned file shows.

    Plesk 12.0.18#22 on CentOS 7.0.1406 (Core).

    Any ideas what’s wrong?

    • previous post got bad because of disabled tags. It should read:

      ‘Error code 1: rndc: /usr/local/psa/var/modules/slave-dns-manager/slave_[ip].conf does not exist’ where ‘[ip]’ is the configured ip for the slave

      • SSH’d into the plesk server as admin, SUDO -i to become root… ran the following command:

        /usr/sbin/rndc -c /usr/local/psa/var/modules/slave-dns-manager/slave_[slave dns ip].conf addzone [domain on plesk server]'{ type slave; file “[domain on plesk server]”; masters { [bind slave server ip]; }; };’

        result: zone added to slave server! So it seems that the script running the rndc command doesn’t have access to the conf files (strange, because i guess it can be read by plesk for viewing as I can click the object).

        Now what?

  13. I get syscall succes on call /usr/sbin/rndc
    The a AVC Denied { getattr } for rndc
    Then a syscall failed for /usr/sbin/rndc

    Seems like permission problem indeed… I’m not a Linux guru.. any advice on how to fix this?

  14. Hi,

    We run CentOS 6 and have permission problem because your extensions only file name for zone without any directory and Bind try to wrote in /var/named but it should be /var/named/slaves. It would be helpful to set the path for slave zone files in Plesk for this extension.

  15. [FAIL] Starting domain name service…: bind9 failed!
    invoke-rc.d: initscript bind9, action “restart” failed.
    root@sproutsmedia-slave:~# service bind9 restart
    [….] Stopping domain name service…: bind9rndc: connect failed: 127.0.0.1#953: connection refused

  16. Hello,
    I’m trying to set up this extension, but the named service won’t restart because of the “allow-new-zones yes;” line tu add in the named.conf of the slave server ( in /var/named/run-root/etc/named.conf ).
    The error on restart is: /etc/named.conf:10: unknown option ‘allow-new-zones’

    Moreover (or may be Consequently), in the “Slave DNS Manager” of the master server, the red exclamation icon says “Error code 1: rndc: connect failed: 46.105.123.76#953: connection refused” on mouse over.

    I’m trying hard to find any clue on the internet or on the KB of Parallels, but I can’t find anything.
    So thanks a lot in advance for any help or clue !

    Best regards,
    Stephane

    Versions:
    Master server (188.165.227.13) : CentOS 6.5 Plesk 12.0.18 Up to date.
    Slave Server (46.105.123.76): CentOS release 5.6 (Final) Plesk 10.4.4#59

  17. Hi,

    I want to build DNS Master ( Centos with Plesk 12 installed ) and DNS Slave ( Centos ) . I want to know how to configure DNS Slave (Centos) because it so different with Slave (Debian ) configuration file. Can you send me the configuration file on Slave (Centos).

    Thanks

  18. I have the ‘Slave DNS Manager’ extension installed on my primary DNS server, which has the following setup:

    OS: CentOS v6.6
    Control Panel: Plesk Panel 12
    DNS: BIND 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.3

    I have a secondary DNS server with the following setup:

    OS: CentOS v6.6
    Control Panel: None
    DNS: BIND 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.3

    When a change is made to a pre-existing DNS zone file within the Plesk Panel on the primary DNS server and that DNS zone file exist in the ‘named.conf’ file and there is a zone file (i.e. slave/domain.tld) on the slave server, it updates successfully. However, if a new domain is added or deleted within the Plesk Panel on the primary server, then it does not create or remove the zone file on the secondary server.
    Additionally, if I execute the following command on the primary DNS server:

    /usr/sbin/rndc -c slave_2.2.2.2.conf addzone example.com ‘{ type slave; file “example.com”; masters { 1.1.1.1; }; };’
    * 1.1.1.1 = Primary DNS server
    * 2.2.2.2 = Secondary DNS server

    The result of the command is:

    rndc: ‘addzone’ failed: permission denied

    I am at a loss. If anyone can provide any assistance, I would greatly appreciate it! Thanks in advance.

    • I had the same problem, the root cause is that the CentOS BIND9 package expects slave zones to be stored under /var/named/slaves, but this extension’s rndc commands use file “example.com” which implies /var/named/example.com. SELinux and the directory permissions prevent BIND from writing that file, so the rndc commands fail.

      I already had disabled SELinux for other reasons, but there are commands that I don’t know off the top of my head to force SELinux to allow the named daemon to write to that directory. I also used chmod to make the /var/named/ directory group writable. However, it is worth noting that CentOS enforces the separation of zones in /var/named into multiple directories the way that it does in order to protect against known vulnerabilities in BIND, so you may want to find another option.

  19. what a bout if the master dns and plesk is behind nat. i have a problem that on the slave dns in therndc configs the master ip address is the plesk private ip.. i have the NAT manager in use and the records are correct but in rndc the for zone transfers the master ip address is still the private one. does any one have asolution for this?

  20. Not only that:

    allow-new-zones yes;

    should be added:

    allow-transfer { ; ; ;};
    allow-query { trusted; };

    Above the existing options block, create a new ACL block called “trusted”. This is where we will define list of clients that we will allow recursive DNS queries from servers. Using example IP addresses, add host1, host2, host3 to list of trusted clients:

    acl “trusted” {
    ; # host1
    ; # host2
    ; # host3
    };

    this may be helpful

  21. It seems there is a problem with IPv6 at my slave or master server. Setting up the Plesk addon and the slave DNS was easy. At the master server I see the updates in syslog:

    Example:
    Oct 23 12:31:19 37081 named[12891]: client 81.30.156.94#53098: transfer of ‘jet-hangar.de/IN’: AXFR-style IXFR started
    Oct 23 12:31:19 37081 named[12891]: client 81.30.156.94#53098: transfer of ‘jet-hangar.de/IN’: AXFR-style IXFR ended
    Oct 23 12:31:19 37081 named[12891]: client 81.30.156.94#44545: transfer of ‘de.powie.de/IN’: AXFR-style IXFR started
    Oct 23 12:31:19 37081 named[12891]: client 81.30.156.94#44545: transfer of ‘de.powie.de/IN’: AXFR-style IXFR ended

    At the slave Server this is logged to sylog at this time:

    Oct 23 12:31:34 156094 named[27377]: zone powie.de/IN: refused notify from non-master: 2001:4ba0:cafe:278::1#46739
    Oct 23 12:31:34 156094 named[27377]: client 2001:4ba0:cafe:278::1#46739: received notify for zone ‘de.powie.de’
    Oct 23 12:31:34 156094 named[27377]: zone de.powie.de/IN: refused notify from non-master: 2001:4ba0:cafe:278::1#46739
    Oct 23 12:31:34 156094 named[27377]: client 2001:4ba0:cafe:278::1#46739: received notify for zone ‘skyspots.de’
    Oct 23 12:31:34 156094 named[27377]: zone skyspots.de/IN: refused notify from non-master: 2001:4ba0:cafe:278::1#46739

    I dont’t know why, but there is a confusion between IPv4 and IPv6….??

    Tips?

  22. Do I need this extension if my slave server is also a plesk server? Thanks.

  23. I got this..

    root@ns2:~# sudo /etc/init.d/bind9 restart
    * Stopping domain name service… bind9 rndc: connect failed: 127.0.0.1#953: connection refused
    [ OK ]
    * Starting domain name service… bind9 [fail]
    root@ns2:~#

  24. I had to change your code for named.conf.local a bit to get it working:

    controls {
    inet * port 953 allow { ; 127.0.0.1; } keys {“rndc-key”, “plesk-key”};
    };

    changed to:

    controls {
    inet * port 953 allow { ; 127.0.0.1; } keys {“plesk-key”; };
    };

    The semikolon after plesk-key was missing.

  25. First of all, thanks a bunch for the work on this plugin. It’s helped me out a lot so far! The only problem that I have run into is that when I add a slave DNS server, the plugin doesn’t seem to automatically add all of the zones that are currently on the master server to the slave server. After I manually ran the rndc addzone commands for some of the existing zones, they started working properly and updating when I made changes, but I wanted to know if there was any way to force Plesk to add all zones on the server to the slave servers.

  26. Unfortunately the script is not working for me on centos 7 with bind. I’ve set up the rdnc stuff. Everything looks fine. I’ve got a green checkmark in the plesk panel. When I change a DNS entry in plesk, I can see that the plesk server is connecting to my slave server. (in /var/log/messages), but no zone file is creating…

    Anyone has an idea what to do?

  27. Hi there,

    Had anyone been able to use the script on Plesk for Windows syncing the zones to a Linux (CentOS) server? I will really appreciate your help.

  28. this article should be update and include CentOS.

    for the past 6hrs now same error like 2yrs ago now fix

Add a Comment

Your email address will not be published. Required fields are marked *

GET LATEST NEWS AND TIPS

  • Yes, please, I agree to receiving my personal Plesk Newsletter! WebPros International GmbH and other WebPros group companies may store and process the data I provide for the purpose of delivering the newsletter according to the WebPros Privacy Policy. In order to tailor its offerings to me, Plesk may further use additional information like usage and behavior data (Profiling). I can unsubscribe from the newsletter at any time by sending an email to [email protected] or use the unsubscribe link in any of the newsletters.

  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden

Related Posts

Knowledge Base

Plesk uses LiveChat system (3rd party).

By proceeding below, I hereby agree to use LiveChat as an external third party technology. This may involve a transfer of my personal data (e.g. IP Address) to third parties in- or outside of Europe. For more information, please see our Privacy Policy.

Search
Generic filters
Exact matches only
Search in title
Search in content
Search in excerpt