Primary and secondary DNS Communication

Discussion in 'General' started by Donno, Oct 30, 2018.

  1. Donno

    Donno Member

    If you install a Primary DNS and Secondary DNS with multi-server setup on ISPconfig 3.1, how does the DNS server communicate with each other to update records ?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig takes care to mirror the records, all slaves pull changes from master trough mysql.
     
    ahrasis likes this.
  3. Donno

    Donno Member

    Could a multi server configuration be set on local area network instead of the open internet ?
     
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  5. Donno

    Donno Member

    Hi i followed this guide https://www.howtoforge.com/how-to-r...-secondary-with-ispconfig-3-debian-squeeze-p2 and my secondary dns server not working

    Using Ubuntu 18.04

    ///On Primary Server
    mysql -u root -p
    SELECT host FROM mysql.user WHERE User = 'root';
    CREATE USER 'user'@'localnetworkip' IDENTIFIED BY 'Password';
    GRANT ALL PRIVILEGES ON * . * TO 'user'@'localnetworkip' IDENTIFIED BY 'Password' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
    FLUSH PRIVILEGES;
    quit;

    after multi server setup
    Log into ISPconfig panel then SYSTEM -> Server Services -> click on secondary server and set Is Mirror of server ns1.example.com

    on secondary server i run /usr/local/ispconfig/server/server.sh to see errors
    and saw PHP Warning: mysqli_real_connect(): (HY000/1045): Access denied for user 'ispcsrv*'@'localnetworkip'
    So i saw what is the password for ispcsrv* in
    sudo nano /usr/local/ispconfig/server/lib/config.inc.php

    ///On Primary Server
    mysql -u root -p
    SELECT host FROM mysql.user WHERE User = 'ispcsrv*;
    CREATE USER 'ispcsrv*'@'localnetworkip' IDENTIFIED BY 'Password';
    GRANT ALL PRIVILEGES ON * . * TO 'ispcsrv*'@'localnetworkip' IDENTIFIED BY 'Password' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
    FLUSH PRIVILEGES;
    quit;

    I now have no errors in /usr/local/ispconfig/server/server.sh

    But Secondary DNS not working and no help in syslog. Bind is running but not updating new zones from Primary Server.
    NOTE as a temp measure i copied primary DNS records from /etc/bind on primary onto secondary server

    ANY HELP Please :)
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Comment out server.sh cronjob in root crontab on secondary dns, enable debug mode for slave server in ispconfig, run tools > resync on the dns records, then run server.sh on the slave and post the output.
     
  7. Donno

    Donno Member

    removed
    * * * * * /usr/local/ispconfig/server/server.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    from crontab -e

    Log unto panel system -> Server config -> ns2.example.com -> Loglevel = debug

    ISPconfig -> Tools -> resync -> DNS

    run /usr/local/ispconfig/server/server.sh

    06.11.2018-10:38 - DEBUG - Found 82 changes, starting update process.
    06.11.2018-10:38 - DEBUG - Replicated from master: REPLACE INTO `server` .....

    Then after a few lines has first error
    06.11.2018-10:38 - DEBUG - Writing BIND domain file failed: /etc/bind/pri.example.com zone example.com/IN: has no NS records zone example.com/IN: not loaded due to errors.
    .....

    /etc/init.d/bind9 status
    Nov 06 10:38:46 ns2 named[20488]: all zones loaded
    Nov 06 10:38:46 ns2 named[20488]: running

    dig test shows that the DNS is updated and https://mxtoolbox.com confirms that Primary DNS is same as Secondary DNS

    Weird looks like problem solved :/

    I have Reset settings add cronjob and set logfile to error will monitor server thanks for showing how to use debug will be useful in the future. Any idea what was wrong ?
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Did you create the dns zones on the first server before you added the second server?
     
  9. Donno

    Donno Member

    I go into panel and in DNS ->Add new DNS Zone with Wizard should that not create records on primary and secondary server ? The primary server is where the ispconfig panel is installed.
     
  10. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Is that zone some leftover example? If the zone is faulty it will not be loaded. But I think ISPConfig still copies the zone file to the other name server, but of course zone is still faulty there.
     
  11. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    If secondary server is not installed or does not exist yet, the zones can not be copied there. It may be you have to force resync in this case, so even older zones get copied to secondary.
     
  12. Donno

    Donno Member

    I setup both servers before I set the main domain as i use custom name server from my registrar to the 2 DNS servers , when it did not work i redone Secondary DNS from scratch. After 24 hours still did not work so after that i copied bind files from Primary server to secondary just as temporary solution to get other things running on the servers.

    I rerun

    Log unto panel system -> Server config -> ns2.example.com -> Loglevel = debug

    ISPconfig -> Tools -> resync -> DNS

    run /usr/local/ispconfig/server/server.sh

    Errors seem gone now, doing a mxtoolbox.com -> DNS Check -> shows 2 DNS servers are the same now, other errors are :
    - SOA Expire Value out of recommended range reported Expire 604800 : Expire is recommended to be between 1209600 and 2419200.
    - No DMARC Record found

    Will just run for a while to make sure all is well :) THANKS FOR THE HELP
     
    ahrasis likes this.

Share This Page