What is a DNS Server? | What They Are & How They Work

What is a DNS Server? | What They Are & How They Work

To open any website, we need to know its domain name. For instance, we can type gcore.com and get to the home page.

Every website is hosted on a server, and every server has an IP address. To open the required page, the browser must establish a connection with the IP address. This address is obtained via DNS.

In this article, we will try to explain as clearly as possible what DNS is, what a DNS server is, what it is for, and how it all works.

What is DNS?

DNS (Domain Name System) is a hierarchically distributed database. One of its functions is to connect the website domain names with the IP addresses of the servers where they’re located.

Every website has an IP address. Two types of addresses are currently in use:

  • IPv4—a four-byte address: four numbers ranging from 0 to 255. The format looks like this: 000.111.222.123.
  • IPv6—a more modern type of IP, a 16-byte address. There are several formats to record IPv6 addresses. The most widespread one is 8 groups with 4 symbols in each (eight four-digit hexadecimal numbers), divided by colons, which might look like this: 1234:abcd:1b4d:000a:987c:5555:a2d8:bcd6.

IP addresses are akin to phone numbers, and domain names are like the names of people who own these numbers. In turn, the Domain Name System is like the contacts search in our smartphones.

When we want to open a web resource (for instance, gcore.com), we enter the domain name, the system then transposes it into an IP address, and then uses it to determine where to send the request. The request is sent to the required address, and the page opens in the browser.

DNS servers: what they are and how they work

What is a DNS server?

If DNS is like the contacts search system in your smartphone, DNS servers are phonebooks with contact lists. They contain information about domains and specify who owns which IP address.

What are DNS servers for?

They have two main functions:

  1. Information storage—which IP address relates to the domain.
  2. Caching the entries from other servers.

The first function is clear and simple: a DNS server has a list of names and addresses relating to them. It receives a query and sends back the required information.

Caching is a bit more complicated. Most servers do not store the information about all the domain names and IP addresses on the web.

Let’s imagine that a user from China wants to open a website, and the information about the IP of this website is stored at a DNS server in the US. If whenever this user clicks the link the browser sends the query to the United States, it will take a really long time for the page to load. So, the browser usually sends the query to the internet service provider’s servers, which are usually closer to the end user.

The ISP’s server connects to the American server, obtains the resource address, and saves the data in its cache. The next time, when a Chinese user wants to open this web service, the DNS server operator will have the required IP at hand, and the page will open faster.

This is what’s called caching.

However, the cache is not stored on a server forever. The storage time mainly depends on the TTL parameter of the resource records (more about them below).

To better figure out how it all works, let’s start by understanding the types of DNS servers out there.

Types of DNS servers

1. Caching (local)—as a rule, these belong to internet providers and process client queries. They usually contain the domain names and IP addresses most often requested by the nearest clients.

Caching is the main function of these servers. They receive queries from users and either provide information from the cache or request the IP addresses from the authoritative DNS servers.

2. Authoritative—the servers that actually store the original information. They may be responsible for the entire domain zone, such as .ru or .com, storing the addresses of DNS servers of each domain in the zone.

One of the authoritative server types is root servers—the top of the hierarchy, the entry point into the space of internet names we’re all used to.

How does it work?

1. It all starts on the user’s PC. When the user enters the domain name in the browser type bar, the browser starts by looking for the information in its own cache and the OS cache: if the user has opened the website recently, the data is probably still there. The browser obtains the required IP address from the cache, sends the query, and the page opens really fast.

DNS servers: what they are and how they work

2. If the data is not available in the cache, the browser sends a query to the local ISP server. It looks for the entry internally and replies with the relevant IP address if it manages to find it.

DNS servers: what they are and how they work

3. If the provider doesn’t have the necessary information, the query is sent further to the root DNS server. In turn, it responds with either the required IP (if it has it) or the DNS address of the domain zone server. In our case, for gcore.com, it would be the .com server. A local server might then save this address internally in its cache, so as not to go to the root server the next time.

