Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp ›...

63
2-1 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/ Application Layer Raj Jain Washington University in Saint Louis Saint Louis, MO 63130 [email protected] Audio/Video recordings of this lecture are available on-line at: http://www.cse.wustl.edu/~jain/cse473-16/

Transcript of Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp ›...

Page 1: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-1 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Application Layer

Raj Jain Washington University in Saint Louis

Saint Louis, MO 63130 [email protected]

Audio/Video recordings of this lecture are available on-line at: http://www.cse.wustl.edu/~jain/cse473-16/

Page 2: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-2 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Overview

1. Network Application Architecture 2. HyperText Transfer Protocol (HTTP) 3. File Transfer and Email protocols 4. Domain Name Service 5. Peer-to-Peer Applications

Note: This class lecture is based on Chapter 2 of the textbook

(Kurose and Ross) and the figures provided by the authors.

Page 3: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-3 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Network Application Architectures

1. Protocol Layers 2. Client-Server vs. Peer-to-Peer 3. Process Communication 4. Names, Addresses, Ports 5. Transports

Overview

Page 4: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-4 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Protocol Layers

q Top-Down approach

Internetwork

Host to Network

IP

Application

Transport

HTTP

TCP

FTP SMTP

UDP

Physical

Ethernet Wi-Fi Point-to-Point

Coax Fiber Wireless

P2P DNS Skype

Page 5: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-5 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Network Application Architectures

q Client-Server q Peer-to-Peer

Page 6: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-6 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Client-Server

q Clients: Request service q Server: Provides a service.

Waits for clients q Server is always up q Clients do not communicate

directly with each other q Server = Data Center q Example: Web Server, Search

Engine, Social Networking

client/server

Page 7: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-7 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Peer-to-Peer q Does not require always-on servers q Hosts communicate directly

⇒ Peers q Hosts may come on or may go off

at any time q Examples: File Sharing (Bit

Torrent, eMule, LimeWire), Telephony (Skype)

q Highly scalable q Highly symmetric traffic

⇒ ISP unfriendly q Difficult to authenticate ⇒ Insecure q Need incentives to share

Page 8: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-8 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Process Communications q Inter-Process Communication on the Same Host

⇒ Operating system provides message passing q Unix provides application programming interface

called “sockets” q Inter-Process Communication on Different Hosts

⇒ Network provides message passing

process socket

Host

process

TCP/IP TCP/IP

socket

Host

Internet

controlled by app developer User

Operating System

Page 9: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-9 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Names, Addresses, Ports q Domain Name System: www.google.com q IP Address: 209.85.225.147 q 4 decimal numbers less than 256=8 bits each

⇒ 32-bits q Ports: Entry point (Transport service access points) q 21=FTP, 80=HTTP

Port 1

Port 2

Page 10: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-10 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Transports TCP UDP

Reliable data transfer Unreliable Data Transfer Packet Sequence # required Sequence # optional Every packet is acked Not Acked Lost packets are retransmitted No Retransmission May cause long delay Quick and Lossy Connection-oriented service Connection-less Service Good for Reliable and delay-insenstive applications

Good for loss-tolerant and delay sensitive applications

Applications: email, http, ftp, Remote terminal access

Telephony, Streaming Multimedia

Page 11: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-11 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Application Layer Protocols

q HTTP: HyperText Transfer Protocol q FTP: File Transfer Protocol q SMTP: Simple Mail Transfer Protocol q DNS: Domain Name Server

(Control Plane Application) q P2P: Peer-to-Peer Applications (Class of applications) q Skype q Each application has its own protocol, message

format, semantics of fields

Page 12: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-12 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Application Arch: Summary

1. P2P applications are more scalable than client-server 2. Applications exchanges messages using operating

system sockets 3. Applications communicate using host names,

addresses, and ports 4. Applications use transports: TCP, UDP, … 5. TCP is used for reliable communication

UDP for loss-tolerant delay-sensitive applications

Page 13: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-13 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

HTTP

1. Concepts 2. Sample Web Page 3. HTTP Messages 4. Cookies 5. Proxy Servers 6. Conditional GET

Overview

Page 14: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-14 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

HTTP Concepts q Client=Browser, e.g., Internet

Explorer, Firefox q HTTP Server, e.g., Microsoft

Internet Information Service (IIS), Apache

q Web Page=Group of objects q Object=Text, Images, files, ... q URL: Uniform Resource

Locator http://www.cse.wustl.edu/ ~jain/cse473-09/sample.htm

PC running Explorer

Server running

Apache Web server

Mac running Navigator

Page 15: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-15 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

HTTP

q Uses TCP q Stateless: Server does not remember previous history q Non-Persistent: Open new TCP connection, get one

object, close q Persistent: Open one TCP connection, get all objects,

close Server leaves the connection open after sending an object and closes on timeout

q Web pages are written in HyperText Markup Language (HTML)

Page 16: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-16 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Sample Web Page

<HTML> <HEAD> </HEAD> <BODY> <img src=jain.jpg> <BR> Raj Jain </BODY> </HTML>

Raj Jain

Page 17: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-17 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Sample HTTP Request Message

GET /~jain/cse473-16/sample.htm HTTP/1.1 Host: www.cse.wustl.edu Connection: close User-agent: Mozilla/4.0 Accept-Language: en

q Method = Get q URL = /~jain/cse473-16/sample.htm q Version = HTTP/1.1 q Header Fields = Host, Connection, User-agent, …

Page 18: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-18 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

HTTP Request Message Format

Page 19: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-19 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Sample HTTP Response Message

HTTP/1.1 200 OK Connection: close Date: Tue, 09 Sept 2009 13:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Sun, 6 May 2009 09:23:24 GMT Content-Length: 6500 Content-Type: Text/html Data…

Status Codes: q 200 OK q 301 Moved

Permanently q 400 Bad Request q 404 Not Found q 505 HTTP Version

Not Supported

Page 20: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-20 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

HTTP Response Message Format Version sp Status code sp Phrase cr lf Header field Name: sp value cr lf

Header field Name: sp value cr lf cr lf

Status Line

Header lines

Blank line

Entity body

Page 21: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-21 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Hands-on HTTP telnet www1.cse.wustl.edu 80 GET /~jain/cse473-16/sample.htm HTTP/1.1 Host: www1.cse.wustl.edu HTTP/1.1 200 OK Date: Tue, 13 Sep 2011 23:39:53 GMT Server: Apache/2.2.3 (CentOS) Accept-Ranges: bytes Content-Length: 233 Connection: close Content-Type: text/html; charset=ISO-8859-1 <HTML> <head> </head> <body> This is a sample text. </body> </html>

This is a sample text.

Page 22: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-22 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Hands-on HTTP (cont) telnet www1.cse.wustl.edu 80 GET /~jain/cse473-08/sample.htm HTTP/1.1 Host: www1.cse.wustl.edu HTTP/1.1 404 Not Found Date: Tue, 13 Sep 2011 23:42:48 GMT Server: Apache/2.2.3 (CentOS) Content-Length: 307 Connection: close Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL /~jain/cse473-08/sample.htm was not found on this server.</p> <hr> <address>Apache/2.2.3 (CentOS) Server at www1.cse.wustl.edu Port 80</address> </body></html>

Page 23: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-23 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Cookies q Allow servers to remember previous information

C:\Documents and Settings\Raj Jain\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-

spectific action

access ebay 8734 amazon 1678

backend database

Page 24: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-24 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Proxy Server: Web Caching q All requests are sent to proxy server q Proxy server caches objects q Only new objects are requested from origin server q Fast, Lower traffic on the link

client

Proxy server

client

origin server

Page 25: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-25 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Conditional GET

cache server

HTTP request msg If-modified-since: <date>

HTTP response HTTP/1.0

304 Not Modified

object not

modified

HTTP request msg If-modified-since: <date>

HTTP response HTTP/1.0 200 OK

<data>

object modified

Page 26: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-26 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

HTTP: Summary

1. HTTP is a client-server protocol. Uses text-based messages

2. Web pages are generally written in HTML 3. HTTP uses non-persistent/persistent TCP

connections 4. Cookies allow servers to maintain state 5. Proxy servers improve performance by caching

frequently used pages 6. Conditional gets allows proxy servers to reduce

Internet traffic

Page 27: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-27 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Homework 2A P5. The text below shows the reply sent from the server in response to the HTTP GET

message. Answer the following questions, indicating where in the message below you find the answer. HTTP/1.1 200 OK Date: Tue, 07 Mar 2011 12:39:45GMT Server: Apache/2.0.52 (Fedor) Last-Modified: Sat, 5 Jan 2008 18:27:46 GMT Etag: “526c3-f22-a88a4c80” Accept-ranges: bytes Content-Length: 4061 Keep-Alive: timeout=max=100 Connection: Keep-Alive Content-Type: text/html; charset=ISO-8859-1 <!doctype html publi “-//w3c//dtd html 4.0 transitional//en”>

<html> <head> <much more document text following here (not shown)>

A. Was the server able to successfully find the document or not? What time was the document reply

provided? B. When was the document last modified? C. How many bytes are there in the document being returned? D. What are the first 5 bytes of the document being returned? E. Did the server agree to a persistent connection?

Page 28: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-28 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Lab 2 Submit answers for the following: (See hints in the parenthesis.) 1. Find the IP addresses of www.google.com and

www.yahoo.com (ping) 2. Modify the hosts file to map www.google.com to yahoo’s IP

address and try to do a google search. Remove the modification to the host file and repeat. (Windows: c:\windows\system32\drivers\etc\hosts)

3. Find the domain name and country of 128.252.165.7 (http://www.webyield.net/domainquery.html )

4. Find the owner of wustl.edu domain (http://www.networksolutions.com/whois/index.jsp )

5. Find the name server of wustl.edu domain ( http://www.networksolutions.com/whois/index.jsp)

Page 29: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-29 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Electronic Mail

user mailbox

outgoing message queue

mail server

user agent

user agent

user agent

mail server

user agent

user agent

mail server

user agent

SMTP

SMTP

SMTP

user

Page 30: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-30 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

SMTP

q Simple Mail Transfer Protocol q Old Protocol: Allows only 7-bit ASCII messages q All binary objects have to be converted to ASCII q Uses port 25 at the server

Page 31: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-31 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Sample SMTP Exchange telnet mail.seas.wustl.edu 25 220 POSTOFFICE.seas.wustl.edu Microsoft ESMTP MAIL Service, Version: 6.0.3790.46 75 ready at Tue, 13 Sep 2011 18:34:56 -0500 HELO acm.org 250 POSTOFFICE.seas.wustl.edu Hello [128.252.19.232] MAIL FROM: [email protected] 250 2.1.0 [email protected] OK RCPT TO: [email protected] 250 2.1.5 [email protected] DATA 354 Start mail input; end with <CRLF>.<CRLF> This is test email. This serves as an exmaple for CS473 class. . 250 2.6.0 <[email protected]> Queued mail

for delivery QUIT 221 2.0.0 POSTOFFICE.seas.wustl.edu Service closing transmission channel

Try the above client sequence by telnet mail.seas.wustl.edu 25

C: S: C: S: C: S: C: S: C: S: C: S: C: S:

Page 32: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-32 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

HTTP vs. SMTP

HTTP SMTP Persistent/Non-Persistent TCP Persistent TCP Mostly Pull Mostly Push Accepts binary objects Accepts only 7-bit ASCII One Object/response Multiple objects/message

Page 33: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-33 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Mail Access Protocols q SMTP can be used to send messages to destination user agent

⇒ Requires destination to be always accessible q Post Office Protocol - Version 3 (POP3) q Internet Mail Access Protocol (IMAP) q HTTP

user agent

sender’s mail server

user agent

SMTP SMTP access protocol

receiver’s mail server

Page 34: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-34 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

POP3 protocol

Authorization phase

C: list S: 1 498 S: 2 912 S: . C: retr 1 S: <message 1 contents> S: . C: dele 1 C: retr 2 S: <message 2 contents> S: . C: dele 2 C: quit S: +OK POP3 server signing off

S: +OK POP3 server ready C: user bob S: +OK C: pass hungry S: +OK user successfully logged on

Transaction phase

Page 35: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-35 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

IMAP

q Internet Mail Access Protocol q More sophisticated than POP3 q Allows users to maintain folders on the server q Messages can be moved from one folder to another q Users can get only headers or other components of the

message q Official IMAP site: www.imap.org

Page 36: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-36 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Mail: Summary

1. SMTP is the protocol send email 2. SMTP uses only 7-bit ASCII messages 3. POP3, IMAP, or HTTP is used to receive email

Page 37: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-37 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Homework 2B P17. Consider accessing your e-mail with POP3. A. Suppose you have configured your POP mail client to operate in the download and delete

mode. Complete the following transaction: C: list S: 1 498 S: 2 912 S: . C: retr 1 S: blah blah … S: … Blah S: . ? ? B. Suppose you have configured your POP mail client to operate in the download and keep mode.

Complete the above transaction. C. Suppose you have configured your POP mail client to operate in the download-and-keep mode.

Using your transcript in part (b), suppose you retrieve messages 1 and 2. Exit POP and then five minutes later you again access POP to retrieve new e-mail. Suppose that in the five-minute interval no new message have been sent to you. Provide a transcript of this second POP session.

Page 38: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-38 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Domain Name Service

1. DNS Hierarchy 2. How DNS Works? 3. DNS Records 4. DNS Message Format 5. DNS Registration 6. DNS Vulnerability

Page 39: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-39 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

DNS q Domain Name Service q DNS servers translate a host name to IP address

E.g., www.wustl.edu ⇒ 128.252.87.149 q Distributed database of all hosts in the universe q Other Services:

q Host Aliasing: www.rajjain.com or www.cse.wustl.edu/~jain/

q Mail Server Aliasing: MX record (e.g., [email protected])

q Load Distribution: Multiple addresses, rotated

Page 40: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-40 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

DNS Example F:\>nslookup www.wustl.edu Server: ns00.ip.wustl.edu Address: 128.252.0.1 Name: www.wustl.edu Address: 128.252.87.149 F:\>nslookup www.google.com Server: ns00.ip.wustl.edu Address: 128.252.0.1 Non-authoritative answer: Name: www.l.google.com Addresses: 74.125.225.48, 74.125.225.52, 74.125.225.50, 74.125.225.49 74.125.225.51 Aliases: www.google.com

Page 41: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-41 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

DNS Hierarchy

q Root DNS Servers q Top-level Domain (TLD) servers q Authoritative DNS Servers

Root DNS Servers

com DNS servers org DNS servers edu DNS servers

poly.edu DNS servers

umass.edu DNS servers yahoo.com

DNS servers amazon.com DNS servers

pbs.org DNS servers

Page 42: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-42 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

How DNS Works?

q Redirects q Recursive queries:

Give me an answer q Iterative queries:

Give me an answer or a hint

q DNS responses are cached

requesting host www.cse.wustl.edu

gaia.cs.umass.edu

root DNS server

local DNS server Dns.wustl.edu

1

2 3

4

5

6

authoritative DNS server dns.cs.umass.edu

7 8

TLD DNS server

Page 43: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-43 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

DNS Records

q Resource Records=(Name, Value, Type, TTL) q Type=A: IP Address for the host name q Type=NS: Name server for the domain name q TYPE=CNAME: Canonical name for a host name q Type=MX: Canonical name of mail server

Page 44: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-44 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

DNS Message Format

q Questions: Name, type q Answers: Name, type, value, TTL q Authority: Other authoritative servers q Additional: Other information, e.g., IP address of

canonical name in MX response Identification Flags

# of Questions # of Answer RRs # of Authority RRs # of Additional RRs

Questions Answers Authority

Additional Information

12 Bytes

Page 45: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-45 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

DNS Registration

q Many Registrars q Internet Corporation for Assigned Names and

Numbers (ICANN) accredits registrars q www.internic.net q Registrars provide authoritative name servers, A and

MX records for the domain

Page 46: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-46 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

DNS Vulnerability

q Distributed Denial of service attack on Name server q DNS cache poisoning – A server gives wrong answer

Page 47: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-47 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

DNS: Summary

1. DNS is used to resolve names to IP address 2. Also provides Name aliasing (CNAME), Mail Server

(MX) records 3. DNS is a distributed database

⇒ Servers ask other servers for answers when needed

4. Recursive (answer only) or iterative (answer or hint) queries

5. Root Servers, Top level domain servers, Authoritative servers

Page 48: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-48 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Homework 2C

R19: q Is it possible for an organization’s web server and

mail server to have exactly the same hostname? (Briefly explain why or why not?)

q What would be the type of RR that contains the host name of the mail server?

Page 49: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-49 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Peer-to-Peer Applications

1. Client Server vs. P2P Scalability 2. P2P File Distribution (BitTorrent)

Overview

Page 50: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-50 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

P2P File Distribution (BitTorrent)

Tracker: tracks peers participating in torrent

Torrent: group of peers exchanging chunks of a file

Obtain list of peers

trading chunks

peer

Page 51: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-51 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Peer-to-Peer Applications

q N= # of peers q F= File Size q ui= uplink speed or ith host q di= downlink speed of ith host q dmin=min{d1, d2, ..., dN} q Dcs > max{ NF/us, F/dmin} q DP2P > max{F/us, F/dmin, NF/(us+Σui)}

us

u2 d1 d2 u1

uN

dN

Server

Network (with abundant bandwidth)

File, size F

Page 52: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-52 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

2: Application Layer 52

0

0.5

1

1.5

2

2.5

3

3.5

0 5 10 15 20 25 30 35

N

Min

imum

Dis

tribu

tion

Tim

e P2PClient-Server

Client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us

Client Server vs. P2P Scalability

Page 53: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-53 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

BitTorrent P2P File Distribution q Peers=nodes participating in a

file distribution q Torrent=Set of all peers q Torrent File =a file containing

information about the tracker, object ID, and file

q Files are segmented into equal size chunks (256kB)

q Seeds=Peers that have the complete file

q Leechers=Peers that have incomplete file

q Tracker=Has list of all peers

Torrent Directory Tracker

Leecher 1

2

3

1

Seed 1

Seed m

Seed 2 Leecher 2

Leecher n

Page 54: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-54 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

BitTorrent File Distribution (Cont) 1. Alice uses torrent directories (search engines) to find a torrent

for "Raj Jain's Lecture" 2. Alice contact the tracker to get the current list of peers

Tracker may provide random subset (say 50) peers 3. Alice sets up TCP connections with these peers in parallel and

gets a map of available chunks q Requests least available chunks first (rarest first) q Every 10 seconds, Alice calculates the receiving rates q Sends to (Unchokes) the top 4 senders q Every 30 seconds, Alice sends to one randomly selected peer

(optimistically unchokes) ⇒ Helps find high-rate neighbors

q Ref: www.bittorrent.org http://en.wikipedia.org/wiki/BitTorrent_(protocol)

Page 55: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-55 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

P2P Applications: Summary

1. P2P applications are more scalable ⇒ More efficient when the number of peers is large

2. BitTorrent has peers, trackers, seeds, and leechers 3. BitTorrent unchokes 4 top uploaders and one random

node for load balancing 4. Distributed hash tables are used to manage large

distributed databases used in P2P applications 5. Skype uses super-nodes to keep track of active users

and provides relays for users behind NATs.

Page 56: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-56 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Homework 2D

P26. Suppose Bob joins a BitTorrent torrent, but he does not want to upload any data to any other peers (so called free-riding).

A. Bob claims that he can receive a complete copy of the file that is shared by the swarm. Is Bob’s claim possible? Why or Why not?

B. Bob further claims that he can further make his “free-riding” more efficient by using a collection of multiple computers (with distinct IP addresses) in the computer lab in his department. How can he do that?

Page 57: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-57 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Streaming Video

q Video traffic is 80% of consumer traffic q Video: 25-30 Frames/sec q Video can be compressed:

q Spatial: next pixel is similar to this q Temporal: Pixel in the next frame is similar to this

q Variable bit rate (VBR)/Constant bit rate (CBR) q Motion Picture Expert Group (MPEG) 1: 1.5 Mbps q MPEG2: 3-6 Mbps q MPEG4 (.mp4): Less than 1 Mbps

Page 58: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-58 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Dynamic Adaptive Streaming over HTTP (DASH) q DASH provides an efficient method for video streaming q Standard Web Servers: No changes required to servers, Content

Distribution Networks (CDN), or HTTP protocol. q Mobile client controls what is downloaded using a “media

presentation description (MPD)” file defined by DASH q MPD contains URLs for segments q Client measures throughput and requests segments as needed.

Allows fast forward, rewind, etc.

Segment

Segment

Segment

Media

HTTP Requests

Client With DASH Engine

MPD Segment

Segment

Segment

Rate 1

Rate 2

Rate 3

… … …

Page 59: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-59 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Content Distribution Networks (CDN)

q To reduce latency to worldwide users, the data is replicated at many sites

q Users are directed to nearby site by DNS q netflix.com -> cdn_stl.com or cdn_sfo.com, …

Users

Network

Service/Content hosted on w

eb servers

Distributed Content Caches

Page 60: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-60 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Homework 2E

q A DASH system stores video at 5 different qualities (rates) and 15 minute segments. How many URLs will be required for a 2-hour movie?

Page 61: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-61 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Application Layer: Summary

1. Applications use TCP/UDP ports for communication 2. HTTP/FTP/SMTP are client-server protocols and use TCP

connections 3. HTTP is stateless but cookies allows servers to maintain state 4. Proxy servers improve performance by caching 5. BitTorrent is a P2P file distribution protocol and uses trackers

to keep list of peers 6. DASH allows clients to request different video segments as

needed 7. CDN’s directs users to to nearby copy via DNS

Page 62: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-62 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Scan This to Download These Slides

Raj Jain http://rajjain.com

Page 63: Application Layer - Washington University in St. Louis › ~jain › cse473-16 › ftp › i_2app.pdfApplication Layer Protocols q HTTP: HyperText Transfer Protocol q FTP: File Transfer

2-63 ©2016 Raj Jain Washington University in St. Louis http://www.cse.wustl.edu/~jain/cse473-16/

Related Modules

Audio/Video Recordings and Podcasts of Professor Raj Jain's Lectures, https://www.youtube.com/channel/UCN4-5wzNP9-ruOzQMs-8NUw

CSE473S: Introduction to Computer Networks (Fall 2016), http://www.cse.wustl.edu/~jain/cse473-16/index.html

Wireless and Mobile Networking (Spring 2016), http://www.cse.wustl.edu/~jain/cse574-16/index.html

CSE571S: Network Security (Fall 2014), http://www.cse.wustl.edu/~jain/cse571-14/index.html

CSE 473s: Introduction to Computer Networks (Course Overview), http://www.cse.wustl.edu/~jain/cse473-16/ftp/i_0int.pdf