DNS server

Basic operation of DNS server

The basic operation of the DNS server is to receive a request message from the client and return the information in response to the contents of the inquiry (return the response message). The request message from the client contains three pieces of information.

  • name The name of the server or mail delivery destination (the name after @ of the mail address) etc.
  • class The class is always assigned the value “IN”, thereby identifying the information class.
  • type It indicates what type (kind) of information is associated with the name. If the type is “A”, it indicates that the name is associated with the IP address, and “MX” indicates that the delivery destination is associated with the name. The content of information responding to clients depends on this type.

#001 To the DNS server, register the items to correspond to these three pieces of information and respond to the client. (Above figure) Look for what corresponds to the inquiry message from this registration content and reply to the client. When asking for an IP address, I use the type “A” (abbreviation of adress), but when asking for the destination of the mail, use the type “MX” (mail exchange). The destination of the mail is registered as “MX” on the DNS server, and the IP address is registered in the DNS server as “A” type. For example, when examining the mail server of the delivery destination for the mail address katu @ glasscom.com, the name after that @ is the delivery destination, so ask the following three items as a message.

  1. Name = glass.com
  2. Class = IN
  3. Type = MX

The inquiry DNS server responds with two items, 10 and mail.glasscom.com. According to the figure above, the type is MX, two items, mail server priority of 10 and mail.glasscom.com mail server name are registered. In addition, in the case of MX, it is supposed to return the IP address in addition to this reply. Since there is a line in which the IP address is registered in the third line of the table in the above figure, we search for it and reply it at the same time. In the example shown in the figure, we will reply with the IP address “192.0.2.227” together. The basic operation is that the DNS server specifies the information to be checked by name and type, and according to it, finds the applicable one and responds to the client. Also, check the correspondence table of domain name and IP address registered in the server and answer the IP address. Besides A and MX types, there are two types of DNS servers: “PTR” used to look up names from IP addresses, “CNAME” to name aliases (nicknames) to names, and IP addresses of DNS servers “NS” to register, “SOA” to register attribute information of the domain itself, and so on. The operation of the DNS server is as simple as finding and replying information corresponding to the name and type in the inquiry message, but by using different types, it is possible to handle various kinds of information. In this way, the DNS server checks the correspondence table of the domain name and the IP address registered in the server. I will answer the IP address. Although the registration information is described in the table in the above figure, the registration information is actually written in the setting file and so on. A resource record is equivalent to one line of information in the table.

Domain hierarchy

If there is a limited number of web servers and mail servers, such as the company network, you can register that information on one DNS server, so it works as described so far, but on the internet There is a huge number of servers, so it can not be handled by one DNS server. So, there is a mechanism to disperse information, register it on many DNS servers, and find out where the necessary information is registered in cooperation with that many DNS servers.

Register information in the DNS server

All the information registered in the DND server has a hierarchical structure called domain name. For example, I think that it is easy to understand if you imagine a hierarchy like a hierarchy such as a prefecture, city, town in a local city. By layered, you can efficiently organize a lot of information. The names used in DNS are separated by “.” Dots for www.katu.katucom.com, but this dot represents a hierarchy break. Separate by dots instead of being separated by prefecture or city like local cities. And the ones on the right side are supposed to represent the higher hierarchy. And what is equivalent to that one area (equivalent to prefecture or city) is called a domain. That is, under com, there is a domain called katucom, under it there is a domain called katu, and that domain has the name www. I will register this hierarchical domain information in the DNS server, but in that case I treat one domain as one. Domain information can not be divided and registered. However, it is possible to register information of multiple domains on one DNS server. Here we will proceed as one that registers one domain on one DNS server. Then, the DNS server is arranged in the same way as the hierarchical structure of the domain, and the information of each domain is registered in the DNS server in that domain.

Register information in the domain

