Open In App

Address Resolution in DNS (Domain Name Server)

Last Updated : 11 Dec, 2024
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report

Address resolution in DNS is the process of converting a human-readable domain name, such as "www.example.com", into an IP address that computers can understand and use. When you enter a website's address in your browser, the DNS system helps find the corresponding IP address of that website. Think of it like looking up a phone number in a contact list: the domain name is the name, and the IP address is the number. This process is crucial for connecting your computer to the correct server, allowing websites to load properly.

Without DNS and address resolution, we'd have to remember complex IP addresses instead of easily memorable domain names

What is DNS?

Before we learn address resolution, it’s important to understand what DNS is. The Domain Name System is a decentralized system that translates human-readable domain names (like www.geeksforgeeks.org) into machine-readable IP addresses (like 192.0.2.1). This enables users to access websites and services without needing to memorize complex numerical addresses.

Key Components of DNS:

  • Domain Names: Human-readable addresses (e.g., www.google.com).
  • IP Addresses: Numeric addresses used by computers to identify each other (e.g., 172.217.3.110).
  • DNS Records: Structured data that provides information about the domain name, such as IP address mappings

The Role of DNS Resolver in Address Resolution

DNS operates as a client-server application. A host that needs to map a domain name to an IP address (or vice versa) calls a DNS client called a resolver. The resolver accesses the nearest DNS server with a mapping request. Here's how the process works:

Step 1: The resolver sends a query to the nearest DNS server.
Step 2: If the server has the required information, it returns the result. If not, it refers the resolver to other DNS servers.
Step 3: The resolver checks if the response is correct and delivers it to the requesting application or user.

How Does Address Resolution Work in DNS?

Address resolution in DNS can be broken down into the following categories:

A) Mapping Domain Names to IP Addresses

When a user types a domain name into their browser, the DNS system queries various DNS servers to find the corresponding IP address. The resolver checks different domain sections (e.g., generic or country domains) to determine the correct IP address for the given domain name.

B) Mapping IP Addresses to Domain Names

A client can send an IP address to a server to be mapped to a domain name. This is called a PTR query. To answer queries of this kind, DNS uses the inverse domain. However, in the request, the IP address is reversed and two labels, in-addr and arpa are appended to create a domain acceptable by the inverse domain section.

For example. if the resolver receives the IP address 132.34.45.121, the resolver first inverts the address and then adds the two labels before sending. the domain name sent is "121.45.34.132.in-addr.arpa", which is received by the local DNS and resolved.

To find a particular DNS requesting host place its query to the Local DNS Server with a mapping request. If it has the information, the resolver is satisfied else the resolver is referred to other servers or other servers are asked to provide the information. After the resolver, gets the response, it checks whether the response is correct or not. If the response is correct, the response is passed to the process that requested it, or else the name query fails. 

Types of DNS Resolution: Recursive vs. Iterative

A resolution can be of two types – iterative and recursive

1. Recursive Resolution

Here, the client requires the Local Server to give either the requested mapping or an error message. A DNS Query is generated by the application program to the resolver to fetch the destination IP Address. The Query is then forward to the local DNS Server. If it knows the IP Address, it sends a response to the resolver. Assuming, it does not know the IP Address, it sends the query to the root name server. 

The client (resolver) can ask for a recursive answer from a name server. This means that the resolver expects the server to supply the final answer. If the server is the authority for the domain name, it checks its database and responds. If the server is not the authority, it sends the request to another server (the parent usually) and waits for the response. If the parent is the authority, it responds. Otherwise it sends the query to yet another server. When the query is finally resolved, the response travels back until it finally reaches the requesting client.

The root name server contains information about at least one server of Top Level Domain. The query is then sent to the respective Top-Level Domain server. If it contains the mapping, the response is sent back to the root server and then to the host’s local server. If it doesn’t contain the mapping, it should contain the IP Address of the destination’s local DNS Server. The local DNS server knows the destination host’s IP Address. The information is then sent back to the top-level domain server, then to the root server and then to the host’s Local DNS Server, and finally to the host.  

Recursive and Iterative Resolution

2. Iterative Resolution

