When you are setting up a website, one of the technologies you’ll encounter is the Domain Name System(DNS). DNS’ primarily function is to translate human-friendly domain names into their Numeric IP address equivalents. But DNS has other uses such as proving domain name ownership and email verification.
When hosting a website, you will need to configure DNS A and CNAME records which point your website name or domain name to the IP address of the server hosting the website files. The other DNS resource record you will need is the TXT (short for text record). The TXT record contains a bunch of plain text. It was originally intended to add human-readable notes or documentation to a domain, but now it’s morphed into other functions such as providing domain name ownership and secure Email communication.
Related post: Correctly setting up DNS records for your website or App
How to check for TXT records
To find out the TXT record of any domain, you can use dig, the DNS Linux commandline tool or any of the graphical DNS Lookup tools we already looked at. If you use Google’s Gsuite Toolbox dig, then enter your domain name and select the TXT tab.
Related post: Top 5 DNS lookup tools you should use for your domain
Or if you choose to use dig, simply enter “dig txt your-domain-name”.
In my case I have two TXT records google-site-verification=kRcMr01RoDmZvuL3C9TazdNVpt7O2VWX6OpAQ_2ZjMM and google-site-verification=HGZLsLLvcP9AMHRyqCHou9jK1JfU_Jd7vTNYisCtALk. I use one of them to verify my domain in Google Search Console.
TXT record is used to fight Email Spam by ensuring that emails sent from a specific domain indeed originated from that domain. If you host your own emails, you’ll need to configure SPF and DMARC by entering TXT records to your domain name DNS records. Otherwise, your email will end in the Spam folder of the recipient’s inbox. Here are examples from Wikipedia of how TXT records are used to add SPF and DMARC records;
The character string from a TXT record used for SPF: "v=spf1 ip4:192.0.2.0/24 ip4:198.51.100.123 a -all" An example of use for DMARC: "v=DMARC1;p=none;sp=quarantine;pct=100;rua=mailto:[email protected];" Use for site verification: "google-site-verification=6P08Ow5E-8Q0m6vQ7FMAqAYIDprkVV8fUf_7hZ4Qvc8"
How to add TXT records?
Adding a TXT record is variable depending on your DNS hosting provider. Usually your provider will provide you with a web interface or a web form with couple of input fields where you can enter TXT record. These records are generated by either a program like the case of Email or by a provider as in the case of domain verification with Google on Search Console. You get the TXT values and enter them in your DNS manager. Just copy and paste the value as it is.
Here’s an example of how to enter TXT DNS records in name.com.
- Log in to your Name.com account.
- Click on the MY DOMAINS button, located on the top right hand corner.
- Click on the domain name you wish to create a TXT record for.
- Click Manage DNS Records.
- Here you will add the desired TXT record, provided by your host.
- Select TXT in the Type drop-down menu.
- If provided a subdomain or host, enter it in the Host field.
- Enter or copy+paste the value (string) into the Answer field.
- Leave TTL as 300 (default)
- Click the blue Add Record button.
The steps will highly dependant on your DNS Provider. But generally you will have to select TXT as the DNS record type, host name is normally the “origin” or the root domain name also respresented as ‘@’ symbol, the TXT value which is some long text value and the TTL normally provided as a default by your provider.
After you are done entering TXT records, you can verify them as we have mentioned about.