For example, in the case of a company domain, if you want to place DNS servers for each division and register domain information separately. Since one domain can not be divided, you can create a further subdomain under the domain and assign it to each department. For example, if the company domain is example.co.jp, create multiple domains under that domain, such as sub1.example.co.jp, sub2.example.co.jp, It can be assigned to each division. Since domains do not point specifically to business divisions or specific organization names, you can assign domains to not only business divisions, but also subsidiaries as well, for example. All the domains on the Internet are those that create domains subordinate to this way and assign them to countries, companies, organizations, etc. EX: For the domain www.katuhiro.co.jp The domain named jp at the top is the domain assigned to Japan, and the subdomain co domain is a domain established to classify domestic domains and represents a company. And the underlying katuhiro will be the domain assigned to the company and the lowest www will be the name of the server.

Locate DNS server (get IP address)

How to locate information registered in the DNS server

I will explain which DNS server the registered WEB server is registered and how to find it. Since there are tens of thousands of DNS servers on the net, it is impossible to investigate everything. So we will register the IP address of the DNS server that is responsible for the domain of the meeting in the order that it is registered in the higher DNS server and also in the higher DNS server. For example, register the DNS server responsible for the domain www.katuhiro.com to the katuhiro.com DNS server and katuhiro.com DNS server to the com domain DNS server. With this method, if you know the upper DNS server, you can automatically know the IP address of the lower DNS server and send a request message there.

Root domain

Although it looks like it seems to be the end of registering a subordinate DNS server to the DNS servers of domains such as com and jp (these are called top level domains), the Internet domain has one more com and jp , There is a domain called root domain. Since there is no domain name, the domain name is usually omitted, but if you explicitly write it, add “.” (Period) at the end like www.katuhiro.katuhiro. Com. Represents the root domain. Register com and jp’s DNS servers on the DNS server of this root domain. By registering the lower DNS server in the upper DNS server in this way, you can go downward from the root domain in order. The DNS server of the root domain is registered in all the DNS servers existing on the net so that any DNS server can access the root domain. In other words, if you access a DNS server from a client somewhere, from there you can follow the domain hierarchy via the root domain, and finally reach the target DNS server. (Lower figure) 

There are currently only 13 IP addresses assigned to DNS servers in the root domain, so it is not difficult to register them to each DNS server. Actually, since the information on the DNS server of the root domain is distributed as the configuration file together with the DNS server software, registration will be finished automatically if you install that software. (Register DNS server in root domain) This is the preparation stage. When setting up the DNS server, you have completed registration up to individual. The DNS server can find out the target DNS server from the DNS servers with tens of thousands of generations or more.

Obtain an IP address

Following the request and response from the domain of www.katuhiro.com from the domain of www.katuhiro.com to repeat the request and response from the root domain to the upper DNS server to the lower DNS server and finally arrive at the target WEB server The domain of the IP address is notified to the user. 

 

DNS server responds quickly with caching function

Since there are cases where multiple domain information is registered on one DNS server on the actual net, there is no guarantee that there will be one DNS server for each domain. Sometimes upper and lower domains are registered on the same DNS server. In that case, if you inquire of the upper DNS server, you will skip down the lower DNS server and the information about the DNS server under it will be returned. Also, if you do not operate according to the principle of going from the top root domain to the top in each case, the cash function may be working. The DNS server has a function to record the name that was checked once in the cache, and if the information corresponding to the inquired name is in the cache, it will answer that information. You can find the hierarchy downward from that position. In such a case, it is faster and less troublesome than starting searching from the root domain. If the inquired name is not registered in the domain, you will get an answer that the name does not exist, but sometimes you save it in the cache. You can answer quickly even if the name does not exist. There is one point of caution in the mechanism of this cache. Since the registration information may be changed after saving the information in the cache, the information saved in the cache is not always correct. For that reason, we set an expiration date for information registered in the DNS server. When that expiration time passes, we delete that data from the cache. Furthermore, when answering the inquiry, it is supposed to inform whether the information is stored in the cache or reply from the DNS server of the registration source.

Leave a Reply

Your email address will not be published. Required fields are marked *