What Is DNS ? How DNS Works ? How WWW works ?
When you enter a domain address on your computer, the site loads right in front of your computer. Have you ever thought about how does the browser find its way to the site infinitely expanding internet?

This blog is about to make you clear on this.

What is DNS ?

The Domain Name System (DNS) is the phonebook of the Internet. Humans access information online through domain names, like nytimes.com or espn.com. Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names to IP addresses so browsers can load Internet resources.

Each device connected to the Internet has a unique IP address which other machines use to find the device. DNS servers eliminate the need for humans to memorize IP addresses such as 192.168.1.1 (in IPv4), or more complex newer alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6).

There are 4 DNS servers involved in loading a webpage:

DNS recursor — The recursor can be thought of as a librarian who is asked to go find a particular book somewhere in a library. The DNS recursor is a server designed to receive queries from client machines through applications such as web browsers. Typically the recursor is then responsible for making additional requests in order to satisfy the client’s DNS query.

Root nameserver — The root server is the first step in translating (resolving)

human readable host names into IP addresses. It can be thought of like an index in a library that points to different racks of books — typically it serves as a reference to other more specific locations.

TLD nameserver — The top level domain server (TLD) can be thought of as a specific rack of books in a library. This nameserver is the next step in the search for a specific IP address, and it hosts the last portion of a hostname (In example.com, the TLD server is “com”).

Authoritative nameserver — This final nameserver can be thought of as a

dictionary on a rack of books, in which a specific name can be translated into its definition. The authoritative nameserver is the last stop in the nameserver query.

If the authoritative name server has access to the requested record, it will return the IP address for the requested hostname back to the DNS Recursor (the librarian) that made the initial request.

How DNS Works ?

The computer performs some series of steps to turn the domain name into the machine-readable form. The following figure illustrates the entire workflow of DNS. Let us dig deep into each process:

Request Information: The process starts when the user enters a domain name into their system browser. For example, he wants to visit the website, https://mrscriptkiddie.com . First of all, the system looks into its local DNS cache, where the IP address of some recently viewed site is stored. If the system does not find the records, it needs to initiate the DNS query to respond the user’s request.

Request the Recursive DNS server: In case the system doesn’t find the details locally, then it sends a query to a recursive DNS server of the ISP. This is a specialized computer that performs research of a DNS query in place of the user browser. This server includes its own caches. If the record for the query is found in this cache, the process ends here and return the details to the user browser.

Request the Root Name Server: If the record is not found in the recursive server, then the query is forwarded to the root nameservers. The root nameserver is the name server at the root of the DNS hierarchy. It serves as a network of a wide range of servers in various countries across the world. And, these servers are grouped together in 13 named servers in the root zone of the DNS.

If the record is in the root zone, the server will directly respond to the query. Otherwise, it directs the request to appropriate top-level domain server (TLD) which knows where to find the record.

Request the TLD name server: As the root server reads the request (www.mrscriptkiddie.com) from right to left, it redirects the request to the TLD for .com. TLD denotes to the last part of the domain name. Some examples of TLD and their descriptions are given below:

Each TLD includes its own set of nameservers. Though these servers don’t include the details of the record, they can aware the exact server where we have the information. Here, our query is directed to the TLD nameservers for .com. In that, the TLD reads the next part the request, www.mrscriptkiddie.com, and forward the query to the authoritative name server, which is responsible for the certain domain.

Request the Authoritative Server: It is the nameserver which holds the exact DNS records for a certain domain name. This server includes all kinds of information about a certain domain, that are kept in a DNS record. The authoritative server includes several sorts of records, and each comprises a different type of information. Here, we requested to the IP address of the www.scriptkiddie.gq, so the nameserver returns the address record.

Retrieve the address record: As the recursive server receives the address record for the scriptkiddie.gq from the authoritative server, it stores the details in its local cache. The address record is in the cache for certain time period based on its time-to-live (TTL) values. Hence, if the server receives the request for the same domain, it will respond to the request directly without performing the lookup process again. Keep in mind, the record details present no longer in the server after its expiration time. So, the server needs to ask for a new record copy if any request arises after a while.

Receive the answer: The computer receives the address record from the recursive server and reads the IP address to display the answer to the user’s request. So, the user can access the website. Here, the computer caches the record for a while in its local machine for further use as like what recursive server did.

This entire process happens every time when you use a domain name for any purpose including viewing webpage, sending an email and much more. All these processes take only a few milliseconds to complete.

Keep Coming for more.

Thank you.
['Harshit Dodia']
['Cybersecurity', 'Ethical Hacking', 'DNS', 'Network', 'Www']