DNS Records and Types
As we mentioned before in the DNS explained article, the domain name system is what makes up the internet as we know it. The domain name system translates the human-friendly URLs that we can read, write, and memorize into IP addresses that connect to websites that we use. If you plan to run your own website, you will definitely need to understand DNS records and how to use them properly.
So what is a DNS record?
DNS records contain that data to answer a client’s query; they are simply the database that holds the information about the servers IP addresses. Depending on their type, this will determine the data returned to the client and what they can do with it. Let’s explain the most common DNS records you will need to use.
Name server record:
More commonly known as NS records. The name server record indicates which DNS server actually holds the DNS records for a domain. It basically tells the internet where to find the IP addresses to a website or an application. Most hosting providers will provide you with two NS records. A primary record and a secondary one in case the primary server fails. NS record is an essential service for every registrar or hosting provider and you will have to change them when you change your hosting provider.
A and AAAA record:
An A record is short for address record and is basically used to point a domain or a subdomain to an IPv4 server’s IP address. For example, if you have a website that consists of a store and blog and wants to host them on two separate servers, you can use two separate A records by setting, for example, blog.example.com to a shop.example.com to another server’s IP address. You can also set this record in order to indicate the IP address for your mail subdomain.
AAAA records are used the same as A records but are used to route IPv6 addresses. It is worth noting that both A and AAAA accept only IP addresses as values.
CNAME record:
The CNAME record is short for canonical name record and is used to set a domain or a subdomain as an alias to another domain. A very common use case for this record would be setting domain names to resolve to the same IP addresses with or without WWW. CNAME records always take host names as a value not an IP address.
MX entry:
Mail exchanger entry is used to direct emails to email servers. MX entries differ from A and CNAME records in that they take priority as a value so you can prioritize servers, and records will attempt to use the highest priority server first (higher priority numbers are used first). Like CNAME entries, MX entries must be to a domain or a subdomain not an IP address, so you will have to set the A records for the domain first.
TXT records:
A TXT (text) record is used to store text data that was first used to store human readable text. Nowadays, they are used for verification such as Google verification to verify for Google that you own a certain domain or verify that emails are coming from trusted sources.
Conclusion
Managing DNS can be tricky in the beginning, especially if you don’t know what each record is used for and for the most your hosting provider will handle it, but for more advanced use cases, you will need to do it yourself, so we hope you have a better idea of how each DNS record is used by now.