ece453 – introduction to computer networks

48
ECE453 – Introduction to Computer Networks Lecture 16 – Application Layer (DNS, E-mail, Web, FTP)

Upload: venus-maxwell

Post on 30-Dec-2015

21 views

Category:

Documents


1 download

DESCRIPTION

ECE453 – Introduction to Computer Networks. Lecture 16 – Application Layer (DNS, E-mail, Web, FTP). application transport network data link physical. application transport network data link physical. application transport network data link physical. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: ECE453 – Introduction to Computer Networks

ECE453 – Introduction to Computer Networks

Lecture 16 – Application Layer(DNS, E-mail, Web, FTP)

Page 2: ECE453 – Introduction to Computer Networks

Applications and Application Level Protocols

The three concepts Service model Protocol Interface

Network application is more than application level protocols Client site Server site Application level protocol

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Page 3: ECE453 – Introduction to Computer Networks

Client/Server ParadigmClient

Initiates contact with server (speak first)

Typically request service from server

Question: identify who is/implements client in

Web? Email?

Server Provides requested service to

clients Question: identify who

is/implements the server counterpart in

Web? Email?

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

request

reply

Page 4: ECE453 – Introduction to Computer Networks

Which Transport Service Does Application Need? - Parameters

Data Loss Loss-tolerant applications, e.g. audio/video other app such as file transfer, telnet requires

100% reliable transmission

Bandwidth Bandwidth-sensitive applications, such as

multimedia, require a maximum amount of bandwidth

Elastic applications: can use whatever bandwidth available

Timing Some apps such as internet telephone requires

“low delay” to be effective

Page 5: ECE453 – Introduction to Computer Networks

Transport Service Required By Common Applications

Application

file transfere-mail

Web documentsreal-time audio/video

stored audio/videointeractive games

financial apps

Data loss

no lossno lossloss-tolerantloss-tolerant

loss-tolerantloss-tolerantno loss

Bandwidth

elasticelasticelasticaudio: 5Kb-1Mbvideo:10Kb-5Mbsame as above few Kbps upelastic

Time Sensitive

nononoyes, 100’s msec

yes, few secsyes, 100’s msecyes and no

Page 6: ECE453 – Introduction to Computer Networks

Internet Apps and Their Transport Layer Protocols

Application

e-mailremote terminal access

Web file transfer

streaming multimedia

remote file serverInternet telephony

Applicationlayer protocol

smtp [RFC 821]telnet [RFC 854]http [RFC 2068]ftp [RFC 959]proprietary(e.g. RealNetworks)NFSProprietary (private)(e.g., Vocaltec)

Underlyingtransport protocol

TCPTCPTCPTCPTCP or UDP

TCP or UDPtypically UDP

Page 7: ECE453 – Introduction to Computer Networks

DNS – Domain Name System

Name: panda.ece.utk.edu

IP: 160.36.30.108

Page 8: ECE453 – Introduction to Computer Networks

DNS: Mapping Name To Address

Name: panda.ece.utk.edu is used by humanIP address: a 32-bit numerical value used by machineDNS A distributed database, implemented by a

hierarchy of name servers Application level protocols used by hosts,

routers and name servers Internet intelligence is on the edge

Page 9: ECE453 – Introduction to Computer Networks

DNS Name Space

biz, info, name, proaero, coop, museum ICANN

http://www.icann.org/

Page 10: ECE453 – Introduction to Computer Networks

DNS – Why Not Centric?

Single point of failureTraffic volumeDistant name server means slow responseScalability

History: ARPANET begins with a single hosts.txt.

Page 11: ECE453 – Introduction to Computer Networks

DNS – Hierarchical View

Local DNS serverAuthoritative DNS serverRoot DNS server

                                                                                                              

          

Page 12: ECE453 – Introduction to Computer Networks

DNS: Where Are Root Servers?

                                                                                                              

          

Page 13: ECE453 – Introduction to Computer Networks

DNS: An Example

Case: Root server knows authoritative DNS server

requesting hostpanda.ece.utk.edu

worf.mcnc.org

root name server

local name serverdns.ece.utk.edu

1

23

45

6

Authoritative DNS serverdns.mcnc.org

Page 14: ECE453 – Introduction to Computer Networks

DNS: An Example

Case: Root server doesn’t know immediate authoritative DNS server, but know the intermediate one

requesting hostpanda.ece.utk.edu

people.anr.mcnc.org

root name server

local name serverdns.ece.utk.edu

