Major components of Email

  1. User Agent → Software program that is used for composing, editing and forwarding mail. Ex- Outlook, web browser etc.
  2. Mail server -
    1. Contains incoming message for user.
    2. Message queue of outgoing mail message.
  3. Transfer protocol → why does it only mentioned SMTP on the slide? cause SMTP only push email to the server does not fetch it, we need pop or imap for it.
    1. Why does we need SMTP? And why we need POP3 and IMAP also? → Answer
    2. user agent will compose the mail and give it a mail address.
    3. How to send a mail? -
      1. This mail will go to the senders server. (SMTP + TCP)
      2. Sender's server will send the mail to receivers server. (SMTP + TCP)
      3. Sender's mail server will place the mail to sender's inbox.
      4. Sender will invoke his user agent to read message.
  4. IMAP vs POP -

Untitled

  1. SMTP - persistent connection, requires header and body to be in 7bits. It uses CRLF to determine end of the message. Multiple object sent in multipart object, uses RFC822. Message body has only ASCII characters. It delivers or stores the mail to the mail server.
  2. HTTP vs SMTP

Untitled

  1. 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.

  2. 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.

  3. Client Request → DNS Resolver → Local DNS Server → Root Server → Top Level Server →Authoritative Server

    1. Why DNS is physically decentralized? → of it was centralized then there would have been several issues like single point failure, huge traffic volume, does not scale up and hard to do maintenance. Here is the explanation of the hierarchy of DNS (Domain Name System) servers and how they store data:
    2. Root Zone: This is the top-most level of the DNS hierarchy. The root zone contains information about the root name servers, which are the authoritative servers for the root zone. There are 13 root name server organizations, and these servers are responsible for directing queries to the appropriate top-level domain (TLD) name servers. The root zone file includes pointers to the TLDs like .com, .org, .net, and country code TLDs like .uk, .jp, etc. This servers are managed by ICANN.
    3. Top-Level Domain (TLD) Zone: These are the first-level domains beneath the root zone. TLDs are divided into generic TLDs (gTLDs) like .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 zone
    4. Second-Level Domain Zone: This level is directly below the TLDs and usually represents domain names registered by individuals or organizations. For example, in example.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.
    5. Subdomains and Lower-Level Domains: Domains can be further divided into subdomains. For example, 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.
  4. Why DNS server had to be bulletproof→ Cause it has the power to shutdown the whole internet.

    1. Local DNS → A local DNS server, often referred to as a resolver, plays a crucial role in the Domain Name System (DNS) by acting as an intermediary between client devices and the broader DNS hierarchy. Here’s what it does:
    2. Query Handling: When a client device (like your computer or smartphone) needs to resolve a domain name into an IP address, it sends a DNS query to the local DNS server. This server is typically provided by your Internet Service Provider (ISP) or can be a public DNS server like Google DNS or Cloudflare DNS.
    3. Caching: The local DNS server maintains a cache of previously resolved queries. If the requested domain name is found in its cache, it can immediately return the IP address without needing to query other servers. This speeds up the resolution process and reduces network traffic.
    4. Recursive Resolution: If the domain name is not found in the cache, the local DNS server acts as a recursive resolver. It will query the root servers, then the appropriate top-level domain (TLD) servers, and finally the authoritative servers for the domain in question, collecting and caching the information as it goes.
    5. Forwarding: In some configurations, local DNS servers can forward queries to other DNS servers, such as upstream resolvers or centralized DNS servers managed by an organization.
    6. Load Distribution and Redundancy: By distributing the load among multiple local DNS servers, organizations and ISPs can ensure redundancy and improve the reliability of DNS resolution.

    Benefits of Local DNS Servers

    ### Iterative Query vs. Recursive Query in DNS

    Iterative Query:-

  5. 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:

    1. Client queries the local DNS server.

    2. Local DNS server queries a root DNS server.

    3. Root DNS server responds with a referral to a TLD server.

    4. Local DNS server queries the TLD server.

    5. TLD server responds with a referral to an authoritative DNS server.

    6. Local DNS server queries the authoritative DNS server.

    7. 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.

    Recursive Query:-

    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:

    1. Client queries the local DNS server.

    2. Local DNS server takes over and performs all subsequent queries to other DNS servers on behalf of the client.

    3. 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.

    ### Differences

    **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.

    Advantages and Disadvantages

    ****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.

  6. 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.

  7. Dns record

Untitled

Untitled

  1. DNS Flood using DOS and DDOS

Untitled