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.
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:
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.
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.
They have two main functions:
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.
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.
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.
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.
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.
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:
The totality of the domain’s resource records is called a DNS zone.
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:
We offer really quick hosting.
Our service is currently in beta mode, so you’ll be able to connect and use it for free!