Add TXT record to bind9 DNS record for google site verification on Debian

Difficulty: 1/5 – It is very easy to do, you just need to follow few simple steps.

For the purposes of this article, your DNS has already been configured and your server/domain is accessible. You just need to add Google (or any other provider) Apps TXT verification to your DNS zone file. Replace any “domainname.com” occurences with your domain name and “111.222.333.444” with your server’s IP.

First, test bind configuration for errors to make sure everything is working fine and you are not introducing new code to a faulty system – makes it hard to debug any problems that may arise.

# named-checkconf /etc/named.conf

You get no messages if everything is working as it should.
Now open for editing your domainname.com DNS record file:

# nano /var/cache/bind/db.domainname.com

Make sure you increase version number by 1. Standard is to use today’s date “YYYYMMDD” followed by two digit version number “01” for that day. For example, third edit on 2020 June 16th will result in 2020061603. Tomorrow you start at 2020061701 🙂
Add TXT record at the end of the file:

$ORIGIN .
$TTL 3600       ; 1 hour
domainname.com  IN      SOA     ns1.domainname.com. root.domainname.com. (
                         2020061603
                         10800
                         3600
                         604800
                         86400 )
                         NS      ns1.domainname.com.
                         NS      ns3.domainname.com.
                         NS      ns4.domainname.com.
                         A       111.222.333.444
                         MX      10      mx.google.com.
                         MX      20      mx2.google.com.
$ORIGIN domainname.com.
www                     A       111.222.333.444
*                       IN      CNAME   domainname.com.
@               IN      TXT     "google-site-verification=xxxxx-xxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxx"

Save the file and reload bind:

# service bind9 reload

Now test your configuration using one of the tools available online like the one from UltraTools. Enter your domainname.com and you will see new record in TXT section. Now you are ready to verify with Google Apps.

Useful external links. Checked as working when this post has been made.
Debian Bind9 documentation
How to check DNS files for errors
Wiki – TXT records
UltraTools – DNS Lookup Result
mx Supertool

Leave a Reply

Your email address will not be published. Required fields are marked *