Everything You Need To Know About DNS

Posted in Tips, Web Design • Posted on 10 Comments

DNS. Three letters that can make or break your website. A fault with DNS and your website can go down for 24 to 48 hours. What is DNS? From where does this 48 hour delay come from in the age of super fast Internet and high-speed technology? Why hasn’t the ever evolving technology replaced the age-old DNS and the frightening 48 hours delay? This discussion will shed some light on most of the queries about DNS. I hope that you will see DNS from a completely different perspective after this writeup.

What is DNS?

That is the customary question that we got to answer when we are discussing something as vast as DNS. Basically, DNS (Domain Name System) is responsible for translating human friendly website URLs like www.1stwebdesigner.com to computer readable IP addresses like 148.68.30.27 (just an example). You know, our mind cannot remember combination of such digits so we devised a system which helps convert these IP addresses to English names and vice versa.

Please understand that DNS isn’t a localized system where all the IP addresses corresponding to every website present on this planet is stored. If that was the case then an unimaginable amount of care would be required to keep such a huge database working. Also, having a localized DNS would be against the distributed character of the Internet.

Rather, DNS is a distributed service which is actually a collective group of name servers (which we call as “nameserver” in Internet lingo). These nameservers constantly refer to each other in order to stay updated with the changes that are rolled out every now and then. The process sounds simple but it is quite complex.

So, every website has a nameserver?

Well, technically speaking, yes! Though it’s a different case that one nameserver will be used for multiple websites. Otherwise, we would end up having 100 million nameservers for 100 million domains – which makes no sense. Like, I host a domain of mine on DreamHost.com. So, they give me nameservers like ns1.dreamhost.com, ns2.dreamhost.com and ns3.dreamhost.com. Now, DreamHost is giving these nameservers to almost every client that they have. So, these three nameservers basically have almost all the IP address to URL details of every DreamHost client.

A basic flow of request on the Internet

When you type Google.com in your browser then a lot of stuff happens behind the scenes before you get to see the Google homepage. The image below tries to explain the flow of request.

Let me try to make it bit more clearer:

  • When you visit a website URL via your browser then Windows will look for the corresponding IP address stored in the nameservers of your ISP.
  • If the IP address is found then the request is directly sent to that IP address henceforth reducing the execution time.
  • If the IP address is not found locally then the request is sent to the cloud of Internet and your browser waits for the virtual world to do its job.
  • Every website has a nameserver associated with itself. Henceforth, that particular nameserver receives that request and sends it to the respective IP address.
  • If that nameserver does not have the IP address details then it communicates with other nameservers and they with others. The request flows in the Internet till correct IP details are attained.
  • Once the IP address is known then the request is sent to the particular IP address and data is served.

What is “48 hours delay”?

Usually, when you are about to change the nameservers for your domain or when you are hosting a fresh domain then your hosting company will tell you that it might take up to 48 hours for the information to be updated. Technically speaking, they are correct. It might take up to 48 hours for all nameservers on this planet to connect with every other nameserver and keep themselves in sync. You see, it’s a huge virtual world out there. But, my personal experience says that it usually takes less than 24 hours for the global update to complete. Still, you should consider the 48 hour delay in your time plan before you make any changes.

The below image via Wikipedia will give you an idea of hierarchical DNS, organized into zones, each served by a nameserver.


How and when does caching occur?

Nice question. You got the information for Google.com request that you had sent some time back. Now, that information is saved in the local ISP’s nameservers so that next time your request isn’t sent to third-party nameservers. But, after a stipulated time period these nameservers contact other nameservers so that their information isn’t outdated. This is where the term TTL comes into play.

What is TTL?

TTL (or Time To Live) is the time period that comes in along with the IP address info. This time period information is sent by the third-party nameserver along with the IP address. The value is usually in seconds and it is more like a suggestion from the third-party nameserver that you can stay away from me for X seconds and still stay updated. Come back after X seconds and I will pass on the latest information.

Usually the TTL value is 12 hours or 24 hours. This can be set to a custom number as and when required to reduce traffic.

Other types of DNS lookups

