Domain Name System

What is it?

DNS stands for Domain Name System. It is a mechanism by which domain names are translated into IP addresses. Domain names and IP addresses are controlled by the Internet Corporation for Assigned Names and Numbers (ICANN).

A domain is a space (namespace). Accordingly, domain name is the unique name given to a particular space which may be a virtual space in the internet or part of your hard disk. The structure of DNS is illustrated below:

  • root — dot
  • top-level domain (TLD) — .com, .net, .org, .co.uk, .de (referred to as .tld)
  • secondary domain — domain.com, domain.net, domain.org, domain.tld
  • tertiary domain — host.domain.com, host.domain.net, host.domain.tld
The correct DNS notation for a host is host.domain.tld.. Yes, there is dot at the end. This is also called fully qualified domain name (FQDN).

It is an accepted practice to call domain.com as a TLD. Tertiary domains are sometimes misunderstood as subdomains. All domains are in fact subordinate domains (subdomain) of root domain.

DNS and IP

The relationship between domain name and IP address is perhaps better explained with an example.

  • yahoo.com. — 216.109.112.135 (also 66.94.234.13)
  • www.yahoo.com. — 68.142.197.73 (also several other IP addresses)
    Keying http://www.yahoo.com on the address bar of a browser is the same as keying http://68.142.197.73. Try it.

Some IP updaters come with a utility which pings Yahoo.com hourly. It may appear to be a rude action. In reality, Yahoo.com will not reply. That utility is more like a stay-alive engine or heart beat generator. (Caution: Do not target an automatic ping at a host. You will be treated as a nuisance.)

How does it work?

How is a domain name translated to IP address? There is an extensive network of nameservers which will get that translation done. All TLDs are served by two (sometimes one) nameservers. Details, most important of which are domain name and the corresponding IP address, are stored on an authoritative nameserver and propagated to and cached by other nameservers. When a query is issued by a client, such as browser, it is passed to the nearest nameserver which either replies or passes it to another nameserver. The process is repeated until a reply is obtained. The reply can be an IP address or "non-existent domain".

The following is a graphical illustration of a 3-hop query (LL is your DNS client; NS is nameserver):

LL  >>> where is www.yahoo.com? >>> NS1
NS1 >>> where is www.yahoo.com? >>> NS2
NS2 >>> where is www.yahoo.com? >>> NS3
NS3 >>> www.yahoo.com is on 68.142.197.73 >>> NS2
NS2 >>> www.yahoo.com is on 68.142.197.73 >>> NS1
NS1 >>> www.yahoo.com is on 68.142.197.73 >>> LL

After getting that information, your browser (HTTP client) will send a packet to 68.142.197.73 requesting connection.





Q&A

How do I find out the IP from a domain name?

On Linux, you can use the command dig domain-name to get the public IP of a host. On Windows, the DOS command is nslook domain-name. (Reminder: Do not ping!)

Why do you keep telling me not to ping?

Ping is a network testing command. It is not meant to be a replacement for DNS query command. It is sometimes used to attack another host (as in denial of service) or cause irritation. Besides, most networks nowadays are configured not to respond to pings.