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.

Possible to edit multiple DNS zones

Discussion in 'Bind / DNS / Nameserver Issues' started by andrewm, Mar 4, 2004.

  1. andrewm

    andrewm Member

    Joined:
    Sep 27, 2003
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    I'm about to move servers and I want to lower the TTL value on all the domains in my WHM - there are about 100.

    Is there any way of modifying all these at once, or am I going to have to edit each DNS zone manually?

    Thanks

    Andrew
     
  2. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    When I need to do things like that, I just download the files, open them in a good text editor like cutehtml or notetabpro, and use search/replace, then upload the new files. Takes a total of about 5 minutes for 100 files.

    If you prefer from shell, see this thread.
     
  3. andrewm

    andrewm Member

    Joined:
    Sep 27, 2003
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Thanks.

    Which files do I need to download though - all the named.db files?
     
  4. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    Yes
    Should be /var/named/[domain].db

    Just make sure you upload and download in ascii not binary.
     
  5. bamasbest

    bamasbest Well-Known Member

    Joined:
    Jan 10, 2004
    Messages:
    531
    Likes Received:
    0
    Trophy Points:
    16
    From shell:

    (first, backup all of your files;)

    then:

    find /var/named -type f -exec \
    sh -c 'gawk "$0" "$1" > "$1.tmp"; mv "$1.tmp" "$1"' \
    '{gsub("oldvalue","newvalue"); print $0}' '{}' \;


    Just replace oldvalue and newvalue with the appropriate values.

    So, if you wanted to change "expire" from 3600000 to 600 .....

    find /var/named -type f -exec \
    sh -c 'gawk "$0" "$1" > "$1.tmp"; mv "$1.tmp" "$1"' \
    '{gsub("3600000","600"); print $0}' '{}' \;
     
  6. andrewm

    andrewm Member

    Joined:
    Sep 27, 2003
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Thanks to you both.
     
  7. kickedmydog

    kickedmydog Well-Known Member

    Joined:
    Oct 28, 2004
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    You saved me hours of work. Sweet


    YOU ARE AWESOME!! ;)
     
  8. lloyd_tennison

    lloyd_tennison Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    698
    Likes Received:
    1
    Trophy Points:
    18
    how about:

    replace '36000' '6000' -- *.db

    Lots easier and command line. No script needed.
     
  9. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Bear in mind that if you touch a zone file you should always increment the SERIAL number too.
     
Loading...

Share This Page