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.
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:
- com – business organization;
- gov – government institutions;
- edu – educational institutions;
- mil – military mission;
- org – private organizations;
- 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.
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.
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.
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.
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:
- authoritative – if the data sent from the device serving the network;
- reauthorisations. Is sent to a foreign computer, which receives the necessary data from its own cache or after an iterative query.
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:
- self service area. The exchange of data takes place between master and slaves computers. The requests from reauthorisation users will not be accepted;
- implementation of recursive issue;
- 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».
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.
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.
The flags field (16 bits) includes:
- message type;
- operation code;
- identification of authoritatively (i.e. indicates whether the service computer to the network);
- TS-flag. Displays, the message came cropped or full.
- the recursive flag, i.e. the requirements of the server to send requests to the computers of the highest order;
- flag the possibility of recursion. Shows the server’s ability to forward messages;
- 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.
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.
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.
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.
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:
- 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;
- And contain a list IP addresses and their corresponding hosts. They allow to identify the address of the resource domain;
- NS (Name Server) include a list of computers that serve domain;
- SRV (Service) display all the resources that perform the essential service functions;
- MX (Mail Exchanger) allow you to automatically adjust the distribution of data serving computers in one domain.
- PTR (Pointer) used to locate the name of the resource, if the user knows the IP address;
- 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.
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.
UDP or TCP
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.
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.