1 of 96

CS 31204: Computer Networks – Application Layer

INDIAN INSTITUTE OF TECHNOLOGY

KHARAGPUR

Department of Computer Science and Engineering

Sandip Chakraborty

sandipc@cse.iitkgp.ac.in

Abhijnan Chakraborty

abhijnan@cse.iitkgp.ac.in

2 of 96

Protocol Stack Implementation in a Host

Software, Kernel

Firmware, Device Driver

Hardware

Physical

Data Link

Network

Transport

Application

Indian Institute of Technology Kharagpur

3 of 96

Some Network Applications

  • social networking
  • Web
  • text messaging
  • e-mail
  • multi-user network games
  • streaming stored video (YouTube, Hulu, Netflix)
  • P2P file sharing

  • voice over IP (e.g., Skype)
  • real-time video conferencing (e.g., Zoom)
  • Internet search
  • remote login

Indian Institute of Technology Kharagpur

4 of 96

Creating a Network App

mobile network

home network

enterprise

network

national or global ISP

local or regional ISP

datacenter

network

content

provider

network

application

transport

network

data link

physical

application

transport

network

data link

physical

application

transport

network

data link

physical

write programs that:

  • run on (different) end systems
  • communicate over network
  • e.g., web server software communicates with browser software

no need to write software for network-core devices

  • network-core devices do not run user applications
  • applications on end systems allows for rapid app development, propagation

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

5 of 96

Client-server Paradigm

mobile network

home network

enterprise

network

national or global ISP

local or regional ISP

datacenter

network

content

provider

network

Server:

  • Always-on host
  • Permanent IP address
  • Often in data centers, for scaling

Clients:

  • Contact, communicate with server
  • May be intermittently connected
  • May have dynamic IP addresses
  • Do not communicate directly with each other
  • Examples: HTTP, IMAP, FTP

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

6 of 96

Peer-peer Architecture

mobile network

home network

enterprise

network

national or global ISP

local or regional ISP

datacenter

network

content

provider

network

  • No always-on server
  • Arbitrary end systems directly communicate
  • Peers request service from other peers, provide service in return to other peers
    • Self-scalability – new peers bring new service capacity, as well as new service demands
  • Peers are intermittently connected and change IP addresses
    • Complex management
  • Example: P2P file sharing

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

7 of 96

Processes Communicating

Process: program running within a host

  • Within same host, two processes communicate using inter-process communication (defined by OS)
  • Processes in different hosts communicate by exchanging messages

  • note: applications with P2P architectures have client processes & server processes

client process: process that initiates communication

server process: process that waits to be contacted

clients, servers

Indian Institute of Technology Kharagpur

8 of 96

Sockets

  • Process sends/receives messages to/from its socket
  • Socket analogous to door
    • sending process shoves message outdoor
    • sending process relies on transport infrastructure on other side of door to deliver message to socket at receiving process
    • two sockets involved: one on each side

Internet

controlled

by OS

controlled by

app developer

transport

application

physical

link

network

process

transport

application

physical

link

network

process

socket

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

9 of 96

Addressing Processes

  • To receive messages, process must have identifier
  • Host device has unique 32-bit IP address
  • Q: does IP address of host on which process runs suffice for identifying the process?
  • Identifier includes both IP address and port numbers associated with process on host.
  • Example port numbers:
    • HTTP server: 80
    • mail server: 25
  • To send HTTP message to www.iitkgp.ac.in web server:
    • IP address: 203.110.243.180
    • port number: 80
    • A: no, many processes can be running on same host

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

10 of 96

An Application-layer Protocol Defines

  • Types of messages exchanged,
    • e.g., request, response
  • Message syntax:
    • what fields in messages & how fields are delineated
  • Message semantics
    • meaning of information in fields
  • Rules for when and how processes send & respond to messages

Open protocols:

  • Defined in RFCs, everyone has access to protocol definition
  • Allows for interoperability
  • e.g., HTTP, SMTP

Proprietary protocols:

  • e.g., Skype, Zoom

Indian Institute of Technology Kharagpur

11 of 96

What Transport Service does an App Need?

Data Integrity

  • Some apps (e.g., file transfer, web transactions) require 100% reliable data transfer
  • Other apps (e.g., audio) can tolerate some loss

Timing

  • Some apps (e.g., Internet telephony, interactive games) require low delay to be “effective”

