DNS is term you may have come across when purchasing or moving your website. It’s also a term you may have seen if you have every tried to access a website when your internet was having trouble. So what the heck is it?
A domain is human readable text e.g. amazon.com, google.com) that is an identifier for some portion of the Internet. DNS stands for Domain Name System and its purpose is to translate a domain from a human readable bit of text to an IP address that is meaningful to computers. It does this by setting rules that are referred to as DNS records that are managed by nameservers.
When you purchase a domain from a Domain Registrar your new domain is automatically assigned to that registrar’s default nameservers. Those registrar’s typically have tools that let you administer the domain to set your own DNS records. They also allow you to change the nameservers so that you may control the domain elsewhere.
There are many different types of DNS records that a nameserver may set. For the purpose of this article we will only cover the 5 most common DNS records.
DNS Records: A records
An A record is the the most fundamental aspect of DNS. It is responsible for setting the IP address that a domain or subdomain will be translated into. A subdomain is a prefix that is appended to a domain that sets another record. The most common subdomain for any given domain is “www”. Yes, this means that it is possible for you to host your example.com at one location and www.example.com at another location by setting two different IP addresses for one another.
DNS also allows you to set multiple A records for the same domain/subdomain. You would do this if the domain was extremely popular and was under heavy load. For example, at the present time a DNS look up for Google.com returns 11 DNS records. When a computer is looking up a domain it will pull the record at random, but you may assign a priority to attempt to shift most of your traffic to/from a particular resource.
DNS Records: MX records
MX records are responsible for setting the e-mail records for a domain. In every realistic situation an MX record would just return a bit of text that represents an A record. From there a second look-up occurs to look up the value of that A record to find out what IP address e-mail should actually be sent to. Like with A records it is possible to set multiple MX records for a domain. For example, if your e-mail is hosted via Google Apps you are instructed to set 5 records at this present time (though I have seen it recommend up to 7 previously) with a certain priority level for each record.
DNS Records: CNAME, TXT, and PTR records
CNAME , TXT, and PTR records are the next most common DNS records. Their utilization is significantly less than MX or A records, but they are critical record types nonetheless.
A CNAME record allows you to set up redirects. Some times people prefer to set the ‘www’ subdomain as a CNAME record that tells a computer to look up the record for the main domain.
A TXT record is text record inside of DNS. It was originally supposed to be something that was human readable that could provide some information to humans doing a DNS look-up. It has evolved now to be some type of configurable variable that machines tend to use for various means. It often ends up being a mechanism to verify domain ownership with software.
A PTR record stands for pointer record. Their purpose is to point to a another record just like a CNAME record does, but unlike a CNAME record the DNS look-up does not continue. PTR records are useful for performing reverse DNS look-ups and is thus helpful as an anti-spam mechanism.