Computer Networks: Application and Transport Layers

Domain Name System (DNS)

  • Function & Purpose: Maps human-readable hostnames (e.g., cs.umass.edu) to 32-bit IPv4 or 128-bit IPv6 addresses used by network routers.
  • Architecture: Distributed, hierarchical database comprising:
    • Root DNS Servers: 13 logical root servers managed by ICANN, replicated worldwide (~200 in the US).
    • Top-Level Domain (TLD) Servers: Handle .com, .org, .edu, and country-code domains (.cn, .uk). Maintained by registrars like Network Solutions (.com, .net) or Educause (.edu).
    • Authoritative DNS Servers: Host-to-IP mappings for an organization's specific named hosts.
    • Local DNS Name Servers (Default Name Servers): Provided by ISPs or institutions; serve cached answers or act as proxies into the DNS hierarchy.

DNS Zones and Subdomains

  • DNS Zones vs Domains: A domain represents an entire naming subtree, while a zone is an administrative boundary grouping contiguous domains and subdomains for management delegation.
  • Query Types:
    • Iterated Query: Contacted server returns a referral to the next server ("I don't know, ask this server"); the requesting host performs the path traversal.
    • Recursive Query: Contacted server assumes the burden of fully resolving the address on the client's behalf.
  • Caching & TTL: Learnings are cached with a Time To Live (TTL) expiration to optimize performance. Update notifications follow IETF standard RFC 2136.
  • DNS Records (Name, Value, Type, TTL):
    • Type A: Hostname →\rightarrow IPv4 address.
    • Type AAAA: Hostname →\rightarrow IPv6 address.
    • Type NS: Domain →\rightarrow authoritative name server hostname.
    • Type CNAME: Alias hostname →\rightarrow canonical (real) hostname.
    • Type MX: Domain →\rightarrow mail server canonical name (with priority).
    • Type TXT: Free-text data used for domain verification, SPF, and DKIM anti-spam policies.
    • Type SOA: Start of Authority information for a zone.
  • DNS Message Format: Includes a 16-bit Identification, 16-bit Flags (Query/Reply, Authoritative, Recursion Desired, Recursion Available), Question count, Answer RRs, Authority RRs, and Additional RRs.
  • DNSSEC: Adds digital signatures (RRSIG) to provide authentication and message integrity chained from Root →\rightarrow TLD →\rightarrow Authoritative, preventing cache poisoning.

Peer-to-Peer (P2P) Architecture

  • Concept: Direct communication between arbitrary end-systems (peers) without reliance on centralized servers.
  • Key Characteristics:
    • Self-Scalability: New peers bring new service demands as well as additional serving capacity.
    • Intermittent Connectivity: Peers join, leave, and change IP addresses dynamically.
    • Examples: BitTorrent (file sharing), Skype (VoIP), Spotify (streaming), Blockchain/cryptocurrencies.

Application Layer Protocols & Port Summary

  • File Transfer Protocol (FTP): Uses TCP port 21 for control commands and TCP port 20 for data transmission.
  • Simple Mail Transfer Protocol (SMTP): Uses TCP port 25 for pushing emails between mail servers, secured via SSL.
  • Dynamic Host Configuration Protocol (DHCP): UDP protocol for dynamic IP allocation. Uses UDP port 67 for servers and UDP port 68 for clients. Functions via the DORA process (Discovery, Offer, Request, ACK).
  • Simple Network Management Protocol (SNMP): Exforces management queries via UDP ports 161/162 between SNMP Managers, Managed Devices, SNMP Agents, and the Management Information Base (MIB).
  • Remote Login Protocols: Telnet operates over TCP port 23 in unencrypted plaintext; Secure Shell (SSH) provides encrypted terminal access over TCP port 22.
  • Network Time Protocol (NTP): Uses UDP port 123 for time synchronization.
  • Lightweight Directory Authentication Protocol (LDAP): Operates on TCP/UDP port 389.
  • Web Protocols: HTTP uses TCP port 80; HTTPS uses TCP port 443.

Application Layer Protocols Summary Table

Transport Layer Multiplexing and Demultiplexing

  • Multiplexing (Sender): Gathering data from multiple application sockets, encapsulating data with transport header fields, and passing segments to the network layer.
  • Demultiplexing (Receiver): Using transport header fields to deliver incoming segments to the appropriate application socket.
  • Connectionless Demultiplexing (UDP): Identified solely by the destination port number (00 to 6553565535; well-known ports are 00 to 10231023). All datagrams bound for the same destination port are routed to the same socket regardless of source IP/port.
  • Connection-Oriented Demultiplexing (TCP): Identified by a unique 4-tuple:   (Source IP, Source Port, Destination IP, Destination Port)\text{(Source IP, Source Port, Destination IP, Destination Port)}   Receiving hosts route segments to distinct sockets based on all four fields.

TCP Welcoming and Connection Sockets

User Datagram Protocol (UDP) & Checksum Calculation

  • Protocol Characteristics (RFC 768): "No-frills," connectionless transport over IP providing lightweight, best-effort, out-of-order delivery without handshaking, congestion control, or flow control.
  • Header Structure: Fixed 8-byte overhead containing four 16-bit fields:
    1. Source Port
    2. Destination Port
    3. Segment Length (header plus data in bytes)
    4. Checksum

