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!

mass change NS in all zones

Discussion in 'General Discussion' started by dragon2611, Feb 1, 2010.

  1. dragon2611

    dragon2611 Well-Known Member

    Nov 30, 2003
    Likes Received:
    Trophy Points:
    I seem to have accidently missed one of my Nameserver entries out of my template on the last server migration I performed, is there an easy way to rebuild all of the DNS zones on the server to re-add the missing NS entry?
  2. jman_

    jman_ Member

    Sep 23, 2008
    Likes Received:
    Trophy Points:
    This is all at your own risk, so backup first in case anything goes awry...

    Am assuming you can ssh into your server.

    The zone files are stored in /var/named. For each domain that has a zone, you'll see a file with that domain name and a .db extension. These are just text files, you can cat them or open with any editor.

    You'd have to mass edit those files, either with sed or your favorite text editor that supports search/replace in files.

    You could look for something the same in all the records (say, '86400 in NS' followed by a newline), and use that match to append another line with your missing info.

    Probably best to copy just one of the db's and experiment until you have it right.

    When done, restart named & you should be good to go.

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