You can edit the template and then reset the zone if your zones have no customizations. This is not practical in all cases because zones may have customizations and this will remove those customizations.
Experienced system administrators should explore manually editing all DNS Zones from the command line. For instance, if you want to update the nameservers in all DNS zones from ns1.example.com and ns2.example.com to ns1.example.net and ns2.example.net, you could do so using customized sed and find Linux commands after backing up all zones in the /var/named/ directory.
SafeAdmin Certified system administration service providers are listed on the SafeAdmin Certified Services page for your convenience.
An example of the command line changes to change nameservers for all domains is the following.
NOTE: We strongly recommend backing up all DNS zones prior to making bulk changes. It is the responsibility of the administrator performing these changes to ensure that all commands are run correctly.
To back up all zones, run the following command:
cp -rf /var/named{,.backup}
Replace the nameservers used. In the following examples, we will use ns1.olddomain.tld
and ns2.olddomain.tld
as the current nameservers, and ns1/2.newddomain.tld
for the updated records, be sure to update the oldns
and newns
variables.
oldns="ns1.olddomain.tld"; newns="ns1.newdomain.tld" ; find /var/named/*.db -exec perl -pi -e "s/(?<=IN\s\NS\s)$oldns/$newns/g" '{}' \;
Run the command a second time for ns2
.
Update the serial records for all modified DNS zones:
find /var/named/*.db -mtime -1 -exec perl -pi -e 'if (/^\s+(\d{10})\s+;\s?(?i)serial/i) { my $i = $1+1; s/$1/$i/;}' '{}' \;
Restart the DNS service to apply changes:
/scripts/restartsrv_named
Verify that the zones were updated correctly.
If DNS Clustering is enabled, sync all zones:
/scripts/dnscluster syncall
Comments
0 comments
Article is closed for comments.