How to update all DNS records in DirectAdmin

Modified on Wed, 13 Oct 2021 at 08:54 PM

There can be multiple reasons why you want to update the DNS records of every domain at once. This is only possible to do when you have direct SSH access to the server. If you do not you can ask us (your server administrator) to run the commands. Do note that these commands can only be run for all domains on the server and all domains of one account. Furthermore, this is only possible on your own server or a server that is managed by Yourwebhoster.eu.

DirectAdmin mass update DNS server

In this example we assume that you want to replace the old name server ns1.old.com with the new one: ns1.new.com. And ns2.old.com with ns2.new.com. Replace the nameservers with yours and run the following commands:

# Reconfigure the settings in DirectAdmin for new domains
cd /usr/local/directadmin/data/users
perl -pi -e 's/ns1.old.com/ns1.new.com/' */user.conf
perl -pi -e 's/ns2.old.com/ns2.new.com/' */user.conf
perl -pi -e 's/ns1.old.com/ns1.new.com/' */reseller.conf
perl -pi -e 's/ns2.old.com/ns2.new.com/' */reseller.conf

# Reconfigure existing DNS entries. Change directory to the location of the DNS files.
cd /var/named
perl -pi -e 's/ns1.old.com/ns1.new.com/' *.db
perl -pi -e 's/ns2.old.com/ns2.new.com/' *.db

# Make sure that DirectAdmin generates a new serial for every domain.
echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq

Do you want to update the SPF settings? Use our knowledgebase article DirectAdmin mass add IP of setting to SPF record.

Source: DirectAdmin: How to use perl to do a mass dns update

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article