What Is DNS and How Does It Work?

Find out what DNS is and why it turns URLs, the web addresses we type into the browser, into IP addresses.

Nick Sandoval - Product Marketing Manager
Vivian Seixas - Technical Researcher
What Is DNS and How Does It Work?

Do you know that accessing a website goes far beyond typing the address into the browser toolbar? There’s a universe behind the scenes, things that we don’t see in front of our screens, but that make this world called the Internet go round – and one of its key elements is the DNS.

What Is DNS?

The acronym DNS stands for Domain Name System. In general terms, DNS is a system for translating domain names into IP addresses, being, therefore, a necessary service for all computers or devices that use the Internet.

From a theoretical perspective, according to Kurose and Ross, “DNS is (1) a distributed database implemented in a hierarchy of DNS servers, and (2) an application layer protocol that allows hosts to query the distributed database.”¹

So, the main function of DNS is to convert the typed URL (Uniform Resource Locator) into a corresponding IP number. But why do we need it? Because machines understand the IP address, the string of numbers, not the address we type into the toolbar. Without DNS, we would have to remember the IP address of any device we wanted to connect to.

With the IP address, it’s possible to locate the server or set of servers hosting the website and thus access its pages. But the question on everyone’s lips is: “why don’t we just type the IP number in the toolbar instead of the URL, the email address?” Because for human beings in general, it’s much more difficult to memorize large sequences of numbers. Imagine having to know the numerical sequence of each website you want to access? It would certainly be very difficult to memorize many numbers – especially nowadays, when many of us just know our cell phone numbers, if that.

To make it simpler, try thinking of DNS as a phone book that, instead of recording people’s phone numbers and addresses, shows the IP address of each device connected to the Internet. But since there are millions of IP addresses, it would be impossible to put them all in a single phone book – and so does DNS. With millions of computers and devices connected and the impossibility of having a single server that stores all IP addresses, there are other servers that store all the DNS records that exist on the Internet.

In short, we can think of DNS services as large databases that are located on servers all over the world.

If you want to deep dive into a more technical perspective, two good sources are RFCs 1034 and 1035.

Brief history of DNS

At the time of ARPANET, the “mother” of the Internet, there were relatively few networked devices. The network structure was much simpler and had only a text file, with a table of the IPs of each device. As new computers were connected, their IP number was added to this table, but obviously there came a time when it became untenable to update the spreadsheet.

It was in that scenario, with the need to automate the management and creation of new IP addresses, that DNS emerged in 1985. One of the goals of creating the DNS was to make the expansion and scalability of the Internet easier through the use of the TCP protocol /IP.

In addition, another important change was that this information was made available on other machines, which then gave rise to the distributed system.

How Does DNS Work?

Let’s explain here in a very basic way how DNS works. To find the chosen IP address, the DNS server uses a number of specialized servers to find out the exact location of the IP address. First, your own operating system checks if the IP address is already saved in your local cache. This is possible if you searched for the same web address recently. If it’s not in the cache, that’s when the DNS service comes in.

Your request is then forwarded to an inbound DNS server, called DNS resolver, also known as local server. This local server will look in its own much larger cache memory and return with the correct IP address that is stored. If the local server doesn’t have the right address, it looks for the answer on another server.

The local server sends the request to a central DNS, called root server. There are only 13 sets of root servers in the world (10 in the US, 1 in the Netherlands, 1 in Sweden, and 1 in Japan), distributed globally to meet the needs of all DNS-bound networks. The root server checks if its own cache has the information. It doesn’t matter if it has the information, but it knows how to find whoever has it. The root server, in turn, finds the Top-Level Domain Server, or TLD, and creates a connection between it and the server.

TLDs are massive repositories, and each one is responsible for different categories of domain names, such as .com, .org or .net. For example, if you type azion.com, the root server will establish a connection between your local server and the TLD server .com. After that, the TLD then passes the request to the final stage of the server maze: the authoritative server.

