In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
DNS (Domain Name System) is the abbreviation of "domain name system". It is a computer and network service naming system organized into a domain hierarchy. It is used in TCP/IP networks. The services it provides are used to convert host names and domain names into IP addresses. You can think of it as a huge phone book. What is DNS?
DNS (Domain Name System) is the abbreviation of "domain name system". It is a computer and network service naming system organized into a domain hierarchy. It is used in TCP/IP networks. The services it provides are used to convert host names and domain names into IP addresses. You can think of it as a huge phone book.
For example, if you want to access the domain name math.stackexchange.com, first check through DNS that its IP address is 151.101.129.69.
DNS is such a "translator". Its basic working principle can be shown in the following figure:
II. Spatial structure of DNS domain name
As a hierarchical and distributed database, the domain name system contains various types of data, including hostnames and domain names. The names in the DNS database form a hierarchical tree structure called domain namespaces.
Root domain: the DNS domain name is specified by the trailing period'.' To specify a domain hierarchy whose name is at the root or higher.
Top-level domain: used to indicate a country, region, or organization. Use three characters, such as com-> commercial companies, edu-> educational institutions, net-> Internet companies, gov-> non-military government agencies, and so on.
Secondary domain: the registered name used by an individual or organization in Internet. Use two characters, such as: cn-> for China, jp-> Japan, uk-> UK, hk-> Hong Kong and so on.
Host: the host name is at the bottom of the domain name spatial structure. The host name and the domain name are combined to form a FQDN. The host name is the leftmost part of the FQDN.
III. The process of obtaining DNS
DNS is an application layer protocol, and in fact it works for other application layer protocols, including not limited to HTTP and SMTP, as well as FTP, to resolve user-provided host names to IP addresses.
The specific process is as follows:
There is a DNS client running on the ① user host, that is, our PC or mobile client is running the DNS client.
The ② browser extracts the domain name field from the received url, which is the hostname of the access, such as http://www.baidu.com/, and passes this hostname to the client of the DNS application.
The ③ DNS client sends a query message to the DNS server containing the host name field to be accessed (including some column cache queries and distributed DNS cluster work).
④ the DNS client will eventually receive an answer message containing the IP address corresponding to the hostname.
⑤ once the browser receives the IP address from DNS, it can initiate a TCP connection to the HTTP server where the IP address is located.
IV. The architecture of DNS services
The role of DNS service: to resolve domain names to IP addresses and IP addresses to domain names.
Suppose some applications running on the user's host, such as Webl browsers or mail readers, need to translate the host name to an IP address. These applications will call the client side of DNS and indicate the hostname that needs to be converted. (on many UNIX-based machines, the application needs to call the function gethostbyname () to perform this transformation.) After receiving the DNS client of the user host, it sends a DNS query message to the network. The UDP datagrams used by all DNS request and reply messages are sent through port 53 (as for why UDP is used, see why there are only 13 domain name root servers? Guo's unintentional answer) after a delay of several ms to several seconds, the DNS client on the user's host receives an DNS reply message that provides the desired mapping. The result of this query is passed to the application that calls DNS. Therefore, from the point of view of invoking the application on the user's host, DNS is a black box that provides simple and direct transformation services. But in fact, the black box for implementing this service is very complex, which consists of a large number of DNS servers distributed around the world and application layer protocols that define how the DNS server communicates with the query host.
5. Why does DNS not adopt a single point of centralized design, but work in a distributed cluster?
A simple design pattern of DNS is to use only one DNS server on the Internet, which contains all the mappings. In this centralized design, the client sends all query requests directly to a single DNS server, and the DNS server responds directly to all query clients. Although this design is very attractive, it does not apply to the current Internet. Because today's Internet has a large and growing number of hosts, this centralized design will have a single point of failure, communication capacity (query DNS packet requests sent by hundreds of millions of hosts, including but not limited to all HTTP requests, e-mail message servers, TCP persistent connection services), long-distance time delays (examples from Australia to New York) Problems such as high maintenance overhead (because all hostname-IP mappings are updated at one service site).
DNS servers are generally divided into three types: root DNS server, top DNS server, and authoritative DNS server.
VI. The working process of DNS service
When the DNS client needs to query the name used in the program, it queries the local DNS server to resolve the name. Each query message sent by the client includes three pieces of information to specify which questions the server should answer.
The specified DNS domain name, represented as a fully qualified domain name (FQDN).
The specified query type, which can specify resource records based on the type, or as a specialized type of query operation.
Specified category of the DNS domain name.
For DNS servers, it should always be specified as an Internet category. For example, the specified name can be a fully qualified domain name of the computer, such as im.qq.com, and the specified query type is used to search for address resource records by that name.
DNS queries are parsed in a variety of ways. Clients can sometimes answer queries in place by using cached information obtained from previous queries. The DNS server can use its own resource record information cache to answer the query, or it can query or contact another DNS server on behalf of the requesting client to fully resolve the name and then return the reply to the client. This process is called recursion.
Alternatively, the client itself can try to contact another DNS server to resolve the name. If the client does this, it uses independent and additional queries based on server responses, a process called iteration, that is, interactive queries between DNS servers are iterative queries.
The query process for DNS is as follows:
1. Enter www. For the qq .com domain name, the operating system will first check whether its local hosts file has this URL mapping relationship, and if so, first call the IP address mapping to complete the domain name resolution.
2. If there is no mapping of this domain name in hosts, look for the local DNS parser cache to see if there is this URL mapping relationship. If so, return directly to complete the domain name resolution.
3. If there is no corresponding URL mapping relationship between hosts and the local DNS parser cache, we will first find the preferred DNS server set in the TCP/ip parameter, here we call it the local DNS server. When this server receives the query, if the domain name to be queried is included in the local configuration zone resources, the resolution result will be returned to the client to complete the domain name resolution.
4. If the domain name to be queried is not resolved by the local DNS server region, but the server has cached the URL mapping, the IP address mapping is called to complete the domain name resolution. This resolution is not authoritative.
5. If the local DNS server local zone file and cache resolution are invalid, the query will be made according to the settings of the local DNS server (whether to set the forwarder). If the forwarding mode is not used, the local DNS will send the request to 13 root DNS. After receiving the request, the root DNS server will determine who is responsible for the authorization and management of the domain name (.com), and will return an IP responsible for the top-level domain name server. When the local DNS server receives the IP information, it will contact the server responsible for the .com domain. After the server in charge of the .com domain receives the request, if it cannot resolve it, it will find a DNS server address that manages the next level of the .com domain (http://qq.com) to the local DNS server. When the local DNS server receives this address, it will find the http://qq.com domain server, repeat the above action, and query until it finds www. Qq .com host.
6. If the forwarding mode is used, the DNS server will forward the request to the DNS server at a higher level, which will be parsed by the server at the next level. If the server at the next level cannot resolve the request, it can either find the root DNS or transfer the request to the superior in a loop. Whether the local DNS server uses a forwarding or root prompt, the result is finally returned to the local DNS server, which in turn returns the DNS server to the client.
From the client to the local DNS server is a recursive query, and the interactive query between DNS servers is iterative query.
Original address: https://www.linuxprobe.com/dns-ip-work.html
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.