4. The query is sent to the zone server, which has to report where the IP address of the required domain is stored. This information is also saved in the local server cache.

5. The query is further transferred to the domain DNS server, which must definitely have the required IP. It will send the response to the local server, which will also save the data in the cache, so that the query won’t have to travel such a long way the next time.

6. The results are sent to the browser, which is finally able to connect to the website hosting.

DNS servers: what they are and how they work

What are DNS zones?

In our example, we had one domain and one IP address corresponding to it. However, in practice, that is not always the case.

One domain can often have several IP addresses. It might also have subdomains, which also often have individual IPs.

The information about domains, subdomains, and their IPs is written in the resource records. There are quite a lot of them. To help you understand the general picture, we’ll list the main ones:

  • A and AAAA—address of a web app with a particular domain name.
  • MX—mail server name.
  • CNAME—connects the analog of a resource to a domain name. Usually, this record is used to link a subdomain to a domain: for instance, www.example.com to example.com.
  • NS—name of the DNS server responsible for other resource records.
  • SOA—initial record of the zone that specifies the location of the domain reference record. Contains the contact information of the person responsible for the zone, the time of caching on the servers, and the data about DNS interaction.

The totality of the domain’s resource records is called a DNS zone.

DNS hosting

When you create a new web resource and register a domain, you need to make it available to the users, which means you need to post the information about it on the DNS server and specify the resource records.

Each domain usually has several servers like this. This is useful for safety and fault tolerance. Whenever a failure happens and one of the computers gets out of order, the reserve servers will still be there, and your resource will remain available.

Hosting providers often offer the domain placement option. Some have it for free, and others, for a fee.

But you can also get a dedicated DNS hosting server, which would be favorable in many situations—and here’s why.

Authoritative DNS servers where the IPs of your domain are stored should be as close as possible to the end users and to the local servers of their ISPs, so that the queries from the caching servers arrive faster and the web resources open quicker. So, you need to be able to choose the servers to place the information about your domain and decide where these servers will be located.

Besides information placement, the hosting allows you to control the settings, balance the traffic, and refer particular queries wherever you need—for example, based on geolocation.

When choosing DNS hosting like this, you need to take into account the following:

  • The DNS servers positioning: how close they are to your clients.
  • Their number: the more of them there is, the better in terms of safety and reliability —even if one server fails, others will stay up.
  • Their distribution across cities and countries, which is important for international projects with users all around the world.
  • Traffic balancing and other useful features.

Advantages of Gcore DNS hosting

We offer really quick hosting.

  • Over 60 locations worldwide.
  • Average response time within 20 ms.
  • We support wildcard records.
  • We offer geographical traffic balancing.

Our service is currently in beta mode, so you’ll be able to connect and use it for free!

Sign up for DNS hosting

Conclusions

  1. DNS is a system that helps browsers find websites by their names. It links domain names to IP addresses.
  2. The information about which IP addresses belong to a domain is contained on DNS servers, which store the data and cache the records from other servers.
  3. There are various types of DNS servers. For some of them, the main function is caching, while others actually store original information about the domains.
  4. To open a website, the browser needs to send queries to different servers and get the right IP addresses from them. If the user visited a website recently, the information should be saved in the ISP’s cache, and the page will load quickly.
  5. A single domain often has several IPs, and it can also have subdomains with different IPs. All this information is stored in resource records, the totality of which is called the DNS zone.
  6. DNS hosting is required to place a domain on DNS servers and make a web app available for users. A good hosting service has many locations in different parts of the world and a wide set of features to manage the servers and balance the traffic.
  7. Gcore hosting meets all these parameters, and is available for free.

Learn more about our DNS hosting

What is a DNS Server? | What They Are & How They Work

Subscribe
to our newsletter

Get the latest industry trends, exclusive insights, and Gcore
updates delivered straight to your inbox.