You are currently viewing What is a DNS? Introduction to the Domain Name System.

What is a DNS? Introduction to the Domain Name System.

If you have ever dealt a bit with the Internet and computer networks, you have probably heard of the Domain Name System (DNS). After reading the article you will learn how it all works.

The host name itself will not give any information about the location of the specific machine that you are going to contact, since all connections occur at 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 talk about the details of various DNS queries, the types of DNS servers, and the types of DNS records.

DNS resolver

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

DNS resolver caches information. For example, the site example.comis located on a machine with an IP address 35.195.226.230. Therefore, the resolver caches from around the world will contain the following mapping: example.com→ 35.195.226.230.

It is believed that in the future the site may move to any other host with a different IP, say 35.192.247.235. DNS resolver caches around the world will keep their old IP address for some time. This can make the site unavailable until the changes reach all the DNS.

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

It can be installed in the control panel of the service 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, 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:

Root DNS server

Organizations managing root DNS servers

This does not mean that there are only 13 machines that process all requests from around the world – there are also secondary servers that distribute traffic.

TLD servers

These servers are associated with top-level domains (TLDs). They usually go after the root DNS servers. TLD servers contain information about the top-level domain of a specific host.

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

Now the question is – how do TLD servers know the address of authoritative servers? The answer is simple – after you buy any domain from registrars 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 select 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 such as A, NS, CNAME, TXT, etc.

Authoritative DNS servers return host IP addresses whenever possible. If the server cannot do this, it gives an error, and the search for the IP address of the servers ends there.

Types of DNS Queries

There are 3 types of DNS queries:

  1. Recursive : such requests are performed by users to the resolver. Actually, this is the first query that is performed during the DNS lookup process. The resolver most often is your Internet service provider or network administrator.
  2. Non-recursive : in non-recursive queries, the resolver immediately returns a response without any additional queries to other name servers. This happens if the required IP address is cached in the local DNS server, or if requests are sent directly to authoritative servers, which avoids recursive requests.
  3. Iterative : Iterative requests are executed when the resolver cannot return a response because it is not cached. Therefore, it makes a request 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 give out the address of the TLD server for .com. The root server will return this address to the resolver. After that, the resolver will query the TLD server. The TLD server may not know the desired IP address, but it can give the address of an authoritative DNS server for medium.com.

Let’s explain the above example:

  1. The user makes a request to the resolver to find the IP address. This is a recursive query.
  2. If possible, the resolver scans its cache for the necessary IP address.
  3. If the resolver has the required IP address, then it returns it.
  4. Otherwise, the resolver performs an iterative query on the root DNS server. The root DNS server is looking for the desired TLD for the requested address. For example, if the host is – medium.com, then TLD – .com. The root DNS server finds the address of the .com domain and returns a response to the resolver.
  5. The resolver now performs an iterative request to the TLD server to obtain 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 mapping with the IP address, which is returned to the resolver (which, in turn, returns it to the user).
  7. If the necessary record does not exist on the authoritative server, the error ” DNS_PROBE_FINISHED_NXDOMAIN” is returned .
  8. For all servers through which the request passes, the result is cached, and in the case of a repeated request, the result will already be on the server.
  9. On average, about 4 queries will be required for a DNS lookup, but this lookup will only take a few milliseconds.

What is the result?

Even if you change the record at the registrars, making changes on resolvers around the world will take some time. This process can last from 24 to 72 hours, but usually ends faster, because during this time the TTL records of the providers have time to expire.