2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name...

64
2: Application Layer 1 Chapter 7 The Application Layer (Cont’d) Network Security Domain Name Server Network management Applications File Transfer Protocol, Email, Http, Telnet, …. rights reserved. No part of these slides may be reproduced, rights reserved. No part of these slides may be reproduced, orm or by any means, without permission in writing from orm or by any means, without permission in writing from rofessor Wen-Tsuen Chen (email: [email protected]). rofessor Wen-Tsuen Chen (email: [email protected]).
  • date post

    22-Dec-2015
  • Category

    Documents

  • view

    222
  • download

    3

Transcript of 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name...

Page 1: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 1

Chapter 7The Application Layer (Cont’d)Chapter 7The Application Layer (Cont’d)

Network Security Domain Name Server Network management Applications

File Transfer Protocol, Email, Http, Telnet, ….

© © All rights reserved. No part of these slides may be reproduced, in anyAll rights reserved. No part of these slides may be reproduced, in any form or by any means, without permission in writing from form or by any means, without permission in writing from Professor Wen-Tsuen Chen (email: [email protected]).Professor Wen-Tsuen Chen (email: [email protected]).

Page 2: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 2

Email SecurityEmail Security PGP: Pretty Good Privacy, by Phil Zimmermaun in 1995. Support text compression, secrecy and digital signatures.

Page 3: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 3

PGP message formatPGP message format

Page 4: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 4

PEM: Privacy Enhanced MailPEM: Privacy Enhanced Mail

An official Internet standard described in RFC 1421-1424.

Support privacy and authentication for RFC 822 based email systems.

The message together with its message digest is encrypted using DES with a one-time key that is enclosed along with the message.

The key can be protected with RSA and certified by certification authorities.

Page 5: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 5

Page 6: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 6

DNS: Domain Name SystemPeople: many

identifiers: SSN, name, passport #

Internet hosts, routers: IP address (32 bit) -

used for addressing datagrams

“name”, e.g., gaia.cs.umass.edu - used by humans

Q: map between IP addresses and name ?

Domain Name System: A distributed database

implemented in hierarchy of many name servers

An application-layer protocol that allows host, routers, name servers to communicate to resolve names (address/name translation) DNS provides a core

Internet function, implemented as application-layer protocol

DNS is an example of the Internet design philosophy of placing complexity at network’s “edge”

Page 7: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 7

DNS

Why not centralize DNS? single point of failure traffic volume distant centralized

database maintenance

doesn’t scale!

DNS services Hostname to IP

address translation Host aliasing

Canonical and alias names

Mail server aliasing Load distribution

Replicated Web servers: set of IP addresses for one canonical name

Page 8: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 8

Root DNS Servers

com DNS servers org DNS servers edu DNS servers

poly.eduDNS servers

umass.eduDNS servers

yahoo.comDNS servers

amazon.comDNS servers

pbs.orgDNS servers

Distributed, Hierarchical Database

Client wants IP for www.amazon.com; 1st approx: Client queries a 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

Page 9: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 9

DNS name serversThere are three types of name

servers:(1) local name servers:

each ISP, company has local (default) name server

host DNS query first goes to local name server

(2) root name servers: top level name servers ( to be explained next)

(3) authoritative name servers: for a host: stores that host’s

IP address, name can perform name/address

translation for that host’s name

The DNS is a distributed design

A large number of name servers organized in a hierarchical fashion and distributed around the world

no server has all name-to-IP address mappings

Page 10: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 10

DNS: Root name servers contacted by local name server that can not resolve name root name server:

gets mapping returns mapping to local name server contacts authoritative name server if name mapping not

known

b USC-ISI Marina del Rey, CAl ICANN Marina del Rey, CA

e NASA Mt View, CAf Internet Software C. Palo Alto, CA

i NORDUnet Stockholm

k RIPE London

m WIDE Tokyo

a NSI Herndon, VAc PSInet Herndon, VAd U Maryland College Park, MDg DISA Vienna, VAh ARL Aberdeen, MDj NSI (TBD) Herndon, VA

13 root name servers worldwide

Page 11: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 11

TLD and Authoritative Servers Top-level domain (TLD) servers:

responsible for com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp. Network Solutions maintains servers for com

TLD Educause for edu TLD

Authoritative DNS servers: organization’s DNS servers, providing authoritative hostname to IP mappings for organization’s servers (e.g., Web and mail). Can be maintained by organization or service

provider

Page 12: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 12

Local Name Server

