Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Changing the NS records for multiple zones

Discussion in 'General Discussion' started by movielad, Jun 30, 2009.

  1. movielad

    movielad Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    109
    Likes Received:
    2
    Trophy Points:
    168
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    I have 323 DNS zones on a cPanel server whose NS records I need to change within the zones themselves. Is there a quick 'n' dirty way of applying multiple changes across DNS zones?

    Thanks,

    Martyn
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. PlatinumServerM

    PlatinumServerM Well-Known Member
    PartnerNOC

    Joined:
    Jul 10, 2005
    Messages:
    400
    Likes Received:
    3
    Trophy Points:
    168
    Location:
    New Jersey, USA
    cPanel Access Level:
    Root Administrator
    If you want to do a from -> to change then you can use the replace command

    replace fromxxxx toxxxx -- /var/named/*

    Make a backup first before doing that
    tar cf /var/namedbackup.tar /var/named
     
  3. movielad

    movielad Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    109
    Likes Received:
    2
    Trophy Points:
    168
    cPanel Access Level:
    Root Administrator
    Twitter:
    Thanks. I had quite forgotten about /var/named/*.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    8
    Trophy Points:
    193
    Just a little bit cleaner run of the same command written for fewer unintended
    side effects than what PlatinumServerM had in good faith posted above ....

    Code:
    # replace '(old string)' '(new string)' -- /var/named/*.db
    You can run this putting whatever you want for (old string) and (new string)
    respectively and all instances of those strings will be updated in your DNS
    zone files on your server.

    Don't forget to update the serial number on your zone files and restart
    your "named" service to make the changes effective:
    Code:
    # sed -i 's/200[0-9]\{7\}/2009063010/g' /var/named/*.db
    # service named restart
    # service named status
    
    (Incidentally the serial number in the example above is one you might use for updating all the
    zone files to a valid serial number for the date this post was made and runs in the
    format of "yyyymmddee" where y= year, m = month, d = day, and e = edit number for day)


    .
     
    #4 Spiral, Jul 1, 2009
    Last edited: Jul 1, 2009
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice