65
Network Applications 9/14/2009

Network Applications 9/14/2009. 2 Outline Recap r ISO/OSI Layering and Internet Layering r Application layer overview r Examples

Embed Size (px)

Citation preview

Network Applications

9/14/2009

2

Outline

Recap ISO/OSI Layering and Internet Layering Application layer overview Examples

3

Recap: Summary of the Taxonomy of Communication Networks

circuit-switchednetwork

communication network

switchednetwork

broadcastcommunication

packet-switched network

datagram network

virtual circuit network

4

Recap: Statistical Multiplexing

no reservation: all arrivals into the single link with rate R, the queueing delay + transmission delay:

reservation: each flow uses its own reserved (sub)link with rate R/n, the queueing delay + transmission delay:

A simple model to compare bandwidth efficiency of - reservation/dedication (aka circuit-switching) and - no reservation (aka packet switching)setup - a single bottleneck link with rate R - n flows; each flow has an arrival rate of a/n

1

1

R

L

1

1

R

Ln

Recap: Layering

Layered reference model for discussion

Modularization eases maintenance, updating of system

Physical vs logical communication

Key design decision: what functionalities to put in each layer?

5

6

Recap: End-to-End Arguments

If a higher layer can do it, don’t do it at a lower layer -- the higher the layer, the more it knows about the best what it needs

Add functionality in lower layers iff it (1) is used by and improves performance of a large

number of (current and potential future) applications,(2) does not hurt (too much) other applications, and (3) does not increase (too much) complexity/overhead

Practical tradeoff, e.g., allow multiple interfaces at a lower layer (one

provides the function; one does not)

7

Examples We used reliability as an example

Assume two layers (L1: network; L2: end-to-end). Where may you implement the following functions? security (privacy of traffic) quality of service (e.g., delay/bandwidth

guarantee) congestion control (e.g., not to overwhelm

network links or receiver)

L1

L2

L1

S R

L1

L2 A

8

Challenges

Challenges to build a good (networking) system: find the right balance between:

reuse, interoperability,implementation effort

(apply layering concepts)

end-to-end arguments

performance

No universal answer: the answer depends on the goals and assumptions!

9

Outline

Recap ISO/OSI Layering and Internet Layering Application layer overview Examples

10

ISO/OSI Reference Model

Seven layers lower three layers are hop-by-hop next four layers are end-to-end (host-to-

host)Application

Presentation

Session

Transport

Network

Datalink

Physical

Application

Presentation

Session

Transport

Network

Datalink

Physical

Network

Datalink

Physical

Physical medium

11

Internet Layering

Lower three layers are hop-by-hop Next two layers are end-to-end

Application

Transport

Network

Datalink

Physical

Application

Transport

Network

Datalink

Physical

Network

Datalink

Physical

Physical medium

12

Internet Protocol Layers

A rough division Five layers

Application: supporting network applications

• ftp, smtp, http, p2p, IP telephony Transport: host-host data transfer

• tcp, udp Network: routing of datagram from

source to destination

• ip Link: data transfer between neighboring

network elements

• ethernet, 802.11, cable, DSL, … Physical: bits “on the wire”

• cable, wireless, optical fiber

application

transport

network

link

physical

13

The Hourglass Architecture of the Internet

networkinfrastructure

end users

IP

Ethernet Cable/DSLWireless

TCP UDP

TelnetEmail FTPWWW

14

Link Layer: Services Provided by Ethernet

Multiple access control send frame to peer sharing the

common channel

Multiplexing/demultiplexing from/to the network layer

Error detectionIP

Ethernet Cable/DSLWireless

TCP UDP

TelnetEmail FTPWWW

15

Network Layer: Services Provided by IP

Routing best-effort to send packets from

source to destination

Multiplexing/demultiplexing from/to the transport

Fragmentation and reassembling partition a fragment into smaller

packets removed in IPv6

Error detection Certain QoS/CoS Does not provide

reliability or reservation

IP

Ethernet Cable/DSLWireless

TCP UDP

SSLTelnetEmail FTPWWW

16

Network Layer: IPv4 Header

17

Services Provided by UDP

A connectionless service Does not provide: connection

setup, reliability, flow control, congestion control, timing, or bandwidth guarantee why is there a UDP?

