19 internets

37
 Carnegie Mellon 1 Internetworking 15-213: Introduction to Computer Systems 19 th  Lecture, Oct. 28, 2010 Instructors:  !ndy "ry!nt !nd #!$e O%&!''!ron

Upload: allan-daniel-calero-g

Post on 14-Jan-2016

229 views

Category:

Documents


0 download

DESCRIPTION

S

TRANSCRIPT

Page 1: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 1/37

Carnegie Mellon

1

Internetworking

15-213: Introduction to Computer Systems

19th Lecture, Oct. 28, 2010

Instructors: 

!ndy "ry!nt !nd #!$e O%&!''!ron

Page 2: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 2/37

Carnegie Mellon

2

A Client-ServerTransaction

Clientprocess

Serverprocess

1. Client sends request 

2. Serverhandlesrequest 

3. Server sends response 4. Clienthandles

response

Resource

  Most network applications are based on the

client-server model: ( server  process !nd one or more client  processes

Ser$er m!n!)es some resource

Ser$er pro$ides service *y m!nipu'!tin) resource +or

c'ients Ser$er !cti$!ted *y reuest +rom c'ient $endin) m!chine

Note: clients and servers are processes running on hosts(can be the same or diferent hosts

Page 3: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 3/37

Carnegie Mellon

3

Hardware rgani!ation o" a#etwork Host

mainmemor$

I%bridge

MI

A&'

register (le

C)' chip

s$stem bus memor$ bus

diskcontroller

graphicsadapter

'S*controller

mouseke$board monitor

disk 

I% bus

+,pansion slots

network adapter

network 

Page 4: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 4/37

Carnegie Mellon

4

Computer #etworks 

A net!or"  is a hierarchical s$stem o"bo,es and wires organi!ed b$geographical pro,imit$ S(/ System (re! /etor sp!ns c'uster or m!chine

room

Sitched thernet, u!drics S4, L(/ Loc!' (re! /etor sp!ns ! *ui'din) or c!mpus

thernet is most prominent e6!mp'e 4(/ 4ide (re! /etor sp!ns country or or'd

 7ypic!''y hi)h-speed point-to-point phone 'ines

  An internet!or"  ( internet   is aninterconnected set o" networks  7he 'o*!' I Internet upperc!se I; is the most

+!mous e6!mp'e o+ !n internet 'oerc!se i;

  &ets see how an internet is built "rom the

Page 5: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 5/37

Carnegie Mellon

5

&owest &evel: +thernetSegment

  +thernet segment consists o" a collection o"hosts connected b$ wires .twisted pairs/ toa hub

  Spans room or 0oor in a building

  peration !ch thernet !d!pter h!s ! uniue <8-*it !ddress =(C

!ddress .)., 00:1>:e!:e3:5<:e>

&osts send *its to !ny other host in chuns c!''ed #rames

&u* s'!$ish'y copies e!ch *it +rom e!ch port to e$ery other port $ery host sees e$ery *it

host host host

hub122 Mb%s122 Mb%s

 port 

Page 6: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 6/37

Carnegie Mellon

6

#e,t &evel: *ridged +thernetSegment

  Spans building or campus

  *ridges cleverl$ learn which hosts are

reachable "rom which ports and then

host host host host host

hub hubbridge122 Mb%s 122 Mb%s

host host

hub122 Mb%s 122 Mb%s

1 3b%s

host host host

bridge

hosthost

hub

A *

C

4

 5 

Page 7: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 7/37

Carnegie Mellon

7

Conceptual 6iew o" &A#s 

7or simplicit$8 hubs8 bridges8 and wires areo"ten shown as a collection o" hostsattached to a single wire:

host host host999

Page 8: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 8/37

Carnegie Mellon

8

#e,t &evel: internets

 

Multiple incompatible &A#s can beph$sicall$ connected b$ speciali!edcomputers called routers

  The connected networks are called aninternet 

host host host999 host host host999

A# A#

$%N 1 and $%N 2 might be completel& diferent' totall&incompatible

(e.g.' thernet and )i*' +,2.11-' 1/lin"s' 0S$'

router router router

&A# &A#

Page 9: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 9/37

Carnegie Mellon

9

&ogical Structure o" aninternet

  Ad hoc interconnection o" networks /o p!rticu'!r topo'o)y

?!st'y di@erent router A 'in c!p!cities

  Send packets "rom source to destination b$hopping through networks outer +orms *rid)e +rom one netor to !nother

#i@erent p!cets m!y t!e di@erent routes

router

router

routerrouter

router

router

hosthost

Page 10: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 10/37

Carnegie Mellon

10

The #otion o" an internet)rotocol

  How is it possible to send bits acrossincompatible &A#s and A#s;

  Solution:

protoco' so+t!re runnin) on e!ch host !nd router smooths out the di@erences *eteen the di@erent

netors

 

Implements an internet protocol .i9e98 seto" rules/ )o$erns ho hosts !nd routers shou'd cooper!te

hen they tr!ns+er d!t! +rom netor to netor

 7CBI is the protoco' +or the )'o*!' I Internet

C i M ll

Page 11: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 11/37

Carnegie Mellon

11

hat <oes an internet )rotocol<o;

 

)rovides a naming scheme (n internet protoco' denes ! uni+orm +orm!t +or host

addresses

!ch host !nd router is !ssi)ned !t 'e!st one o+ theseinternet !ddresses th!t uniue'y identies it

  )rovides a deliver$ mechanism (n internet protoco' denes ! st!nd!rd tr!ns+er unit

 pac"et 

!cet consists o+ header  !nd pa&load  &e!der: cont!ins in+o such !s p!cet siDe, source !nd

destin!tion !ddresses !y'o!d: cont!ins d!t! *its sent +rom source host

C i M ll

Page 12: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 12/37

Carnegie Mellon

12

$%N2

Trans"erring <ata ver aninternet

protocolso"tware

client

&A#1adapter

Host A$%N1

data.1/

data )H 7H1.=/

