DNS Domain name resolution process
We all know that when a browser makes a web request through a domain name, the DNS server resolves the domain name to an IP address so that the request can be sent to the correct IP address. How does this process work? Today sorted out the DNS domain name resolution process. Roughly divided into 10 steps:
The first step
The browser checks the cache for an IP address corresponding to the domain name. The cache has an expiration period, usually ranging from a few minutes to a few hours.
The second step
If the browser cache does not exist, check the hosts file of the operating system. For example, Windows is C:\Windows\System32\drivers\etc\hosts. Linux is configured in /etc/hosts.
The third step
If no local configuration will be according to the DNS domain name server to the machine configuration in this region (LDNS) initiate the request, if you are connected to the Internet through the school’s general is your school’s DNS servers, if you are connected to the Internet community in general is a network providers such as telecommunications, unicom, DNS server, DNS server usually can’t be too far away. On Linux, you can run cat /etc/resolv.conf to query the local DNS server. At this point, you can resolve 80% of your domain names.
The fourth step
If the LDNS cannot be resolved, then the root DNS server is directly requested for resolution.
Step 5
The root DNS server gives the local DNS server a gTLD address, which is an international top-level domain name server, such as.com,.cn,.org, and so on.
Step 6
The local DOMAIN name server LDNS sends the request to the gLTD server returned in the preceding step.
Step 7
The gLTD Server queries and returns the address of the domain Name Server. This is usually the address of the domain Name Server that you have registered. For example, if you have applied for a domain Name from a DNS provider, this DNS provider performs the domain Name resolution task.
Step 8
Name Server The DNS Server queries the mapping table between domain names and IP addresses and returns the IP address and a TTL value to the DNS Server.
Step 9
LDNS caches the IP address and TTL. The cache time is controlled by the TTL value.
Step 10
The domain name resolution result is returned to the user and cached in the local cache according to the TTL value. The domain name resolution process is complete.
The whole process is represented by a graph:
In the actual process of DNS resolution, there may be not only these 10 steps, but also multiple levels or a GTM in the incoming Name Server to control load balancing, which can affect the DNS resolution process.
Look at all, still don’t point a praise yao, it is said that point praise + collection === = learn