IP

Ethernet Cable/DSLWireless

TCP UDP

TelnetEmail FTPWWW

18

Transport Layer: Services Provided by TCP

Multiplexing/demultiplexing Reliable transport

between sending and receiving processes

setup required between sender and receiver: a connection-oriented service

Flow control sender won’t overwhelm receiver

Congestion control throttle sender when network

overloaded Error detection Does not provide

timing, minimum bandwidth guarantees

IP

Ethernet FDDIWireless

TCP UDP

TelnetEmail FTPWWW

19

Transport Layer: TCP Header

Secure Socket Layer Architecture

HTTP POP3

SSL Record-Layer Packet Format

20: change_cipher21: alert

22: handshake23: application

22

Summary: The Big Picture of the Internet Hosts and routers:

>600 mil. Hosts (2009) organized roughly hierarchical backbone links 10 40Gbps

Software: datagram switching with virtual

circuit support at backbone layered network architecture

• use end-to-end arguments to determine the servicesprovided by each layer

the hourglass architecture of the Internet

IP

Ethernet Cable/DSLWireless

TCP UDP

TelnetEmail FTPWWWSSL

23

Outline

Recap ISO/OSI Layering and Internet Layering Application layer overview Examples

24

Application Layer: Goals Conceptual + implementation aspects of

network application protocols client server paradigm peer to peer paradigm network app. programming

Learn about protocols by examining common application-layer protocols smtp/pop dns http ftp p2p

25

Network Applications vs. Application-layer Protocols

Network application: communicating, distributed processes

a process is a program that is running within a host

• a user agent is a process serving as an interface to the user

– web: browser– streaming audio/video: media

player processes communicate by an

application-layer protocol• e.g., email, Web

Application-layer protocols one “piece” of an app define messages exchanged by

apps and actions taken implementing services by using

the service provided by the lower layer, i.e., the transport layer

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

26

How does an Application Access the Transport Service?

API: application programming interface

Defines interface between application and transport layer

Example: Socket API sometimes called "Berkeley sockets" acknowledging their

heritage from Berkeley Unix a socket consists of a host IP address and a port number

• e.g., email (SMTP) port number 25, web port number 80 an application process binds to a socket

• %netstat –anp --tcp two processes communicate by sending data into socket,

reading data out of socket

There are other API’s such as XTI (X/Open Transport Interface), a slight modification of the Transport Layer Interface (TLI) developed by AT&T.

More later!

27

App. and Trans.: App. Protocols and their Transport Protocols

Application

e-mailremote terminal access

Web file transfer

Internet telephony

remote file serverstreaming multimedia

Applicationlayer protocol

smtp [RFC 821]telnet [RFC 854]http [RFC 2068]

ftp [RFC 959]proprietary

(e.g., Vocaltec)NFS

proprietary

Underlyingtransport protocol

TCP/SSLTCPTCP/SSLTCPtypically UDP

TCP or UDPtypically UDP

An application needs to choose the transport protocol

28

Client-Server Paradigm

Typical network app has two pieces: client and server

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Client (C): initiates contact with server

(“speaks first”) typically requests service

from server for Web, client is

implemented in browser; for e-mail, in mail reader

Server (S): provides requested service

to client e.g., Web server sends

requested Web page; mail server delivers e-mail

request

reply

Two questions to ask about a C-S application- How does a client locate a server process?- Is the application extensible, scalable, robust, secure?

29

Outline

Recap ISO/OSI Layering and Internet Layering Application layer overview Examples

30

Electronic Mail

Three major components:

User agents Mail servers Protocols

Outgoing email• SMTP

Retrieving email • POP3: Post Office

Protocol [RFC 1939]• IMAP: Internet Mail

Access Protocol [RFC 1730]

user mailbox

outgoing message queue

mailserver

useragent

useragent

useragent

mailserver

useragent

useragent

mailserver

useragent

SMTP

SMTP

SMTP

POP3 orIMAPSMTP

31

SMTP: Outgoing Email as a Client-Server Application

S: 220 mr1.its.yale.edu C: HELO cyndra.yale.edu S: 250 Hello cyndra.cs.yale.edu, 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: Date: Wed, 23 Jan 2008 11:20:27 -0500 (EST)C: From: "Y. R. Yang" <[email protected]>C: To: "Y. R. Yang" <[email protected]>C: Subject: This is subjectC:C: This is the message body! C: Please don’t spoof!C:C: . S: 250 Message accepted for delivery C: QUIT S: 221 mr1.its.yale.edu closing connection

32

Mail Message Data Format

SMTP: protocol for exchanging email msgs

RFC 822: standard for text message format:

Header lines, e.g., To: From: Subject:

Body the “message”, ASCII

characters only

blankline

header

body

33

Message Format: Multimedia Extensions MIME: multimedia mail extension, RFC 2045, 2056 Additional lines in msg header declare MIME content type

From: [email protected]: [email protected] Subject: Network map. MIME-Version: 1.0 Content-Type: image/jpeg Content-Transfer-Encoding: base64

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

multimedia datatype, subtype,

parameter declaration

method usedto encode data

MIME version

encoded data

34

Multipart Type: How Attachment Works

From: [email protected]: [email protected] Subject: Network map. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=98766789 --98766789Content-Transfer-Encoding: quoted-printableContent-Type: text/plain

Hi, Attached is network topology map.--98766789Content-Transfer-Encoding: base64Content-Type: image/jpeg

base64 encoded data ..... ......................... ......base64 encoded data --98766789--

35

POP3 Protocol: Mail Access

Authorization phase client commands:

user: declare username

pass: password server responses

+OK -ERR

Transaction phase, client: list: list message

numbers retr: retrieve message by

number dele: delete quit

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 alice S: +OK C: pass hungry S: +OK user successfully logged on

%telnet <netid>.mail.yale.edu 110%openssl s_client –connect pop.gmail.com:995

36

Discussions: Positive

Some nice designs we can learn from the design of the email application separate protocols for different functions

• email retrieval (e.g., POP3, IMAP)• email transmission (SMTP)

simple/basic requests to implement basic control; fine-grain control through ASCII header and message body

• make the protocol easy to read/debug/extend (analogy with end-to-end layered design?)

status code in response makes message easy to parse

37

Discussions: Negative Some design challenges

handling spam

http://www.yale.edu/its/metrics/email/index.html

Recap:

38

Two questions to ask about a C-S application

• How does a client locate a server process?

• Is the application extensible, scalable, robust, secure?

39

DNS: Domain Name System

Function map between (domain

name, service) to value, e.g.,

• (www.cs.yale.edu, Addr) -> 128.36.229.30

• (cs.yale.edu, Email) -> netra.cs.yale.edu

• (netra.cs.yale.edu, Addr) -> 128.36.229.21

Why use name, instead of IP address directly?

routers

DNS

Hostname, Service

Address

servers

clients

40

DNS: Domain Name System

Naming scheme a hierarchical naming space divided into zones each zone is a sub-tree of the global tree

called a zone

41

Distributed Management of the Domain Name Space A distributed database managed by authoritative name

servers each zone has its own authoritative name servers an authoritative name server of a zone may delegate a subset

(i.e. a sub-tree) of its zone to another name server

called a zone

42

Root Zone and Root Servers

The root zone is managed by the root name servers 13 root name servers worldwide

43

Linking the Name Servers

Each name server knows the addresses of the root servers

Each name server knows the addresses of its immediate children (i.e., those it delegates)

Top level domain(TLD)

44

DNS Message Flow: Two Types of Queries

Recursive query: Puts burden of name resolution on contacted

name server the contacted name server resolves the name

completely

Iterated query: Contacted server replies with name of server

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

45

DNS Message Flow: Examples

Local DNS server helps requesting hosts to query the DNS systemLocal DNS server is learned from DHCP, or configured, e.g. /etc/resolv.conf

46

DNS Message Flow: The Hybrid Case

requesting hostcyndra.cs.yale.edu

gaia.cs.umass.edu

root name server

1

23

4

authoritative name serverdns.cs.umass.edu

5 6

TLD name server

7

8

iterated query

local name server130.132.1.9

47

DNS Records

DNS: distributed db storing resource records (RR)

Type=NS name is domain (e.g.

yale.edu) value is the name of

the authoritative name server for this domain

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

Type=A name is hostname value is IP address

Type=CNAME name is an alias name

for some “canonical” (the real) name