data )H 7H>.?/

data.@/

data )H 7H> ./

$%N2 #rame

protocol

so"tware

&A#1adapter

&A#>adapter

outer data )H.B/ 7H1

data )H 7H1.>/

internet pac"et 

$%N1 #rame

./ data )H 7H>

protocolso"tware

server

&A#>adapter

Host *

&: Internet p!cet he!der&: L(/ +r!me he!der

C i M ll

Page 13: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 13/37

Carnegie Mellon

13

ther Issues 

e are glossing over a number o"important Duestions: 4h!t i+ di@erent netors h!$e di@erent m!6imum

+r!me siDesF se)ment!tion

&o do routers no here to +or!rd +r!mesF

&o !re routers in+ormed hen the netor topo'o)ych!n)esF

4h!t i+ p!cets )et 'ostF

 

These .and other/ Duestions areaddressed b$ the area o" s$stems knownas computer net!or"ing

C i M ll

Page 14: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 14/37

Carnegie Mellon

14

3lobal I) Internet

 

Most "amous e,ample o" an internet

  *ased on the TC)%I) protocol "amil$ I Internet protoco' :

ro$ides basic naming scheme !nd unre'i!*'e delivery

capability  o+ p!cets d!t!)r!ms +rom host-to-host

G# Gnre'i!*'e #!t!)r!m rotoco' Gses I to pro$ide unre'i!*'e d!t!)r!m de'i$ery +rom process-to-process

 7C 7r!nsmission Contro' rotoco' Gses I to pro$ide reliable *yte stre!ms +rom process-

to-process o$er connections

  Accessed via a mi, o" 'ni, (le I% and"unctions "rom the soc"ets inter#ace

Carnegie Mellon

Page 15: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 15/37

Carnegie Mellon

15

Hardware and So"twarergani!ation

o" an Internet Application

TC)%I)

Client

#etwork adapter

3lobal I) Internet

TC)%I)

Server

#etwork adapter

nternet client host nternet server host  

Soc"ets inter#ace(s&stem calls

ard!are inter#ace(interrupts

5ser code

6ernel code

ard!areand *rm!are

Carnegie Mellon

Page 16: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 16/37

Carnegie Mellon

16

*asic InternetComponents 

Internet backbone: co''ection o+ routers n!tionide or or'dide connected

*y hi)h-speed point-to-point netors

  #etwork Access )oint .#A)/: router th!t connects mu'tip'e *!c*ones o+ten re+erred to

!s peers

  Regional networks: sm!''er *!c*ones th!t co$er sm!''er )eo)r!phic!' !re!s

