What is DNS? (Domain Name System)
If you have ever dealt with the Internet and computer networks, you probably heard about the domain name system (DNS).

The host name itself will not give any information about finding the particular machine with which you intend to contact, since all connections are made by IP addresses.

A domain name server is a device that maps the host name to the IP address of a specific machine / hardware.

This article will cover the details of various DNS queries, types of DNS servers, and variations on DNS records.

DNS resolver

These are the computers that providers use to search in their database for a specific node requested by the user. When data is received, the user is redirected to the appropriate IP address. Resolvers play a crucial role in the DNS.

DNS resolver caches information. For example, example.com is located on a machine with an IP address of . Therefore, resolver caches from all over the world will contain the following correspondence: example.com35.195.226.230 .

It is believed that in the future the site may move to any other host with a different IP, say, . Cache DNS resolvers around the world for some time will keep the same IP address. This can lead to the site being inaccessible until the changes reach all DNS.

The time during which the recording is stored in the resolver is called TTL (time to live).

It can be installed in the service control panel on which the domain was purchased.

Types of DNS servers

Root DNS Server

This is a DNS server that stores the addresses of all TLD servers (TLD – top-level domain). On the way from the host name to the IP address, the request first goes to the root DNS server.

There are 13 root DNS servers:

This does not mean that there are only 13 machines that process all requests from all over the world – there are also secondary servers over which traffic is distributed.

TLD servers

These servers are linked to top level domains (TLDs). Usually they go after root DNS servers. TLD servers contain information about the top-level domain of a particular host.

Say, if you request the IP address of the host domain.com , then the TLD server that corresponds to the .com domain will be polled. The TLD server returns the address of the authoritative DNS server for the resolver.

Now the question arises – how do TLD servers know the address of authoritative servers? The answer is simple – after you buy any domain from a registrar like Godaddy or Namecheap, registrars bind authoritative servers to the TLD server.

Now some providers provide the ability to use third-party authoritative servers. You can choose a specific authoritative name server from the registrar.

Authoritative DNS server

The request for these servers comes in the last turn. These servers store actual records of type A, NS, CNAME, TXT, and so on.

Authoritative DNS servers, if possible, return the IP addresses of the hosts. If the server cannot do this – it gives an error, and this ends the search for the IP address on the servers.

Types of DNS queries

There are 3 types of DNS queries:

  1. Recursive : similar requests are performed by users to the resolver. Actually, this is the first query that is executed during the DNS lookup. As a resolver, your Internet provider or network administrator most often acts.
  2. Non-recursive : in non-recursive requests, the resolver returns the answer immediately without any additional requests to other name servers. This happens if the necessary IP address is cached in the local DNS server, or if requests are sent directly to authoritative servers, thus avoiding recursive requests.
  3. Iterative : iterative queries are executed when the resolver cannot return an answer because it is not cached. Therefore, it performs a query to the root DNS server. And he already knows where to find the actual TLD server.

For example, if you are trying to get the IP address of medium.com, then the root domain server will display the TLD server address for .com . This address will be returned by the root server to the resolver. After that, the resolver will poll the TLD server. The TLD server may not know the desired IP address, but it may give the authoritative DNS server address for medium.com .

Let’s sort the big picture:

  1. The user makes a request to the resolver to find the IP address. This is a recursive query.
  2. Resolver, if possible, scans its cache for the required IP address.
  3. If the resolver has the required IP address, then it returns it.
  4. Otherwise, the resolver performs an iterative query to the root DNS server. The root DNS server searches for the required TLD for the requested address. For example, if the host is medium.com , then the TLD is .com . The root DNS server finds the address of the .com domain and returns a response to the resolver.
  5. Now the resolver performs an iterative query to the TLD server to get the required IP address. The TLD server returns the address of the authoritative server for the requested host.
  6. The authoritative server stores the actual host name matching records with the IP address that is returned to the resolver (which, in turn, returns it to the user).
  7. If the required entry does not exist on the authoritative server, then the error ” DNS_PROBE_FINISHED_NXDOMAIN ” is returned.
  8. For all servers through which the request passes, the result is cached, and in case of a second request, the result will already be on the server.
  9. On average, DNS lookups take about 4 queries, but this search will take only a few milliseconds.

What is the result?

Even if you change the record from the recorders, it will take some time to make changes on resolvers around the world. This process can last from 24 to 72 hours, but usually completes faster, since during this time the TTL-record at the providers has time to expire.

Please give your comments and suggestions in the comments below. Your kind suggestions are always welcome.