Changing the NS records for multiple zones

PlatinumServerM

Well-Known Member
PartnerNOC
Jul 10, 2005
400
3
168
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
 

Spiral

BANNED
Jun 24, 2005
2,020
8
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)


.
 
Last edited: