Domain name DNS resolution of some expertise

DNS (English: Domain Name System, abbreviation: DNS), generally speaking, DNS server is divided into: DNS authority server and DNS cache server. The DNS authority server adopts the iterative query mode, while the DNS cache server is generally a recursive server, which is responsible for handling the client’s DNS query request completely until the final result is returned.

DNS Authorized Servers are what we call DNS Resolution Servers and are provided by almost all domain name registrars.

The DNS cache server generally includes ISP service provider DNS server or some Public DNS servers, such as Google Public DNS (8.8.8.8) DNS114 DNS (114.114.114.114,), Baidu Public DNS (180.76.76.76), etc.

Domain name resolution record type

In the DNS system, common resource record types are:

  • Host record (A record) : A record is an important record used for name resolution. It maps a specific host name to the IP address of the corresponding host.
  • Alias ​​record (CNAME record) : CNAME record is used to point an alias to an A record, so that there is no need to create a new A record for a new name.
  • IPv6 host record (AAAA record) : Corresponding to the A record, used to map a specific host name to the IPv6 address of a host.
  • Service location record (SRV record) : Used to define the location of a server that provides a specific service, such as hostname, port number, etc.
  • Domain name server record (NS record) : used to specify which DNS server to resolve the domain name. When registering a domain name, there is always a default DNS server. Each registered domain name is resolved by a DNS domain name server. The DNS server NS record address generally appears in the following form: ns1.domain.com, ns2.domain. com etc. Simply put, the NS record specifies which DNS server resolves the domain name.
  • NAPTR record: It provides a regular expression method to map a domain name. A well-known application of NAPTR records is for ENUM queries.

Technical realization of domain name resolution

DNS implements a hierarchical name space by allowing a name server to “delegate” part of its name service (known as zone) to subservers. In addition, DNS also provides some additional information, such as system aliases, contact information, and which host is acting as the mail hub for the system group or domain.

Any computer network that uses IP can use DNS to implement its own private name system. Nevertheless, when referring to domain names implemented on the public Internet DNS system, the term “domain name” is most commonly used.

This is based on 984 global “root name servers” (divided into 13 groups, numbered A to M). Starting from these 984 root servers, the remaining Internet DNS namespace is delegated to other DNS servers, which provide specific parts of the DNS namespace.

For example, www.php.net  as a domain name corresponds to the IP address 185.85.0.29 . DNS is like an automatic telephone directory, we can directly dial  the name www.php.net of 185.85.0.29 instead of the telephone number (IP address). After we directly call the name of the website, DNS will transform the human-friendly name of www.php.net into an IP address that is convenient for machine identification like 185.85.0.29 .  

Take the query www.php.net as an example:

  • The client sends a query message “query www.php.net” to the DNS cache server. The DNS server first checks its own cache and returns the result directly if there is a record.
  • If the record is aged or does not exist, then:
    1. The DNS server sends a query message “query www.php.net” to the root domain name server, and the root domain name server returns the authoritative domain name server address of the top-level domain .net.
    2. The DNS server sends a query message “query www.php.net” to the authoritative domain name server of the .net domain to obtain the authoritative domain name server address of the secondary domain .php.net.
    3. The DNS server sends a query message “query www.php.net” to the authoritative domain name server of the .php.net domain, obtains the A record of the host www, stores it in its own cache, and returns it to the client.

In the above example, a key value is the cache time (TTL). When doing domain name resolution settings, each record will have a TTL value, which is generally set to 10 minutes (600 seconds) by default. This is the cache time of the record. Once the cache expires or the cache does not exist, the above will be repeated 1, 2, 3 steps.

In other words, if the TTL value is set too small, the root domain name server and authoritative domain name server will be frequently queried. If the TTL value is set to a large value, in most cases, the result will be directly returned in the DNS cache server to speed up the speed of domain name resolution . However, if the TTL value is set to a large value, there will be a disadvantage that the modification of the analysis record takes effect more slowly.

The size of the TTL value and the performance of the DNS resolution server of the domain name will affect the normal resolution of the domain name or the user experience.

Intelligent DNS resolution

Generally, smart DNS resolution is needed, which is a way to determine the resolution value based on different lines or regions when the CDN is turned on or the server has multiple mirrors. Smart DNS is a DNS solution launched to solve the problem of poor interconnection between telecommunications and Netcom. Later, it has been continuously upgraded to be based on different regions (such as dividing provinces, cities, or countries) and different operators (such as telecommunications, China Unicom, China Mobile). , Great Wall Broadband) and other methods.

Specifically, it is to set the same domain name record to point to different values ​​(IP), and determine which value (IP) of the domain name record should be returned according to the specified conditions of the client.

Leave a Comment