DnsWhy not a single-point centralized design approach, rather a distributed cluster approach
A simple design model for dns is the use of only one dns server on the internet, which contains all maps. In this centralized design, the client sends all queries directly to a single dns server, while the dns server responds directly to all query clients. Although this design is very tempting, he does not apply the current internet, because today's internet has a large and growing number of hosts, and this centralized design has single-point failures (a hiccup, a global rush), communication capacity (billion of host requests for dns information, including but not limited to all http requests, e-mail servers, tcp long connection service), long-range delays (for example, from australia to new york), maintenance costs (as all host name-ip images are updated at a service point), etc
Dns servers are generally divided into three categories: root dns servers, top-level dns servers, and authoritative dns servers。

The problem of single-point concentration is addressed using distributed, horizontal database models and cache methods。
Dns domain name
The domain name system, as a hierarchical and distributed database, contains various types of data, including host and domain names. The name in the dns database forms a layered tree structure called domain namespace. Domain names contain individual label partition points, such as:
I'm. Qq. Com
The fully limited domain name (fqdn) only identifies the location of the host in the dns stratification tree, separating the list of names of the host quoted from the root by the specified mid-point of the path. The graph below shows what the host calls the im inside
Qq. Com
Example of dns tree. The host's fqdn is
I'm. Qq. Com
Dns domain name hierarchy

Organization of dns domain name space
Naming the five categories used to describe dns domain names according to their functional spaces is described in the table below, together with examples of each name type。
For example:
Www. Uestc. Edu. Cn

Dns and internet domain
The internet domain name system is maintained by the name registry and is managed by the organization and the national/territorial top level domain on the internet. These domain names are in accordance with international standards 3166. A number of existing abbreviations are retained for use in the organization, as well as for countries/areas with two and three letters, as shown in the table below. Some common dns domain names are illustrated below:

Resource records
Resource records (rr) included in the dns database. Specific resources in each rr identification database. We often use records like soa, ns, a when we build dns servers, and mx, cname when we maintain dns servers。
The common rr is shown below:

The dns service work process
When the dns client needs to search for the name used in the application, it asks for a local dns server to interpret the name. Each query sent by a client machine contains three messages to specify the questions to be answered by the server。
The specified dns domain name is a fully qualified domain name (fqdn)。
Specifies the type of query that allows it to specify resource records, or as a specialized type of query operation。
Specified categories for dns domain names。
For the dns server, it should always be assigned to the internet category. For example, the designated name may be a fully qualified domain name of the computer, such as
I'm. Qq. Com
, and the type of query specified is used to search the address resource record through that name。
Dns queries are analysed in different ways. Client machines can also respond to queries in situ by using cache information obtained from previous queries. The dns server can respond to queries using its own resources to record the information cache, or may request the client machine to query or contact other dns servers to fully decipher the name and then return the response to the client machine. This process is called regression。
In addition, the client can attempt to resolve the name by contacting another dns server. If the client does so, it will use an independent and additional query based on the server response, which is called an iterative process, that is, an interactive query between dns servers。
The process of dns queries is shown in the figure below。

Enter the www. Com domain name in the browser, the operating system will first check whether its local hosts file has this web map and, if so, call this ip address map, completeDomain name resolutionI don't know。
2. If there is no map of the domain in the hosts, find the local dns solver cache, if there is a web site map, and if so, return directly to complete the domain description。
3. If the hosts do not have a web map to match the local dns resolver cache, they will first look for the preferred dns server set up in the tcp/ip parameter, which we call the local dns server, which, when asked for a domain name, is included in the locally configured area resource, returns the resolution to the client machine and completes the domain description, which is authoritative。
4 if the domain name that you want to query is not to be decrypted by the local dns server area, but the server has saved the map of the site, calling this ip address and completing the domain description, which is not authoritative。
5 if both local dns server local area files and cache resolution fail, a query is made based on the local dns server's settings (whether or not to set a transponder) and if there is no forward mode, the local dns sends the request to 13 dns, which, upon request, will determine who the domain name (. Com) is authorized to manage and return to an ip that is responsible for the top level domain name server. Upon receipt of ip information, the local dns server will contact the server responsible for the . Com domain. The server in charge of the . Com domain receives requests and if it is unable to resolve them, it will find a lower level dns server address () for the management of the . Com domain to the local dns server. When the local dns server receives this address, it looks for a domain server, repeats the actions above, and makes inquiries until it is found at www.. Com。
6 if a forwarding mode is used, the dns server forwards the request to a higher level dns server, where it is analyzed by a higher level server, which is unable to resolve the request, or to find a dns or transfer the request to a higher level, which is circular. Whether the local dns server is for forwarding or a hint, the result is returned to the local dns server, which then returns to the client。
From the client to the local dns server is a back-to-back query, and an interactive query between dns servers is an iterative query。
Appendix:
Local dns profile and unconfigured forward package analysis
A new dns, and i'm not going to describe it here
1, dns server does not create forwarding
Install and open the wireshark software on the 192. 168. 14. 2228 server, set the data package to be filtered by the udp, use the nsookup command on the 192. 168. 145. 12 client machine, and see immediately the local dns server directly check some of the 13 root domains around the world, then resolve them step by step, by intergenerational means, until the corresponding ip for www. Sohu. Com is 220. 18. 18. 87。
When the local dns server received the fox search ip, it returned the ip to the 192. 168. 145. 12 client machine to complete the analysis。

2, dns server settings forward
Because the fox field name was used in the first phase of the test, there was a cache, and in order not to be interfered with by the upper steps, we were on the client plane at 192. 168. 145. 12 on the ns lookup 100 degrees. It appears from the figure that the local dns forwards the request to the 192. 168. 133. 10 server, and the 133. 10 server returns the obtained ip to the local dns, and then the local dns tells the dns client and completes the analysis。
Parsing order
1) browser cache
When a user accesss a domain name through a browser, the browser first looks in its own cache for an ip address to which the domain name corresponds (if the domain name has been visited and no clean cache exists)
2) system cache
When the domain name corresponds to ip in the browser cache, the user computer system hosts file dns cache is automatically checked for an ip to match the domain name
3) router cache
When both browsers and system caches have no domain name corresponding to ip, access to router caches is checked, with the above three steps being the dns cache of the client
4) isp (internet service provider) dns cache










