Computer network—DNS domain name resolution process

What is DNS

A distributed database that maps domain names and IP addresses to each other. Simply put, it is the process of finally obtaining the IP address corresponding to the host name through the host name .
DNS is aapplication layeragreement.

How DNS works

DNS domain name format

Domain names in DNS are separated by periods. For example, www.server.com, in the domain name, the position to the right indicates the higher level .

In fact, there is a last point in the domain name, such as www.server.com. This last point represents the root domain name; .com is the top-level domain; and below that is server.com. Domain name hierarchy is similar to a tree structure.
== Therefore, as long as the client can find any DNS server, it can find the root domain DNS server through it, and then follow the clues to find a target DNS server located in the lower layer.

DNS domain name resolution

  • The client sends out a DNS request, and now the browser is looking for anycacheThe IP address corresponding to the domain name you have passed, if not, find ithard diskhosts file, if not, send it tolocal DNS server(That is, the DNS server address filled in the client's TCP/IP settings, usually provided by your network access server provider)
  • After the local DNS server receives the request from the client, ifcacheIf www.server.com can be found in the table, it will directly return the IP address; if not, the local DNS will go back and askroot name server
  • Although the root domain name server does not directly resolve the domain name, it can indicate a path (after the root DNS receives a request from the local DNS, if it finds that the suffix is ​​.com, it will tell the address of the .com top-level domain name server to the local DNS
  • Local DNS receivedTLD serverAfter the address, it will go to the top-level DNS, and the top-level DNS will tell the local DNSAuthoritative DNSs position
  • The authoritative DNS tells the local DNS the IP address after the query
  • The local DNS returns the IP address to the client ( the local DNS server not only returns the IP address to the user computer, but also saves this correspondence in the cache ). The client and target establish a connection.

The query from the host to the local domain name server generally adopts recursive query (the so-called recursion means that if the local domain name server inquired by the host does not know the IP address of the queried domain name, then the local domain name server will continue to query to other root domain name servers as a DNS client. Send a request message instead of letting the host perform the next query by itself); the query from the local DNS to the root DNS is generally an iterative query.

DNS uses UDP

Because UDP is fast.The client queries the DNS server for the domain name, and the content returned generally does not exceed 512 bytes

DNS load balancing

When a website has enough users, if each request is on a machine, then the machine may crash. So use DNS load balancing technology.

principle

Configure multiple IP addresses for the same host name in the DNS server . When answering DNS queries, the DNS server will return different resolution results in sequence based on the IP addresses of the host records in the DNS file for each query. Guide to different machines , so that different clients can access different servers.

Guess you like

Origin blog.csdn.net/qaaaaaaz/article/details/130874737