Crash course about how DNS works and the things you should know about it

I often come with conversations with people and hear them asking how DNS works for hosting their domains. Most of the time, there is plenty of ressources about this. Nevertheless. I felt like I could try to make a nice answer in less than 200 words.

What is DNS?

Just to have everybody on equal grounds, here is some describing facts about domain name resolution that drives the World wide web.

  • Oldest DNS service is the “hosts” file listing basically IP address and name
  • DNS is all about converting “name” into IP address;
  • Registrar is a provider that takes care to register your specification of DNS servers to the ROOT servers

Essentials to know about DNS configuration

Now, the configuration of it. Configuration made of simple flat text files. Format seems cryptic at first but its very straight to the point.

  • Each file is also called a “zone file”
  • A Zone can be created from any DNS server. It is really used ONLY if you specify them at the registrar
  • Entries in a zone represent a subdomain (A,CNAME), a configuration (TXT), or other peers (NS) one per line
  • Each name must end by a dot. Otherwise it gets to be represented as a subdomain of the current zone file name

Some examples

Rougly. The A, and CNAME entries are the essentials to know about.

CNAME is an alias to a A

    domainname.com. IN A 1.1.1.1
    www IN CNAME domainname.com.
    other.domainname.com. IN A 2.2.2.2

Explanations:

  • Both names www.domainname.com and domainname.com in the address bar wil get same IP but you only have to change the A entry
  • Domain entry always end with a dot. Otherwise (like the case of the “www entry) it gets terminated by the zone name (the SOA (Start Of Authority) declaration) not shown.
  • Most important is also the MX and NS entries.  MX is the mail servers and NS the other new DNS servers. Just make sure it follows through

Hope this helps clarify