Roadmap Applicat ion Layer (User level) 16: Applicat ion, Transport - - PDF document

roadmap
SMART_READER_LITE
LIVE PREVIEW

Roadmap Applicat ion Layer (User level) 16: Applicat ion, Transport - - PDF document

Roadmap Applicat ion Layer (User level) 16: Applicat ion, Transport , Transport Layer (OS) Net work and Link Layers Net work Layer (OS) Link Layer (Device Driver, Adapt er Card) Last Modif ied: 7/ 3/ 2004 1:46:53 PM -1 -2


slide-1
SLIDE 1

1

  • 1

16: Applicat ion, Transport , Net work and Link Layers

Last Modif ied: 7/ 3/ 2004 1:46:53 PM

  • 2

Roadmap

Applicat ion Layer (User level) Transport Layer (OS) Net work Layer (OS) Link Layer (Device Driver, Adapt er Card)

  • 3

Applicat ion Layer

Net work Applicat ions Drive Net work

Design

I mport ant t o remember t hat net work

applicat ions are t he reason we care about building a net work inf rast ruct ure

Applicat ions range f rom t ext based

command line ones popular in t he 1980s (like t elnet , f t p, news, chat , et c) t o mult imedia applicat ions (Web browsers, audio and video st reaming, realt ime videoconf erencing, et c.)

  • 4

Applicat ions and applicat ion-layer prot ocols

Applicat ion: communicat ing, dist ribut ed processes

running in net work host s in

“user space”

exchange messages t o

implement app

e.g., email, f ile t ransf er,

t he Web Applicat ion- layer prot ocols

  • ne “piece” of an app

def ine messages

exchanged by apps and act ions t aken

user services provided by

lower layer prot ocols

applicat ion t ransport net work dat a link physical applicat ion t ransport net work dat a link physical applicat ion t ransport net work dat a link physical

  • 5

Client-ser ver par adigm

Typical net work app has t wo pieces: client and server

applicat ion t ransport net work dat a link physical applicat ion t ransport net work dat a link physical

Client :

init iat es cont act wit h server

(“speaks f irst ”)

t ypically request s service f rom

server,

f or Web, client is implement ed

in browser; f or e- mail, in mail reader Ser ver :

Running f ir st (always?) provides request ed service t o

client e.g., Web server sends request ed Web page, mail server delivers e- mail request reply

  • 6

How do client s and servers communicat e?

API : applicat ion pr ogr amming int er f ace

def ines int er f ace

bet ween applicat ion and t r anspor t layer

socket : I nt er net API

t wo processes

communicat e by sending dat a int o socket , reading dat a out of socket

Q: how does a pr ocess “ident if y” t he ot her pr ocess wit h which it want s t o communicat e?

I P address of host

running ot her process

“port number ” - allows

receiving host t o det ermine t o which local process t he message should be delivered

… more on t his lat er.

slide-2
SLIDE 2

2

  • 7

Socket programming

Socket API

int roduced in BSD4.1 UNI X,

1981

Socket s are explicit ly

creat ed, used, released by applicat ions

client / server paradigm t wo t ypes of t ransport

service via socket AP I :

unreliable dat agram reliable, byt e st ream-

  • rient ed

a host - local, applicat ion- creat ed/ owned, OS- cont rolled int erf ace (a “door”) int o which applicat ion process can bot h send and receive messages t o/ f rom anot her (remot e or local) applicat ion process

socket Goal: lear n how t o build client / ser ver applicat ion t hat communicat e using socket s

  • 8

Socket s

Socket : a door bet ween applicat ion process and end-end-t ransport prot ocol (UCP or TCP)

process ker nel buf f er s, var iables socket

cont r olled by applicat ion developer cont r olled by

  • perat ing

syst em

host or server

process ker nel buf f er s, var iables socket

cont r olled by applicat ion developer cont r olled by

  • perat ing

syst em

host or server int ernet

  • 9

Languages and P lat f orms

Socket API is available f or many languages

  • n many plat f orms:

C, J ava,Per l, Pyt hon,… * nix, Windows,…

Socket Programs writ t en in any language

and running on any plat f orm can communicat e wit h each ot her!

Client and server must agree on t he t ype

  • f socket , t he server port number and t he

prot ocol

  • 10

Transport services and prot ocols

pr ovidelogical communicat ion

bet ween app’ processes running on dif f erent host s

t ransport prot ocols run in

end syst ems

t ransport vs net work layer

services:

net work layer:dat a t ransf er

bet ween end systems

t ransport layer:dat a

t ransf er bet ween processes

r elies on, enhances, net wor k

layer services

applicat ion t ransport net work dat a link physical applicat ion t ransport net work dat a link physical net work dat a link physical net work dat a link physical net work dat a link physical net work dat a link physical net work dat a link physical

l

  • g

i c a l e n d

  • e

n d t r a n s p

  • r

t

  • 11

Services provided by I nt ernet t ransport prot ocols

TCP ser vice:

connect ion- orient ed:set up

required bet ween client , server

reliable t ransport bet ween

sending and receiving process

f low cont rol: sender won’t

  • verwhelm receiver

congest ion cont rol: t hr ot t le

sender when net work

  • verloaded

does not providing: t iming,

minimum bandwidt h guarant ees

UDP ser vice:

unreliable dat a t ransf er

bet ween sending and receiving process

does not provide:

connect ion set up, reliabilit y, f low cont rol, congest ion cont rol, t iming,

  • r bandwidt h guarant ee

Q: why bot her ? Why is t here a UDP?

  • 12

UDP

UDP adds very lit t le

f unct ionalit y (or

  • ver head) t o bar e I P

Adds mult iplexing/

demult iplexing

  • t her UDP uses

(why?):

DNS: small, ret ransmit

if necessary

  • f t en used f or st reaming

mult imedia apps

  • Loss t oler ant
  • rat e sensit ive

sour ce por t # dest port # 32 bit s

Applicat ion dat a (message) UDP segment f ormat

lengt h checksum Lengt h, in byt es of UDP segment , including header

slide-3
SLIDE 3

3

  • 13

applicat ion t r anspor t net wor k M

P2

applicat ion t ransport net work

P rocess-t o-P rocess Message Delivery

Goal : Deliver applicat ion dat a t o correct process (and more part icularly t o t he right socket ) Segment - unit of dat a exchanged bet ween t ransport layer ent it ies; t ransport prot ocol dat a unit (TP DU)

r eceiver

Ht Hn segment

segment

M

applicat ion t ransport net work

P1

M M M

P3 P4

segment header applicat ion- layer dat a

  • 14

Mult iplexing/ demult iplexing

Demult iplexing based on I P addr esses of sender and and port numbers of bot h sender and r eceiver

Can dist inguish t r af f ic

coming t o same por t but par t of separ at e conver sat ions (like mult iple client connect ions t o a web server)

gat hering dat a f rom mult iple app processes, enveloping dat a wit h header (lat er used f or demult iplexing)

sour ce por t # dest port # 32 bit s

applicat ion dat a (message)

  • t her header f ields

TCP / UDP segment f ormat Mult iplexing: St ream of incoming dat a int o

  • ne machine separat ed int o

smaller st reams dest ined f or individual processes Demult iplexing:

  • 15

TCP adds f unct ionalit y

TCP adds lot s of f unct ionalit y over bar e I P and

  • ver UDP

St ill has mult iplexing/ demult iplexing Adds reliable, in- order delivery Adds f low cont rol and congest ion cont rol

How can you guar ant ee t hat ot her side get s “A B C

D E” when net wor k could:

Lose dat a “A B D E” Duplicat e dat a “A B C C D E” Cor r upt dat a “A B X D E” Reorder dat a “A C D E B” Or all of t he above!

  • 16

Common Sense

Consider f axing a document wit h f laky machine

Can’t t alk t o person on t he ot her side any ot her way

What would you do t o make sur e t hey got t he

t r ansmission?

Number t he pages – so receiver can put t hem in

  • rder/ det ect duplicat es/ det ect losses

Need f eedback f rom t he receiver!!! Resend dat a t hat is missing or if don’t hear f rom

