Domain Name Resolution: The “Telephone Directory” of the Internet”
When we enter a website address in the address bar of a browser, for example… www.example.comAnd after pressing Enter, a complex process of network addressing is initiated in an instant. The process of converting human-readable domain names into machine-readable IP addresses is known as domain name resolution. It is the cornerstone of the smooth operation of the internet, and its importance is comparable to that of the telephone number lookup systems in the real world.
This process involves multiple layers of servers and complex query steps, which together form a globally distributed database known as the Domain Name System (DNS). Understanding this process not only helps us troubleshoot network issues but also provides a deeper insight into the underlying architecture of the Internet.
The core steps and involved parties in domain name resolution
Domain name resolution is not performed by a single server, but rather through a hierarchical, recursive query chain. The process primarily involves the following key components: the local DNS cache, the recursive resolver, the root domain name server, the top-level domain name servers, and the authoritative domain name servers.
Recommended Reading Domain Name Resolution: A Detailed Explanation of the Entire Process from Registration to Activation。
Step 1: Check the local cache
After receiving the instruction, the browser does not immediately send a query request. Instead, it first checks its own cache to see if the IP address corresponding to that domain name is already stored there. If the user has visited the website recently, this information is likely still available in the cache, which allows for a “zero-delay” access to the website.
If the browser cache does not provide the required information, the operating system will step in and check its local Hosts file as well as the system’s DNS resolver cache. The Hosts file is a local text file that allows you to manually map domain names to IP addresses, and it has the highest priority. The system cache, on the other hand, stores the results of previous DNS lookups.
Step 2: Initiate a query with the recursive parser.
When there are no local records available, the system sends a query request to a pre-configured recursive resolver. This recursive resolver is typically provided by your internet service provider or a public DNS (Domain Name System) service provider. Its role is to act on behalf of the client, carry out the entire query process, and return the final results to the client.
The recursive parser also has its own cache. If another user has just queried the same domain name, the parser may directly return the result from the cache, which significantly improves the efficiency of the query and the overall performance of the network.
Step 3: The journey through the layers of iterative queries
If the cache of the recursive parser also becomes invalid, the actual global query begins. This is an iterative query process:
1. Querying the root domain name servers: There are only 13 sets of root server addresses worldwide. The recursive resolver first sends a query to one of these servers to ask for information.“.com”Who should I contact to manage this domain? The root server won’t provide the final answer, but it will indicate which entity is responsible for the management.”.comThe address of the top-level domain name server for the top-level domain.
2. Querying the top-level domain name servers: The recursive resolver then proceeds to….comTLD server query for “example.com”Who should I contact? The TLD server will provide information about the responsible party.”example.comThe address of the authoritative domain name server for this domain.
3. Querying authoritative domain name servers: Finally, the recursive resolver contacts the authoritative domain name servers for further resolution of the domain name.example.comAuthoritative server query for…“www.example.com”The IP address of the domain name in question. The authoritative server has the final authority to resolve the domain name and will return the corresponding IP address to the recursive resolver.
Recommended Reading Comprehensive Domain Name Analysis: A Complete Guide from Selection, Resolution to Management。
Step 4: Return the results and establish the connection.
After the recursive parser obtains the final IP address, it first stores it in its own cache and sets a validity period for that address. Subsequently, the parser returns the IP address to the client’s operating system, which then passes it on to the browser.
At this point, the domain name resolution is complete. The browser has obtained the actual IP address of the target server. It can then use the TCP/IP protocol to send HTTP/HTTPS requests, establish a connection with the server, and begin transmitting web page data, ultimately completing the rendering of the entire page.
Resolution of key DNS record types
The DNS system not only stores the mapping between domain names and IP addresses but also manages various network services using different types of records. Understanding these record types is crucial for managing domain names effectively.
Record A: The most basic type of record, which directly maps a domain name to an IPv4 address. For example, www.example.com Pointer 93.184.216.34。
AAAA record: Similar to the A record, but it points to an IPv6 address, in order to accommodate the new generation of internet protocols.
CNAME record: Also known as an alias record. It allows you to map one domain name to another domain name, rather than to an IP address. For example, you can… blog.example.com Set it to example.github.io You can set a CNAME record for your domain so that when users visit your website, they will be redirected to the correct server.blog.example.comWhen queried, the parser will perform another search.example.github.ioThe IP address provides flexibility for service migration and CDN integration.
Recommended Reading Mastering Domain Name Resolution and Configuration: A Comprehensive Guide from Beginner to Expert。
MX Record: A mail exchange record that specifies the address of the mail server responsible for receiving emails for a particular domain name. When sending an email, the sender's server uses the MX record of the domain name to determine the destination for the email delivery.
TXT record: A text-based record commonly used for verifying domain name ownership and implementing email security policies, such as SPF, DKIM, and DMARC, which are all configured through TXT records.
NS Record: Specifies which authoritative DNS server is responsible for providing resolution services for that domain name. This is crucial for the hierarchical delegation of DNS responsibilities.
Performance Optimization and Security Considerations
Modern DNS resolution not only aims for accuracy but also for speed and security.
DNS Caching: As mentioned earlier, caching at all levels is a key mechanism for improving the speed of DNS resolution. The TTL (Time To Live) value determines how long a record remains in the cache. Setting the TTL appropriately allows for a balance between the flexibility to make changes and the performance of DNS queries.
Public DNS Services: Using public resolution services such as Cloudflare DNS or Google DNS typically provides faster speeds and better privacy protection compared to the default resolvers provided by your internet service provider (ISP).
DNS Load Balancing: By configuring multiple A records for a domain name, DNS resolution can return different IP addresses in a round-robin manner, distributing traffic across multiple servers. This achieves simple load balancing and failover capabilities.
DNS Security Extensions (DNSSEC): Traditional DNS queries are based on the UDP protocol and are transmitted in plaintext without any authentication, making them vulnerable to hijacking and spoofing. DNSSEC adds digital signatures to DNS data to verify its authenticity and integrity, effectively preventing attacks such as cache poisoning.
Emerging protocols: Such as HTTPS-based DNS and TLS-based DNS, which encrypt DNS query traffic. This prevents network intermediaries from eavesdropping on or tampering with users' domain name query requests, significantly enhancing user privacy.
summarize
Domain name resolution is a sophisticated system that converts human-readable domain names into computer-readable IP addresses. It relies on a layered, distributed, and caching approach to support every internet access request around the world efficiently and reliably. The process begins with local cache queries, progresses through recursive resolvers, root servers, and top-level domain servers, and ultimately reaches authoritative servers, reflecting the elegance and robustness of the internet’s design. Understanding the different types of DNS records, optimizing resolution performance, and paying attention to security and scalability are essential for developers, operations personnel, and even ordinary users. It is one of the fundamental skills needed to navigate the digital world.
FAQ Frequently Asked Questions
How long does it take to take effect after modifying DNS records?
After modifying a DNS record, it takes some time for the changes to take effect globally; this process is known as the “propagation time.” The speed at which the changes are applied depends primarily on the TTL (Time To Live) value set for that record. Until the TTL expires, the old record will continue to be stored in caches at various levels around the world. Typically, it takes several hours to up to 48 hours for the changes to become fully effective.
What is DNS hijacking? How to prevent it?
DNS hijacking refers to the act of attackers altering DNS resolution results, directing users to malicious websites. Preventive measures include: using trusted public DNS services; checking whether network devices have been maliciously modified in their DNS settings; utilizing encrypted DNS protocols such as DNSSEC or DoH/DoT in critical scenarios; and regularly verifying whether domain name resolution results are abnormal.
What are the common reasons for domain name resolution failures?
Domain name resolution failures can be caused by various reasons: issues with the local network connection; failures or unavailability of the configured DNS servers; incorrect record configurations for the domain name itself, or the domain name not being set up at all; the domain name having expired or being locked by the registration authority; local firewalls or security software blocking DNS query requests; and, in rare cases, failures of the root servers or top-level domain servers.
What is the main difference between a CNAME record and an A record?
An A record directly maps a domain name to a fixed IP address, representing the final point of resolution. A CNAME record, on the other hand, uses a domain name as an alias for another domain name; when resolving a request, the system will continue to look up the IP address of the actual domain name that the alias points to. A domain name cannot have both a CNAME record and other types of records set at the same time. CNAME records are more flexible and easier to manage, but they may cause a slight delay due to the additional lookup step.
What are the benefits and potential issues of using public DNS?
The main benefits of using a public DNS service are: generally faster and more stable resolution times; better privacy protection; and the ability to block malicious websites and advertisements. Potential issues include: the inability to take advantage of the operator’s local CDN (Content Delivery Network) optimizations; and in extreme cases, a failure of the public DNS service can affect all users who rely on it; additionally, users may need to manually configure their network settings.
What's next, what's next?
Extended reading and practical knowledge
The following are related to the topic of this article and are suitable for further in-depth reading. Prioritize starting with the article that is closest to your current problem, and gradually expanding to surrounding topics usually works better.
- Starting from scratch: A step-by-step guide on how to efficiently apply for and configure a personal website domain name
- What is a domain name? A comprehensive guide for beginners to experts, from registration to resolution.
- A detailed explanation of the entire domain name resolution process: from entering a website address to the behind-the-scenes journey of loading the web page
- What is a domain name? A comprehensive explanation of its definition, types, and common questions.
- Domain Name Resolution and DNS Configuration: A Comprehensive Guide from Beginner to Expert