Throughput

  • Some apps (e.g., multimedia) require minimum amount of throughput to be “effective”
  • Other apps (“elastic apps”) make use of whatever throughput they get

Security

  • Encryption, data integrity, …

Indian Institute of Technology Kharagpur

12 of 96

Transport Service Requirements: Common Apps

application

file transfer/download

e-mail

Web documents

real-time audio/video

streaming audio/video

interactive games

text messaging

data loss

no loss

no loss

no loss

loss-tolerant

loss-tolerant

loss-tolerant

no loss

throughput

elastic

elastic

elastic

audio: 5Kbps-1Mbps

video:10Kbps-5Mbps

same as above

Kbps+

elastic

time sensitive?

no

no

no

yes, 10’s msec

yes, few secs

yes, 10’s msec

yes and no

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

13 of 96

Internet Transport Protocols Services

TCP service:

  • Reliable transport between sending and receiving process
  • Flow control: sender won’t overwhelm receiver
  • Congestion control: throttle sender when network overloaded
  • Connection-oriented: setup required between client and server processes
  • Does not provide: timing, minimum throughput guarantee, security

UDP service:

  • Unreliable data transfer between sending and receiving process
  • Does not provide: reliability, flow control, congestion control, timing, throughput guarantee, security, or connection setup.

Q: why bother? Why is there a UDP?

Indian Institute of Technology Kharagpur

14 of 96

Internet Applications, and Transport Protocols

application

file transfer/download

e-mail

Web documents

Internet telephony

streaming audio/video

interactive games

application

layer protocol

FTP [RFC 959]

SMTP [RFC 5321]

HTTP 1.1 [RFC 7320]

SIP [RFC 3261], RTP [RFC 3550], or proprietary HTTP [RFC 7320], DASH

WOW, FPS (proprietary) �

transport protocol

TCP

TCP

TCP

TCP or UDP

TCP

UDP or TCP

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

15 of 96

How Application Data Passes Through Different Layers

Physical

Data Link

Network

Transport

Application

HTTP Data

HTTP Header

HTTP Data

HTTP Header

TCP Header

HTTP Data

HTTP Header

TCP Header

IP Header

HTTP Data

HTTP Header

TCP Header

IP Header

MAC Header

HTTP Data

HTTP Header

TCP Header

IP Header

MAC Header

PHY Header

PHY Trailer

Indian Institute of Technology Kharagpur

16 of 96

Application Layer Interfacing

UDP

End to end packet delivery

TCP

Connection Establishment

Reliable Data Delivery

Flow and Congestion Control

Ordered Packet Delivery

Network

Transport

Application - 1

Data Link

Application - 2

Application - 3

Application - 4

Indian Institute of Technology Kharagpur

17 of 96

Application Layer Interfacing

UDP

End to end packet delivery

TCP

Connection Establishment

Reliable Data Delivery

Flow and Congestion Control

Ordered Packet Delivery

Network

Transport

Name Service

(DNS)

Data Link

Web

(HTTP)

Email

(SMTP, POP, IMAP)

File Transfer

(FTP)

Indian Institute of Technology Kharagpur

18 of 96

The Web – Hypertext Transfer Protocol (HTTP)

  • Hypertext - A way to represent web content (text along with formatting)
  • Hypertext Markup Language (HTML) - A scripting language to specify web data along with simple formatting (bold, italics, new line).
    • A way to convert text based information to graphics based information

  • Today’s era: Many graphics, scripts and other information are embedded inside HTML – CSS, JavaScript etc.

Indian Institute of Technology Kharagpur

19 of 96

Differences between HTML Versions

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell

Indian Institute of Technology Kharagpur

20 of 96

A History of the Web

  • 1989 (CERN – European Center for Nuclear Research) – help large teams to collaborate using a constantly changing collection of reports, blueprints, drawings, photos and other documents
    • The proposal came from Tim Berners-Lee
    • A public demonstration at Hypertext ‘91 conference

  • 1993 – The first graphical browser (Mosaic) developed by Marc Andreessen, University of Illinois
    • Andreessen formed the company Netscape Communications Corp
    • Microsoft developed Internet Explorer – “browser war” between Internet Explorer and Netscape Navigator

  • 1994 – CERN and MIT signed an agreement to setup World Wide Web Consortium (W3C)

Indian Institute of Technology Kharagpur

21 of 96

The Web – Architectural Overview

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell

Indian Institute of Technology Kharagpur

