How to use perl to do a mass update of a single A record for all domains
If you're looking to change the IP value of 1 A record in all db files for all domains, perl will be your best friend.
In this example, we'll change the mail
A record from any previous IP to a new value of 188.8.131.52
. This will make all mail get delivered to 184.108.40.206 when the MX record is looked up in the dns query.
First, you'll want to change to the directory where your db files live.
On redhat systems it's /var/named.
On debian /etc/bind
On freebsd /etc/namedb
So the example would be
perl -pi -e 's#^mails14400sINsAs(.*)$#mailt14400tINtAt220.127.116.11#' *.db
Then restart named so the new values take effect.
Note that these steps can be applied to other A record with different names (like pop and smtp), and even to other record types like MX, NS, TXT, etc.