e.)., cities or st!tes

  )oint o" presence .))/: m!chine th!t is connected to the Internet

  Internet Service )roviders .IS)s/: pro$ide di!'-up or direct !ccess to Os

Carnegie Mellon

Page 17: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 17/37

Carnegie Mellon

17

#A)-*ased Internet

Architecture  #A)s link together commercial backbonesprovided b$ companies such as ATET andorldcom

  Currentl$ in the 'S there are about 2commercial backbones connected b$ F1>#A)s .peering points/

 

Similar architecture worldwide connectsnational networks to the Internet

Carnegie Mellon

Page 18: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 18/37

Carnegie Mellon

18

Internet ConnectionHierarch$

#A) #A)

*ackbone *ackbone*ackbone*ackbone

#A)

)))) ))

Regional net

)))) ))

))))

Small *usiness

*ig *usinessIS)

)))) )) ))

)gh emplo$ee

Cablemodem

<C emplo$ee

))

TB

T1

S) ."or individuals/

))

<S&T1

Colocationsites

7rivate

8peering9greementsbet!eeno bac"bone

companies#ten b&pass

N%7

Carnegie Mellon

MCI% ldC %''#+T 3l b l

Page 19: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 19/37

Carnegie Mellon

20

Source: http:BBperson!'p!)[email protected])eBcy*er)eo)r!phyB!t'!sB

MCI%orldCom%''#+T 3lobal*ackbone

Carnegie Mellon

Page 20: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 20/37

Carnegie Mellon

21

#aming and Communicating onthe Internet

  riginal Idea $ery node on Internet ou'd h!$e uniue I !ddress

$eryone ou'd *e !*'e to t!' direct'y to e$eryone

/o secrecy or !uthentic!tion =ess!)es $isi*'e to routers !nd hosts on s!me L(/

ossi*'e to +or)e source e'd in p!cet he!der

  Shortcomings  7here !renHt enou)h I !ddresses !$!i'!*'e

#onHt !nt e$eryone to h!$e !ccess or no'ed)e o+ !''other hosts

Security issues m!nd!te secrecy A !uthentic!tion

Carnegie Mellon

Page 21: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 21/37

Carnegie Mellon

22

+volution o" Internet:#aming

 

<$namic address assignment =ost hosts donHt need to h!$e non !ddress On'y those +unctionin) !s ser$ers

#&C #yn!mic &ost Con)ur!tion rotoco' Loc!' IS !ssi)ns !ddress +or tempor!ry use

  +,ample: =y '!ptop !t C=G ired connection

I !ddress 128.2.213.29  bryant-tp4.cs.cmu.edu

(ssi)ned st!tic!''y =y '!ptop !t home

I !ddress 192.1>8.1.5 On'y $!'id ithin home netor

Carnegie Mellon

Page 22: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 22/37

Carnegie Mellon

23

+volution o" Internet:7irewalls

  7irewalls &ides or)!niD!tions nodes +rom rest o+ Internet

Gse 'oc!' I !ddresses ithin or)!niD!tion

Eor e6tern!' ser$ice, pro$ides pro6y ser$ice

1. C'ient reuest: src10.2.2.2, dest21>.99.99.99

2. Eire!'' +or!rds: src1J>.3.3.3, dest21>.99.99.99

3. Ser$er responds: src21>.99.99.99, dest1J>.3.3.3

<. Eire!'' +or!rds response: src21>.99.99.99,dest10.2.2.2

Corporation 4

7irewall

Internet

10.2.2.21

= >

B

1J>.3.3.3

21>.99.99.99

Carnegie Mellon

Page 23: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 23/37

g

24

6irtual )rivate #etworks

  Supporting road warrior mp'oyee orin) remote'y ith !ssi)ned I !ddress

198.3.3.3 4!nts to !ppe!r to rest o+ corpor!tion !s i+ orin)

intern!''y Erom !ddress 10.>.>.> i$es !ccess to intern!' ser$ices e.)., !*i'ity to send

m!i'

Corporation 4

Internet

10.6.6.6198.3.3.3

7irewall

10.>.>.>

Carnegie Mellon

Page 24: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 24/37

g

25

A )rogrammers 6iew o" theInternet

  Hosts are mapped to a set o" B>-bit 7addresses 128.2.203.1J9

 