Does not strictly belong to hierarchy Each ISP (residential ISP, company,

university) has one. Also called “default name server”

When a host makes a DNS query, query is sent to its local DNS server Acts as a proxy, forwards query into

hierarchy.

Page 13: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 13

requesting hostcis.poly.edu

gaia.cs.umass.edu

root DNS server

local DNS serverdns.poly.edu

1

23

4

5

6

authoritative DNS serverdns.cs.umass.edu

78

TLD DNS server

Example

Host at cis.poly.edu wants IP address for gaia.cs.umass.edu

Page 14: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 14

requesting hostcis.poly.edu

gaia.cs.umass.edu

root DNS server

local DNS serverdns.poly.edu

1

2

45

6

authoritative DNS serverdns.cs.umass.edu

7

8

EDU DNS server

3

Recursive queries

recursive query: puts burden of

name resolution on contacted name server

heavy load?

iterated query: contacted server

replies with name of server to contact

“I don’t know this name, but ask this server”

Page 15: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 15

Recursive and iterated queries

requesting hostcis.poly.edu

gaia.cs.umass.edu

root DNS server

local DNS serverdns.poly.edu

1

23

4

5

6

authoritative DNS serverdns.cs.umass.edu

78

TLD DNS server

iterated queryrecursive query

Typically, all queries are iterated except for the query from the host to the local name server.

Page 16: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 16

DNS: caching and updating records once (any) name server learns mapping, it

caches mapping cache entries timeout (disappear) after

some time (usually two days) Until recently, the contents of each DNS

servers were configured statically from a configuration file created by a system manager.

More recently, an UPDATE option has been added to the DNS protocol to allow data to be added or deleted from the database via DNS messages.

DNS dynamic update mechanism is specified in RFC 2136

Page 17: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 17

DNS recordsDNS: distributed database storing resource records (RR)

Type=NS name is domain (e.g.

foo.com) value is IP address of

authoritative name server for this domain

RR format: (name, value, type, ttl)

Type=A name is hostname value is IP address

Type=CNAME name is alias name for some

“cannonical” (the real) name

www.ibm.com is really servereast.backup2.ibm.com value is cannonical name

Type=MX name is alias name for

some mail server value is the canonical

name of the mail server

Page 18: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 18

DNS protocol, messagesDNS 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 19: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 19

DNS protocol, messages

Name, type fields for a query

RRs in reponse to queryA hostname can have multiple IP addresses

records for otherauthoritative servers

additional “helpful”information that may be used

e.g. IP address for the canonical hostname of the mail server

Page 20: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 20

Inserting records into DNS

Example: just created startup “Network Utopia” Register name networkuptopia.com at a registrar

(e.g., Network Solutions) Need to provide registrar with names and IP addresses

of your authoritative name server (primary and secondary)

Registrar inserts two RRs into the com TLD server:

(networkutopia.com, dns1.networkutopia.com, NS)(dns1.networkutopia.com, 212.212.212.1, A)

Put in authoritative server Type A record for www.networkuptopia.com and Type MX record for networkutopia.com

How do people get the IP address of your Web site?

Page 21: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 21

Network Management SystemsNetwork Management Systems

A network management system is a collection of tools for network monitoring and control.

It has the following key elements: Management station, or manager. Agent in managed nodes, equipments etc. Management Information base (MIB). Network management protocol.

Page 22: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 22

Page 23: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 23

The management station will have A set of management applications for data

analysis, fault recovery etc. An Interface by which the network manager

may monitor and control the network. The capability of translating the network

manager’s requirements into the actual monitoring and control of remote elements in the network.

A database of network management information extracted from the database of all the managed entities in the network.

Page 24: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 24

The agent is an active element residing in hosts, bridges, routers, and hubs etc. that responds to requests for information or actions from a management station, and may provide the management station (through trap) with important but unsolicited information.

An MIB is a collection of objects which are resources in the network that may be managed.

Network management protocol for TCP/IP networks is SNMP (Simple network management protocol), and for OSI-based networks is CMIP (Common Management Information Protocol).

Page 25: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 25

SNMP: Simple Network Management ProtocolSNMP: Simple Network Management Protocol

First Proposed in 1988, RFC 1028, RFC 1067 Version 1 of SNMP in May 1990, RFC 1157 SNMPv2 issued in 11993, RFCs 1441 to 1452.

SNMP provides the infrastructure for network management applications.

The object definition language ASN.1 (Abstract Syntax Notation One), taken from OSI, is used for defining objects in MIBs.

