Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    May 2003
    Posts
    87

    Default Changing the NS records for multiple zones

    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
    Memset Dedicated Hosting
    Managed, dedicated and VPS systems
    http://www.memset.com

  2. #2
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jul 2005
    Location
    New Jersey, USA
    Posts
    397

    Default

    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. #3
    Member
    Join Date
    May 2003
    Posts
    87

    Default

    Thanks. I had quite forgotten about /var/named/*.
    Memset Dedicated Hosting
    Managed, dedicated and VPS systems
    http://www.memset.com

  4. #4
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Thumbs up

    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)


    .
    Last edited by Spiral; 07-01-2009 at 01:33 AM.

Similar Threads & Tags
Similar threads

  1. Need a simple way to change MX records on all DNS zones
    By Hostbox.be in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 10-28-2009, 11:08 AM
  2. Need a simple way to change MX records on all dns zones
    By Pyro411 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 10-28-2009, 11:00 AM
  3. Changing MX/A records
    By andrewclure in forum New User Questions
    Replies: 1
    Last Post: 01-30-2009, 05:23 PM
  4. Automatic massive add of SPF records on all existing domain zones
    By COBRAws in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 09-21-2007, 08:05 PM
  5. Change multiple DNS zones
    By ruber in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-06-2007, 10:12 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube