Sometimes in cases like migration its needed to change the nameservers for all sites / zones to newer ones. Here the cPanel does not provide any option to do so.
Here is way we can do it by command line :
First and most important backup the Zone files :
cp -r /var/named /var/named.backupUsing below you can replace the nameservers under all zone files :
sed -i 's/ns1.old.com/ns1.new.com/g' /var/named/*.dbOR
replace   "ns1.old.com"  "ns1.new.com" -- /var/named/*.dbNow its necessary to update the serials under each zone files to make the changes take effect.
find /var/named/*.db -mtime -1 -exec perl -pi -e 'if (/^\s+(\d{10})\s+;\s+serial/i) { my $i = $1+1; s/$1/$i/;}' '{}' \;Check the DNS service first :
systemctl status pdnsNow restart the service to load the changes :
systemctl restart pdnsMake sure to update the new nameservers under Basic Settings too.
Finally you need to update nameserver IP’s under cpanel using below command :
/scripts/updatenameserverips