value is canonical name

Type=MX value is hostname of mail

server associated with name Type=SRV

general extension

48

DNS Protocol, MessagesDNS protocol : over UDP/TCP; query and reply messages, both with the same

message format

DNS Msg header: identification: 16 bit #

for query, the reply to a query uses the same #

flags: query or reply recursion desired recursion available reply is authoritative

49

Observing DNS

Use the command dig (or nslookup): force iterated query to see the trace:%dig +trace www.cnn.com

• see the manual for more details

Capture the messages using Ethereal DNS server is at port 53

50

What DNS did Right?

Hierarchical delegation avoids central control, improving manageability and scalability

Redundant servers improve robustness see

http://www.internetnews.com/dev-news/article.php/1486981 for DDoS attack on root servers in Oct. 2002 (9 of the 13 root servers were crippled, but only slowed the network)

see http://www.cymru.com/DNS/index.html for performance monitoring

Caching reduces workload and improve robustness

51

Problems of DNS

Domain names may not be the best way to name other resources, e.g. files

Relatively static resource types make it hard to introduce new services or handle mobility

Although theoretically you can update the values of the records, it is rarely enabled

Simple query model makes it hard to implement advanced query

Early binding (separation of DNS query from application query) does not work well in mobile, dynamic environments e.g., load balancing, locate the nearest printer

- How does a client locate a server?- Is the application secure extensible, robust, scalable?

Optional Slides

52

53

Services Provided by Transport

Transmission control protocol (TCP)

multiplexing/demultiplexing reliable data transfer rate control: flow controland congestion control

User data protocol (UDP) multiplexing/demultiplexing

Host A

Hello

Host B

I am ready

DATA

ACK

Secure Socket Layer: Services server authentication

authentication through trusted certificate authority (CA): server obtains a certificate from one of the trusted CAs

data encryption and integrity

client authentication (optional)

Details of the Seven ISO/OSI Layers

56

Physical Layer (1)

Service: moves information between two systems connected by a physical link

Interface: specifies how to send a bit Protocol: coding scheme used to

represent a bit, voltage levels, duration of a bit

Examples: coaxial cable, optical fiber links; transmitters, receivers

57

Datalink Layer (2)

Service: framing, i.e., attach frames separator send data frames between peers others:

• arbitrates the access to common physical media• ensures reliable transmission• provides flow control

Interface: sends a data unit (packet) to a machine connected to the same physical media

Protocol: layer addresses, implement Medium Access Control (MAC) (e.g., CSMA/CD)…

58

Network Layer (3)

Service: delivers a packet to a specified destination performs fragmentation/reassembly of packets others:

• packet scheduling• buffer management

Interface: sends a packet to a specified destination

Protocol: defines global unique addresses; constructs routing tables; implement packet forwarding; fragments/reassembles packets

59

Data and Control Planes

Data plane: concerned with packet forwarding buffer management packet scheduling

Control Plane: concerned with installing and maintaining the states for the data plane

60

Transport Layer (4)

Service: provides an in-order, error-free, and flow and

congestion controlled end-to-end connection multiplex/demuliplex packets

Interface: sends a packet to a destination Protocol: implements reliability, as well

as flow and congestion control Examples: TCP and UDP

TCP: in-order, error free, flow and congestion control

61

Session Layer (5) Service:

full-duplex access management, e.g., token control synchronization, e.g., provide check points for

long transfers Interface: depends on service Protocols: token management; insert

checkpoints, implement roll-back functions

62

Presentation Layer (6)

Service: converts data between various representations

Interface: depends on service Protocol: defines data formats and rules

to convert from one format to another

63

Application Layer (7)

Service: any service provided to end users

Interface: depends on the application Protocol: depends on the application Examples: FTP, Telnet, WWW

64

What Transport Service Does an App Need?

Data loss some apps can tolerate some packet losses other apps require 100% reliable data transfer

Timing some apps require low delay to be “effective”

Bandwidth some apps require minimum amount of bandwidth to be

“effective” other apps make use of whatever bandwidth they get

65

Transport Service Requirements of Common Apps

Application

file transfere-mail

Web documentsreal-time audio/video

stored audio/videointeractive games

financial apps

Data loss

no lossno lossno lossloss-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