Page 26: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 26

Structure of Management InformationStructure of Management Information

The SMI defines the general framework within which an MIB can be defined and constructed.

The SMI identifies the data types (only simple) the scalars and two-dimensional arrays of scalars, called tables) that can be used in the MIB, and how resources within the MIB are represented and named.

Page 27: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 27

Page 28: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 28

SNMP ProtocolSNMP Protocol

Provides a basic mechanism for the exchange of management information between manager and agent.

Get-bulk-request, Inform-request, Response, and SNMPv2-trap are SNMPv2 specific.

An SNMPv2-trap is generated by an agent for reporting unusual events.

Inform-request is sent by a manager on behalf of an application, to another manager for providing management information to an application.

The manager receiving an Inform Request acknowledges receipt with Response.

Page 29: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 29

in lexicographic order

Response Acknowledgement of receipt by Inform-request

Page 30: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 30

Internet apps: application, transport protocols

Application

e-mailremote terminal access

Web file transfer

streaming multimedia

Internet telephony

Applicationlayer protocol

SMTP [RFC 2821]Telnet [RFC 854]HTTP [RFC 2616]FTP [RFC 959]proprietary(e.g. RealNetworks)proprietary(e.g., Dialpad)

Underlyingtransport protocol

TCPTCPTCPTCPTCP or UDP

typically UDP

Page 31: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 31

FTP: the file transfer protocol

transfer file to/from remote host client/server model

Client side: the side that initiates transfer (either to/from remote)

Server side: remote host ftp: RFC 959 ftp server: port 21

file transfer FTPserver

FTPuser

interface

FTPclient

local filesystem

remote filesystem

user at host

Page 32: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 32

FTP: separate control, data connections

FTP client contacts FTP server at port 21, specifying TCP as transport protocol

Client obtains authorization over control connection –- username, password

Client browses remote directory by sending commands over control connection.

When server receives a command for a file transfer, the server opens a TCP data connection to client

After transferring one file, server closes connection.

FTPclient

FTPserver

TCP control connection

port 21

TCP data connectionport 20

Server opens a second TCP data connection to transfer another file.

Control connection: “out of band”

FTP server maintains “state”: current directory, earlier authentication

Page 33: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 33

FTP commands, responses

Sample 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 codesstatus 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 34: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 34

Electronic Mail

Three major components of a mail system:

user agents mail servers simple mail transfer

protocol: SMTP

User Agent Also known as “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 35: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 35

Electronic Mail: mail servers

Mail Servers mailbox contains

incoming messages for user

message queue of outgoing (to be sent) mail messages

SMTP protocol between mail servers to send email messages client: sending mail

server “server”: receiving

mail server

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SMTP

mailbox

message queue

user mailbox

outgoing message queue

Page 36: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 36

Electronic Mail: SMTP [RFC 2821]

Simple Mail Transfer Protocol (SMTP) uses TCP to reliably transfer email message from

client to server, port 25 direct transfer: sending server to receiving server three phases of transfer

handshaking (greeting) transfer of messages closure

command/response interaction commands: ASCII text response: status code and phrase

messages must be in 7-bit ASCII

Page 37: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 37

Scenario: Alice sends message to Bob1) Alice uses user agent to

compose message and “to” [email protected]

2) Alice’s user agent sends message to her mail server; message placed in message queue

3) Alice’s mail server (Client side) of SMTP opens TCP connection with Bob’s mail server (server side)

4) SMTP client sends Alice’s message over the TCP connection

5) Bob’s mail server places the message in Bob’s mailbox

6) Bob invokes his user agent to read message

useragent

mailserver

mailserver user

agent

1

2 3 4 56

mailboxmessage queue

user mailbox

outgoing message queue

Page 38: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 38

Sample SMTP interaction The following transcript begins as soon as the TCP connection is established: S: 220 hamburger.edu C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: <[email protected]> S: 250 [email protected]... Sender ok C: RCPT TO: <[email protected]> S: 250 [email protected] ... Recipient ok C: DATA S: 354 Enter mail, end with "." on a line by itself C: Do you like ketchup? C: How about pickles? C: . S: 250 Message accepted for delivery C: QUIT S: 221 hamburger.edu closing connection

serverclient

Page 39: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 39

Try SMTP interaction for yourself:

telnet servername 25 see 220 reply from server enter HELO, MAIL FROM, RCPT TO, DATA, QUIT

commands above lets you send email without using email

client (reader)

Page 40: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 40

SMTP: final words

SMTP uses persistent connections

SMTP requires message (header & body) to be in 7-bit ASCII

SMTP server uses CRLF.CRLF to determine end of message

Comparison with HTTP: HTTP: pull protocol (client’s

point of view) SMTP: push protocol

both have ASCII command/response interaction, status codes

HTTP does not require message to be in 7-bit ASCII

HTTP: one object in one response message

SMTP: multiple objects can be sent in one message

Page 41: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 41

Mail message format

SMTP: protocol for exchanging email messages

RFC 822: standard for text message format:

header lines, e.g., To: From: Subject:different from SMTP

commands! body

the “message”, ASCII characters only

header

body

blankline

Page 42: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 42

Message format: multimedia extensions

MIME (Multipurpose Internet Mail extensions) : multimedia mail extension, RFC 2045, 2056

additional lines in message header declare MIME content type

From: [email protected] To: [email protected] Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg

base64 encoded data ..... ......................... ......base64 encoded data

multimedia datatype, subtype,

parameter declaration

method usedto encode data

MIME version

encoded data

Page 43: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 43

MIME typesContent-Type: type/subtype; parameters

Currently, seven types are defined:

(1) Text example subtypes: plain,

html

(2) Image example subtypes: jpeg,

gif

(3) Audio exampe subtypes: basic

(8-bit mu-law encoded), 32kadpcm (32 kbps Adaptive Differential Pulse Code Modulation coding)

(4) Video example subtypes: mpeg,

quicktime

(5)Application other data that must be

processed by reader before “viewable”

example subtypes: msword, octet-stream

(6) Multipart one or more different sets of data

are combined in a single body example subtypes: mixed,

alternative (alternative version of the same information)

(7) Message encapsulate another mail

message example subtypes: rfc822, partial

Page 44: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 44

Example of Multipart Type

From: [email protected] To: [email protected] Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=StartOfNextPart --StartOfNextPartDear Bob, Please find a picture of a crepe.--StartOfNextPartContent-Transfer-Encoding: base64Content-Type: image/jpegbase64 encoded data ..... ......................... ......base64 encoded data --StartOfNextPartDo you want the reciple?

Page 45: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 45

Header line inserted by the receiving server

Received: from crepes.fr by hamburger.edu; 12 Oct 98 15:27:39 GMT

From: [email protected] To: [email protected] Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg

base64 encoded data ..... ......................... ......base64 encoded data

Page 46: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 46

Mail access protocols

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

POP3: Post Office Protocol, version 3 [RFC 1939]• authorization (agent <--> server) and download

IMAP: Internet Mail Access Protocol [RFC 2060]• more features (more complex)• manipulation of stored messages on server

HTTP: Hotmail , Yahoo! Mail, etc.

useragent

sender’s mail server

useragent

SMTP SMTP Mail accessprotocol

receiver’s mail server

Page 47: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 47

POP3 protocol(1) Client opens a TCP

connection to the mail server on port 110

(2) authorization phase client commands:

user: declare username pass: password

server responses +OK -ERR

(3) transaction phase, client: list: list message numbers retr: retrieve message by

number dele: delete Quit(4) update phase : mail server

deletes the messages marked for deletion

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 1 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

Message size

Message number

Page 48: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 48

POP3 (more) and IMAP

More about POP3 Previous example uses

“download and delete” mode.

Bob cannot re-read e-mail if he changes client

“Download-and-keep” mode: copies of messages on different clients

POP3 is stateless across sessions

IMAP Keep all messages in

one place: the server Allows user to

organize messages in folders

IMAP keeps user state across sessions: names of folders and

mappings between message IDs and folder name

Page 49: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 49

Web and HTTPFirst some jargon Web page consists of objects An object is a file such as an HTML file, a JPEG

image, a Java applet, an audio file,… A Web page consists of a base HTML-file and

several referenced objects The base HTML file references the other

objects in the page with the object’s URLs (Uniform Resource Locators)

Example URL:www.someschool.edu/someDept/pic.gif

host name path name

Page 50: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 50

HTTP overview

HTTP: hypertext transfer protocol

Web’s application layer protocol

client/server model client: browser that

requests, receives, “displays” Web objects

server: Web server sends objects in response to requests

HTTP 1.0: RFC 1945 HTTP 1.1: RFC 2616

PC runningExplorer

Server running

Apache Webserver

Mac runningNavigator

HTTP request

HTTP request

HTTP response

HTTP response

Page 51: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 51

HTTP overview (continued)

Uses TCP: client initiates TCP

connection (creates socket) to server, port 80

server accepts TCP connection from client

HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)

TCP connection closed

HTTP is “stateless” server maintains no

information about past client requests

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

Page 52: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 52

HTTP connectionsNonpersistent HTTP At most one object is

sent over a TCP connection.

HTTP/1.0 uses nonpersistent HTTP

Persistent HTTP Multiple objects can be

sent over single TCP connection between client and server.

A new connection need not be set up for the transfer of each Web object

HTTP/1.1 uses persistent connections in default mode – can be configured to use nonpersistent connection

Page 53: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 53

Nonpersistent HTTPSuppose user enters URL www.someSchool.edu/someDepartment/home.index

1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80

2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index

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, and sends message into its socket

time

(contains text, references to 10

jpeg images)

Page 54: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 54

Nonpersistent HTTP (cont.)

5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 references to the 10 jpeg objects

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

4. HTTP server closes TCP connection.

time

Page 55: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 55

Response time modeling

Definition of RRT: time to send a small packet to travel from client to server and back.

Response time: one RTT to initiate TCP

connection one RTT for HTTP request

and first few bytes of HTTP response to return

file transmission timetotal = 2RTT+transmit time

time to transmit file

initiate TCPconnection

RTT

requestfile

RTT

filereceived

time time

Page 56: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 56

Persistent HTTP

Nonpersistent HTTP issues: requires 2 RTTs per object OS must work and allocate

host resources for each TCP connection

but browsers often open parallel TCP connections to fetch referenced objects

Persistent HTTP server leaves connection

open after sending response

subsequent HTTP messages between same client/server are sent over connection

Persistent without pipelining: client issues new request

only when previous response has been received

one RTT for each referenced object

Persistent with pipelining: default in HTTP/1.1 client sends requests as

soon as it encounters a referenced object

as little as one RTT for all the referenced objects

Two versions of persistent connections:

Page 57: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 57

HTTP request message

two types of HTTP messages: request, response

HTTP request message: ASCII (human-readable format)

GET /somedir/page.html HTTP/1.1Host: www.someschool.edu User-agent: Mozilla/4.0Connection: close 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 58: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 58

Explanation of the example

GET /somedir/page.html HTTP/1.1 -- Request to return the object /somedir/page.html -- The browser implements version HTTP/1.1

Host: www.someschool.edu -- Specifies the host on which the object resides

User-agent: Mozilla/4.0 -- Specifies the browser type that is making the request

Connection: close -- Indicates that the connection SHOULD NOT be considered

`persistent‘. It wants the server to close the connection after the current request/response is complete

Accept-language:fr -- Indicates that the user prefers to receive a French

version of the object

Page 59: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 59

HTTP request message: general format

Page 60: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 60

Method types

HTTP/1.0 GET : Return the object POST : Send

information to be stored on the server

HEAD Return only information

about the object, such as how old it is, but not the object itself

HTTP/1.1 GET, POST, HEAD PUT

Uploads a new copy of existing object in entity body to path specified in URL field

DELETE deletes object

specified in the URL field

Page 61: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 61

Uploading form input

Post method: Web page often

includes form input Input is uploaded to

server in entity body

URL method: Uses GET method Input is uploaded in

URL field of request line:

www.somesite.com/animalsearch?monkeys&banana

Page 62: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 62

HTTP response messageAn HTTP response consists of the following: 1. A status line, which indicates the success or failure of the request2. Header lines: A description of the information in the response. This

is the metadata or meta information3. The actual information requested

HTTP/1.1 200 OK Connection closeDate: 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 code status

phrase)

header lines

data, e.g., requestedHTML file

blank line

Page 63: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 63

HTTP response status codes

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

In first line in server -> client response message.A few sample codes:

Page 64: 2: Application Layer1 Chapter 7 The Application Layer (Cont’d) r Network Security r Domain Name Server r Network management r Applications í File Transfer.

2: Application Layer 64

Trying out HTTP (client side) for yourself

1. Telnet to your favorite Web server:

Opens TCP connection to port 80(default HTTP server port) at www.eurecom.fr.Anything typed is sent to port 80 at www.eurecom.fr

telnet www.eurecom.fr 80

2. Type in a GET HTTP request:

GET /~ross/index.html HTTP/1.0 By typing this in (hit carriagereturn twice), you sendthis minimal (but complete) GET request to HTTP server

3. Look at response message sent by HTTP server!