22 of 96

HTTP – The Client Side

  • Three questions to be answered for accessing a web page
    • What is the page called? (courses.html)
    • Where is the page located? (cse.iitkgp.ac.in/~sandipc/)
    • How can the page be accessed? (http://)

  • Uniform Resource Locator (URL): Each page is assigned a URL that effectively serves the page’s worldwide name

  • URL have three components:
    • The protocol
    • The qualified name of the machine one which the page is located
    • The path uniquely indicating the specific page

http://cse.iitkgp.ac.in/~sandipc/courses.html

Indian Institute of Technology Kharagpur

23 of 96

The Steps When You Click http://cse.iitkgp.ac.in/~sandipc/courses.html

  • The browser determines the URL
  • The browser asks DNS for the IP address of the server cse.iitkgp.ac.in
  • DNS replies with 203.110.245.250
  • The browser makes a TCP connection to 203.110.245.250 on port 80, the well-known port for the HTTP protocol
  • It sends over an HTTP request asking for the page /courses.html
  • The cse.iitkgp.ac.in server sends the page as an HTTP response, for example by sending the file /courses.html
  • If the page includes URLS that are needed for display, the browser fetches the other URLs using the same process.

Indian Institute of Technology Kharagpur

24 of 96

The Steps When You Click http://cse.iitkgp.ac.in/~sandipc/courses.html

Indian Institute of Technology Kharagpur

25 of 96

The Steps When You Click http://cse.iitkgp.ac.in/~sandipc/courses.html

  • The browser displays the page courses.html
  • The TCP connections are released if there are no other requests to the same server for a short period.

Indian Institute of Technology Kharagpur

26 of 96

Uniform Resource Identifier (URI)

  • Generalization of the URLs – specifies the pages only or partially refers the pages without complete locations
  • /images/iit_kgp.png – may become URL https://cse.iitd.ac.in/images/iit_kgp.png if accessed from cse.iitd.ac.in

Indian Institute of Technology Kharagpur

27 of 96

HTTP – The Server Side

  • Accept a TCP connection from a client (a browser).
  • Get the path to the page, which is the name of the file requested.
  • Get the file (from disk).
  • Sends the content of the file to the client.
  • Release (close) the TCP connection.

Indian Institute of Technology Kharagpur

28 of 96

Multi-Threaded Server

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell

Serves multiple client requests simultaneously

Indian Institute of Technology Kharagpur

29 of 96

Connections

  • HTTP uses TCP to set up a connection between the server and the client. In general, HTTP server runs at port 80 (default port) or 8080 (alternate port).

  • HTTP 1.0 – After the connections were established, a single request was sent over and a single response was sent back. Then the TCP connections are released.
    • Create separate connections for every content in the web-page. Overhead is high.

  • Persistent Connection (HTTP 1.1) – send additional requests and additional responses in a single TCP connection (connection reuse).
    • It is also possible to pipeline requests.

Indian Institute of Technology Kharagpur

30 of 96

Connections

HTTP 1.0

HTTP 1.1 – Persistent Connections

HTTP 1.1 – Persistent Connections (Pipelined)

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell

Persistent Connections: Set at keep-alive information in the HTTP header (HTTP 1.0)

HTTP 1.1 – All connections are by default persistent

Indian Institute of Technology Kharagpur

31 of 96

Non-persistent HTTP: Response Time

RTT (definition): time for a small packet to travel from client to server and back

HTTP response time (per object):

  • one RTT to initiate TCP connection
  • one RTT for HTTP request and first few bytes of HTTP response to return
  • object/file transmission time

time to

transmit

file

initiate TCP

connection

RTT

request file

RTT

file received

time

time

Non-persistent HTTP response time = 2RTT+ file transmission time

Indian Institute of Technology Kharagpur

32 of 96

Persistent HTTP (HTTP 1.1)

Non-persistent HTTP issues:

  • Requires 2 RTTs per object
  • OS overhead for each TCP connection
  • Browsers often open multiple parallel TCP connections to fetch referenced objects in parallel

Persistent HTTP (HTTP1.1):

  • Server leaves connection open after sending response
  • Subsequent HTTP messages between same client/server sent over open connection
  • Client sends requests as soon as it encounters a referenced object
  • As little as one RTT for all the referenced objects (cutting response time in half)

Indian Institute of Technology Kharagpur

33 of 96

HTTP Request Methods

  • Specifies what a HTTP Request will do

  • GET filename HTTP/1.1

Indian Institute of Technology Kharagpur

34 of 96

HTTP Request Header Fields (Partial List)

Indian Institute of Technology Kharagpur

35 of 96

HTTP Response

  • Specifies the status of the request message.

Indian Institute of Technology Kharagpur

36 of 96

HTTP Response Header Fields (Partial List)

Indian Institute of Technology Kharagpur

37 of 96

Dynamic Web Applications

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell

Indian Institute of Technology Kharagpur

38 of 96

HTTP Caching

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell

Indian Institute of Technology Kharagpur

39 of 96

Web Caches (aka Proxy Servers)

  • Web cache acts as both client and server
    • server for original requesting client
    • client to origin server

Why Web caching?

  • Reduce response time for client request
    • Cache is closer to client
  • Reduce traffic on an institution’s access link
  • Internet is dense with caches
    • Enables “poor” content providers to more effectively deliver content
  • Server tells cache about object’s allowable caching in response header:

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

40 of 96

Caching Example

origin

servers

public

Internet

institutional

network

1 Gbps LAN

1.54 Mbps

access link

Performance:

  • Access link utilization = .97
  • LAN utilization: .0015
  • End-end delay = Internet delay +

access link delay + LAN delay

= 2 sec + minutes + usecs

Scenario:

  • Access link rate: 1.54 Mbps
  • RTT from institutional router to server: 2 sec
  • Web object size: 100K bits
  • Average request rate from browsers to origin servers: 15/sec
    • avg data rate to browsers: 1.50 Mbps

problem: large queueing delays at high utilization!

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

41 of 96

Option 1: Buy a Faster Access Link

Performance:

  • access link utilization = .97
  • LAN utilization: .0015
  • end-end delay = Internet delay +

access link delay + LAN delay

= 2 sec + minutes + usecs

origin

servers

public

Internet

institutional

network

1 Gbps LAN

1.54 Mbps

access link

Scenario:

  • access link rate: 1.54 Mbps
  • RTT from institutional router to server: 2 sec
  • web object size: 100K bits
  • average request rate from browsers to origin servers: 15/sec
    • avg data rate to browsers: 1.50 Mbps

154 Mbps

154 Mbps

.0097

msecs

Cost: faster access link (expensive!)

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

42 of 96

Option 2: Install a Web Cache

Performance:

  • LAN utilization: .?
  • access link utilization = ?
  • average end-end delay = ?

origin

servers

public

Internet

institutional

network

1 Gbps LAN

1.54 Mbps

access link

Scenario:

  • access link rate: 1.54 Mbps
  • RTT from institutional router to server: 2 sec
  • web object size: 100K bits
  • average request rate from browsers to origin servers: 15/sec
    • avg data rate to browsers: 1.50 Mbps

How to compute link

utilization, delay?

Cost: web cache (cheap!)

local web cache

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

43 of 96

Calculating Access Link Utilization, End-end Delay with Cache

origin

servers

public

Internet

institutional

network

1 Gbps LAN

1.54 Mbps

access link

local web cache

suppose cache hit rate is 0.4:

  • 40% requests served by cache, with low (msec) delay

  • 60% requests satisfied at origin
    • rate to browsers over access link

= 0.6 * 1.50 Mbps = .9 Mbps

    • access link utilization = 0.9/1.54 = .58 means low (msec) queueing delay at access link
  • average end-end delay:

= 0.6 * (delay from origin servers)

+ 0.4 * (delay when satisfied at cache)

= 0.6 (2.01) + 0.4 (~msecs) = ~ 1.2 secs

lower average end-end delay than with 154 Mbps link (and cheaper too!)

Indian Institute of Technology Kharagpur

44 of 96

Conditional GET

Goal: don’t send object if cache has up-to-date cached version

    • no object transmission delay (or use of network resources)
  • Client: specify date of cached copy in HTTP request

If-modified-since: <date>

  • Server: response contains no object if cached copy is up-to-date:

HTTP/1.1 304 Not Modified

HTTP request msg

If-modified-since: <date>

HTTP response

HTTP/1.0

304 Not Modified

object

not

modified

after

<date>

HTTP request msg

If-modified-since: <date>

HTTP response

HTTP/1.0 200 OK

<data>

object

modified

after

<date>

client

server

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

45 of 96

Stateless HTTP

HTTP is “stateless”

  • server maintains no information about past client requests
  • every Response corresponds to the previous Request only
  • it does not remember any state information, such as last page accessed

protocols that maintain “state” are complex!

  • past history (state) must be maintained
  • if server/client crashes, their views of “state” may be inconsistent, must be reconciled

aside

Indian Institute of Technology Kharagpur

46 of 96

Cookies

  • What if we need to be stateful?

  • Use Cookies to store the state information. Client forwards the additional information along with the Request message by reading the cookie.

Indian Institute of Technology Kharagpur

47 of 96

Maintaining User/Server State: Cookies

Web sites and client browser use cookies to maintain some state between transactions

four components:

1) cookie header line of HTTP response message

