Welcome to the second post in this series of basics/introductory blogs, brings us to something we use day in day out. Our friend DNS….
What is DNS?
DNS (Domain Name Service) is the service used to translate friendly names (michaelriccioni.com) into computer friendly names (an IP address).
How Does It Work?
Think of DNS as a phonebook. You look up the name, and it returns a phone number. This is exactly how DNS works.
For example if you want to search for something via google. It is easier for you to remember the name google.com that it is for you to remember one of its IP Addresses (phone numbers) 184.108.40.206
Both www.google.com and http://220.127.116.11 will bring up the search page, but one is a lot easier to remember than the other.
Each DNS server has a table (database) of entries listing the friendly name and the IP address. When the server is queried it simply checks its own table and returns the entry.
However, if the entry is not present, it can then query another DNS server to see if that server has the information which has been requested.
To further explain, let’s take this example. You are at home with your desktop, you type www.michaelriccioni.com in to your web browser. Firstly your computer checks its own DNS table, but this entry is not present. Your computer will then ask your router (BT homehub) if it knows where to find michaelriccioni.com. The router then replies saying no I don’t have this data, but I can ask my DNS server if it has the information. This is usually an ISP DNS server or public DNS server (such as googles DNS servers). If this has the information it will reply to your router saying I have the information for michaelriccioni.com, which in turn is then passed to your computer. Your computer now has the address (IP address) it needs to access in order to bring up michaelriccioni.com homepage.
The diagram below shows the above example:
In its simplest for this is how a very basic DNS query works. Of course the above can be further expanded by the DNS server contacting other DNS server’s on the internet in search of its answer.
Fully Qualified Domain Names
Fully Qualified Domain Names (or FQDN for short), are essential when DNS resolution is performed. For example, if you were to type www (without the michaelriccioni.com) after this is effectively meaningless as there are millions of www records out there. Each website has one, and the DNS server would not know which one you are after. This is why it is important that you type the full name. Otherwise you will get a page cannot be displayed page due to the DNS resolution not taking place correctly.
This is often why if there is a DNS issue, people assume their internet is not working. I.e they can’t access google.com. BUT if you were to browse to google via its IP address you would see the google home page appear.
There a number of different types of DNS records. The most common being an “A” record.
This is the record which maps a friendly name (for us) to a friendly name for computers.
For example, below shows the record in place for www.michaelriccioni.com
Above we can see an example of an A record.
The “record” (friendly name for us humans), the “type” (A), the “TTL” (time to live), “priority” (blank) and content (computer friendly name).
That is what a typical A record looks like. It is a very simple mapping of name to IP.
The TTL is the value that determines the number of seconds before subsequent changes to the record go into effect.
The current TTL determines how long it will take any change you make now to go into effect. Changes to a record that has a TTL of 86400 seconds, for example, will take up to 24 hours to go into effect.
If you change the TTL setting to a value of 3600, this tells servers across the Internet to check every hour for updates to the record.
Mail Exchange (MX) records are used when it comes to email. This is also a record where you would specify the priority. For example you might have the below MX Records:
The first record would be set with a priority of 10. This means it is the first email record which is checked. The second record would be setup with a priority of 20. This means if the first record is unavailable or does not respond, the second record is queried.
This allows email to still be delivered if your primary email server is offline.
A CNAME or Canonical Name record links an alias name to another “friendly” name.
For example, below shows a CNAME record currently in place for michaelriccioni.com
It simply redirects any traffic which lands on mail.michaelriccioni.com to my web hosts email landing page webmail.gridhost.co.uk
And that’s pretty much a simple over view of how DNS works….