receiver Put some inf o on cover sheet t hat let s per son

ver if y f ax inf o (summar ize inf o like checksum)

What if it is a r eally big document ? Receiver might

like t o be able t o t ell you send f ir st 10 pages t hen 10 mor e…

  • 17

TCP Connect ion Management

Recall: TCP

sender, receiver est ablish “connect ion” bef ore exchanging dat a segment s

init ialize TCP

variables:

  • seq. # s

buf f ers, f low cont rol

inf o (e.g. RcvWindow)

client :connect ion init iat or

Socket clientSocket = new Socket("hostname","port number");

ser ver : cont act ed by client

Socket connectionSocket = welcomeSocket.accept();

Three way handshake:

St ep 1: client end syst em

sends TCP SYN cont rol segment t o server

specif ies init ial seq #

St ep 2: server end syst em

receives SYN, replies wit h SYNACK cont rol segment

ACKs received SYN allocat es buf f ers specif ies server - >

receiver init ial seq. #

St ep 3: client acknowledges

servers init ial seq. #

  • 18

Three-Way Handshake

Active participant (client) Passive participant (server) SYN, SequenceNum = x SYN + ACK, SequenceNum = y, ACK, Acknowledgment = y+ 1 Acknowledgment = x + 1

Not e: SYNs t ake up a sequence number even t hough no dat a byt es

slide-4
SLIDE 4

4

  • 19

Timeout and Ret ransmission

Receiver must acknowledge receipt of all

packet s

Sender set s a t imer if acknowledgement

has not arrived bef ore t imer expires t hen sender will ret ransmit packet

Adapt ive ret ransmission: t imer value

comput ed as a f unct ion of average round t rip t imes and variance

  • 20

TCP: ret ransmission scenarios (1)

Host A

S e q = 9 2 , 8 b y t e s d a t a

loss

t imeout

time lost dat a scenar io

Host B

X

S e q = 9 2 , 8 b y t e s d a t a ACK=100

Host A

S e q = 9 2 , 8 b y t e s d a t a A C K = 1

loss

t imeout

time lost ACK scenario

Host B

X

S e q = 9 2 , 8 b y t e s d a t a ACK=100

  • 21

TCP : ret ransmission scenarios (2)

Host A

S e q = 1 , 2 b y t e s d a t a A C K = 1 Seq=92 t imeout

time premat ure t imeout , cumulat ive AC Ks

Host B

S e q = 9 2 , 8 b y t e s d a t a ACK=120 S e q = 9 2 , 8 b y t e s d a t a Seq=100 t imeout ACK=120

Host A

S e q = 1 , 2 b y t e s d a t a A C K = 1

time

Host B

S e q = 1 , 2 b y t e s d a t a ACK=100 S e q = 9 2 , 8 b y t e s d a t a Seq=100 t imeout S e q = 1 2 , 2 b y t e s d a t a

loss

X

Duplicat e ACK, f ast r et r ansmit (r eally need 3 dup acks bef ore f ast ret ransmit )

  • 22

Net wor k layer f unct ions

t ransport packet f rom sending

t o receiving host s

net work layer prot ocols in

every host , rout er (Recall t ransport layer is end- t o

  • end)

t hree import ant f unct ions:

pat h det erminat ion: rout e

t aken by packet s f rom source t o dest . Rout ing algorit hms

swit ching: move packet s f rom

rout er’s input t o appropriat e rout er out put

call set up: some net wor k

archit ect ures (e.g. t elephone, ATM) require rout er call set up along pat h bef ore dat a f low

net work dat a link physical net work dat a link physical net work dat a link physical net work dat a link physical net work dat a link physical net work dat a link physical net work dat a link physical net work dat a link physical applicat ion t ransport net work dat a link physical applicat ion t ransport net work dat a link physical

  • 23

I nt ernet P rot ocol

The I nt er net is a net wor k of het erogeneousnet works:

using dif f erent t echnologies (ex. dif f erent maximum packet

sizes)

belonging t o dif f erent administ rat ive aut horit ies (ex. Willing

t o accept packet s f rom dif f erent addresses) Goal of I P: int er connect all t hese net wor ks so can send