2) cookie header line in next HTTP request message

3) cookie file kept on user’s host, managed by user’s browser

4) back-end database at website

Example:

  • Susan uses browser on laptop, visits specific e-commerce site for first time
  • when initial HTTP requests arrives at site, site creates:
    • unique ID (aka “cookie”)
    • entry in backend DB for ID
  • subsequent HTTP requests from Susan to this site will contain cookie ID value, allowing site to “identify” Susan

Indian Institute of Technology Kharagpur

48 of 96

Maintaining User/Server State: Cookies

client

server

usual HTTP response msg

usual HTTP response msg

cookie file

one week later:

usual HTTP request msg

cookie: 1678

cookie-

specific

action

access

ebay 8734

usual HTTP request msg

Amazon server

creates ID

1678 for user

create

entry

usual HTTP response

set-cookie: 1678

ebay 8734

amazon 1678

usual HTTP request msg

cookie: 1678

cookie-

specific

action

access

ebay 8734

amazon 1678

backend

database

time

time

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

49 of 96

HTTP cookies: comments

What cookies can be used for:

  • authorization
  • shopping carts
  • recommendations
  • user session state (Web e-mail)

cookies and privacy:

  • cookies permit sites to learn a lot about you on their site.
  • third party persistent cookies (tracking cookies) allow common identity (cookie value) to be tracked across multiple web sites

