How DNS Works?
DNS (Domain Name System) is a distributed system that translates human-readable domain names into IP addresses, allowing computers to communicate with each other over the Internet.
When a user enters a domain name into their web browser, a request is sent to a DNS resolver, which is usually provided by the user’s Internet Service Provider (ISP). The resolver then searches its cache and configuration to see if it has a previous mapping for the domain name. If it doesn’t, it sends a query to a root DNS server.
The root DNS server responds with a referral to one of the top-level domain (TLD) servers, such as .com or .org, based on the TLD of the domain name. The resolver then sends a query to the appropriate TLD server, which responds with a referral to a authoritative DNS server for the domain.
The authoritative DNS server for the domain has a database of the IP addresses associated with the domain and its subdomains. The resolver sends a query to the authoritative DNS server and receives a response with the IP address for the domain name.
The resolver caches the mapping for a certain time period, called the Time-To-Live (TTL), to avoid sending a query for the same domain name repeatedly. Subsequent requests for the same domain name can then be quickly served from the resolver’s cache.
DNS is a critical component of the Internet’s infrastructure and plays a crucial role in allowing users to access websites and other resources by using human-readable domain names instead of IP addresses.
Where does the resolver cache the mapping?
The DNS resolver caches the mapping between a domain name and its corresponding IP address on the local machine, typically in the memory of the machine. The resolver uses this cache to store the results of previous DNS queries, so that it can respond more quickly to subsequent requests for the same domain name.
This caching helps to reduce the number of queries that need to be sent to the root and TLD servers, and to the authoritative DNS servers, which in turn helps to improve the performance of the overall DNS system.
It’s worth noting that different resolvers may have different policies for how they cache mappings and for how long they keep them in the cache. Some resolvers may keep mappings in the cache for a few minutes, while others may keep them for several hours or even days. The Time-To-Live (TTL) value for each mapping, which is specified by the authoritative DNS server, determines how long the mapping should be cached by the resolver.
Need of Dynamic DNS ?
Dynamic DNS (DDNS) is a technology that allows users to associate a hostname (e.g. myhost.example.com) with a dynamic IP address. A dynamic IP address is an IP address that can change over time, whereas a static IP address remains the same.
Since domain names are associated with static IP addresses, it can be difficult to use a domain name to refer to a device that has a dynamic IP address. DDNS solves this problem by automatically updating the DNS server with the device’s current IP address, so that the hostname always points to the correct IP address.
DDNS services work by running a client program on the device with the dynamic IP address. The client program periodically checks the device’s IP address and updates the DDNS server with the new IP address whenever it changes.
This allows users to access their device using a hostname even if the device’s IP address changes, making it convenient for running services such as remote access, VPNs, web hosting, email, and more.