In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you to introduce in detail the "DNS server parsing process is how", detailed content, clear steps, details handled properly, I hope that this "DNS server parsing process is how" the article can help you solve doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.
DNS: Domain Name System Domain name system is a service of the Internet. As a distributed database that maps domain names and IP addresses to each other, it makes it more convenient for people to use the Internet.
domain name
Before we talk about DNS, let's first roughly talk about the domain name. For example, when we use a browser to access the URL, the address of the website we enter is a domain name, such as www.google.com. But in fact, we know that every machine in the Internet has an IP address. If we need to visit a website server, In fact, you need to enter the IP address of the website to access, but the IP address is often difficult to remember, IPv4 is difficult to remember, let alone IPv6, so we manage it by using the domain name, but at the time of access, the bottom layer of the system is accessed through the ip address, and the direct translation of the domain name and IP address is completed through the DNS server.
Nsswitch framework
Now that you have a simple understanding of the domain name, let's talk about the nsswitch framework.
Nsswitch (name service switch configuration, name service switching configuration), which specifies which channels and in what order to find specific types of information. You can also specify what action the system will take when a method works or fails, which is a common framework and a common modular implementation that interacts with various types of storage. Nsswitch is a parsing framework in Linux, which is responsible for a layer of docking between the program and the storage mode. So that users can better choose the storage method, such as user name resolution to UID, service resolution to PORT, domain name resolution to IP, etc. These can be stored in a variety of ways, such as nis,ldap,file,mysql, etc. And the framework of nsswitch is provided to users who can easily change the storage mode. For example, the default user name and password are configured in the / etc/passwd file by default, but users can choose to store their users and passwords in ldap or mysql, while the upper layer only needs to write programs on the framework through nsswitch. When using the system users, they do not need to care about where these accounts and passwords are stored (there is no need to change the program). It is done by the middle layer of nsswitch. There is a line in the nsswitch configuration file / etc/nsswitch.conf, "hosts: files dns", which means to find the local / etc/hosts file and then the dns server when resolving the domain name.
For more information, please see the / etc/nsswitch.conf configuration file. Each line of configuration in nsswitch.conf indicates how to search for information. The format of each line of configuration is as follows:
Info: method [[action]] [method [[action]]...]
Where info specifies the type of information described in the row, method is the method used to find that information, and action is the response to the status returned by the previous method. Action should be put in square brackets. When you need to provide the information described in the nsswitch.conf file, the system checks the configuration line that contains the appropriate info field. It executes the method specified in the configuration line in left-to-right order. By default, the system stops searching if the desired information is found. If no action is specified, the system tries the next action when a method fails to return a result. It is possible that the search ended without finding the information you were looking for.
The emergence of DNS server
In the late 1970s, domain name resolution began to use the / etc/hosts file. In the 1960s, a US military project, ARPAnet, was transferred from a telephone switching network to a TCP/IP data exchange network (data packets can be sent in multiple paths and the receiver receives the data and sends an acknowledgement). At that time, there were only four hosts connected to the Internet at the University of California, Santa Barbara, University of Los Angeles, Utah State, and Stanford Research Institute, because few hosts could remember IP addresses, but because people were most likely to remember strings rather than numbers, as more and more people joined the hosts later, they found that they could no longer remember which host was that IP. Therefore, the concept of naming hosts comes out, and each host has a string that is easy to remember, which can be easily remembered but cannot be recognized by the host; therefore, domain name resolution appears that the hosts file can be used to indicate what the corresponding IP of the host is; people access the host name, and the host is responsible for resolving the host name into an IP address.
But later, with the addition of more and more Internet hosts, hosts files are no longer enough to deal with. So in the United States, there is an organization IANA (now managed by ICANN) responsible for managing the translation of IP and domain names; if A wants to connect to the network, ask IANA to apply for an IP address and a hostname; if B knows A's host name and wants to access A, you need to go to IANA to download the hosts file through FTP to update your hosts file locally, and there will be the IP address corresponding to A host name in the hosts file. With the increasing size of hosts files, IANA management is very troublesome and users have to go to IANA to download hosts files. This general method will not work over a long period of time. Later, IANA set up DNS to handle requests submitted by users to help users resolve the IP address corresponding to the domain name.
Importance of DNS
1) Technical point of view
DNS resolution is the actual addressing method for most Internet applications; the re-development of domain name technology and a variety of applications based on domain name technology have enriched Internet applications and protocols.
2) from the perspective of resources
Domain name is the identity of the Internet, is the unique identification resources that can not be repeated; the globalization of the Internet makes the domain name become a national strategic resource to identify a country's sovereignty.
Domain name spatial structure
DNS's distributed database is indexed by domain names, and each domain name is actually a path in a large inverse tree called domain name space. The hierarchical structure of this tree is shown in the following figure, which is very similar to the structure of the Linux file system. At the top, the tree has a unique root domain. There can be multiple arbitrary branches under the root, which are called "top-level domains". Under each top-level domain, there can be more than one "secondary domain", and the depth of the tree must not exceed 127 layers.
FQDN
FQDN: (Fully Qualified Domain Name) fully qualified domain name / full domain name, which refers to the host name plus the full path, which lists all domain members in the sequence. The full domain name can logically accurately indicate where the host is, and it can also be said that the full domain name is a complete representation of the host name. The location of the host in the domain name tree can be seen from the information contained in the full domain name. Such as www.baidu.com. The meaning of this domain name after decomposition is as follows:
. # for root domain .com # for top-level domain baidu.com # for secondary domain www # for host name
Root domain: at present, there are only 13 root servers in the world, named "A" to "M", of which 10 are located in the United States and 3 in the United Kingdom, Sweden and Japan.
Top-level domain: organized domain and country domain, in which the organizational domain is: .com .org .net .edu .cc .info and so on, and the national domain is: .cn .jp and so on.
Second-level domain name: it is really used for service, for example, you can apply for a trial domain name according to the enterprise name.
Hostname: it is used to identify the service corresponding to this domain name, such as www for the World wide Web and mail for email, which can be set at will.
The following figure shows how each branch is represented:
DNS server rules
\ 1) every host knows where the root domain is
\ 2) the superior must know the subordinate
\ 3) the subordinate does not know the superior.
\ 4) query two-stage recursive query and iterative query
\ 5) the root domain does not iterate (there are 13 a-m.root-servers.net in the root world)
\ 6) Top-level domain does not iterate
\ 7) Secondary domain servers can provide only authoritative queries but not iteration or forwarding
DNS server parsing process
1) Recursive query
Recursive queries are the most common requests sent by the host to the local domain name server. When the local domain name server accepts the query request from the client, the local domain name server will try to find the answer on behalf of the client, while the client just waits while the domain name server does all the work. If the local domain name server cannot answer directly, it will search up and down the branches of the domain name tree recursively to find the answer. For a recursive query, the DNS server continues to search until an answer is received. The answer can be the IP address of the host or "the host does not exist". Regardless of the result, the recursive domain name server returns the result to the client.
2) iterative query (multiple requests may be made)
The local domain name server usually uses iterative query to the root domain name server. When the root domain name server receives the iterative query request message from the local domain name server, it either gives the IP address to be queried, or tells the local domain name server: "which domain name server should you query next?" Then let the local domain name server make subsequent queries.
Analysis of the query process of a domain name
For example, the DNS client needs to resolve the domain name www.baidu.com.cn, as shown below:
1. The DNS client first finds the local DNS server for domain name resolution, that is, the DNS address set by itself.
2. After receiving the request, the local DNS server directly looks up whether the server has this record, and if so, directly returns the address corresponding to the domain name to the client, then the resolution of the domain name is completed, which is called a "recursive query".
3. If the local DNS does not find the corresponding record, the DNS server will request the root domain to find the address of the .cn server (of course, the local DNS server may not find the root DNS but directly forward it to another DNS server for domain name resolution, but if the forwarded DNS server is not the authoritative server of www.baidu.com.cn, it still needs to find the root server)
4. After receiving the request, the root server will find the list of international domain name servers, and then return the address of the .cn server to the local DNS server.
5. After the local DNS server receives the .cn server address, it will find the .cn server to resolve the top-level domain .com.cn server address, and then the .cn server will return the .com.cn server address to the local DNS server.
6. After the local DNS server receives the .com.cn address, it will find the .com.cn server to resolve the address of the baidu.com.cn server.
7. After the local DNS server receives the address of baidu.com.cn, it will find the baidu.com.cn server to resolve the www.baidu.com.cn host address.
8. After the local DNS server obtains the IP address of www.baidu.com.cn, it will immediately return it to the client and cache the domain name.
9. After the client gets the IP address, it is cached locally, and then the Baidu server can be accessed through the IP address.
PS: in this query process, the request issued by the client is a recursive query, while the request issued by the DNS server is an iterative query; in addition, another term is the authoritative server (authoritative reply), which means that the server that is really responsible for the resolution of your domain name record is called the authoritative server, and no other resolution can be called the authoritative reply.
DNS server type
1) Primary DNS server
The primary DNS server is the DNS server that created the zone. The area data here is readable and modifiable. The zone data in the primary DNS server is also known as the original zone data. In a DNS service network, multiple primary DNS servers can be established, which can provide the fault tolerance of DNS services.
2) Secondary DNS server
The secondary DNS server does not create zones, and its zone data is copied from the primary DNS server, so the zone data can only be read and cannot be modified, also known as replica zone data. When the secondary DNS server is started, the secondary DNS server contacts the primary DNS server that established the contact and replicates data from the primary DNS server. When the secondary DNS server is working, it will update the replica area data periodically to ensure the consistency between the replica and the original area data as much as possible. The secondary DNS server can replicate zone data from other secondary DNS servers in addition to replicating data from the primary DNS server.
Setting up multiple secondary DNS servers in a zone can provide fault tolerance, share the burden of the primary DNS server, and speed up DNS parsing.
3) Master DNS server
Whether it is a primary DNS server or a secondary DNS server, if it provides replication services for zone data to other secondary DNS servers, it is called the DNS server is the master DNS server. If DNS server A provides data replication services to DNS server B, An is called the master DNS server.
4) caching server
There is no zone data on the cache server, it only helps the DNS client to query other DNS servers, and then stores the queried data in a cache Cache to respond to the client's query request. The Cache-Only server is only responsible for querying the data, and when the client queries the data, if there is data in the Cache, Cache can quickly feedback the results to the client.
5) DNS forwarding server
DNS forwarding server is a special type of DNS server. In a DNS network, if the domain name resolved by the client to the specified DNS server is not successful, the DNS server can send the client's resolution request to a DNS forwarding server, as the name implies, the DNS forwarding server forwards the domain name request to other DNS servers.
After reading this, the article "what is the parsing process of DNS server" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.