![]() |
DNS data from Standalone servers to Primary DNS server
1 Attachment(s)
Description:
Here is a short PHP script that allows a 'master' DNS server to collect DNS data from other StandAlone ISPConfig3 servers. Intent: To setup a system that allows 1 (one) or more stripped down ISPConfig3/MyDNS servers to act as 'primary' DNS servers. This way clients can keep their own DNS up-to-date them selves while the Primary DNS server (in our case NS3) collects that DNS data from different ISPConfig3 (standalone) servers. You can also add other DNS servers to make sure the data replicated to primary NS1 and NS2 servers is 'whole.' (NS3 wipes all DNS data from it's tables before it collects the new DNS data from other stand alone servers - so using it as a NS1 is not a good idea.) This collected data can then be 'replicated' to NS1 and NS2 using simple MySQL script or 'normal' ISPConfig3 methods. You can run this script on ns3 using command php -q dns.php or by simply adding it to cron with command crontab -e Edit: Code edited 2010.05.29 Changelog: Script no longer stops if one of the queried servers is down but just skips that server. PHP DNS sync code to run in NS3: Quote:
Quote:
1. If client in serverX enters a domain that belongs to serverY client, they can possibly cause problems with the 'original' domains name resolution. FIXED - 2. If the serverX has not run the SQL command to enable ns3 to read it's DNS related tables the script will be unable to complete. Optional scripts to help run the PHP DNS sync code and keep DNS script backup and logfile: This is script is run hourly by crontab: (Or you can test the script manually with this command.) php -q /etc/dns/test-ns.php > /dev/null 1>> /var/log/dns-script.log test-ns.php Quote:
Quote:
|
First fetch data from master server then truncate and insert new data into table.
what if you can not connect to master database. dns data will be deleted. |
The code has been edited so that the personally created local Zones from 0-1000 would not be overwritten by the script.
|
Quote:
|
The script does not tell anything to any server. The script can be run on ns3 every hour to check the ISPConfig3 MyDNS zones and records on serverX, serverY etc.
The script will simply collect that DNS data to ns3 where the script is run hourly by cron. It seems to work quite nicely. There are some limits to how many servers can be included in the script but as it stands now every server can have up to a thousand records that can be collected from up to a thousand servers. (I did not calculate that my self and confirmation from someone who can code would be nice.) |
Quote:
Hm.... need to learn some php again :) |
Quote:
Our way is much more Admin friendly. This script provides a change to collect ALL DNS data to central location AND delegate that work to the client. Win/Win scenario. PS. By definition of MASTER server I mean NS1, NS2 & NS3. Not serverX, serverY & serverZ. |
Quote:
|
| All times are GMT +2. The time now is 01:59. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.