What is DNS and how does it work

By | 10.12.2018

What is DNS and how it works

DNS is a service that provides exchange between different network segments. Its use can significantly reduce the time for information search. In this article you will learn about the basic principles of operation of the service, as well as the ways and forms of transmission over the Internet.

How it works

At the dawn of the Internet, there was a «flat» system of names: each user had a separate file containing a list of the necessary contacts. When he was connected to the world wide web, its data is sent to other devices.

Что такое DNS и как он работает

However, due to the rapid development of the Internet it was necessary to simplify the exchange of data. Therefore, it is divided into smaller segments domains. In turn, they are divided into subdomains. On top addresses, filed in registered form, is the root of the main domain.

Since the Internet is American design, there are two primary domains:

  • total domains owned by agencies of the United States:
  1. com – business organization;
  2. gov – government institutions;
  3. edu – educational institutions;
  4. mil – military mission;
  5. org – private organizations;
  6. net – Internet-provider.
  • the root domains of other countries consist of two letters.

The second level consists of abbreviations of cities or regions and domains of the third order represent different organizations and enterprises.

Что такое DNS и как он работает

Point plays the role of delimiter between domains of a different order. At the end of the name point is not put. Each individual domain with a point is called a label.

Its length must not exceed 63 characters, and the total address length is 255 characters. Basically, using the Latin alphabet, digits and hyphen, but a few years ago started using started using the prefix on the basis of other writing systems. The case of the letters does not matter.

Что такое DNS и как он работает

Servers – are computers that contains a list of other objects within the same network level, allowing you to speed up the exchange between users. They became the basis of the new system.

Each layer of the network must have its own server which contains information about the addresses of users of its segment.

The search of necessary data is as follows:

  • when a person wants to find a certain website, the service makes a request to the local server;
  • if he has this data, the client (this is the user making the request) receives notification that this page exists. The browser receives the address, and loads it;
  • if the local level lacks the necessary information, then the server addresses to computers on a higher level, until the requested entry is not found.

    Что такое DNS и как он работает

DNS fundamentals

The Assembly consisting of multiple domains is called a zone. Her file contains the main parameters of the segment. In particular, it includes information about the FQDN or the fully specified domain name. If this entry ends in a period, it means that object name are set correctly.

Что такое DNS и как он работает

There are several types of computers that serve DNS:

  • master – home agent network. It can change its configuration;
  • slave device the second order. They serve customers on a par with the master and can replace it to replace in case of malfunctions. This offloads the network;
  • cache. Contains information about the domains of foreign areas;
  • invisible. Missing in the description area. Most often this status is assigned to users with master level in order to protect them from attack.

To them, the user can send one of two types of query.

The browser sends it to the resolver:

  • recursive. If the server does not contain the required information, this scenario, he learns the necessary data from the computers of the highest level and sends a response to the client. This reduces the number of queries and saves time and your traffic;
  • iterative. The server sends the response, extracting the information only from its own cache (memory). If it has no matching data, it provides a link to other computers. Then the browser goes to this address.

There are two types of answers:

  1. authoritative – if the data sent from the device serving the network;
  2. reauthorisations. Is sent to a foreign computer, which receives the necessary data from its own cache or after an iterative query.

Video: DNS

The names and IP addresses

DNS translates names of sites into IP addresses. On the Internet, each device can be tracked by 2 main parameters – the domain name and IP address. They can be assigned to user’s computer, network printer, or router.

However, this is very conditional, because the computer may not have the domain name, but use multiple addresses. Furthermore, each IP address must match all domain names. However, the domain can contain only one IP address.


Servers can work in modes:

  1. self service area. The exchange of data takes place between master and slaves computers. The requests from reauthorisation users will not be accepted;
  2. implementation of recursive issue;
  3. the forwarding server sends the request to another zone.

Change DNS settings

Usually these parameters are set in automatic mode. In order to reset the data should go to the «Network connections».

Что такое DNS и как он работает

After that, you must go to the Protocol used for network maintenance.

In the Properties section you can set the required parameters. Usually, you specify the main IP address of the server and alternative.

Message format

The message used for the exchange information service, starts with 12-byte header. Then follows the identification field to determine what request the answer came.

Что такое DNS и как он работает

The flags field (16 bits) includes:

  1. message type;
  2. operation code;
  3. identification of authoritatively (i.e. indicates whether the service computer to the network);
  4. TS-flag. Displays, the message came cropped or full.
  5. the recursive flag, i.e. the requirements of the server to send requests to the computers of the highest order;
  6. flag the possibility of recursion. Shows the server’s ability to forward messages;
  7. return code. Displays a sent reply with errors or not.

The last 16-bit field shows the total number of metered parameters.

The questions in the DNS query

Part of resource record in response

Any response contains information about the side that sent the message. It contains the following data: response, server permissions and more information about it.

Что такое DNS и как он работает

In addition, the message contains:

  • the domain name;
  • type of request;
  • the expiration period for the cached version;
  • the record length of the resource – estimation of the volume of information.

Requests pointer

The query pointer is directed to the search page, in the inverse mode, i.e. search the resource name by IP address submitted in the form of a text string separated by dots.

Что такое DNS и как он работает

To send the node address is written in reverse order with the addition of a specific suffix (usually in the form of in-addr.arpa).

To commit the transaction if the resource contains a PTR record. This allows you to transfer control of the zone owner for the IP addresses.

Resource records

This is a list of the main programs used by the service. Within a single domain, those records are unique. At different levels of the network there may be duplicates of these records.

These data include the following types of records:

  1. SOA –start of authority. It allows you to map the domain and service its computers. They also provide information about the expiration period for the cached version, and contact the person who maintains the server a certain level;
  2. And contain a list IP addresses and their corresponding hosts. They allow to identify the address of the resource domain;
  3. NS (Name Server) include a list of computers that serve domain;
  4. SRV (Service) display all the resources that perform the essential service functions;
  5. MX (Mail Exchanger) allow you to automatically adjust the distribution of data serving computers in one domain.
  6. PTR (Pointer) used to locate the name of the resource, if the user knows the IP address;
  7. CNAME (Canonical Name) allows the server to be referred by several aliases in the service.


To search for the required information, the browser can search for information in three segments. First, the required data is looking for a DNS service, i.e. at the local level. You can find them if the computer contains a Hosts file.

However, if the operation failed, the client submits a request. To speed up the information retrieval, uses the cached server. If he fails to find the required data, it performs a recursive query. When filing, it copies data from other networks.

Что такое DNS и как он работает

This allows to save traffic, not turning subsequently to authoritative users. But the public record is still valid for a limited period of time. The period of its validity is set in the zone file. By default it is minimum 1 hour.


The service supports both UDP and TCP.

UDP is used to send messages to wide area networks. The size of the messages transmitted in this Protocol is limited. Incomplete responses contain the tag of the vehicle. This means that the size of the response exceeded 512 bytes, so the rest never came to PC.

Что такое DNS и как он работает

It differs by the smaller reliability because it does not set a timeout on the query response. However, this system is suitable for transferring a vast amount of information.

TCP is used to transmit such data, as it allows to get any amount of data, divided into segments of a certain size.

Also, this Protocol uses the secondary server when they request data from the main computers every three hours to learn about the update of the network configuration file.

DNS is a complex hierarchical structure. However, the system of servers provides a flexible and rapid interaction between all users and devices on the Network.

To find the necessary information, the client sends the request. The response contains the basic data about the object of interest and the computer technician area. For the implementation of the exchange protocols used are UDP and TCP.

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *