DNS domain name resolution process

DNS domain name resolution process

1. What is DNS

  The full name of dns is Domain Name System, also known as domain name system, which is a service of the Internet.

  The correspondence between domain names and ip addresses is mainly stored in the dns server to provide people with domain name resolution services.

  There are 13 root dns servers in the world, 10 in the United States and 2 in Europe, distributed in the United Kingdom and Sweden.

  One in Asia, in Japan.

2. DNS architecture

  The inclusion relationship of the server is as follows:

  Root DNS server> Top-level DNS server> Authoritative DNS server> DNS server of the second-level domain name

  Root DNS server: control the correspondence between the IP and domain names of all top-level DNS

  Top-level DNS server: master the corresponding relationship between the ip of the authoritative dns and the domain name

    eg: .com .cn .org

  Authoritative DNS server: control the correspondence between the ip of the second-level domain name dns server and the domain name

    eg: baidu.com sina.com

  DNS server of the second-level domain name: control the correspondence between the domain name you want to access and the ip

    eg: www.baidu.com new.sina.com

3. the whole process of inputting url in the browser and pressing enter

3.1 General process

  1. Resolve the entered url domain name into an ip address through dns

  2. The browser sends request information to the ip (including Request Headers and Request Body)

  3. The server responds to the browser with a response message (including Response Headers and Response Body)

3.2 dns resolution detailed process

  1. First check the local dns cache to see if there is an ip address corresponding to the domain name, there is direct access, and there is no further down

  2. Ask the root dns server for the IP address corresponding to the domain name (the root dns server will return the address of the top-level DNS server corresponding to the domain name)

  3. The browser asks the top-level dns server for the IP address corresponding to the domain name (the top-level dns server will ask him to query the authoritative dns server)

  4. Ask the authoritative dns server for the IP address corresponding to the domain name (the authoritative dns server will ask him to query the secondary dns server)

  5. Ask the secondary dns server for the ip address corresponding to the domain name (the secondary dns server will return the corresponding ip address)

  6. After receiving the ip address, the corresponding relationship between ip and domain name will be saved to the local dns cache for easy access next time (the cache is stored in the hard disk, not in the memory, and has an expiration time)

Reference: https://cloud.tencent.com/developer/article/1601280 Dns domain name resolution process-Cloud + Community-Tencent Cloud