aside

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

50 of 96

Application Layer Interfacing

UDP

End to end packet delivery

TCP

Connection Establishment

Reliable Data Delivery

Flow and Congestion Control

Ordered Packet Delivery

Network

Transport

Name Service

(DNS)

Data Link

Web

(HTTP)

Email

(SMTP, POP, IMAP)

File Transfer

(FTP)

Indian Institute of Technology Kharagpur

51 of 96

DNS: Domain Name System

People: many identifiers:

    • Aadhar, name, passport #

Internet hosts, routers:

    • IP address (32 bit) - used for addressing datagrams
    • “name”, e.g., cs.umass.edu - used by humans

Q: how to map between IP address and name, and vice versa ?

Domain Name System (DNS):

  • Assign Unique names to an IP address
  • ARPANET – a file hosts.txt listed all computer names and their IP addresses.
  • To resolve hostname conflicts over the Internet, a naming hierarchy needs to be managed
  • Distributed database implemented in hierarchy of many name servers
  • Application-layer protocol: hosts, DNS servers communicate to resolve names
  • Note: core Internet function, implemented as application-layer protocol -> complexity at network’s “edge”

Indian Institute of Technology Kharagpur

52 of 96

DNS: Services, Structure

Why not centralize DNS?

  • single point of failure
  • traffic volume
  • distant centralized database
  • maintenance

DNS services:

  • hostname-to-IP-address translation
  • host aliasing
    • canonical, alias names
  • mail server aliasing
  • load distribution
    • replicated Web servers: many IP addresses correspond to one name

Doesn't scale!

  • Telecom DNS servers alone: 600B DNS queries/day
  • Akamai DNS servers alone: 2.2T DNS queries/day

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

53 of 96

DNS: A Distributed, Hierarchical Database

Client wants IP address for www.amazon.com; 1st approximation:

  • Client queries root server to find .com DNS server
  • Client queries .com DNS server to get amazon.com DNS server
  • Client queries amazon.com DNS server to get IP address for www.amazon.com

.com DNS servers

.org DNS servers

.edu DNS servers

Top Level Domain

Root DNS Servers

Root

nyu.edu

DNS servers

umass.edu

DNS servers

yahoo.com

DNS servers

amazon.com

DNS servers

pbs.org

DNS servers

Authoritative

Indian Institute of Technology Kharagpur

54 of 96

DNS: Root Name Servers

  • Official, contact-of-last-resort by name servers that does not directly resolve name
  • Incredibly important Internet function
    • Internet could not function without it!
  • An organization Internet Corporation for Assigned Names and Numbers (ICANN) manages root DNS domain

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

logical names in the form letter.root-servers.net, where letter ranges from a to m

Indian Institute of Technology Kharagpur

55 of 96

Top-Level Domain (TLD) servers

  • The top level domains are run by registrars appointed by ICANN
  • Name registrar for India (.in domain): registry.in (National Internet Exchange of India – NIXI)

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell

Indian Institute of Technology Kharagpur

56 of 96

registry.in

Indian Institute of Technology Kharagpur

57 of 96

Operations of NIXI

Indian Institute of Technology Kharagpur

58 of 96

Registers under NIXI

Indian Institute of Technology Kharagpur

59 of 96

Elements of DNS (RFC 1034)

  • The Domain Name Space and Resource Records: Specifications for a tree-structured namespace and data associated with names.
  • Name Servers: Server programs which hold information about the domain tree’s structure and set information
    • A particular name server has complete information about a subset of domain space
    • Name servers know parts of domain tree for which they have complete information
    • A name server is said to be an AUTHORITY for this part of the namespace
  • Authoritative DNS servers:
    • organization’s own DNS server(s), providing authoritative hostname to IP mappings for organization’s named hosts
    • can be maintained by an organization or a service provider

Indian Institute of Technology Kharagpur

60 of 96

Name Servers

  • Divide registries into non-overlapping zones – every zone has a name server

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell

Indian Institute of Technology Kharagpur

61 of 96

Elements of DNS (RFC 1034)

  • The Domain Name Space and Resource Records: Specifications for a tree-structured namespace and data associated with names.
  • Name Servers: Server programs which hold information about the domain tree’s structure and set information
    • A particular name server has complete information about a subset of domain space
    • Name servers know parts of domain tree for which they have complete information
  • Resolvers: Program that extracts information from name servers in response to client requests

Indian Institute of Technology Kharagpur

62 of 96

Local DNS name servers

  • when host makes DNS query, it is sent to its local DNS server
    • Local DNS server returns reply, answering:
      • from its local cache of recent name-to-address translation pairs
      • forwarding request into DNS hierarchy for resolution
    • each ISP has local DNS name server; to find yours:
      • MacOS: % scutil --dns
      • Windows: >ipconfig /all
      • Linux: nslookup
  • local DNS server doesn’t strictly belong to hierarchy

Indian Institute of Technology Kharagpur

63 of 96

Domain Resource Records

  • Every domain has a set of resource records associated with it – DNS database

Indian Institute of Technology Kharagpur

64 of 96

Domain Resource Records

  • Domain_name: Domain to which the record applies.
  • Time_to_live: Time for which this record is active – volatile records may be assigned a small value
  • Class: Normally IN – Internet resources
  • Type: What type of record it is
  • Value: Value of the record (IP address for A record type)

Indian Institute of Technology Kharagpur

65 of 96

Domain Resource Records

  • A Type Records: ��cse.iitkgp.ac.in 86400 IN A 203.110.245.250�
  • CNAME Type Records:��iitkgp.ac.in 86400 IN CNAME www.iitkgp.ac.in

  • PTR Type Records: ��www.iitkgp.ernet.in 86400 IN PTR www.iitkgp.ac.in

Indian Institute of Technology Kharagpur

66 of 96

Name Resolution (nslookup)

One of the name servers for IITKGP

Indian Institute of Technology Kharagpur

67 of 96

Name Resolution (dig)

An authoritative record is one that comes from the authority that manages the record, and thus is always correct

UDP Message for 4096 bytes

Indian Institute of Technology Kharagpur

68 of 96

Sample DNS Database – IITKGP (dig from KGP Network)

Indian Institute of Technology Kharagpur

69 of 96

Sample DNS Database – IITKGP (dig from Airtel Network)

Indian Institute of Technology Kharagpur

70 of 96

Sample DNS Database – IITKGP (dig from Jio Network)

Indian Institute of Technology Kharagpur

71 of 96

DNS Name Resolution: Iterated Query

Example: host at cse.iitkgp.ac.in

wants IP address for gaia.cs.umass.edu

Iterated query:

  • Contacted server replies with name of server to contact
  • “I don’t know this name, but ask this server”

requesting host at

