TCP/IP Application Layer

Dynamic Host Configuration Protocol (DHCP)

Definition

  • Automatically assign IP addresses and other network configuration parameters to devices or clients on a network.
  • This includes:
    • IP address
    • Subnet masks
    • Default gateways
    • DNS server addresses
    • Lease duration
  • Without DHCP, every device would need to be manually configured, which is:
    • Error-prone
    • Inefficient
    • Unscalable

How it Works

DORA
  • **Discover **– Client sends a broadcast to find available DHCP servers
  • **Offer **– DHCP server replies with an offer including an IP address and configuration
  • **Request **– Client requests to use the offered IP address
  • **Acknowledge **– Server confirms and leases the IP address to the client
Setup
  • Uses UDP for sending a broadcast to find available DHCP servers
  • Client device does not have an IP address – cannot use TCP
  • Light-weight, minimal overhead
  • Connectionless – no handshakes, no session setup

IP Address Allocation

Static IP address
  • Manual Configuration
  • Device manually configured with its IP address, subnet mask, etc.
  • DHCP server not involved, thus no DHCP request is sent
  • DHCP reservation by using the MAC address of the device, always allocated the same IP address from the DHCP pool
  • A DHCP request is required to obtain the IP address
Dynamic IP address
  • DHCP server leases a dynamic IP address (reusable) to the client for a period of time

Domain Name System (DNS)

Definition

  • Translates domain names (www.google.com) into IP address (used for routing)

Steps

  1. User passes host name to file transfer client (FTC)
  2. FTC passes the host name to the DNS client
  3. DNS client sends a message to the DNS server with a query containing the FT server name, using the IP address of the DNS server
  4. DNS server responds with IP address of the FT server
  5. DNS client passes the IP address to the FT client
  6. FT client uses IP address to access the FT server

System Hierarchy

Name-Address Resolution

Local Cache (on Host / DNS Client)
  • The client (resolver) checks its own cache
  • If IP address is found, client uses the IP address to route the message in the network
Query Local DNS server (ISP’s DNS resolver)
  • If not found locally, the client sends the query to the DNS server specified in IP config
  • The server checks its own cache
Query the Global DNS Hierarchy (if not cached)
  • Recursive Resolution – ISP DNS resolver will resolve the name
    • Root DNS Server → Direct to the Top-Level Domain (TLD) server
    • TLD Server → Direct to the Authoritative DNS Server for the domain
    • Authoritative DNS Server → Returns the actual IP address
  • Iterative resolution → Client resolver performs queries step by step
    • Root DNS Servers → Returns address of a TLD server
    • TLD Server → Returns the address of authoritative DNS server
    • Authoritative DNS Server → Returns the actual IP address

Hyper Text Transfer Protocol (HTTP)

Definition

  • Hypertext Transfer Protocol (HTTP)
  • Allows clients to fetch hypertext documents, images, scripts etc from the web server
  • Uses Port 80 (HTTP), 443 (HTTPS)
  • Uses client-server model:
    • Client sends a HTTP request
    • Server responds with a HTTP response
  • Stateless – Server does not keep information about the client
  • Each request-response pair is independent
Request

Request line – GET /test.html HTTP/1.1

  • HTTP command/method that the client wants to perform - GET
  • Path of the relevant document - test.html
  • Version of the HTTP used by the client - HTTP/1.1
  • Header fields – provide additional information to the web server – Host: example.com
  • Message body (optional) for POST requests, containing the data submitted
Response

Status line - HTTP/1.1 200 OK

  • HTTP version used by the server – HTTP/1.1
  • Status code: reason phrase – 200: OK, 404: Not found, 500: Internal Server Error
  • Header fields to provide additional information – Content-Type: text/plain
  • Message body – contain document in format specified by Content-Type header field

Simple Mail Transfer Protocol (SMTP)

Definition

  • Protocol used to send email across the internet, NOT for retrieving email
  • Uses Port 25/587 (secure)
  • Uses client-server model

Message Structure

  • MAIL FROM – sender address
  • RCPT TO – recipient address
  • DATA – begin message content
  • Message Headers – describes sender, receiver, content type etc
  • Message Body – content of email

Post Office Protocol v3 (POP3)

Definition

  • Post Office Protocol v3 – protocol to download emails from server to client and delete the message from the mailbox on the server
  • Uses Port 110/995 (secure)
  • Uses client-server model – email client and server

Internet Message Access Protocol v4 (IMAP4)

Definition

  • Similar to POP3 and allows user to view and manage messages on the server
  • It allows user to access mail messages from multiple locations (email clients) and ensure that all copies are synchronized and consistent
  • Extended functionality:
    • Obtain information about the message or examine header fields without retrieving the entire message
    • Search and retrieve portions of a message – partial retrieval is useful for slow-speed connections
  • Uses Port 143/993 (secure)
  • Microsoft Outlook, Apple Mail, Mozilla Thunderbird client, etc. use IMAP4

File Transfer Protocol (FTP)

  • Protocol for copying a file from one host to another
  • FTP resolves some problems with 2 host having
    • Different file name conventions
    • Different ways of representing text and data
    • Different directory structures
  • FTP differs from other client-server systems as it has 2 connections between hosts
  • Control Connection (port 21)
    • Used for commands from clients and response from server
    • Remains open during the session
  • Data Connection (port 20)
    • Used for file transfer – upload, download and directory listing
    • Open when needed and closed after data transfer