end t o end wit hout any knowledge of t he int er mediat e net wor ks

Rout er s, swit ches, br idges: machines t o f or war d

packet s bet ween het er ogeneous net wor ks

  • 24

I P Addressing: int roduct ion

I P

address: 32-bit ident if ier f or host , rout er int er f ace

int er f ace: connect ion

bet ween host and physical link

rout er’s must have

mult iple int erf aces

host may have mult iple

int erf aces

I P addresses (unicast

addresses) associat ed wit h int erf ace, not host , rout er

223.1.1.1 223.1.1.2 223.1.1.3 223.1.1.4 223.1.2.9 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27 223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1

slide-5
SLIDE 5

5

  • 25

I P Addressing

I P

address:

32 bit s net wor k par t (high or der

bit s)

host part (low order bit s) Def ined by class of I P

address?

Def ined by subnet mask

What ’s a net wor k ? (f rom I P address perspect ive)

device int er f aces wit h

same net wor k par t of I P address

can physically r each each

  • t her wit hout int er vening

r out er

223.1.1.1 223.1.1.2 223.1.1.3 223.1.1.4 223.1.2.9 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27

net wor k consist ing of 3 I P net wor ks (223.1.1, 223.1.2, 223.1.3) LAN

  • 26

I P Addressing

How t o f ind t he net works?

Det ach each

int er f ace f r om r out er , host

cr eat e “islands of

isolat ed net wor ks

223.1.1.1 223.1.1.3 223.1.1.4 223.1.2.2 223.1.2.1 223.1.2.6 223.1.3.2 223.1.3.1 223.1.3.27

223.1.1.2

223.1.7.0 223.1.7.1 223.1.8.0 223.1.8.1 223.1.9.1 223.1.9.2

I nt er connect ed syst em consist ing

  • f six net wor ks
  • 27

I P Addresses (Classes)

0 net work host 10 net work host 110 net work host 1110 mult icast address

A B C D class

1.0.0.0 t o 127.255.255.255 128.0.0.0 t o 191.255.255.255 192.0.0.0 t o 223.255.255.255 224.0.0.0 t o 239.255.255.255

32 bit s

given not ion of “net wor k”, let ’s r e-examine I P addr esses: “class- f ull” addr essing

Unicast Mult icast 1111 reserved

E

240.0.0.0 t o 255.255.255.255

Reserved

  • 28

I P Address Space Allocat ion

CAI DA 1998

  • 29

I P addressing: CI DR

classf ul addressing:

inef f icient use of address space, address space exhaust ion e.g., class B net allocat ed enough addresses f or 65K host s,

even if only 2K host s in t hat net work

CI DR: Classless I nt erDomain Rout ing

net work port ion of address of arbit rary lengt h address f ormat : a.b.c.d/ x, where x is # bit s in net work

port ion of address

11001000 00010111 00010000 00000000

net work part host part

200.23.16.0/ 23

  • 30

Recall: How t o get an I P Address?

Answer 1: Nor mally, answer is get an I P addr ess

f r om your upst r eam pr ovider

This is essent ial t o maint ain ef f icient rout ing!

Answer 2: I f you need lot s of I P addr esses t hen

you can acquir e your own block of t hem.

I P

address space is a scarce resource - must prove you have f ully ut ilized a small block bef ore can ask f or a larger one and pay $$ (J an 2002 - $2250/ year f or / 20 and $18000/ year f or a / 14)

slide-6
SLIDE 6

6

  • 31

How t o get lot s of I P Addresses? I nt ernet Regist ries

RI PE NCC (Riseaux I P Eur opiens Net wor k Coor dinat ion Cent r e) f or Europe, Middle-East , Af r ica APNI C(Asia Pacif ic Net wor k I nf or mat ion Cent re ) f or Asia and Pacif ic ARI N (Amer ican Regist r y f or I nt er net Number s) f or t he Amer icas, t he Car ibbean, sub

  • sahar an Af r ica

Not e: Once again r egional dist r ibut ion is impor t ant f or ef f icient r out ing! Can also get Aut onomous Syst em Number s ( ASNs) f rom t hese regist ries

  • 32