cse.iitkgp.ac.in

gaia.cs.umass.edu

root DNS server

a.root-servers.net

local DNS server

ns1.iitkgp.ac.in

1

2

3

4

5

6

authoritative DNS server

dns.cs.umass.edu

7

8

TLD DNS server

a.edu-servers.net

Source: Computer Networking: A Top-Down Approach (8th Ed) by Jim Kurose, Keith Ross

Indian Institute of Technology Kharagpur

72 of 96

DNS Name Resolution: Recursive Query

requesting host at

cse.iitkgp.ac.in

gaia.cs.umass.edu

root DNS server

a.root-servers.net

local DNS server

ns1.iitkgp.ac.in

1

2

3

4

5

6

authoritative DNS server

dns.cs.umass.edu

7

8

TLD DNS server

a.edu-servers.net

Recursive query:

  • Puts burden of name resolution on contacted name server
  • Heavy load at upper levels of hierarchy?

Example: host at cse.iitkgp.ac.in

wants IP address for gaia.cs.umass.edu

Indian Institute of Technology Kharagpur

73 of 96

DNS Packet Structure

Indian Institute of Technology Kharagpur

74 of 96

Why DNS Uses UDP

  • UDP is much faster. TCP requires handshake time. DNR uses a cascading approach for name resolution. With TCP, for every message, a connection setup is required.

  • DNS requests and responses are generally very small and fits well within one UDP segment.

  • UDP is not reliable. In DNS, reliability is ensured at the application layer. After timeout, the DNS client sends back the requests. After few consecutive timeouts (can be set at the client), the request is aborted with an error.

Indian Institute of Technology Kharagpur

75 of 96

Getting Your info into the DNS

Example: you have created a new startup “KGP Ideas”

  • Register name kgpideas.com at DNS registrar (e.g., GoDaddy)
    • Provide names, IP addresses of authoritative name server (primary and secondary)
    • Registrar inserts NS, A RRs into .com TLD server:

(kgpideas.com, dns1.kgpideas.com, NS)

(dns1.kgpideas.com, 212.212.212.1, A)

  • Create authoritative server locally with IP address 212.212.212.1
    • type A record for www.kgpideas.com
    • type MX record for kgpideas.com

Indian Institute of Technology Kharagpur

76 of 96

Application Layer Interfacing

UDP

End to end packet delivery

TCP

Connection Establishment

Reliable Data Delivery

Flow and Congestion Control

Ordered Packet Delivery

Network

Transport

Name Service

(DNS)

Data Link

Web

(HTTP)

Email

(SMTP, POP, IMAP)

File Transfer

(FTP)

Indian Institute of Technology Kharagpur

77 of 96

File Transfer Protocol (FTP)

  • Is built on a client-server model (RFC 959)
    • The client requests for the file or sends the file to the server
    • The server responds with the file data or stores the file at the file server

  • Works in two modes – Active and Passive

File Server

(FTP Server)

User

(FTP Client)

File Request

File Response Status

File Data

Indian Institute of Technology Kharagpur

78 of 96

Active and Passive Modes of File Transfer

FTP server uses two different ports:

Port 21 (Command or Control Port): For command message transfer

Port 20 or Client assigned (Data Port): For data transfer

Image Source: http://henrydu.com/blog/how-to/ftp-active-mode-vs-passive-mode-106.html

Indian Institute of Technology Kharagpur

79 of 96

Why There are Two Channels – Command Channel and Data Channel

  • Specifically to avoid busy waiting, and keep the command channel lightweight.

  • You can always use a multiplexing between command/control and data, but FTP is used for large file transfer; if command channel is used for data transfer as well, the commands for other clients may experience a higher queuing delay while one client is being served.

  • The clients can continue sending and receiving control information while data transfer is being take place

Indian Institute of Technology Kharagpur

80 of 96

Why There are Two Modes in FTP?

Active Mode: Client informs the port number where it is listening, and the server initiates the TCP connection to that port (TCP server is running at the client side)

What If the client is behind a firewall and can not accept a connection?

Indian Institute of Technology Kharagpur

81 of 96

Why There are Two Modes in FTP?

Passive Mode: The server selects a random port, and the client initiates a TCP connection to that server port.

The server can serve multiple clients at different server data ports through different threads.

The clients always initiate the command and the data transfer.

Image Source: http://henrydu.com/blog/how-to/ftp-active-mode-vs-passive-mode-106.html

Indian Institute of Technology Kharagpur

82 of 96

FTP Data Transfer Modes

  • Stream mode: Data is sent as a continuous stream, relieving FTP from doing any processing. Rather, all processing is left up to TCP. No End-of-file indicator is needed, unless the data is divided into records.

  • Block mode: FTP breaks the data into several blocks (block header, byte count, and data field) and then passes it on to TCP.

  • Compressed mode: Data is compressed using a simple algorithm (usually run-length encoding).

Source: Wikipedia

Indian Institute of Technology Kharagpur

83 of 96

FTP Sample Commands and Response Codes

Indian Institute of Technology Kharagpur

84 of 96

Application Layer Interfacing

UDP

End to end packet delivery

TCP

Connection Establishment

Reliable Data Delivery

Flow and Congestion Control

Ordered Packet Delivery

Network

Transport

Name Service

(DNS)

Data Link

Web

(HTTP)

Email

(SMTP, POP, IMAP)

File Transfer

(FTP)

Indian Institute of Technology Kharagpur

85 of 96

Electronic Mails – Architecture and Services

  • User Agent: Allow people to read and send emails.
  • Message Transfer Agents (main servers): Move the message from the source to the destination

sandipc@cse.iitkgp.ac.in

sukumar@iitg.ac.in

cse.iitkgp.ac.in

iitg.ac.in

Indian Institute of Technology Kharagpur

86 of 96

Message Transfer Agents

  • System processes run in the background on mail servers (always available).

  • Automatically move emails through the system from the originator to the recipient

  • Uses Simple Mail Transfer Protocol (SMTP) – RFC 821, RFC 5321

  • Implements mailing lists, an identical copy of message is delivered to everyone in the list (btech@iitkgp.ac.in)

  • Implements Mailboxes, to store all the emails received for a user

Indian Institute of Technology Kharagpur

87 of 96

Message Format (RFC 5322)

  • An envelope containing message header and message body

Indian Institute of Technology Kharagpur

88 of 96

The Internet Message Format (RFC 5322)

  • Header fields (for message transport):

Indian Institute of Technology Kharagpur

89 of 96

The Internet Message Format (RFC 5322)

  • Header fields (additional fields for message description):

Indian Institute of Technology Kharagpur

90 of 96

MIME – The Multipurpose Internet Mail Extension

  • ARPANET: email consisted exclusively of text messages written in English and expressed in ASCII

  • MIME: Use multi-language and multimedia contents (audio, image etc.) inside an email.

  • Additional message headers for MIME:

Indian Institute of Technology Kharagpur

91 of 96

Message Transfer

  • Uses SMTP Protocol

  • Email is delivered by having the sending computer establishing TCP connection to port 25 of the receiving computer.

SMTP Server

(Port 25)

SMTP Client (Port ANY)

SMTP Server

(Port 25)

SMTP Client (Port ANY)

UA – SMTP Client

Port ANY

TCP

TCP

sandipc@cse.iitkgp.ac.in

cse.iitkgp.ac.in

iitg.ac.in

SMTP

SMTP

Indian Institute of Technology Kharagpur

92 of 96

Message Transfer (SMTP)

Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell

Indian Institute of Technology Kharagpur

93 of 96

Final Delivery

  • Pull type protocol – UA at the receiver side pulls the emails from mail server after login.

  • Post Office Protocol, Version 3 (POP3) – an earlier protocol for email delivery

  • Internet Message Access Protocol, Version 4 (IMAP v4) – RFC 3501
    • The email server runs an IMAP server at port 143
    • The user agent runs IMAP client
    • The client connects to the server and issues mail delivery commands

Indian Institute of Technology Kharagpur

94 of 96

IMAP (Version 4) Commands

Indian Institute of Technology Kharagpur

95 of 96

Retrieving email: mail access protocols

  • SMTP: delivery/storage of e-mail messages to receiver’s server
  • mail access protocol: retrieval from server

IMAP: Internet Mail Access Protocol [RFC 3501]: messages stored on server, IMAP provides retrieval, deletion, folders of stored messages on server

  • HTTP: gmail, Hotmail, Yahoo!Mail, etc. provides web-based interface on top of STMP (to send), IMAP (or POP) to retrieve e-mail messages

Indian Institute of Technology Kharagpur

96 of 96

  • Next, we’ll go for the Transport Layer ….

Indian Institute of Technology Kharagpur