1

23

67

8

Intermediate serverdns.mcnc.org

Authoritative serverdns.anr.mcnc.org

5

4

Page 15: ECE453 – Introduction to Computer Networks

DNS: Iterated Query

Root server replies with the name of intermediate serverIterated query vs. recursive query requesting host

panda.ece.utk.edupeople.anr.mcnc.org

root name server

local name serverdns.ece.utk.edu

1

23

8

Intermediate serverdns.mcnc.org

Authoritative serverdns.anr.mcnc.org

6

5

4

7

Iterated query

Page 16: ECE453 – Introduction to Computer Networks

DNS Caching

Once (any) server learns new mapping, it caches itThe cache will expire after some timeUpdate/notify mechanism is defined by IETF RFC 2136

Page 17: ECE453 – Introduction to Computer Networks

DNS Server and ServiceRunning on top of UDPPort number: 53Frequently used by other applications such as SMTP, FTP, HTTPImportant services

Host aliasing Mail server aliasing Load distribution (DNS rotation)

User utilities: dig, http://www.netliner.com/dig.htmlMore DNS information: see DNS NET http://www.dns.net/dnsrd/docs/

Page 18: ECE453 – Introduction to Computer Networks

*DNS Resource RecordDNS: distributed database storing resource

records (RR)RR format: (domain_name, ttl, class, type, value)

Page 19: ECE453 – Introduction to Computer Networks

*DNS: Message FormatDNS protocol : query and reply messages, both

with same message format

message header• identification: 16 bit # for query, reply to query uses same #• flags:

• query or reply• recursion desired• recursion available• reply is authoritative

Page 20: ECE453 – Introduction to Computer Networks

*DNS Protocol Message

Name, type fields for a query

RRs in reponseto query

records forauthoritative servers

additional “helpful”info that may be used

Page 21: ECE453 – Introduction to Computer Networks

Electronic MailThree major

components: user agents mail servers simple mail transfer

protocol: smtp

User Agent “mail reader” composing, editing,

reading mail messages e.g., Eudora, Outlook, elm,

Netscape Messenger outgoing, incoming

messages stored on server

user mailbox

outgoing message queue

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SMTP

Page 22: ECE453 – Introduction to Computer Networks

Electronic Mail: Mail Server

mailbox contains incoming messages (yet to be read) for usermessage queue of outgoing (to be sent) mail messagesCommon Mail Server: Sendmail MS Exchange

Page 23: ECE453 – Introduction to Computer Networks

SMTP: RFC 821

Use TCP for reliable transfer, use port number 25Message must be 7-bit ASCII

Page 24: ECE453 – Introduction to Computer Networks

[hqi@aicip hqi]$ telnet panda.ece.utk.edu 25Trying 160.36.30.108...Connected to panda.ece.utk.edu.Escape character is '^]'.220 panda.ece.utk.edu ESMTP Sendmail 8.11.6/8.11.6; Thu, 21 Nov 2002 09:54:04 -0500HELO panda.ece.utk.edu250 panda.ece.utk.edu Hello pegasus.ece.utk.edu [160.36.30.110], pleased to meet youMAIL FROM: <[email protected]>250 2.1.0 <[email protected]>... Sender okRCPT TO: <[email protected]>250 2.1.5 <[email protected]>... Recipient okDATA354 Enter mail, end with "." on a line by itselfdo you like ketchup?how about pickles?.250 2.0.0 gALEt5U25932 Message accepted for deliveryQUIT221 2.0.0 panda.ece.utk.edu closing connectionConnection closed by foreign host.

Page 25: ECE453 – Introduction to Computer Networks

Mail Access Protocol – Final Delivery

SMTP: delivery/storage to receiver’s server Mail access protocol: retrieval from server

– POP: Post Office Protocol [RFC 1939] (port 110)o authorization (agent <-->server) and download o Does not maintain state across POP sessionso Cannot manipulate emails at the server side

– IMAP: Internet Mail Access Protocol [RFC 1730]o more features (more complex)o manipulation of stored msgs on servero Maintain state for the user

– HTTP: Hotmail , Yahoo! Mail, etc.– Slow

useragent

sender’s mail server

useragent

SMTP SMTP POP3,IMAP, or

HTTPreceiver’s mail server

http

Page 26: ECE453 – Introduction to Computer Networks

Summary

Application Client Server Protocol

What type of service

Through what interface

Which port

DNS Aliasing vs. load

distribution “nslookup” and

“dig”

Email SMTP Mail access protocol

POP3 IMAP HTTP

Page 27: ECE453 – Introduction to Computer Networks

Web: TerminologyWeb page

Consists of “objects” Addressed by “url”

(universal resource locator)

Most of web page One base web page Several referenced

“objects”

URL has two components A host name and a path http://panda.ece.utk.edu/

~hqi/teaching.html

Web client Netscape

communicator Mozilla Microsoft IE browser

Web server Apache Microsoft Internet

Information Server (IIS)

Page 28: ECE453 – Introduction to Computer Networks

Web: the http Protocol

Web application layer protocol: a hyper text transfer protocol, httpDefined by

HTTP 1.0, RFC 1945 HTTP 1.1, RFC 2068

Client/Server Mode Client: browser asks for

objects, and display it Request Display

Server: provide objects in response to requests

PC runningExplorer

Server running

NCSA Webserver

Mac runningNavigator

http request

http re

quest

http response

http re

sponse

Page 29: ECE453 – Introduction to Computer Networks

Web: http Operation Flow

HTTP utilizes TCP transport servicesHTTP client initiates TCP connection (create socket) to server, at port 80Server accepts this connection from clientHTTP messages (defined by HTTP protocol) are exchanged between http client and http serverTCP connection closed

HTTP is stateless Server doesn’t

maintain the state of past requests ‘back’?

Page 30: ECE453 – Introduction to Computer Networks

HTTP ExampleSuppose user enters URL

www.someSchool.edu/someDepartment/home.index

1a. http client initiates TCP connection to http server (process) at www.someSchool.edu. Port 80 is default for http server.

2. http client sends http request message (containing URL) into TCP connection socket (plus another acknowledge message)

1b. http server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client

3. http server receives request message, forms response message containing requested object (someDepartment/home.index), sends message into socket

(contains text, references to 10

jpeg images)

time

Page 31: ECE453 – Introduction to Computer Networks

HTTP Example (cont’d)

5. http client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects

6. Steps 1-5 repeated for each of 10 jpeg objects

4. http server closes TCP connection.

time

• Two RTT (Round-trip time)• Slow start• Place burden on the Web server

Page 32: ECE453 – Introduction to Computer Networks

HTTP: Persistent and Non-persistent Connection

Non-persistent HTTP 1.0 Server parses request, responds, then

closes TCP connection Each object requires 2 RTT Each object suffers slow start

Persistent HTTP 1.1 On the same TCP connection, server parses

request, responds, and parses new requests

Page 33: ECE453 – Introduction to Computer Networks

SMTP vs. HTTP

HTTP: Direct connection, no intermediate mail serversBoth use persistent connectionHTTP is a pull protocol, while SMTP is a push protocolSMTP: 7-bit ASCII format, message ended with a line consisting of only a period

Page 34: ECE453 – Introduction to Computer Networks

*HTTP Message Format

two types of http messages: request, responsehttp request message:

ASCII (human-readable format)

GET /somedir/page.html HTTP/1.0 User-agent: Mozilla/4.0 Accept: text/html,image/gif,image/jpeg Accept-language:fr

(extra carriage return, line feed)

request line(GET, POST,

HEAD commands)

header lines

Carriage return, line feed

indicates end of message

Page 35: ECE453 – Introduction to Computer Networks

*HTTP Request: General Format

Page 36: ECE453 – Introduction to Computer Networks

*HTTP Message Format: Response

HTTP/1.0 200 OK Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html data data data data data ...

status line(protocol

status codestatus phrase)

header lines

data, e.g., requestedhtml file

Page 37: ECE453 – Introduction to Computer Networks

*HTTP Response: Status Code

200 OK request succeeded, requested object later in this

message

301 Moved Permanently requested object moved, new location specified

later in this message (Location:)

400 Bad Request request message not understood by server

404 Not Found requested document not found on this server

505 HTTP Version Not Supported

Page 38: ECE453 – Introduction to Computer Networks

Try Out http (client side) For Yourself

telnet panda.ece.utk.edu 80

open TCP connection to panda port 80, anything you type be sent to panda port 80 socket

Telnet to your favorite web site

Type in request, and look at the response

GET /~hqi/index.html HTTP/1.0

Page 39: ECE453 – Introduction to Computer Networks

[hqi@com779 hqi]$ telnet panda.ece.utk.edu 80

Trying 160.36.30.108...

Connected to panda.ece.utk.edu.

Escape character is '^]'.

get /~hqi/index.html http/1.0

HTTP/1.1 501 Method Not Implemented

Date: Sun, 02 Sep 2001 21:03:28 GMT

Server: Apache/1.3.19 (Unix) (Red-Hat/Linux) PHP/4.0.4pl1

Allow: GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, PATCH, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, TRACE

Connection: close

Content-Type: text/html; charset=iso-8859-1

Page 40: ECE453 – Introduction to Computer Networks

[hqi@com779 hqi]$ telnet panda.ece.utk.edu 80

Trying 160.36.30.108...

Connected to panda.ece.utk.edu.

Escape character is '^]'.

GET /~hqi/index.html http/1.0

HTTP/1.1 200 OK

Date: Sun, 02 Sep 2001 21:05:43 GMT

Server: Apache/1.3.19 (Unix) (Red-Hat/Linux) PHP/4.0.4pl1

Last-Modified: Sat, 07 Jul 2001 15:42:14 GMT

ETag: "1f222e-df9-3b472dd6"

Accept-Ranges: bytes

Content-Length: 3577

Connection: close

Content-Type: text/html

<HTML>

……

</HTML>

Connection closed by foreign host.

Page 41: ECE453 – Introduction to Computer Networks

Add-on Features: Authentication

Purpose of authentication: control access to documentMeans: user name and passwordUser must present password on each request, Authorization:lineServer asks for it by giving it the response with WWW authenticate:

client server

usual http request msg401: authorization req.

WWW authenticate:

usual http request msg

+ Authorization:lineusual http response

msg

usual http request msg

+ Authorization:lineusual http response

msg

time

Page 42: ECE453 – Introduction to Computer Networks

Add-on Feature: Cookies

Server sends user cookie in response message:

Set-cookie: 1678453

Client presents cookie in later request

cookie: 1678453

Server matches cookies with stored information: such as user preference, password etc

client server

usual http request msgusual http response

+Set-cookie: #

usual http request msg

cookie: #usual http response

msg

usual http request msg

cookie: #usual http response msg

cookie-spectificaction

cookie-spectificaction

Page 43: ECE453 – Introduction to Computer Networks

Add-on Feature: Web Caches or Proxy Servers

Goal: to satisfy user request without invoking origin serverUser makes request, the object requested has been cached, then proxy server will reply, else proxy server request the object for client and then response

client

Proxyserver

client

http request

http re

quest

http response

http re

sponse

http re

quest

http re

sponse

http requesthttp response

origin server

origin server

Page 44: ECE453 – Introduction to Computer Networks

Why Web Caching?

Cache should be closer to the clientsFaster responseReduce traffic (pay less money)

Web cache: Cost is low

originservers

public Internet

institutionalnetwork 10 Mbps LAN

1.5 Mbps access link

institutionalcache

Page 45: ECE453 – Introduction to Computer Networks

FTP: File Transfer Protocol

transfer file to/from remote host client/server model

– client: initiates transfer (either to/from remote)– server: remote host

ftp: RFC 959

file transfer FTPserver

FTPuser

interface

FTPclient

local filesystem

remote filesystem

user at host

Page 46: ECE453 – Introduction to Computer Networks

FTP: Operation Flowftp client contacts ftp server at port 21, specifying TCP as transport protocoltwo parallel TCP connections opened: control: exchange

commands, responses between client, server“out of band control”

data: file data to/from serverftp server maintains “state”: current directory, earlier authentication

FTPclient

FTPserver

TCP control connection

port 21

TCP data connectionport 20

Data connection is closed whenever it finished transferring one file.

Page 47: ECE453 – Introduction to Computer Networks

FTP: Command and ResponseSample commands: sent as ASCII text over

control channel USER username PASS password LIST return list of file in

current directory RETR filename retrieves

(gets) file STOR filename stores

(puts) file onto remote host

Sample return codes status code and phrase

(as in http) 331 Username OK,

password required 125 data connection

already open; transfer starting

425 Can’t open data connection

452 Error writing file

Page 48: ECE453 – Introduction to Computer Networks

Summary

Application Client Server Protocol

What type of service Through what interface Which port

DNS Aliasing vs. load distribution “dig” UDP

Email SMTP Mail access protocol

POP3 IMAP HTTP

TCP

Web http Stateless Persistent Pull vs. push Cookies, authentication, proxy

serverFile transfer

ftp Two connection flows Maintain state

Application protocols Push vs. pull State vs. stateless Persistent vs. non-persistent Port number Service model used