DNS Records & Mapping – An Easy Guide For Beginners

DNS records are instructions that live in the authoritative DNS server also known as a zone file which provides information about an IP address of a domain the mail server records the Cname records etc. In our previous blog, we learned What is DNS and how does it work?. As DNS is considered the internet’s phonebook, the DNS records are considered as a single page in the phonebook which holds the complete information of the domain.

What is the use of a DNS zone file?

We already have learned the mapping of an IP address to a domain as the internet is a complex thing we need to keep a file for all the records for a particular domain for tracking all the records which are called the DNS zone file. The DNS zone file is a simple text file which normally resides on the authoritative DNS server so whenever there is a change in any of the DNS records we can edit the particular zone file of the domain.

Common types of DNS records?

A record: A stands for Address A record is the most fundamental record in DNS. It indicates the IP address of a given domain name. For example, if you query the A record of google.com it will give the output You can use tools like dig or nslookup to query the A record of a domain name.

Domain.comrecord typevalueTTL

This is the common syntax of A record the @ indicates that the record is for the root domain.

We can have other A records for our domain similarly as shown below

Domain.comrecord typevalueTTL

Here mail.domain.com has a different IP address which indicates that the website files are present on the server and mail is mapped to another server having a different IP address as shown.

CNAME record: Canonical name which maps one domain name to another domain name. It acts as an alias for an A record. Cname record must always point to another domain, not an IP address.

For example, if blog.domain.com has a CNAME record mapped to domain.com so whenever we query blog.domain.com it actually triggers the A record of domain.com.

blog.domain.comrecord typevalueTTL

Mx record: This record point the domain’s email to the mail server. This DNS record identifies an email server. You must configure the MX record in order to receive emails for the domain. Like cname record, the MX record must point to a domain name, not an IP address. When an email message is sent to a recipient at a domain, the sending mail server looks up the MX records for that domain to find the appropriate server to deliver the message to. The priority value in the MX record determines the order in which the servers should be tried if one is unavailable. For example, an MX record with a higher priority value would be tried before an MX record with a lower priority value.

domain.comrecord typevaluepriority

In this example, the domain MX is pointed to the mail.domain.com hostname. So mail.domain.com must have a CNAME record or A record configured in order to route the emails.

The priority indicates the preference the lowest number is the highest preference. We can have multiple MX records with different priority value according for example google’s MX record is as follows

For more information visit the link https://support.google.com/a/answer/174125?hl=en

Name/Host/AliasTime to Live (TTL*)Record TypePriorityValue/Answer/Destination

Txt DNS record: As the name indicates it is just a text record for a domain name. We need text records for email security and domain verification purposes. In some situations, we need to verify our domain ownership for that they provide a text record which needs to add to our zone file for verification purposes.

The example below shows the SPF record which is added as a txt record for email security purposes.

domain.comrecord typevalueTTL
@TXTv=spf1 ip4:<IP> include:_spf.google.com ~all14400

NS record: Ns stand for nameserver which determines which DNS server is authoritative for the domain. The nameserver is a server which stores all the records of a domain as zone files. The nameserver tells the internet ie where the DNS record exists for the domain and maps the IP address. Normally there are multiple Ns records for a single domain which points to different DNS server IP addresses in order for high availability.

domain.comrecord typevalueTTL

Here the ns record for the domain is ns1.dnsserver.com and ns1.dnsserver.com where both points to different IP addresses and in that server a zone file for the respected domain must exist in order to map the records.

PTR record: We have seen the mapping of the domain name to the IP address PTR record is the exact opposite of it.PTR record maps an IP address to a domain name.PTR records as used in reverse DNS lookups. DNS PTR records are stored under the IP address — reversed, and with “.in-addr.arpa” added. For example, the PTR record for the IP address would be stored under “”.

Tools like nslookup and dig can query your DNS-related information and also helps to troubleshoot dns related issue.Vist our previous blogs to learn about querying dns records using these tools
How to use the Nslookup command?

How to use Dig command in linux?

In this blog, we have learned the different types of DNS records and their use cases

Related article: What is DNS and how does it work?

Leave a Reply

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