Once DNS started to serve the IP address lookup (as discussed above), then it was time to expand. DNS was later on used for other type of lookups, two of which we will discuss below:

  • A Record – A Record lookup is something that we have already discussed. The IP address lookup is actually the A Record lookup for DNS.
  • MX Record – MX (which is acronym for “mail exchanger”) is used for email address lookups. Usually when a tool tries to send an email to mail box related to your domain then it will look for MX record of your domain. This MX record will have another domain (something like mail.yourdomain.com) as its value. Now the A Record for this MX record will be checked to get the target IP address.
  • CNAME Record – CNAME (stands for Canonical Name Record) is actually an alias for another domain name. This comes in handy when you want to use your own domain and data from another website. Like, during the ancient Internet Age (when blogspot.com was luxury), blogspot.com had a feature (they still have it) where you can use your own domain (yourdomain.com) instead of using the bogspot’s sub-domain for your blogspot hosted blog. In this case all that Google would do was ask you to change the CNAME of yourdomain.com to your blogspot’s sub-domain and the job is done. Whenever one would visit yourdomain.com then the data from your blogspot’s sub-domain will be delivered although the sub-domain won’t be visible in address bar.

Other usage of DNS

Other then the three lookups that I discussed above, DNS can be used for many other functions like:

  • As I discussed before, domain names and nameservers do not have a one-to-one matching. This gives the hosting companies the chance for shared hosting and save a lot on money invested. Here, multiple domains can result into one IP address. This means one machine can host many websites. Additionally, one domain can point to multiple IP addresses. This helps in redundancy and high availability.
  • The DNS system can be used to save and share IP addresses of blacklisted email hosts. Such databases are available for free in order to fight spam.
  • These days software makers save the version of a software in the DNS database. This way the client machine connects to find out the latest version of the software available. It connects to the software maker’s server only if a new version is available. This helps in reducing the requests that client machines get.

51 Written ArticlesWebsite

Salman Siddiqui is an alpha geek, design guru and seasoned WordPress critic. Writing, for him, started out of ego but it has become the most luring and enlightening career option of his life. He is walking that extra mile for his freelancing dream.

