Ever heard about the term “DNS” when using the Internet? DNS stands for Domain Name System. Before we go ahead and talk about what DNS is and how DNS lookup works, let us understand what the D in the DNS stands for.
What is a Domain?
You know that the format of a web URL is http:s//www.domainname.tld. In this example, TLD (tld) refers to the top-level domain. In the early days of the web, TLD was one of the following:
- .com (refers to commercial organizations)
- .org (refers to non-profit organizations)
- .net (commercial websites again)
- .gov (government websites)
- .edu (educational)
- .mil (military purposes) and
- .int (international)
As more people started buying websites, location-based domain types were introduced. For example, .asia, .us, .in, and .ca refer to Asia, US, India and Canada, respectively. Soon, several other types of TLD came in that tell us the type of website. For example, .me refers to a personal website, whereas a .tv refers to a video streaming website. More TLD categories make it possible to categorize websites by type while meeting increasing consumer demand.

In the above example of the URL (https://www.domainname.tld), HTTPS refers to the mode of transfer of data, and www says it relates to the World Wide Web. Anything between www and TLD is the domain name of a website.
Earlier, people had to type in www to access a website. Since the hosting service providers allow redirection of www.domainname.tld to domainname.tld, you can skip typing www while entering the URL into the browser. An example of a domain name is “thewindowsclub”. The URL for accessing the domain “thewindowsclub” is https://www.thewindowsclub.com or http://thewindowsclub.com. Here, “thewindowsclub” is part of the .com TLD. Then, there can be sub-domains. In the case of www.news.thewindowsclub.com, “news” is the sub-domain of “thewindowsclub”.
When you buy a domain, you purchase a name that goes with different TLDs. You can choose .com, .net, .us or other TLDs – provided it is not taken already by someone else. Buying a website will not help, as people cannot reach it until it has an address. For any domain you purchase, you can create any number of sub-domains and use it for websites and other purposes. For each domain and sub-domain you create, you need to specify the address of servers that contain the content of your website. If the domain or sub-domain refers to some device (for example, a network printer), you need to specify the address of that device.
All the domains and sub-domains on the Internet have an address attached. We call it the IP address: Internet Protocol address or, in other words, an address that works with the Internet. You can access a domain/sub-domain only if you know the IP address of the servers containing its content.

What is DNS?
You know that there are unlimited websites on the Internet. Again, each website can have its many sub-domains. Remembering the IP addresses of these websites is not possible. This is why you can enter the domain name in your own language (using the URL format – also called an alias in technical terms). A system resolves domain names so you can connect to the website you entered in the URL. This system helps you find the IP address for the domain names you enter in your browser so the browser can connect to the website. This system is called the Domain Name System or DNS for short.
The Domain Name System, or DNS as it is popularly known, is a distributed database that maps domain names to IP addresses.
Until recently, a non-profit organization called InternNIC was responsible for managing the domain names and their IP addresses. When it went “for-profit”, its monopoly ended, and many companies now manage domain-related databases. Though different companies maintain the databases, they are interconnected, so any DNS Service can get the IP address of any domain.
A DNS Service helps you resolve the domain names that you enter in your web browser. It also helps resolve addresses when you send emails or click active links. In general, your Internet Service Provider gives you a DNS Service. Besides your ISP, other companies offer Public Domain Name Services. Examples include Google, Comodo, and OpenDNS. When you click on a link or enter a URL into your web browser, the DNS Service is contacted to resolve the related DNS. It is the responsibility of the DNS service to scan the Domain Name System database and provide you with the IP address of the host to which you wish to connect.
The domain names and sub-domains can be called aliases. The servers holding a database containing information on the addresses of different aliases are called Name Servers. There are two types of servers operating in the Domain Name System. The first types are the Root Servers – these hold data about Top Level Domains (TLD: .com, .net and .org, etc.). The other types contain the addresses of servers that host your domains and sub-domains.
Example 1: In the case of abc.xyz.com, Root Servers will hold information about xyz being a .com. Some other Name Server will contain database entries showing the address of xyz.com. Since you also are hosting abc.xyz.com, its address can be either on the same Name server holding the address of xyz.com or on a different Name Server. If you add another subdomain to abc.xyz.com, its address may again be on the same or a different Nameserver, depending on where you host it. The relation between the above can be established as below:
abc is related to xyz.com
qwe is related to abc.xyz.com
To establish the address of qwe, the Domain Name System Service will have to resolve:
.xyz.com
.abc.xyz.com
.qwe.abc.xyz.com
This is a case where the Domain Name System Service uses no cache. We will talk about caches a little later in this article. The above shows that to resolve the DNS of qwe.abc.xyz.com, the DNS system has to scan the DNS database four times. This gets more complex because different parts of the URL can be on different Name Servers. But because of the speed of the Internet, you can see the page download in a matter of milliseconds and, in worst cases, a few seconds.
What is DNS Lookup?

By now, you know that different servers host databases that contain the IP addresses of different domains and their subdomains. You also know that there are Root Servers that hold the IP addresses of servers hosting Top Level Domains. These Root Servers help you reach the servers that hold the IP address for the main domain name. If there are subdomains, their addresses can be on the same servers as the main domain name or on different servers. All these servers help you find the IP address for the exact URL you need to use.
Read: Free DNS Lookup Tools & Online services.
How DNS Lookup works?
The process of finding out the IP address of any URL on the Internet is known as DNS lookup. To understand how DNS Lookup works, consider the following example.
Example 2: Consider a network of ten computers. Each computer has its own address so that data packets traveling in the network know where to go. An 11th computer hosts a database containing the alias names of these ten computers and their IP addresses. While users can refer to computers by name, data packets need IP addresses to reach the intended recipient. If computer A needs to use the printer attached to computer B, A checks the database on the 11th computer to find B’s IP address, then finds the address of the printer attached to B. Only after obtaining the printer’s address will A route the print command to the printer attached to B.
In this case, the following iterations happen:
A contacts Computer11
A contacts B
A contacts printer attached to B
A similar method is used to look up DNS records. For example, when you click https://www.thewindowsclub.com, your router contacts your default DNS Service for DNS resolution. The DNS service will contact Root Servers and ask for the IP address of the server containing .com records. This address is sent back to your DNS service. The DNS service again reaches the Name Server containing addresses of .com domains and asks it for the address of https://www.thewindowsclub.com. After obtaining the IP address of the servers that host thewindowsclub.com, your DNS service returns the IP address to your computer, which then opens your browser to download the main webpage. This means your DNS service is sending at least two requests to receive the IP address of a simple domain name.
Following is an image that explains how DNS lookup works:

In the above case, if you looked up https://news.thewindowsclub.com, your DNS service had to make an extra request to find its IP address.
Since resolving DNS from scratch every time takes up time, many ISPs and DNS Service Providers create local caches that contain already resolved addresses. These are primarily addresses they previously fetched from Root Servers and other name servers. In this case, when you request a URL, the DNS service looks up the resolved address in its local DNS cache instead of contacting the root server directly. If it finds it, it sends the resolution back to your computer instantly; otherwise, it resolves the DNS using the method above by contacting Root Servers and other Name Servers.
Some operating systems also contain a locally cached copy of addresses that you commonly use on your computer. This also helps save time when using the Internet. We will cover DNS caches in a different article later.
Please let us know if you still have any doubts about how DNS lookup works.