The set o" I) addresses is mapped to a seto" identi(ers called Internet domainnames 128.2.203.1J9 is m!pped to .cs.cmu.edu

  A process on one Internet host cancommunicate with a process on anotherInternet host over a connection

Carnegie Mellon

Page 25: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 25/37

g

26

I) Addresses  B>-bit I) addresses are stored in an 7

address struct  I !ddresses !re !'!ys stored in memory in netor

*yte order*i)-endi!n *yte order

 7rue in )ener!' +or !ny inte)er tr!ns+erred in ! p!cethe!der +rom one m!chine to !nother.

.)., the port num*er used to identi+y !n Internetconnection.

/* Internet address structure */struct in_addr {  unsigned int s_addr; /* network byte order (big-endian) */};

'se"ul network b$te-order conversion "unctions .Gl B> bits8 Gs 1? bits/

ton!" con$ert uint32Kt +rom host to netor *yte ordertons" con$ert uint1>Kt +rom host to netor *yte order

nto!" con$ert uint32Kt +rom netor to host *yte orderntos" con$ert uint1>Kt +rom netor to host *yte order

Carnegie Mellon

Page 26: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 26/37

g

27

<otted <ecimal #otation  *$ convention8 each b$te in a B>-bit I)

address is represented b$ its decimal valueand separated b$ a period

I !ddress: #$%##&'&& &%.&.+4.&4&

  7unctions "or converting between binar$ I)addresses and dotted decimal strings: inet_aton:  dotted decim!' strin) I !ddress in netor

*yte order

inet_ntoa:  I !ddress in netor *yte order dotteddecim!' strin)

n; denotes netor represent!tion

!; denotes !pp'ic!tion represent!tion

Carnegie Mellon

Page 27: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 27/37

28

I) Address Structure

 

I) .6=/ Address space divided into classes:

  #etwork I< ritten in "orm w9,9$9!%n n num*er o+ *its in host !ddress

.)., C=G ritten !s 128.2.0.0B1> C'!ss " !ddress

  'nrouted .private/ I) addresses:10.0.0.0B8 1J2.1>.0.0B12 192.1>8.0.0B1>

C'!ss (

C'!ss "

C'!ss C

C'!ss #

C'!ss

0 1 2 3 8 1> 2< 31

2 /et I# &ost I#

&ost I#

&ost I#/et I#

/et I#

=u'tic!st !ddress

eser$ed +or e6periments

12

121

1 121

1 111

Carnegie Mellon

Page 28: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 28/37

29

Internet <omain #ames

9net 9edu 9gov 9com

cmu berkele$mit

cs ece

greatwhite128.2.220.10

ics

unnamed root 

sp

iB@?-"128.2.200.<J

ama!on

www200J.1J1.1>>.252

irst/level domain names

Second/level domain name

hird/level domain names

Carnegie Mellon

Page 29: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 29/37

30

<omain #aming S$stem.<#S/

  The Internet maintains a mapping between I)

addresses and domain names in a hugeworldwide distributed database called 0NS Conceptu!''y, pro)r!mmers c!n $ie the #/S d!t!*!se !s !

co''ection o+ mi''ions o+ host entry structures:

  7unctions "or retrieving host entries "rom <#S: getostbyname" uery ey is ! #/S dom!in n!me.

getostbyaddr" uery ey is !n I !ddress.

/* , ost entry structure */struct ostent {

car *_name; /* oicia! domain name o ost */car **_a!iases; /* nu!!-terminated array o domain names */int _addrtype; /* ost address type (0_I12) */int _!engt; /* !engt o an address3 in bytes */car **_addr_!ist; /* nu!!-terminated array o in_addr structs

*/};

Carnegie Mellon

Page 30: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 30/37

31

)roperties o" <#S Host+ntries

  +ach host entr$ is an eDuivalence class o"domain names andI) addresses

  +ach host has a locall$ de(ned domain name

!oca!ost which alwa$s maps to the loopbac"

address &.#.#.

  <iJerent kinds o" mappings are possible: Simp'e c!se: one-to-one m!ppin) *eteen dom!in n!me

!nd I !ddress: greatwi!e.ics.cs.cmu.edu  m!ps to &%.&.&&#.#

=u'tip'e dom!in n!mes m!pped to the s!me I !ddress: eecs.mit.edu

 

!nd 

cs.mit.edu 

both map to 

%.5&..5

=u'tip'e dom!in n!mes m!pped to mu'tip'e I !ddresses:

goog!e.com  

m!ps to mu'tip'e I !ddresses

%

Carnegie Mellon

Page 31: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 31/37

32

A )rogram That Kueries <#S

