Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004

    Running PLESK as backup DNS

    Does anybody he eknow hwo to get a PLESK server to run as 2ndary DNS?

    Im using 2 PLESK machines, and I want the 2nd one to run as the 2ndary DNS.

    However I want to do this at server level, not at domain level.

    So, basically the machine should copy all the DNS records from server 1.

    What I dont want to do is to create domains at server 2, and then at domain level tell the domain to use server 1 as DNS server.
    Im just not sure if this is possible?

  2. #2
    Join Date
    May 2002
    *** This would probably work between any 2 named name servers. All you'd need to change are the paths. ***

    It can be done. I did it some time ago, on Plesk 5. I had a main Plesk server to which I added the domains, and a backup Plesk server which fetched the domain list from server 1 and put them in server 2, completely outside of plesk.

    I just added an 'include' directive in Server 2's named.conf, and then with some scripting, some cron jobs and with the help of wget, everything gets transfered regularly.

    You need to create a protected directory on a website on server 1 (password protected), and extract a list of domains from the named.conf on this server (cat /var/.../named.conf | grep ...), write it to a file (slaves.txt). This can be done as often as you like.

    On server 2, set up a cron job to fetch that file (wget http://user:[email protected]/folder/slaves.txt), and create a script to process it and create the file that you included higher. Then restart named on server 2, and it will check every domain's serial number. If it's been updated or inexistant, it will fetch the records.

    Here's the stuff... I didn't know about the cut command at the time, so the content of slaves.txt is really

    but that's adjusted in the php file (which I didn't do. It can still be found in the programming forum).

    The first script, run on server 1:
    cd /home/httpd/vhosts/
    rm -f slaveslist
    touch slaveslist
    chmod 444 slaveslist
    cat /var/named/run-root/etc/named.conf | grep 'zone "' | grep -v IN | tr -d \" | tr -d ' ' | tr -d { > slaveslist
    That's assuming you have a 'normal' plesk install. The paths may have to be changed.

    Here's the script for the 2nd server.
    PHP Code:
    ('IP','(server1 ip here)');
    if (!
    strlen($file) ||
    is_readable($file) ||
    is_file($file)) die('Could not open file.');
    $cnt file($file);

    $fmt = array('zone "%s" {');
    $fmt[] = '     type slave;';
    $fmt[] = '     file "%s";';
    $fmt[] = '     masters { %s; };';
    $fmt[] = '};';
    $fmt join("\n",$fmt);

    $cnt as $line)

    if (
    $_SERVER['argc'] < 2printf("Usage: %s <file>\n",$_SERVER['argv'][0]);
    Script 1 can be run every hour or half or whatever. It will keep an up to date domain list on your first server.

    Before running script 2, erase the included file (say named2.conf) via a cron job. Immediately after, run
    php -q script2.php slaves.txt > named2.conf
    adding and replacing file names and paths as needed. Change the permissions, the owners, and restart named. That's it.

    You still have to update a plesk table on server 1 so it allows zone transfers from server 2 before it works.


  3. #3
    Join Date
    Feb 2004
    I was hoping for some more easy option.
    Plesk says something about the 'DNS_Allow_Transfer1' parameter (see http : // for more information.
    (this has to be set up at the master DNS server ofcourse)

    Now I wonder if there isnt something like a DNS_Get_ZoneFile_From_Server setting for the backup-DNS-server?
    I can't beleive that SWSoft didnt think of such an automated option.

  4. #4
    Join Date
    May 2002
    The complexity comes from your need to have every zone file created automatically. Plesk won't know what zones to create unless you create the domains on Server 2. If you don't, then you have to tell named what to do, and that's what the scripts do.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts