Accidently synced all zones from the nameservers to a shared server. Is there a way to clean up the zones not hosted locally on the shared server ?
Tried cleandns but I think it will remove the zone entry only if the db file is not present.
Accidently synced all zones from the nameservers to a shared server. Is there a way to clean up the zones not hosted locally on the shared server ?
Tried cleandns but I think it will remove the zone entry only if the db file is not present.
You can write a script that compares each zone in /var/named/ to the domains in /etc/userdomains
For any that don't exist, it can remove the dns zone.
Anyone happen to have such a script? I could use this also.
- Scott
I opened a ticket regarding a similar issue, and asked about a script. cPanel was able to clean things up for me, and the tech said he'd post a script and the process in the near future, in case others could benefit from this.
- Scott
Last edited by sneader; 09-19-2009 at 03:51 PM.
I have several specialized scripts to do these sort of tasks but to be perfectly honest, you would be much better off rebuilding your DNS zones from scratch unless you have a lot of custom edits you are trying to protect.
I'd just wipe (or preferably move) the /var/name/*.db files from their current
location and then renamed your /etc/named.conf file and then you can issue a rebuild of the "named" server config file and DNS zones and that should get you back up and running again in about 15 seconds.
does anyone have this script, which compare /var/named/domain.com.db zone in /etc/localdomains and then remove it / move it to another folder ?
If your intent is cleaning up you DNS, you are going about it the wrong way!
However, since you asked:
Code:#!/bin/bash IFS="$" # Put the folder you want to move the zones to below: TARGET="/var/localzones" cd /var/named if [ ! -d ${TARGET} ]; then mkdir ${TARGET} fi ### If you want to move out remotedomains, change next line: cat /etc/localdomains | while read CPDOMAIN; do if [ -f /var/named/${CPDOMAIN}.db ]; then mv /var/named/${CPDOMAIN}.db ${TARGET}/${CPDOMAIN}.db fi done
thank you for script. Can you please tell me what would be the correct way?.
We have 6 servers in cluster and number of zones have increased to 7000+, all are setup to sync with each other and now its taking long time for bind/named to load all zones at startup. named.conf has increased to 50,000 lines.
I have changed settings on all web servers to syn only with dns server and dns server do not sync zones with web servers. Now, We want to remove unnecessary zones from web servers but want to keep all zones only on dns server where they are backed up every few hours.
Can you please suggest any workaround for it?
I could probably tell you better if I saw your current DNS configuration.
I do have scripts that can sort out zones back to their original servers but sounds like your DNS might not be setup the best it could be setup.