What is DNS?

DNS or Domain Name System is a decentralized naming system used to associate an easy to understand domain name such as servermania.com with an IP address such as 104.20.47.240. DNS consists of a series of standardized protocols so that devices around the world can each understand how to find and connect to the underlying server of a domain name.

What Are DNS Record Types?

One core component of DNS is the DNS zone file. This is a text based file which is stored on the name server of a domain and it contains instructions for all other servers to follow in order to connect to various services hosted on the domain such as a web server or email server.

The DNS zone file contains a variety of DNS records  which each perform a separate function in the DNS process.

What Are the Types of DNS Records?

The DNS zone file contains a variety of DNS query types. Here are some of the most common records:

SOA record

The DNS zone file of every domain must contain an SOA or Start of Authority record. This record contains important information about the domain and how the DNS records should be interpreted.

servermania.com. 3599 IN SOA elaine.ns.cloudflare.com. dns.cloudflare.com. 2033516212 10000 2400 604800 3600

This record contains the following information:

  • The primary name server for the domain: elaine.ns.cloudclare.com
  • The responsible party for the domain’s DNS: dns.cloudflare.com
  • A timestamp that changes whenever you update your domain: 2033516212
  • How often the DNS records for the domain should be refreshed in seconds: 10000
  • The number of seconds before a failed refresh should be retried: 2400
  • The expiry time of the DNS zone file: 604800
  • The default TTL (Time to Live) of  DNS records: 3600

NS Record

At the top of the DNS record types is the NS record. The NS record is a DNS record which indicates the name servers of the domain. The name servers are the servers which serve the DNS records of a particular domain name.

There should be a minimum of two name servers set at both the registrar of the domain and these NS records should match those listed in the DNS zone file. If there is a mismatch, some resolvers may query the name server in the DNS zone file instead of those listed at the registrar, and if that name server is not functional, the domain will not resolve for a user.

servermania.com.11929INNSelaine.ns.cloudflare.com. servermania.com.11929INNSfred.ns.cloudflare.com.

A Record

The DNS A record is a DNS commonly used record listed for the root of a domain or a subdomain which indicates the IP address of a web server. For example, servermania.com has the A record of the IP address 104.20.46.240 as this is the web server which hosts our website.

The dig command can be used in a terminal to return the A record of a domain:

servermania.com.   299   IN  A  104.20.46.240

There should be an A record configured for the root of the domain as well as the www subdomain. An A record can then be configured for any other subdomain of the website such as blog.servermania.com in order to connect the subdomain to a specific IP address or IP addresses.

A round-robin DNS platform can be used in order to connect a domain A record to multiple IP addresses. When an A record is used in this way, a device would attempt to connect to a second IP address in the event that the connection to the first IP was unsuccessful.

AAAA Record

The AAAA record functions in the same way as an A record, but this record is used for IPv6 addresses instead of IPv4.

servermania.com.299 . IN . AAAA . 2606:4700:10::6814:2ef0

CNAME Record

The CNAME or canonical name record is another commonly used DNS record type which will direct one subdomain of a domain to another hostname. Unlike an A record, the CNAME record type will direct traffic from one subdomain to another subdomain instead of an IP.

For example, deals.servermania.com could have a CNAME set to blog.servermania.com so that users visiting weblog.servermania.com would be resolved to blog.servermania.com.

TXT Record

The TXT or text DNS record is used to insert some text into the DNS record when querying the domain. This is most often used by SaaS tools to verify domain ownership. The tool can generate a unique piece of text, and the domain owner would add it to the domain’s DNS record in order to verify ownership.

The TXT records are used when configuring SPF records on a domain. SPF or Sender Policy Framework is an anti-spam system designed to indicate at a domain which mail servers are authorized to send email on behalf of a domain. When a receiving mail server receives mail from a server other than one specified in the domain’s SPF record, it can choose to reject the mail or send it to the spam folder. It’s important that the TXT record be kept up to date with an accurate SPF record, or mail from a domain may be rejected.

In this example, we see that the servermania.com DNS server TXT records indicate that google.com and sendgrid.net are both permitted to relay mail on behalf of servermania.com:

servermania.com.299INTXT”v=spf1 include:sendgrid.net include:_spf.google.com ~all”

MX Record

The MX or Mail Exchange record is a DNS record type which indicates what the mail servers are for a domain.

A domain can have multiple MX records and most domains have at least two MX records for redundancy. MX records are labelled by priority, with 0 being the first MX record to be connected with and the other MX records with a higher number for priority will be connected to if the other MX records cannot be reached.

servermania.com. 299  IN MX 10 aspmx2.googlemail.com. servermania.com. 299  IN  MX   1 aspmx.l.google.com. servermania.com. 299  IN MX 10 aspmx3.googlemail.com.

In this example, aspmx.l.google.com would be the first host to be connected to when attempting to relay mail on the servermania.com domain. If it is unreachable, then the next two hosts will be attempted.

An MX record hostname should be a hostname with an A record. It is improper to use a CNAME as an MX record as this leaves an extra layer of failure potential in the connection process.

Want More Information?

Record types in DNS are an important aspect of the DNS server infrastructure and every domain owner should understand how they function in order to ensure they are accurate. You can perform a check of your domain record types using a tool such as IntoDNS.com.

The ServerMania Knowledge Base contains hundreds of other tutorials on all types of server related topics. Feel free to contact us if you have any questions about setting up or configuring a server for your next project!