UDP Header Format RFC 768

  • Checksum Calculation Steps:
    1. Treat the entire segment (header, payload, pseudo-header) as a sequence of 16-bit binary integers.
    2. Compute the 1's complement sum of these 16-bit words.
    3. Add any wraparound carry-outs from the most significant bit back to the least significant bit.
    4. Invert all bits (take the 1's complement) to obtain the final checksum.
    5. Receiver Verification: Sum all received words including the checksum. If all bits are 1, no errors were detected; otherwise, an error occurred.
  • Error Detection Limits: Catches all single-bit flips and burst errors under 16 bits; fails to detect multi-bit errors across different words that cancel each other out in the sum.

Reliable Data Transfer (RDT) Principles

  • RDT Protocol Progression:
    • RDT 1.0: Assumes a perfectly reliable underlying channel.
    • RDT 2.0: Handles bit errors using Checksums, Positive ACKs, and Negative ACKs (NAKs).
    • RDT 2.1: Adds 1-bit sequence numbers (00, 11) to detect and handle duplicate packets resulting from corrupted ACKs/NAKs.
    • RDT 2.2: NAK-free design utilizing duplicate ACKs to signal packet loss or corruption.
    • RDT 3.0 (Alternating-Bit Protocol): Handles both bit errors and packet loss using countdown timers and retransmission on timeout.
  • Stop-and-Wait vs Pipelining:
    • Stop-and-Wait Utilization: Sender is idle during round-trip transmission:     Usender=L/RRTT+L/RU_{\text{sender}} = \frac{L/R}{\text{RTT} + L/R}
    • Pipelining: Allows multiple in-flight, unacknowledged packets to dramatically scale link utilization.

Stop-and-Wait vs Pipelined Protocol

  • Pipelined Protocol Mechanisms:
    • Go-Back-N (GBN): Uses cumulative ACKs (ACK(n) acknowledges all bytes up to nn) and a single timer for the oldest unACKed packet. On timeout, retransmits packet nn and all subsequent packets in the current window. Receiver discards out-of-order packets.
    • Selective Repeat (SR): Individually acknowledges all correctly received packets and uses per-packet timers. Receiver buffers out-of-order packets. Requires window size N≤12Sequence Number SpaceN \le \frac{1}{2} \text{Sequence Number Space} to prevent duplicate sequence number confusion.

Transmission Control Protocol (TCP) Architecture

  • Key Properties: Point-to-point, reliable in-order byte-stream transport using full-duplex communication with Maximum Segment Size (MSS), flow control, and congestion control.
  • RTT Estimation & Timeout Formulas:
    • Exponential Weighted Moving Average (EWMA) of Sample RTT (typical α=0.125\alpha = 0.125):     EstimatedRTT=(1−α)×EstimatedRTT+α×SampleRTT\text{EstimatedRTT} = (1 - \alpha) \times \text{EstimatedRTT} + \alpha \times \text{SampleRTT}
    • RTT Deviation estimation (typical β=0.25\beta = 0.25):     DevRTT=(1−β)×DevRTT+β×∣SampleRTT−EstimatedRTT∣\text{DevRTT} = (1 - \beta) \times \text{DevRTT} + \beta \times |\text{SampleRTT} - \text{EstimatedRTT}|
    • Dynamic Timeout Interval calculation:     TimeoutInterval=EstimatedRTT+4×DevRTT\text{TimeoutInterval} = \text{EstimatedRTT} + 4 \times \text{DevRTT}
  • TCP Fast Retransmit: If the sender receives 3 duplicate ACKs (4 identical ACKs total), it retransmits the missing segment immediately without waiting for the timer to expire.
  • Flow Control: Prevents sender from overflowing receiver buffers via advertised Receive Window (rwndrwnd):   LastByteRcvd−LastByteRead≤RcvBuffer\text{LastByteRcvd} - \text{LastByteRead} \le \text{RcvBuffer}rwnd=RcvBuffer−(LastByteRcvd−LastByteRead)rwnd = \text{RcvBuffer} - (\text{LastByteRcvd} - \text{LastByteRead})
  • TCP Connection Handshake (3-Way):
    1. Client sends SYN=1, Seq=x (State: SYN_SENT).
    2. Server responds with SYN=1, ACK=1, Seq=y, AckNum=x+1 (State: SYN_RCVD).
    3. Client sends ACK=1, AckNum=y+1 (State: ESTABLISHED).
  • TCP Connection Teardown:
    1. Host sends FIN=1, Seq=x (State: FIN_WAIT_1).
    2. Peer returns ACK=1, AckNum=x+1 (State: CLOSE_WAIT).
    3. Peer sends FIN=1, Seq=y (State: LAST_ACK).
    4. Host sends ACK=1, AckNum=y+1 and enters TIME_WAIT (waits 2×Max Segment Lifetime2 \times \text{Max Segment Lifetime}) before closing.