int main(int argc3 car **arg6) { /* arg678 is a domain name */

  car **pp; /* or dotted decima! I9 addr */  struct in_addr addr;  struct ostent *ostp;

  i (inet_aton(arg6783 :addr) #)  ostp <etostbyaddr((const car *):addr3 si=eo(addr)3

 0_I12);  e!se  ostp <etostbyname(arg678);  print(>oicia! ostname" ?s@n>3 ostp-A_name); 

or (pp ostp-A_a!iases; *pp BCC; ppDD)  print(>a!ias" ?s@n>3 *pp);

  or (pp ostp-A_addr_!ist; *pp BCC; ppDD) {  addr.s_addr ((struct in_addr *)*pp)-As_addr;  print(>address" ?s@n>3 inet_ntoa(addr));  }}

Carnegie Mellon

Page 32: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 32/37

33

'sing <#S )rogram!inu$A ./dns greatwite.ics.cs.cmu.edu

oicia! ostname" greatwite.ics.cs.cmu.eduaddress &%.&.&&#.#

!inu$A ./dns &%.&.&&#.oicia! ostname" 0<1CE0FG.I'.'.'HB.1,Baddress" &%.&.&&#.

!inu$A ./dns www.goog!e.com oicia! ostname" www.!.goog!e.com a!ias" www.goog!e.com address" &.4.&#4.++address" &.4.&#4.#address" &.4.&#4.#4address" &.4.&#4.4!inu$A dig Dsort -$ &.4.&#4.#iad#4s#-in-#.e##.net.

Carnegie Mellon

Page 33: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 33/37

34

Kuer$ing <I3

  <omain In"ormation 3roper .dig/ provides ascriptable command line inter"ace to <#S

!inu$A dig Dsort greatwite.ics.cs.cmu.edu&%.&.&&#.#

!inu$A dig Dsort -$ &%.&.&&#. 0<1CE0FG.I'.'.'HB.1,B.!inu$A dig Dsort goog!e.com&.4.&#4.#4&.4.&#4.4&.4.&#4.++

&.4.&#4.#!inu$A dig Dsort -$ &.4.&#4.#iad#4s#-in-#.e##.net.

Carnegie Mellon

Page 34: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 34/37

35

More +,otic 7eatures o" <I3

 

)rovides more in"ormation than $ou wouldever want about <#S

!inu$A dig www.pys.msu.ru a Dtrace&%.&.&&#.#

!inu$A dig www.goog!e.com a Dtrace

Carnegie Mellon

Page 35: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 35/37

36

Internet Connections  Clients and servers communicate b$ sending

streams o" b$tes over connections: oint-to-point, +u''-dup'e6 2-!y communic!tion, !nd

re'i!*'e.

   % soc"et  is an endpoint o" a connection

Socet !ddress is !n I9address"port  p!ir

  A port  is a 1?-bit integer that identi(es aprocess:

phemeral port : (ssi)ned !utom!tic!''y on c'ient henc'ient m!es ! connection reuest )ell/"no!n port: (ssoci!ted ith some ser$ice

pro$ided *y ! ser$er e.)., port 80 is !ssoci!ted ith 4e*ser$ers

  A connection is uniDuel$ identi(ed b$ the

Carnegie Mellon

Page 36: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 36/37

37

)utting it all Together:Anatom$ o" an Internet

Connection

Connection socket pair.1>@9>91L=9>=>:1>1B8 >2@9>1?91@191:@2/

Server.port @2/

Client

Client soc"et address1>@9>91L=9>=>:1>1B

Server soc"etaddress

>2@9>1?91@191:@2

Client host address1>@9>91L=9>=>

Server host address>2@9>1?91@191

Carnegie Mellon

Page 37: 19 InternetS

7/18/2019 19 InternetS

http://slidepdf.com/reader/full/19-internets 37/37

#e,t Time  How to use the sockets inter"ace to

establish Internet connections betweenclients and servers

  How to use 'ni, I% to cop$ data "rom onehost to another over an Internet

connection