Stop DNS replication in a ISPconfig cluster

Discussion in 'Installation/Configuration' started by MrWolf, Jul 30, 2013.

  1. MrWolf

    MrWolf New Member

    Hi,

    I used two Debian 7.1 server with ISPconfig 3.0.5.2 to create a cluster.

    I used a master-to-master setup for the mysql and unison for the files.

    everything is working perfetly, but I want something special for the dns.

    to create a HA on it, I would like to stop the replication on the dns. This way each server will have his own DNS and the DNS will only have his own server.

    When someone will access a web site, the domain will point to the DNS, and the DNS who will answer will provide his own ip adress. This way if a server failed, we will not have any timeout caused by a round robin setup.

    so my question is, is there a way to be able to configure the dns from ispconfig but without any replication of the dns only?

    Thank you
     
  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    You can modify the dns-plugin and add the server-ip to the sql-selects.
     
  3. MrWolf

    MrWolf New Member

    the plugin to modify seems to be:
    /usr/local/ispconfig/server/plugins-enabled/bind_plugin.inc.php

    but even if I add the server ip, it will be replicated to the other server. no?
     
  4. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    You´re right. You can´t use something like
    Code:
    AND data = 'SERVER_IP'
    but
    Code:
    SELECT * FROM dns_rr WHERE zone =8 AND active = 'Y' AND data <> 'REMOTE_IP'
    should work.

    In this case you should fetch the remote-ip from the database.

    But you can also use a shell-script with sed to comment out the unwantend entries.
    Code:
    sed -i "/\(${IP_REGEX}\)/d" /var/lib/named/pri.*
    Where IP_REGEX is something like "IPv4_1\|IPv4_2\|IPv6-subnet"
     
  5. MrWolf

    MrWolf New Member

    Thanks florian,
    I like this idea:
    But this is to write the DNS file. it's an important step but how do I tell ispconfig to split the config. I don't have anything in my Server drop down list on the DNS Zone Wizard page.

    I might misundertsanding something
     
  6. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    You can change
    Code:
    $records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ".$zone['id']." AND active = 'Y'");
    to
    Code:
    $records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ".$zone['id']." AND active = 'Y' AND data <> '78.46.84.244'");
    If you run server.sh on your server no dns-records with the IP 8.46.84.244 will be written.

    On server A (IP 1.1.1.0) use
    Code:
    AND data <> '2.2.2.0'
    and on server B (IP 2.2.2.0) use
    Code:
    AND data <> '1.1.1.0'
     
  7. MrWolf

    MrWolf New Member

    Thank you Florian,

    This is a good and working solution.

    this is the way I found the easier to manage in ispconfig:
    create 2 "A" record with the same name, one for each server and give them the ip of each server.
    then create cname for all the other name you need and point them to the "A" record you created. this way you only have to insert the ip address once.
     
  8. MrWolf

    MrWolf New Member

    Update for anyone who have a problem using own dns.

    My domain name are registered at godaddy.com
    So I registered my hostname like described here: http://support.godaddy.com/help/article/668/registering-your-own-nameservershosts

    then, I changed my ns on godaddy for my own ns and my dns stop working.
    I couldn't resolv my domain anymore.

    in the bind folder, I had pri.domain.com.err instead of pri.domain.com
    to solve this problem I had to modify the MySQL query to this:
    $records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ".$zone['id']." AND active = 'Y' AND (data <> 'REMOTE IP' OR name = 'ns1.domain.com.' OR name = 'ns2.domain.com.')");

    *domain.com would be my main domain

    this way, I create 2 "A" record with ns1 and ns2 and I use ns1 and ns2 as nameserver

    as soon as I did that, the .err from my pri.domain.com disappear and my dns start working.

    if anyone need more detail of what I did, just reply to this post :)
     
  9. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    I just changed the request to
    Code:
    SELECT * FROM dns_rr WHERE zone=".$zone['id']." AND active = 'Y' AND (data NOT IN (SELECT ip_address FROM server_ip WHERE server_ip.server_id<>".$conf["server_id"].") OR name REGEXP '^ns')
    
    I`ve the same code on each server und the sub-select filters out all remote-ips, a long as they are not defined as ns*
     
  10. MrWolf

    MrWolf New Member

    Thank you for this fine-tuning,

    I'll change my settings also
     

Share This Page