Why don't we use HTTP on email? → mail protocols are historically developed only for mail. This protocols provides features like mailbox management, delivery status, queuing forwarding that HTTP doesn't provide. Not only that, this mail protocols provides security features like SMTP over TLS, authentication which HTTP/HTTPS does not provide. Many of the features are available on HTTP, but those feature is for general web traffic not specifically curated for the email. But we do need HTTP is some cases of mail. For example - to load web mail interface we do need to use http.
DNS - automated client/server service. Automated because client do not have to manually do anything to do this. It automatically does it whenever we put an URL to the browser.
Client Request → DNS Resolver → Local DNS Server → Root Server → Top Level Server →Authoritative Server
.com
, .org
, .net
, and country code TLDs like .uk
, .jp
, etc. This servers are managed by ICANN..com
, .org
, .net
, and country-code TLDs (ccTLDs) like .us
, .fr
, .cn
. Each TLD has its own set of authoritative name servers that store the DNS records for that TLD. For example, the TLD zone for .com
will have the DNS records of all the second-level domains registered under .com
. After this level everything falls under authoritative zoneexample.com
, "example" is the second-level domain. The authoritative DNS servers for these domains store records such as A records (which map domain names to IP addresses), MX records (which specify mail servers for the domain), and other types of DNS records.sub.example.com
is a subdomain of example.com
. Each subdomain can have its own DNS records and even its own set of authoritative DNS servers if needed.
The hierarchy works in such a way that when a DNS query is made, it starts at the root zone and moves down the hierarchy until it reaches the authoritative server for the requested domain, resolving each level of the hierarchy step by step.Why DNS server had to be bulletproof→ Cause it has the power to shutdown the whole internet.
Performance: By caching DNS query results, local DNS servers can significantly reduce the time it takes to resolve frequently accessed domain names.
Reduced Traffic: Caching also reduces the number of queries that need to be sent to the broader DNS hierarchy, which decreases overall network traffic.
Control and Security: Organizations can configure local DNS servers to filter or block certain domains, enhancing security and enforcing usage policies. In summary, local DNS servers are essential for efficient and effective domain name resolution, providing faster responses and reducing the load on higher-level DNS servers.
Iterative Query:-
Iterated query VS recursive query → ইটারেটেডে সবকিছু মেইনটেইন করছে লোকাল সার্ভার, রিকারসিভে কে করছে?
How It Works:
In an iterative query, the DNS client (resolver) sends a query to a DNS server, which returns the best answer it can. If the DNS server does not have the answer, it responds with a referral to another DNS server that might know the answer. The client then queries the referred server, repeating this process until it gets an answer or an error.-
Process:
Client queries the local DNS server.
Local DNS server queries a root DNS server.
Root DNS server responds with a referral to a TLD server.
Local DNS server queries the TLD server.
TLD server responds with a referral to an authoritative DNS server.
Local DNS server queries the authoritative DNS server.
Authoritative DNS server provides the final answer.- Example: If a client asks the local DNS server for www.example.com
, the local DNS server will make successive queries to root, TLD, and authoritative servers, gathering information step-by-step.
How It Works:
In a recursive query, the DNS client (resolver) sends a query to a DNS server, which takes full responsibility for resolving the query. The DNS server will perform all the necessary steps (including iterative queries) to return the final answer to the client.-
Process:
Client queries the local DNS server.
Local DNS server takes over and performs all subsequent queries to other DNS servers on behalf of the client.
The local DNS server returns the final answer to the client once it resolves the query.- Example: If a client asks the local DNS server for www.example.com
, the local DNS server will contact root, TLD, and authoritative servers as needed, and then return the final IP address to the client.
**Complexity and Load:
**- Iterative Query: The client is responsible for querying multiple DNS servers. This can lead to more complex client implementation and increased client-side processing.- Recursive Query: The DNS server handles all the complexity and load of resolving the query, making it simpler for the client.
Performance:- Iterative Query: Can be slower due to multiple back-and-forth communications between the client and different DNS servers.- Recursive Query: Can be faster for the client since the server handles the entire resolution process, often with optimizations and caching.
Network Traffic:- Iterative Query: Generates more network traffic between the client and multiple DNS servers.- Recursive Query: Reduces client-side network traffic but increases the load on the recursive DNS server.
****Iterative Query:-
Advantages: - Reduces load on individual DNS servers. - Each DNS server only needs to provide referrals, not perform full resolution.-
Disadvantages: - More complex and time-consuming for the client. - Can result in higher latency due to multiple round-trip communications.
Recursive Query:-
Advantages: - Simpler and faster for the client. - Centralized caching at the recursive server can speed up future queries.-
Disadvantages: - Increases the load and complexity on the recursive DNS server. - Potential for single points of failure if the recursive server is overwhelmed.
### When to Use What Iterative Query:- Suitable for DNS servers within large networks where distributing the load and complexity is beneficial.- When the client or application is designed to handle the complexity of multiple queries. Recursive Query:- Ideal for end-user devices and simple clients where ease of use and speed are priorities.- When centralized caching and optimization by the recursive server can significantly improve performance. In most everyday internet use cases, recursive queries are preferred because they simplify the resolution process for the client and take advantage of caching mechanisms to improve speed. Iterative queries are more common in specialized network configurations or when developing DNS infrastructure.
Dns caching → Once a server learns mapping, it caches it for some time (TTL). If host name changes its ip, may not be known internet wide until ttl expried.
Dns record →