Classf ul vs Classless

Class A = / 8 Class B = / 16 Class C = / 24

  • 33

I P addresses: how t o get one? r evist ed

Net work (net work port ion):

get allocat ed port ion of I SP’s address space:

ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20 Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... ….. …. …. Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23

  • 34

Hierarchical addressing: rout e aggregat ion

“Send me anyt hing wit h addr esses beginning 200.23.16.0/ 20”

200.23.16.0/ 23 200.23.18.0/ 23 200.23.30.0/ 23

Fly -By- Night-I SP Or ganizat ion 0 Or ganizat ion 7 I nt er net Or ganizat ion 1 I SPs-R-U s “Send me anyt hing wit h addr esses beginning 199.31.0.0/ 16”

200.23.20.0/ 23

Or ganizat ion 2

. . . . . .

Hier ar chical addr essing allows ef f icient adver t isement of r out ing inf or mat ion:

  • 35

Hierarchical addressing: more specif ic rout es

I SPs-R

  • Us has a mor e specif ic r out e t o Or ganizat ion 1

“Send me anyt hing wit h addr esses beginning 200.23.16.0/ 20”

200.23.16.0/ 23 200.23.18.0/ 23 200.23.30.0/ 23

Fly -By- Night-I SP Or ganizat ion 0 Or ganizat ion 7 I nt er net Or ganizat ion 1 I SPs-R-U s “Send me anyt hing wit h addr esses beginning 199.31.0.0/ 16

  • r 200.23.18.0/ 23”

200.23.20.0/ 23

Or ganizat ion 2

. . . . . .

  • 36

I P Address Allocat ion

CI DR is gr eat but must wor k ar ound exist ing

allocat ions of I P addr ess space

Company 1 has a / 20 allocat ion and has given out sub por t ions of it t o

  • t her companies

Univer sit y has a f ull class B addr ess Company 2 has a / 23 allocat ion f r om some ot her class B ALL use t he same upst r eam I SP – t hat I SP must adver t ise r out es t o all

t hese blocks t hat cannot be descr ibed wit h a simple CI DR net wor k I D and mask!

Est imat ed r educt ion in r out ing t able size wit h CI DR

I f I P addr esses r eallocat ed, CI DR applied t o all, I P addr esses r eallocat ed

based on geogr aphic and ser vice pr ovider divisions t hat cur r ent r out ing t ables wit h 10000+ ent r ies could be r educed t o 200 ent r ies [For d, Rekht er and Br own 1993]

How st able would t hat be t hough? Leases f or all?

slide-7
SLIDE 7

7

  • 37

Current Allocat ion

I nt erest ing t o exam current I P address

space allocat ion (who has class A’s ? Et c)

Who has A’s? Comput er companies ar ound dur ing init ial

allocat ion (I BM, Apple)

Univer sit ies (St anf or d, MI T) CAI DA has inf o on complet e allocat ion

  • 38

Rout ing

I P Rout ing – each rout er is supposed t o

send each I P dat agramone st ep closer t o it s dest inat ion

How do t hey do t hat ?

Hier ar chical Rout ing – in ideal wor ld would t hat

be enough? Well it s not an ideal wor ld

Ot her choices

  • St at ic Rout ing
  • Dynamic Rout ing

– Before we cover specific routing protocols we will cover principles of dynamic routing protocols

  • 39

Rout ing

Gr aph abst r act ion f or r out ing algor it hms:

gr aph nodes ar e

r out er s

gr aph edges ar e

physical links

link cost : delay, $ cost ,

  • r congest ion level

Goal: det ermine “good” pat h (sequence of rout ers) t hru net work f rom source t o dest .

Rout ing pr ot ocol

A E D C B F

2 2 1 3 1 1 2 5 3 5

“good” pat h:

t ypically means minimum

cost pat h

  • t her def init ions

possible

  • 40

Rout ing Algorit hm classif icat ion: St at ic or Dynamic?

Choice 1: St at ic or dynamic?

St at ic:

