The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DNS cleanup

Discussion in 'Bind / DNS / Nameserver Issues' started by linux.newbie, Jun 15, 2009.

  1. linux.newbie

    linux.newbie Well-Known Member

    Joined:
    Sep 8, 2006
    Messages:
    73
    Likes Received:
    0
    Trophy Points:
    6
    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.
     
  2. PlatinumServerM

    PlatinumServerM Well-Known Member
    PartnerNOC

    Joined:
    Jul 10, 2005
    Messages:
    397
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    New Jersey, USA
    cPanel Access Level:
    Root Administrator
  3. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    Anyone happen to have such a script? I could use this also. :)

    - Scott
     
  4. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    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
     
    #4 sneader, Sep 19, 2009
    Last edited: Sep 19, 2009
  5. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    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.
     
  6. mahinder

    mahinder Well-Known Member

    Joined:
    Jun 12, 2003
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    matrix
    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 ?
     
  7. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    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
    
     
  8. mahinder

    mahinder Well-Known Member

    Joined:
    Jun 12, 2003
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    matrix
    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?
     
  9. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    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.
     
Loading...

Share This Page