The main difference between iterative and recursive resolution is that here each server that does not know the mapping sends the IP Address of the next server to the one requested it. Here, the client allows the server to return the best answer it can give as a match or as a referral. A DNS Query is generated by the application program to the resolver to fetch the destination IP Address. The Query is then forward to the local DNS Server. Assuming, it does not know the IP Address, it sends the query to the root name server. 

The root name server returns the IP Address of the Top-Level Domain Server to the Local Server. The Top-Level Domain server is contacted by the Local Server and it returns either the IP of the destination host or its local DNS Server. If it returns the server’s address, then by contacting the destination’s Local DNS Server, we get the IP Address of the destination host. The response/mapping is then passed from the host’s local DNS server to the resolver and then finally to the host. 

If the client does not ask for a recursive answer, the mapping can be done iteratively. If the server is an authority for the name, it sends the answer. If it is not, it returns (to the client) the IP address of the server that it thinks can resolve the query. The client is responsible for repeating the query to this second server. If the newly addressed server can resolve the problem, it answers the query with the IP address. Otherwise it returns the IP address of a new server to the client. Now the client must repeat the query to the third server. This process is called iterative because the client repeats the same query to multiple servers.

Caching Mechanism in DNS Resolution

In both iterative and recursive resolution, after a server asks for a mapping request from another server, it receives the response and stores this information in the Cache memory before sending it to the client. This is done to lower the search time it takes for a server to check the IP Address in its Database. So, the next time if a request comes to the server, it first checks its cache memory and tries to resolve the request. The response is marked as Unauthoritative to inform the client that the response is from Cache. The only way caching can be problematic is when the server caches the mapping for a long time and the mapping gets outdated. However, there are techniques to resolve this like using TTL.

Each time a server receives a query for a name that is not in its domain, it needs to search its database for a server IP address . Reduction if this search time would increase efficiency. DNS handles this with a mechanism called caching. when a server asks for a mapping from another server and receives the response it stores this information in its cache memory before sending it to the client. Caching speeds up resolution, but it can also be problematic. The cache memory must be searched periodically and those mappings with an expired TTL must be purged. If a server caches a mapping for a long time, it may send an outdated mapping to the client.

Comparison of Iterative and Recursive Resolution

PropertyIterative Resolution Recursive Resolution
Server Response Returns the best match or a referral Returns the requested mapping or an error message
Query Propagation Each server that does not know the mapping sends the IP address of the next server Only the local server sends the query to the next server
Server Load Higher load on servers since each server in the chain must be queried Lower load on servers since only the local server is queried
Response Time Longer response time since multiple servers may need to be queried Shorter response time since only one or a few servers are queried
Cache Usage Lower cache hit rate since referrals are returned instead of mappings Higher cache hit rate since mappings are returned directly
Security Lower security since each server in the chain may potentially modify the response.Higher security since only the local server is trusted to return a valid response.

Address Resolution Failures and Troubleshooting

Address resolution can occasionally fail due to various issues, such as:

  • DNS Server Unavailability: If the DNS resolver or authoritative server is down, the user may not be able to resolve the domain name.
  • DNS Cache Poisoning: Malicious actors may attempt to inject false DNS records into a cache, leading to misdirection to malicious websites.
  • Incorrect DNS Configuration: Misconfigured DNS records can result in incorrect resolution, making a website or service unreachable.

Common Troubleshooting Steps:

  • Clear DNS Cache: Clearing local DNS caches on the device or DNS resolver can resolve stale or corrupted records.
  • Use a Different DNS Resolver: Switching to a public DNS resolver, such as Google DNS or Cloudflare DNS, can often bypass issues with the ISP's DNS servers.
  • Check DNS Records: Ensure that the DNS records for the domain are correctly configured and propagated

Conclusion

The process of address resolution in DNS plays a very important role in making the internet user friendly by making it possible to translate domain names into IP addresses. Therefore, accessing websites becomes easy with much less hard work because of not having to remember difficult numerical addresses. Through acting like an internet directory, DNS ensures that our browsers can quickly find the right website and load it properly. Whenever a website address is searched, know that DNS is quietly at work to ensure that the right destination comes to you with smoothness and effectiveness.


Next Article

Similar Reads