10 Comments Best Comments First
  • Ben

    Thursday, November 10th, 2011 14:40

    1

    thanks for this kind of useful dns article… helped me a lot recently. Good idea to post it ;)

    0
  • Vinnie

    Saturday, November 12th, 2011 06:52

    3

    i always wanted to know the background process!! i had some knowledge but still its a great elaboration on DNS. Thanks a lot!!

    0
  • Reece Cropley

    Friday, November 11th, 2011 20:27

    2

    I had a client today in which the website I built wouldn’t work on their server (problem with the php version being run) but it would work on my server. So I hosted the files on my server then set up an A record to point my server IP. I’m waiting for the “48 hour” delay over the weekend. My question is, after reading this article, should I of used the CNAME to redirect the user?

    PS: normally I would have changed the DNS to point to my server but they were adamant on keeping it on there own personally server

    0
    • Salman Siddiqui

      Saturday, November 12th, 2011 07:57

      4

      Can you explain this once more? I need to confirm the below information before I give you a clear answer:

      – You have set up an A record on their server to point to your server IP. Yes/No
      – The DNS is still what their hosting provider gives? Yes/No
      – Did you try to ask the same question to their hosting provider first? Usually, it is the hosting providers best provided settings that works on their servers.

      CNAME is for domain redirect and in this case you are setting up a single domain but the data is on some other server. It isn’t domain redirect..

      0
      • Reece Cropley

        Saturday, November 12th, 2011 11:42

        5

        Apologies, I’m still trying to get my head around how it all works.

        Yes I have logged into the cPanel for the domain on their server and changed the A record to point to the IP of my server.

        The DNS is still what the hosting provider gives.

        The third question I’m not sure I fully understand, so bare with me. The company I built the website for have their own server in which they host multiple websites on. I phoned the client (who I presume would be the hosting provider also?) explained why it didn’t work and then set up an A record to which he agreed.

        Hope these help you.

        If the CNAME is a domain redirect, what’s the difference between that and changing the name servers?

        0
  • Hank

    Saturday, November 12th, 2011 23:07

    6

    Thanks so much!

    0
  • Mevil Bhojani

    Thursday, November 17th, 2011 14:05

    10

    Great post, I believe blog owners should larn a lot from this website its very user friendly. So much great information on here :D.

    0
  • Estiak Ahamed

    Tuesday, November 15th, 2011 18:09

    9

    I had no idea about DNS before. From this post i know many things about DNS. Very good post.

    0
  • Marie Jasis

    Sunday, November 13th, 2011 22:06

    8

    This has to be the most comprehensive article I have found about DNS! I am glad I found it because it is so well laid out and on a level everyone can understand. This will help me explain the process much easier.

    0
  • Michael

    Sunday, November 13th, 2011 21:21

    7

    I was aware of how to create custom name servers for each domain and how they work once they are associated with domain but didn’t know how they function between ISP and that they are even cached.

    My experience shows that it usually takes maximum of 4 hours till changes take effect. Usually once I transfer my sites I can get them back to work within 1 hour.

    0
  • Mevil Bhojani

    Thursday, November 17th, 2011 14:05

    10

    Great post, I believe blog owners should larn a lot from this website its very user friendly. So much great information on here :D.

    0
  • Estiak Ahamed

    Tuesday, November 15th, 2011 18:09

    9

    I had no idea about DNS before. From this post i know many things about DNS. Very good post.

    0
  • Marie Jasis

    Sunday, November 13th, 2011 22:06

    8

    This has to be the most comprehensive article I have found about DNS! I am glad I found it because it is so well laid out and on a level everyone can understand. This will help me explain the process much easier.

    0
  • Michael

    Sunday, November 13th, 2011 21:21

    7

    I was aware of how to create custom name servers for each domain and how they work once they are associated with domain but didn’t know how they function between ISP and that they are even cached.

    My experience shows that it usually takes maximum of 4 hours till changes take effect. Usually once I transfer my sites I can get them back to work within 1 hour.

    0
  • Hank

    Saturday, November 12th, 2011 23:07

    6

    Thanks so much!

    0
  • Vinnie

    Saturday, November 12th, 2011 06:52

    3

    i always wanted to know the background process!! i had some knowledge but still its a great elaboration on DNS. Thanks a lot!!

    0
  • Reece Cropley

    Friday, November 11th, 2011 20:27

    2

    I had a client today in which the website I built wouldn’t work on their server (problem with the php version being run) but it would work on my server. So I hosted the files on my server then set up an A record to point my server IP. I’m waiting for the “48 hour” delay over the weekend. My question is, after reading this article, should I of used the CNAME to redirect the user?

    PS: normally I would have changed the DNS to point to my server but they were adamant on keeping it on there own personally server

    0
    • Salman Siddiqui

      Saturday, November 12th, 2011 07:57

      4

      Can you explain this once more? I need to confirm the below information before I give you a clear answer:

      – You have set up an A record on their server to point to your server IP. Yes/No
      – The DNS is still what their hosting provider gives? Yes/No
      – Did you try to ask the same question to their hosting provider first? Usually, it is the hosting providers best provided settings that works on their servers.

      CNAME is for domain redirect and in this case you are setting up a single domain but the data is on some other server. It isn’t domain redirect..

      0
      • Reece Cropley

        Saturday, November 12th, 2011 11:42

        5

        Apologies, I’m still trying to get my head around how it all works.

        Yes I have logged into the cPanel for the domain on their server and changed the A record to point to the IP of my server.

        The DNS is still what the hosting provider gives.

        The third question I’m not sure I fully understand, so bare with me. The company I built the website for have their own server in which they host multiple websites on. I phoned the client (who I presume would be the hosting provider also?) explained why it didn’t work and then set up an A record to which he agreed.

        Hope these help you.

        If the CNAME is a domain redirect, what’s the difference between that and changing the name servers?

        0
  • Ben

    Thursday, November 10th, 2011 14:40

    1

    thanks for this kind of useful dns article… helped me a lot recently. Good idea to post it ;)

    0

Comments are closed.

54.80.120.136 - unknown - unknown - US