Overview
A lot of what web hosting does for you is affected by DNS (Domain Name System), but what is it and how does it work. While we can’t get too deep into the mechanics of DNS, we will try to explain the basics of what DNS is and how it affects your hosting.
What is DNS
DNS stands for Domain Name System. The easiest way to think of DNS is to compare it to a phone book. Computers look up other computers by their IP address (think of it as a phone number), but people use names. You would not call out to your friend in a crowded restaurant using their phone number, would you. The same is true with websites. Would you rather tell your customers to go to mycoolsite.com, or 192.168.42.69?
So, when you want to call someone (website) and you don’t know their number (IP address), what do you do? Well, a long, long time ago, you would use an ancient tome called a phone book. Here you could look up a person or business by their name and it would show you what their phone number was. This is basically what DNS does for websites. When you enter mycoolsite.com in your browser (your friend’s name), your browser checks with DNS servers (phone book) to see what IP (phone number) to connect you to. This is a very simplified version of what happens, but it should work fine for the scope of this guide.
A domain name consists of several parts, separated by decimals, but needs at least two parts, the domain name as well as the TLD (top level domain). In the example of domain.com, ‘domain’ is the domain name and ‘com’ is the TLD. There can also be subdomains such as newsite.domain.com.
DNS servers read domains from right to left, in a way. When a DNS resolver is searching for a domain, it firsts checks the TLD, then domain name, and then any subdomains.
In the example above (newsite.domain.com) the DNS resolver with first check the .com name server. This will provide the Authoritative name server for the domain name (‘domain’ in this example). Once it gets to the Authoritative name server, it will find the Zone File for the domain. This zone file will have the IP addresses for the main domain (blank record) as well as any subdomains (newsite.domain.com).
The DNS chain
Whenever you look up a domain, there is a chain of events that occurs. Once again, this is a very simplified version of events.
- First, the browser will send the request to your DNS resolver. This is a typically controlled by your ISP or internet service provider.
- The resolver will first check to see if it has cached an IP for that domain. If it has an IP for the domain that has not expired (cached DNS records have a set lifespan or TTL), it will send that to the browser and the chain ends here. If it does not have a valid IP, it will pass the request on to the proper TLD (Top Level Domain) server.
- The TLD server contains information on all the domains with the same TLD. The TLD of the domain is the last part of the domain (in domain.com, the TLD is .com). Once it finds the Authoritative name server for the domain in question, it will pass the request to it.
- The Authoritative nameservers for the domain is the nameservers set by your domain registrar. Once at the nameserver, it can read your Zone File and find the IP address that it is looking for and respond to the browser with the IP address to connect to.
Where do I find my DNS?
The DNS records for your domain reside on your DNS provider’s nameservers in what is called a Zone File. You can have zone files for your domain on as many nameservers as you wish, but the only zone that will be active is the one your nameservers are currently pointing to.
The way to access your Zone File depends on what service you have.
If you have a cPanel account, you can edit these records using your DNS Zone Editor in your cPanel. You can find out how here. If you do not know how to access your cPanel, you can find out here.
There are also several online tools that you can use to see a domain’s DNS records.
What type of DNS records can I have?
There are several different types of DNS records you can use for different tools and services. You can find more information here.
What does my DNS zone file contain?
A typical DNS zone file will contain several records that control where domain traffic is forwarded to. When you create a new account (or add an addon domain or create a subdomain), a default zone file is created as well. In most cases, you should not need to change anything. However, there are cases when you will need to update these records. We will give a few examples below.
Every zone file needs to contain one blank (sometimes referred to as ‘@’) A record that points to an IP address. This is required and the zone file is not valid if you don’t have this set.
Website records
These control your website and ftp client connections. Your website records are created when you set up your services for the first time. In most cases, these records do not need to be updated. By default, you should have the following:
- a blank A record for domain.com
- a CNAME record for www.domain.com that points to domain.com
- an A record or CNAME for ftp.domain.com that points to domain.com
If you have any subdomains or custom name servers for this domain, those records will be here as well.
Email records
These records control your email traffic and ensure that your emails make it to your mail server.
- MX records for domain.com (there can be several for redundancy)
- several A or CNAME records to assist with mail clients (Ex. pop.domain.com, imap.domain.com, smtp.domain.com, autodiscover.domain.com)
- several TXT records to help with mail verification (see here for more information)
Other domain records
By default, there are several other records created for additional services that you may not use (webdisk, cpcontacts, cpcalender, etc). It is not necessary to delete these records, even if they are not needed.
When should I update my DNS records?
As long as you are using our services, you typically do not need to update your DNS records. However, there are times when you will need to update your records.
Third party website
If you decide to use a third party service to host your website, you will need to update the records to point website traffic to the new server. Your new host should be able to provide you with these records. These typically consist of one or more blank (or may be named ‘@’) records as well as records for www.domain.com (can be A or CNAME). There may be other records as well, such as records for ftp access (ftp.domain.com) and other services.
Third party email host
If you are using someone else for your email hosting, you will need to update the mail records accordingly. This information should be provided by your new host. This will normally consist of MX records, and possibly other TXT and A or CNAME records.
Third party email filters
If you are using a third party email filter, you will need to update the MX records so the mail goes through the filter before it is forwarded to your mail server. Typically, all you need to update here is the MX record(s). Once again, your filter provider should be able to provide you with this information.
Other services
Depending on what other services you require, there may be additional records that need to be added to your zone file. Your service provider should be able to provide what records their services require.
An Important Note About DNS
Whenever you update your DNS, it can take time for the changes to propagate across the internet. While this is typically updated within four to six hours, we recommend waiting up to twenty-four hours for records to fully propagate.
If you have any further questions, please be sure to reach out to our support staff by putting in a ticket.