rout es change slowly over t ime Conf igured by syst em administ rat or Appropriat e in some circumst ances, but obvious

drawbacks (rout es added/ removed? sharing load?)

Not much more t o say?

Dynamic:

rout es change more quickly

periodic updat e in response t o link cost changes

  • 41

Rout ing Algorit hm classif icat ion: Global or decent ralized?

Choice 2, if dynamic: global or decent r alized inf or mat ion?

Global:

all r out er s have complet e t opology, link cost inf o “link st at e” algor it hms

Decent r alized:

r out er knows physically-connect ed neighbor s, link

cost s t o neighbor s

it er at ive pr ocess of comput at ion, exchange of inf o

wit h neighbor s (gossip)

“dist ance vect or ” algor it hms

  • 42

Link Layer: set t ing t he cont ext

t wo physically connect ed devices:

host- rout er, rout er- rout er, host- host

unit of dat a: f rame

applicat ion t r anspor t net work link physical net work link physical

M M M M Ht Ht Hn Ht Hn Hl M Ht Hn Hl f rame

  • phys. link

dat a link prot ocol adapt er car d

slide-8
SLIDE 8

8

  • 43

Link Layer Services

Framing, link access:

encapsulat e dat agram int o f rame, adding header, t railer implement channel access if shared medium, ‘physical addresses’ used in f rame headers t o ident if y

source, dest

  • dif f erent f rom I P

address! Reliable deliver y bet ween t wo physically connect ed

devices:

Reliable delivery over an unreliable link (like TCP

but done at link layer)

seldom used on low bit error link (f iber, some t wist ed

pair)

wireless links: high error rat es

  • Q: why bot h link - level and end- end reliabilit y?
  • 44

Link Layer Services (more)

Flow Cont rol:

pacing bet ween sender and r eceiver s

Er r or Det ect ion:

er r or s caused by signal at t enuat ion, noise. r eceiver det ect s pr esence of er r or s:

  • signals sender f or ret ransmission or drops f rame

Er r or Cor r ect ion:

r eceiver ident if ies and cor r ect s bit er r or (s)

wit hout r esor t ing t o r et r ansmission

  • 45

Mult iple Access Links and P rot ocols

Three t ypes of “links”:

br oadcast (shar ed wir e or medium; e.g, Et her net ,

Wavelan, et c.)

point-to-point (single wir e, e.g. PPP, SLI P) swit ched (e.g., swit ched Et her net , ATM et c)

  • 46

Link Layer: I mplement at ion

implement ed in “adapt er”

e.g., PCMCI A car d, Et her net car d t ypically includes: RAM, DSP chips, host bus

int er f ace, and link int er f ace applicat ion t r anspor t net work link physical net work link physical

M M M M Ht Ht Hn Ht Hn Hl M Ht Hn Hl f rame

  • phys. link

dat a link prot ocol adapt er car d

  • 47

Mult iple Access prot ocols

single shar ed communicat ion channel t wo or more simult aneous t ransmissions by

nodes: int erf erence

  • nly one node can send successf ully at a t ime

mult iple access prot ocol:

dist r ibut ed algor it hm t hat det er mines how st at ions

shar e channel, i.e., det er mine when st at ion can t r ansmit claim: humans use mult iple access prot ocols all

t he t ime

  • 48

CSMA: Carrier Sense Mult iple Access

CSMA: list en bef or e t r ansmit :

I f channel sensed idle: t r ansmit ent ir e pkt I f channel sensed busy, def er t r ansmission

Per sist ent CSMA: r et r y immediat ely wit h

pr obabilit y p when channel becomes idle (may cause inst abilit y)

Non-persist ent CSMA: r et r y af t er r andom int er val

human analogy: don’t int er r upt ot her s!

slide-9
SLIDE 9

9

  • 49

Et hernet

“dominant ” LAN t echnology:

cheap $ 20 f or 100Mbs! f ir st widely used LAN t echnology Simpler , cheaper t han t oken LANs and ATM Kept up wit h speed r ace: 10, 100, 1000 Mbps

Uses CSMA wit h collision det ect ion

Met calf e’s Et hernet sket ch