转自ByteByteGo
The diagram below illustrates how DNS lookup works under the hood:
-
google.com is typed into the browser, and the browser sends the domain name to the DNS resolver.
-
The resolver queries a DNS root name server.
-
The root server responds to the resolver with the address of a TLD DNS server. In this case, it is .com.
-
The resolver then makes a request to the .com TLD.
-
The TLD server responds with the IP address of the domain’s name server, google.com (authoritative name server).
-
The DNS resolver sends a query to the domain’s nameserver.
-
The IP address for google.com is then returned to the resolver from the nameserver.
-
The DNS resolver responds to the web browser with the IP address (142.251.46.238) of the domain requested initially.