The role of dns: resolve domain names (web addresses) into IP addresses. This process is called DNS domain name resolution. The client sends a domain name query request to the DNS server; then the DNS server informs the client of the IP address of the Web server; and finally the client communicates with the Web server.
DNSIntroduction
DNS is the domain name resolution protocol
DNS It is the abbreviation of Domain Name System and is a core service of the Internet. As a distributed database that can map domain names and IP addresses to each other, it can make people access the Internet more conveniently without having to remember what to do. The IP number string read directly by the machine. This is also the official statement of DNS.
To put it bluntly: communication is carried out through IP addresses on the Internet. However, IP addresses are expressed in numbers, which are difficult to remember (such as 116.213.120.232), so each IP is given a domain name that is easier for humans to remember (such as www.google.com), and DNS is used to resolve the domain name into IP (parse the naming format that is easy for people to understand into a format that the computer can understand, or translate the IP into a domain name)
The role of the DNS service: resolve the domain name into an IP address
The client sends a domain name query request to the DNS server (the DNS server has its own IP address)
The DNS server informs the client of the IP address of the Web server
Client and Web server communication
DNS query process (it is very important to understand DNS A process based on the principle)
Through hierarchical management, hundreds of millions of domain name information around the world can be effectively managed (Similar to a company, the CEO only manages the managers of each department; each department The manager only manages each team leader in his own department; each team leader only manages the team members of his own group. At least this is a more effective management method)
The following is a client's request Visit www.benet.com, the process of this WEB server to understand the principle of DNS
1. The client (PC) requests the preferred DNS server (the preferred DNS server refers to your current The DNS server connected to the PC, Windows can use the ipconfig command to view) Initiate a request: "Do you know the IP of www.benet.com?" If the preferred DNS server knows it (generally if the preferred DNS server has resolved it before, then a period of The cache time, the default is three days. If it happens to be within the cache time, then the preferred server will know the IP of this domain name), then the preferred DNS server will directly return the IP address of the domain name to the client
2 . If there is no relevant information on the preferred DNS server, it cannot directly return the IP address of the domain name. At this time, the preferred DNS server will ask the root DNS server (all DNS servers know where the 13 DNS root servers in the world are). The root server may not know the specific IP address of www.benet.com, but it knows the IP of the first-level domain com (that is to say, the root server is only responsible for maintaining all first-level domains, so there are only a few hundred pieces of data here , although the amount of data is small, it accepts requests from all over the world, so the load is also very large)
3. The root server returns the IP address of com to the preferred DNS server
4. The preferred DNS server then requests the "com" DNS server: "Do you know the IP of www.benet.com?", but the com DNS server does not know the IP of www.benet.com, but the com DNS server does. The IP of benet.com,
5. "com" DNS server returns this information to the preferred DNS server
6. The preferred DNS server then requests the "benet.com" DNS server, this Of course, the benet.com server will know the IP address of www.benet.com
7. The "benet.com" DNS server will return this information to the preferred DNS server
8. Preferred DNS The server returns the obtained IP address of www.benet.com to the client
9. The client accesses the WEB server based on the obtained IP address of www.benet.com
10. The WEB server returns relevant data
Domain name space structure
Expansion:
Why must I set up DNS to access the Internet? Some friends may find out why I can log in to QQ and MSN but cannot open the web page? In fact, most of the reasons are caused by DNS server failure. The DNS server address is unique and is provided by operators to end users to resolve the relationship between IP addresses and domain names. If the DNS server address is not set, then it cannot be queried. Naturally, the web page cannot be opened depending on the address. However, instant messaging software such as QQ and MSN use the UDP transmission protocol, which is an unreliable transmission protocol. There is no need to provide a DNS server address, and you can still log in.
The above is the detailed content of What is the role of dns?. For more information, please follow other related articles on the PHP Chinese website!