The authoritative server is responsible for knowing everything about the domain in question, including the IP address. This server delivers the IP address to the local server, which forwards it to the user’s device – ​​and all this quickly, within the time of loading a web page. Azion’s Intelligent DNS is an authoritative DNS system.

DNS System Architecture And Flow

In short, this is a basic example of how DNS works:

1. The client asks the local server for name resolution (for example, www.azion.com.br);

2. The local server asks www.azion.com.br to a root server;

3. The root server responds: who is responsible for .br is 200.219.148.10;

4. The local server asks the server responsible for .com.br for www.azion.com.br;

5. The server responsible for .com.br responds: who is responsible for .com.br is this one 179.191.160.2;

6. The local server asks www.azion.com.br to the authoritative server responsible for azion.com.br;

7. The authoritative server responsible for azion.com.br responds to the local server www.azion.com.br = 200.240.235.4;

8. The local server sends the response www.azion.com.br = 200.240.235.4 to the user.

The following image shows the architecture and the flow of the DNS system mentioned earlier:

Image explaining how DNS works

Important Elements of a DNS Service

The process of DNS query and loading a webpage also depends on other components, more complex processes. To understand it, it’s important to know about other pieces that are part of the gear. That’s what we’ll see next.

What Is an IP Address?

The IP address is a unique numerical sequence, each device has its own, structured by a sequence of numbers and dots, which helps to identify devices connected to the Internet. Since the IP address is required to recognize devices, DNS connects domain names to corresponding IP addresses. Basically, when the user enters a web address in the web browser, DNS converts the domain name into an IP address.

So, when the user types the domain into the web browser, DNS searches its database to find the corresponding IP address for that domain name. It then matches the domain name to the website’s IP address. After that, the user can communicate with the webpage.

What Is Domain Name Space?

The Domain Name Space, also known as the domain hierarchy, has a hierarchical structure in an inverted tree format, and contains specifications of domain names and data associated with those names. This name space is divided into domains, and the responsibility for managing names within each domain is delegated to systems within each domain. That is, the naming structure is divided into small, manageable zones. Each DNS server maintains a specific database file and is only responsible for managing the name-to-IP mappings for that small part of the DNS structure. When a DNS server receives a request for name translation that is not part of the DNS zone, the DNS server forwards the request to another DNS server in the appropriate zone for translation.

Check the domain hierarchy in following image:

Image explaining what is domain name space

About this structure:

  • each intersection (in this case, the rectangle with a name inside) is called a node;
  • each node represents a domain;
  • each domain has a name, so each node in this structure is called a domain name;
  • the domain name identifies each one’s position in the DNS logical hierarchy relative to its primary domain. Each domain name consists of a few names separated by dots;
  • each domain can contain subdomains;
  • a subdomain is part of a larger domain. For example, documentation.azion.com and blog.azion.com are subdomains of the azion.com domain;
  • domains and subdomains are grouped into zones to allow for distributed administration of the namespace.

What Is a DNS Server?

DNS servers perform the following tasks:

  • respond to queries from external clients or servers (coming from the Internet) about names registered in their local domain;
  • perform Internet domain name resolutions for their local customers (machines within their domain);
  • cache the name resolutions requested by their clients in a local cache to expedite future queries.

As for their functionality, DNS servers can be classified as:

  • Primary - is responsible for a domain. The addition, alteration or deletion of records for that domain is done on this server.
  • Secondary - works as a backup to the primary server, receiving domain records from it through a process called zone transfer; it also responds to customer requests when requested.
  • Caching-only - only queries and returns results, maintaining a local cache. It’s not responsible for any domain, its only function is to improve the performance of name resolutions for local clients using its cache.

Curious and want to know how you can implement a modern DNS to leverage your digital business? Talk to our experts. Azion has the best solution.

Reference

¹ KUROSE, J. F.; ROSS, K. Computer Networking: A Top-Down Approach. 6th Edition. São Paulo: Pearson Education do Brasil, 2013.

Subscribe to our Newsletter