DNS stands for Domain Name System and is an essential part of the functionality of the internet. This blog post is an attempt to explain how the DNS works for the everyday internet user. It is not a technical post and therefore won’t explain every complex detail of the DNS.
The DNS can be seen as the phone book of the internet. It translates human-friendly hostnames (like www.google.com or www.mywork.com.au) into IP addresses. An IP address (Internet Protocol address) is a unique identifier for every single computer or server that is connected to the internet. With the help of the DNS a user’s internet browser (like Chrome, Firefox, etc) can find the IP address of the server where the requested website is located. It can then connect to this server, load and display the contents of the website.
Every domain name on the internet has at least one DNS server (or name server) set. This name server is actually responsible to publish the information about the domain (IP address etc.). Every time a domain name is entered into the address bar of a browser, the first thing that gets queried is the name server. Once the name server of a domain name is known, this name server can be queried for information about the domain name. If a browser wants to display the website, it will query the name server for the main A record. This record saves the IP address. The IP address is then used to connect to the server with that IP address to retrieve the content of the website.
The information of a domain name on the name server is called the DNS record. The DNS record is simple text file with all necessary information about the domain in a certain syntax. It consists of a list of records, which all have a type, an expiration time limit and a class. They can also have some other information, depending on the type.
The most important two records in the DNS record are the main A record which saves the IP address of the domain name and the MX record. The MX record is important when it comes to emails that are associated with the domain name. MX stands for Mail Exchanger and saves the hostname of the mail server that is handling the emails for this domain. When an external mail server wants to sent an email to an email address on our domain, it queries the name server to retrieve the DNS record. Once the DNS record is retrieved, the external mail server checks the MX record to get the hostname of the retrieving email accounts mail server. The mail server can then resolve that mail servers hostname again to get the IP address of the mail server. With the IP address of the mail server know, our mail server can then connect and deliver the email.
The DNS record has a lot of other types of entries that are used to set up subdomains, redirects and even verifications for Google etc, but the main A record and the MX record are the most important to know about.
In theory the above system would work just fine for the operation of the internet, but to improve efficiency and to reduce DNS traffic across the internet, DNS caching has been implemented. Just imagine how much traffic alone would be generated if every time an address is entered into a browser or every time an email is sent, the DNS is queried. To increase the speed and efficiency DNS caching is used to save DNS records. ISPs (Internet Service Provider) like Bigpond or Optus save DNS records locally once they are queried for the first time to make the DNS lookup quicker the next time a page is loaded from the same domain (for example when navigating through a website).
When caching or copying a DNS records from the nameserver the ISPs check the expiration time limit (mentioned above) of the DNS record that is queried. This is a time limit that controls how long a record is valid once queried. A standard value for the expiration time limit is 4 hours. This means that the ISP will consider the DNS record valid for 4 hours from the time it has queried the record and it won’t query the name server again for 4 hours.
Although caching is necessary to speed up the internet and delivery a high efficiency, DNS caching comes with a small problem. What happens when the DNS record is changed after an ISP has queried and therefore cached the DNS record? This is a typical scenario here at MyWork Australia when we redesign a website or online shop for a client. While the new site is in development, the old site is still hosted on a non-MyWork server. Then the time for the launch of the newly designed website comes and our client is super keen to see the new site live. Our team changes the website over and the new website is now live and the domain name points to the IP address of a MyWork web server. Unfortunately our client has been busy before the launch and was already on his (old) website that day. Therefore his ISP has cached the DNS entry and will use the old IP address for at maximum of another 4 hours. During this time, our client will still see the old website, because his ISP uses the cached DNS record which is now obsolete. Luckily it’s only for a maximum of 4 hours and everybody else (who hasn’t been on the website that day) will see the new site instantly (because the DNS record hasn’t been cached by their ISP), but it still causes frustration and confusion for our client who was really looking forward to see his new website live and in action.
For high-traffic websites like established online shops, any downtime would be a problem, even if it’s only 4 hours. To get around the caching issue, some arrangements can be made before the new website is switched live. The previously mentioned expiration time limit can be se set to only a few minutes or less. This way ISPs cache the DNS record for only a few minutes (or less). This change has to be done well in advance (at least 4 hours) to take full effect. Obviously the expiration time limit should be set back to 4 hours once the switch over has been completed.
The DNS system can be confusing for non-technical users and any small change to the DNS record of a domain can break the website and stop it from loading. Therefore we always recommend to our clients to let our technical team here at MyWork do any DNS record related work for them. This way our clients can be sure that the work is done properly by our experienced staff.