You are on page 1of 1187

I

nte
rne
twor
kingWi
thTCP/
IP
VolI
:
Pr
inc
ipl
es,Pr
otoc
ols
,andAr
chi
tec
tur
e
S
ixt
hEdi
ti
on
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
I
nte
rne
twor
kingWi
thTCP/
IP
VolI:
Pr
inc
ipl
es,Prot
ocol
s,a
nd
Archi
tec
ture

S
ixt
hEdi
ti
on

DOUGLASE.COMER
Depar
tmentofComputerSc
ienc
es
Pur
dueUni
vers
ity

Bos
tonCol
umbusIndiana
pol
isNewYorkS a
nFrancis
coUppe
rS addl
eRi v
erAmste
rdam
CapeTownDubaiLondonMa dr
idMil
anMunic
hPa ri
sMontrea
lTor ontoDel
hiMexi
co
Cit
yS aoPauloSydneyHongKongSeoulSi
nga
poreTa i
peiTokyo
Editori
a lDirec
t or,Eng i
ne eri
nga ndComput
erS
cie
nce
:Ma
rci
aJ.Hor
ton
Acquisi
tionsEdi tor:Ma ttGol dst
e i
n
Editori
a lAssi
stant:Je na hBlit
z-Stoehr
Ma rketi
ngMa na ger:YezAl ayan
Ma rketi
ngAs sistant:JonBr yant
SeniorMa na gi
ngEdi tor:S cottDisanno
Ope r
a t
ionsS pecial
ist:LindaS age
r
ArtDi rector:Ant honyGe mme l
laro
Me diaEditor:Re nataBut era
Printer/Binder:Edwa r
dsBr others
Cov erPr i
nter:Le high-Phoenix

Creditsa nda cknowledgmentsb orrowe dfromot hers ourcesa ndr ep


r oduced,wi thpermiss
ion,inthist extb
ook
appe aront hea ppropria
tep agewi thi
nt het e
x t.Cisc oisar eg i
stere
dt ra
de ma rkofCiscoSystems,I nc.EUI -64isa
trade markoft heI nstit
utef orEl ect
ricalandElectr onicEng i
ne ers(IEEE).I EEEisar egi
steredtrade ma rkoft he
Instituteo fElectri
c a
landEl e
ct ronic
sEng i
nee r
s,I nc .Linuxisar egi
s t
eredt r
adema r
kofLi nusTor valds.UNI Xisa
register
e dt r
ade markofTheOp enGr oupint heUSa ndot herc ountries
.Zig Beeisar egi
stere
dt rade ma rkoft he
ZigBe eAll
iance.Op enFl
owi sat radema rkofS tanfor dUni vers
ity.Wi ndows ,Wi ndowsNT,Wi ndowsCE,a nd/or
othe rMic r
osoftp roductsreferencedhe rei
na ree i
t he rtradema rksorr egisteredtrademarksofMi cro soft
Corp orati
oni nt heUnitedS t
ate sand/orot hercount ri
es.S k
yp eisar eg
isteredt ra
dema r
kofS k
ype ,I ncorporate
d
int heUSa ndot hercountrie
s.

Addit
iona
lcomp
a nyandproductna
me sus
edi
nt hi
stextmaybetra
demarksorr
egi
ste
red
trademar
ksoftheindi
vi
dualcompani
es,a
ndar
er esp
ectf
ull
yac
knowle
dge
d.

Copyri
ght 201 4,2006,2000Pe a
r sonEduc ation,I nc.
,OneLa keStree
t,Up p
erS addleRiver
,
NewJe rsey07458.Al lr i
ghtsres
erved.Ma nuf
act uredint heUnit
edS t
atesofAme ri
c a.This
publ
ic
ationisp rotec
te db yCopyri
ght,a ndp er
mis si
ons houldbeobtai
nedfromt hepub li
sherpri
or
toanyp rohib
itedr e
pr oducti
on,storag einar etr ie
valsystem,ort r
ansmis
sioninanyf ormorb y
anyme ans,electr
onic,me chani
cal
,p hot ocopyi
ng,r ecording,orli
kewis
e.Toob tai
np ermiss
ion(
s)to
usemate r
ialfromt hiswo rk,pl
eases ubmi tawr ittenr equesttoPears
onEduc ati
on,Inc .
,
Permi
ssi
onsDe pa r
tme nt,OneLa keSt ree t
,Up perS addleRiver,NewJersey07458.

Manyofthedesi
gnationsbyma nufac
tur
ersandsell
ertodisti
nguis
ht hei
rproduct
sarecl
ai
meda
s
tr
ademar
ks.Wheret hosedesi
gnati
onsappe
arinthisbook,andthep ubl
is
herwa sawa
reofa
tr
ademar
kc l
ai
m,t hede s
igna
tionshaveb
eenprint
edini ni
ti
alcapsora l
lcap
s.

Li
bra
ryofCongr
essCa
tal
ogi
ng-
in-
Pub
lic
ati
onDa
taonFi
le

1
0987654321

I
SBN1
0:0-13
- 608530-X
I
SBN1
3:978-0-13-608530-
0
www.
pea
rsonhi
ghe
red.
com
ToChr
is
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
Cont
ent
s

For
ewor
d xxi
ii

Pr
efa
ce xxv

Cha
pte
r1I
ntr
oduc
tionAndOv
erv
iew 1
TheMot i
vati
onFor
1
.1 Internet working 1
TheTCP/ I
P
1
.2 Internet 2
Internet
1
.3 Services 2
1
.4 His
t oryAndSc opeOfTheI nt
ernet 6
TheI nt ernetAr chi
tectur
e
1
.5 Boar d 7
1
.6 TheI ABReor ganizati
on 8
1
.7 InternetReques tForComment s(RFCs
)8
Internet
1
.8 Growt h 9
1
.9 Transit i
onToI Pv6 1 2
Commi tteeDes i
gnAndTheNewVer si
onof
1
.10 IP 1
2
RelationshipBet weenIPv4And
1
.11 IPv6 1
3
1
.12 IPv6Mi grati
on 1 4
1
.13 DualSt ackSystems 1 5
Organi zati
onOfThe
1
.14 Text 1
5
1
.15 Summar y 16

Cha
pte
r2 Ov
erv
iewOfUnde
rlyi
ngNe
twor
kTe
chnol
ogi
es 1
9
I
ntr
oduc
tion
2.
1 1
9
2.
2 TwoApproac
hesToNetworkCommuni
cat
ion 20
2.
3 WANAndLAN 21
2.
4 Har
dwareAddres
singSc
hemes 21
2.
5 Ethernet( IEEE802.3) 22
2.
6 Wi -
Fi( I
EEE802. 1
1) 26
2.
7 ZigBee( I
EEE802. 15.
4) 26
2.
8 OpticalCarrierAndPacketOverSONET(OC,POS) 27
Point-To-Point
2.
9 Net wor ks 28
2.
10 VLANTec hnologyAndBroadc
astDomai
ns 28
v
ii
i Cont
ent
s

2.
11 Bri
dging 29
Congest
ionAndPac
ket
2.
12 Loss 30
2.
13 Summary 31

Cha
pte
r3 I
nte
rne
twor
kingConc
eptAndAr
chi
tec
tur
alMode
l 35

3.
1 I ntroduc t
ion 35
Appli
c ation-Level
3.
2 I nterc onnection 35
Networ k-Level
3.
3 I nterc onnection 37
Proper tiesOfThe
3.
4 I nternet 38
3.
5 I nternetAr chit
ectur
e 39
Interc onnectionOfMultipleNetwor
ksWi
thI
P
3.
6 Rout er s 39
3.
7 TheUs ersView 41
AllNet wor ksAr e
3.
8 Equal 42
3.
9 TheUnans weredQuesti
ons 43
3.
10 Summar y 43

Cha
pte
r4 Pr
otoc
olLa
yer
ing 47

4.
1 I ntroduc t i
on 47
4.
2 TheNeedForMul tipleProtocols 47
4.
3 TheConc eptualLayer sOfPr otoc olSof
tware 49
Func tionalityOfThe
4.
4 Layer s 49
4.
5 I SO7- LayerRef erenceModel 50
4.
6 X. 25AndI tsRelationToTheI SOModel 51
TheTCP/ IP5- LayerRef erenceModel
4.
7 52
4.
8 Loc usOfI nt el
l
igenc e 56
ThePr otoc olLayer i
ng
4.
9 Pr inciple 57
4.
10 TheLayer i
ngPr incipleAppli
edToANet wor
k 58
Layer ingI nMes h
4.
11 Net wor ks 60
4.
12 TwoI mpor tantBoundar iesInTheTCP/ IPModel 62
4.
13 Cros s
- LayerOpt i
mi zati
ons 63
TheBas icI deaBehi ndMul ti
pl
exi ngAnd
4.
14 Demul t i
plexing 64
4.
15 Summar y 66
Cha
pte
r5 I
nte
rne
tAddr
ess
ing 69

5.
1 Intr
oduc ti
on 69
5.
2 Univ
ersalHostIdenti
fi
ers 69
5.
3 TheOr i
ginalIPv
4Classf
ulAddr
ess
ingScheme 71
5.
4 DottedDec i
malNotati
onUsedWit
hI Pv
4 72
IPv4Subnet
5.
5 Addres
sing 72
Co
nte
nts i
x
FixedLengt hI Pv 4
5.
6 Subnet s 75
5.
7 Variabl e- Lengt hI Pv4Subnet s 77
5.
8 Impl ement ationOfI Pv 4Subnet sWi thMas ks 77
5.
9 IPv4SubnetMas kRepr esentationAndSl ashNot at
ion 78
TheCur rentCl as s
lessI Pv4Addr ess
ing
5.
10 Scheme 79
IPv4Addr essBl ocksAndCI DRSl ash
5.
11 Not at i
on 82
5.
12 ACl as slessI Pv 4Addr essi
ngExampl e 82
5.
13 IPv4CI DRBl ocksRes ervedForPr i
vat eNet works 83
5.
14 TheI Pv 6Addr es si
ngSc heme 84
5.
15 IPv6Col onHexadec i
malNot at i
on 84
IPv6Addr essSpac e
5.
16 Assignment 85
5.
17 Embeddi ngI Pv4Addr essesInI Pv 6ForTr ansi
tion 86
5.
18 IPv6Uni cas tAddr essesAnd/ 64 87
IPv6I nt er fac eI dentifiersAndMAC
5.
19 Addr ess es 88
IPAddr es ses,Hos ts,AndNet wor k
5.
20 Connec t i
ons 89
5.
21 Spec ialAddr es ses 90
Weaknes sesI nI nt ernet
5.
22 Addr ess ing 94
5.
23 Inter netAddr essAs signmentAndDel egati
onOfAut hor
ity 96
AnExampl eI Pv4Addr ess
5.
24 Assignment 96
5.
25 Summar y 98

Cha
pte
r6 Ma
ppi
ngI
nte
rne
tAddr
ess
esToPhys
ica
lAddr
ess
es(
ARP)1
01

6.
1 Intr oduc tion 1 01
6.
2 TheAddr es sResoluti
onPr oblem 1 01
6.
3 TwoTypesOfHar dwareAddr ess
es 1 02
6.
4 Resol utionThr oughDi r
ectMappi ng 1 02
6.
5 Resol utionI nADi rect-MappedNet wor k103
6.
6 IPv4Addr essResolut
ionThr oughDynami cBi
ndi
ng 1
04
6.
7 TheARPCac he 1 05
6.
8 ARPCac heTi meout 1 06
6.
9 ARPRef inement s 1 06
6.
10 Relat ionshi pOfARPToOt herPr ot
oc ol
s1 08
6.
11 ARPI mpl ement ation 1 08
ARPEnc aps ulat
ionAnd
6.
12 Ident ificat i
on 110
6.
13 ARPMes s ageFor mat 1 10
6.
14 Aut omat i
cARPCac heRev al
idati
on 1 12
6.
15 Revers
eAddr essResolut
ion(
RARP) 11
2
6.
16 ARPCac hesInLayer3Swi tc
hes 113
6.
17 ProxyARP 1 14
6.
18 IPv6NeighborDiscovery 115
6.
19 Summary 1 1
6
x Cont
ent
s

Cha
pte
r7 I
nte
rnetProt
ocol
:Conne
cti
onl
essDa
tagr
amDe
li
ver
y(I
Pv4,1
19
IPv
6)

7.
1 I ntr oduc tion 1 19
7.
2 AVi r tualNet wor k 1 19
Inter netAr chitec tureAnd
7.
3 Phi losophy 120
Princ i
pl esBehi ndThe
7.
4 St ruc tur e 1
20
7.
5 Connec t i
onles sDel i
verySystemChar act er
isti
cs 121
Pur pos eAndI mpor tanceOfTheI nter net
7.
6 Pr ot ocol 1
22
7.
7 TheI PDat agr am 1 22
7.
8 Dat agr amTypeOfSer vi
c eAndDiffer ent i
atedServi
ces1
27
7.
9 Dat agr amEnc aps ulati
on 1 29
Dat agr amSi ze,Net workMTU,andFr agment ati
on
7.
10 130
7.
11 Dat agr amReas sembl y 1 34
7.
12 HeaderFi eldsUs edForDat agramReas sembly 1 35
TimeToLi v e( I
Pv 4)AndHopLi mit
7.
13 (IPv 6) 1
36
7.
14 Opt ionalI PI tems 1 37
7.
15 Opt ionsPr oces s
ingDur i
ngFr agmentat ion 1 41
7.
16 Net wor kByt eOr der 1 43
7.
17 Summar y 1 44

Cha
pte
r8 I
nte
rne
tPr
otoc
ol:For
war
dingI
PDa
tagr
ams 1
47

8.
1 I ntroduc tion 1 47
8.
2 For war di
ngI nAnI nt
er net 1 47
DirectAndI ndir
ec t
8.
3 Del iver y 149
Trans mi s
sionAc rossASi ngle
8.
4 Net wor k 150
8.
5 I ndirec tDel i
very 1 51
8.
6 Tabl e- DrivenI PFor war ding 1 52
8.
7 Next -HopFor war di
ng 1 53
8.
8 Def aul tRout esAndAHos tExampl e 1 55
8.
9 Hos t -SpecificRout es 1 56
8.
10 TheI PFor wardi
ngAl gor ithm 1 57
Longes t -
Pr efixMat ch
8.
11 Paradi gm 158
8.
12 Forwar di
ngTabl esAndI PAddr ess
es 1 60
8.
13 Handl i
ngI ncomingDat agrams 1 61
8.
14 Forwar di
ngI nThePr esenc eOfBr oadc
astAnd 1
62
Multi
cast
8.
15 Soft
war eRoutersAndSequenti
alLookup 1
63
8.
16 Est
abli
shingForwardi
ngTables 163
8.
17 Summary 1 63
Co
nte
nts x
i

Cha
pte
r9 I
nte
rne
tPr
otoc
ol:Er
rorAndCont
rolMe
ssa
ges(
ICMP) 1
67

9.
1 I ntr oduc tion 1 67
TheI nt ernetCont r
olMes sage
9.
2 Pr ot ocol 1 67
9.
3 Er r orRepor tingVs .ErrorCor recti
on 169
9.
4 I CMPMes sageDel i
very 1 70
9.
5 Conc ept ualLayer ing 1 71
9.
6 I CMPMes sageFor mat 1 71
9.
7 Exampl eI CMPMes s
ageTypesUs edWi t
hI Pv4AndI Pv6 1
72
Tes tingDes ti
nat ionReac habilityAndSt at us
9.
8 ( Ping) 1
73
9.
9 Ec hoReques tAndRepl yMes sageFor mat 1 74
9.
10 Chec ksumComput ati
onAndTheI Pv6Ps eudo- Header 175
Repor tsOfUnr eachabl
e
9.
11 Des tinat i
ons 1
76
9.
12 ICMPEr r
orRepor tsRegar dingFr agment at i
on 1 78
Rout eChangeReques tsFr om
9.
13 Rout ers 1
78
9.
14 Det ec t
ingCi rc ularOrExc essivel
yLongRout es 1 80
9.
15 Repor ti
ngOt herPr obl
ems 1 81
OlderI CMPMes s
agesUs edAt
9.
16 Star tup 182
9.
17 Summar y 1 82

Cha
pte
r10 Us
erDa
tagr
amPr
otoc
ol(
UDP) 1
85

1
0.1 Introduc t
ion 1 85
1
0.2 Usi
ngAPr otoc olPor tAsAnUl ti
mateDestinat i
on 1 85
1
0.3 TheUs erDat agramPr otocol 1 86
1
0.4 UDPMes sageFor mat 1 87
InterpretationOft heUDP
1
0.5 Checksum 188
1
0.6 UDPChec ksumComput ati
onAndThePs eudo-Header 1 89
1
0.7 IPv4UDPPs eudo- HeaderFor mat 1 89
1
0.8 IPv6UDPPs eudo- HeaderFor mat 1 90
1
0.9 UDPEnc apsulat i
onAndPr otocolLayeri
ng 1 90
1
0.1
0 LayeringAndTheUDPChec ksumComput ation 1 92
UDPMul tipl
exing,Demul ti
plexing,AndProtoc ol
1
0.1
1 Ports 193
1
0.1
2 ReservedAndAv ai
labl
eUDPPor tNumbers 1 94
1
0.1
3 Summar y 1 96

Cha
pte
r11Re
li
abl
eSt
rea
m Tr
ans
por
tSe
rvi
ce(
TCP) 1
99
1
1.1 Introducti
on 1 99
1
1.2 TheNeedForRel i
abl
eSer v
ice 199
Properti
esOfTheRel i
ableDeli
very
1
1.3 Servic
e 200
1
1.4 Reli
abil
ity:Ac
knowledgementsAndRet
rans
miss
ion 201
1
1.5 TheSl i
dingWindowPar adi
gm 203
x
ii Cont
ent
s

1
1.6 TheTr
ans
mis
sionCont
rolPr
otoc
ol 205
20
1
1.7 Layer ing,Por t s,Connec t i
ons,AndEndpoi nts 6
1
1.8 Pas siveAndAc t i
v eOpens 208
Segment s ,St reams ,AndSequenc e
1
1.9 Number s 208
1
1.10 VariableWi ndowSi zeAndFl owCont rol 209
1
1.11 TCPSegmentFor mat 21 0
1
1.12 OutOfBandDat a 21 2
1
1.13 TCPOpt ions 21 2
1
1.14 TCPChec ksumComput ation 21 4
Acknowl edgement s,Ret ransmission,And
1
1.15 Timeout s 21
6
Accur ateMeas ur ementOfRoundTr i
p
1
1.16 Sampl es 218
1
1.17 Karn sAl gor i
thmAndTi merBac koff 219
1
1.18 Respondi ngToHi ghVar i
anc eInDel ay 220
Respons eTo
1
1.19 Conges t
ion 223
1
1.20 FastRec ov eryAndOt herRes pons eModifi
cat
ions 225
1
1.21 ExplicitFeedbac kMec hanisms( SACKandECN) 227
1
1.22 Conges t
ion,Tai lDr op,AndTCP 228
RandomEar l
yDet ecti
on
1
1.23 (RED) 229
1
1.24 EstablishingATCPConnec ti
on 231
1
1.25 Initi
alSequenc eNumber s 232
1
1.26 ClosingaTCPConnec ti
on 233
1
1.27 TCPConnec t
ionRes et 234
1
1.28 TCPSt at eMac hine 235
1
1.29 ForcingDat aDel ivery 236
1
1.30 Reser vedTCPPor tNumber s 237
Sil
lyWi ndowSyndr omeAndSmal l
1
1.31 Packet s 238
1
1.32 AvoidingSi llyWi ndowSyndr ome 239
Buff erBl oatAndI tsEffectOn
1
1.33 Latenc y 242
1
1.34 Summar y 243

Cha
pte
r12 Rout
ingAr
chi
tec
tur
e:Cor
es,Pe
ers
,AndAl
gor
ithms 247

1
2.1 Introducti
on 247
1
2.2 TheOr igi
nOfForwardingTables 248
1
2.3 ForwardingWithPar
t i
alInformat
ion 249
1
2.4 Ori
ginalInter
netArchi
t ec
tureAndCores251
1
2.5 BeyondTheCor eArchi
t ec
tureToPeer 253
Backbones
1
2.6 Automat icRoutePropagat
ionAndAFI B254
1
2.7 Distanc e-Vec
tor(Bel
lman-Ford)Routing 255
Reliabil
ityAndRout i
ng
1
2.8 Prot ocols 257
1
2.9 Link- State(SPF)Routi
ng 258
1
2.1
0 Summar y 259
Co
nte
nts x
ii
i

Cha
pte
r13 Rout
ingAmongAut
onomousS
yst
ems(
BGP) 263

1
3.1 I ntroduc t ion 263
TheSc opeOfARout i
ngUpdat eProtocol
1
3.2 263
1
3.3 Det er miningAPr acticalLimitOnGr oupSize 264
1
3.4 AFundament alI dea:Ext raHops 266
AutonomousSys tem
1
3.5 Conc ept 267
1
3.6 Ext er i
orGat ewayPr ot oc
olsAndReac habil
ity 268
1
3.7 BGPChar ac ter i
s tics 269
1
3.8 BGPFunc t ionalityAndMes sageTypes 270
1
3.9 BGPMes sageHeader 271
1
3.10 BGPOPENMes s age 272
1
3.11 BGPUPDATEMes sage 273
1
3.12 Compr es sedI Pv 4Mas k- Addres sPai
rs 274
1
3.13 BGPPat hAt t r
ibut es 274
1
3.14 BGPKEEPALI VEMes sage 276
1
3.15I nformat ionFr omTheRec ei
v er
sPer spec
tive 277
TheKeyRes trictionOfExt er i
orGat eway
1
3.16 Protoc ols 278
TheI nt ernetRout i
ngAr chitectureAnd
1
3.17 Registr i
es 280
1
3.18 BGPNOTI FI CATI ONMes s
age 280
BGPMul tipr otoc olExt ensi
onsFor
1
3.19I Pv6 281
Multipr otoc olReac hableNLRI
1
3.20At tribut e 283
1
3.21I nternetRout ingAndEc onomi cs 284
1
3.22Summar y 285

Cha
pte
r14 Routi
ngWithi
nAnAut
onomousS
yst
em(
RIP,RI
Png, 289
OSPF,I
S-I
S)

1
4.1 Int roduc tion 289
Stat icVs .Dynami cInter ior
1
4.2 Rout es 289
1
4.3 Rout ingI nformationPr ot oc
ol(RI
P) 293
1
4.4 SlowConv ergencePr oblem 294
SolvingTheSl owConv er gence
1
4.5 Pr oblem 296
1
4.6 RI PMes sageFor mat( IPv 4) 297
1
4.7 FieldsI nARI PMes s
age 299
1
4.8 RI PForI Pv 6( RI
Png) 299
1
4.9 TheDi s
adv antageOfUs ingHop 301
Count s
1
4.1
0 Del ayMetri
c( HELLO) 301
Del ayMetri
cs,Os c
ill
ation,AndRoute
1
4.1
1 Flapping 302
1
4.1
2 TheOpenSPFPr otocol(OSPF) 303
1
4.1
3 OSPFv 2Mes s
ageFor mat s(IPv
4) 305
1
4.1
4 ChangesI nOSPFv 3ToSuppor tIPv6 31
0
IS- ISRoutePropagat i
on
1
4.1
5 Prot ocol 31
2
1
4.1
6 Tr ustAndRout eHi j
acking 31 3
x
iv Cont
ent
s
Gated:ARoutingGateway
14.
17Daemon 31
3
14.
18Arti
fici
alMetr
icsAndMetri
cTr
ans
formati
on 31
4
14.
19RoutingWithParti
alI
nfor
mati
on 31
5
1
4.20Summar y 315

Cha
pte
r15I
nte
rne
tMul
ti
cas
ting 31
9

1
5.1 Introduct ion 31 9
1
5.2 Hardwar eBr oadc as t 31 9
1
5.3 Hardwar eMul ti
c as t 320
1
5.4 EthernetMul ticas t 321
TheConc ept ualBui ldi
ngBl ocksOfI nt
ernet
1
5.5 Mul ticast 321
1
5.6 TheI PMul ticas tSc heme 322
1
5.7 I Pv4AndI Pv 6Mul ti
castAddr esses 323
1
5.8 Mul ticastAddr es sSemant ic
s 326
MappingI PMul t i
c astToEt hernet
1
5.9 Mul ticast 327
1
5.10 HostsAndMul ticas tDel i
very 328
1
5.11 MulticastSc ope 328
1
5.12 HostPar tic i
pat ionI nI PMul ti
casting 329
IPv4I nter netGr oupManagementPr otocol
1
5.13( IGMP) 330
1
5.14I GMPDet ails 331
1
5.15I GMPGr oupMember shipStateTr ansi
t i
ons332
1
5.16I GMPMember shipQuer yMes s
ageFor mat 333
1
5.17I GMPMember shipRepor tMes sageFor mat 334
1
5.18I Pv6Mul t icastGr oupMember shipWi thMLDv 2 335
1
5.19 MulticastFor war dingAndRout i
ngI nformati
on337
1
5.20Bas i
cMul ticas tFor war di
ngPar adigms 339
1
5.21Cons equenc esOfTRPF 341
1
5.22Mul ticastTr ees 342
TheEs senc eOfMul t i
castRout e
1
5.23Pr opagation 343
ReversePat h
1
5.24Mul ticasting 344
1
5.25Exampl eMul ticastRout i
ngPr otocols 345
1
5.26Rel i
ableMul t i
cas tAndACKI mplosi
ons 347
1
5.27Summar y 349

Cha
pte
r16 La
belS
wit
chi
ng,Fl
ows
,AndMPLS 353

1
6.1 Int
roduc
tion 353
1
6.2 Swit
chi
ngTechnol
ogy 353
1
6.3 Fl
owsAndFl owSetup 355
LargeNetworks
,LabelSwappi
ng,AndPat
hs
1
6.4 355
Usi
ngSwitchi
ngWi th
1
6.5I P 357
1
6.6I PSwitc
hingTechnol
ogi
esAndMPLS 357
Cont
ent
s xv

16.
7 LabelsAndLabelAs signment 359
16.
8 Hierarchi
c alUs eOfMPLSAndALabelSt ack 359
1
6.9 MPLSEnc aps ulat
ion 360
1
6.1
0 LabelSemant ics 361
1
6.1
1 LabelSwi tc hi
ngRout er 362
1
6.1
2 Cont r
olPr ocessi
ngAndLabelDist
ribut
ion 363
1
6.1
3 MPLSAndFr agmentation 364
MeshTopol ogyAndTr affi
c
1
6.1
4 Engineering 364
1
6.1
5 Summar y 365

Cha
pte
r17 Pa
cke
tCl
ass
ifi
cat
ion 369

1
7.1 Introduc t
ion 369
1
7.2 Mot i
vationForCl assi
fi
cat
ion 370
Class
ificati
onI nsteadOf
1
7.3 Demul ti
plexi
ng 371
1
7.4 LayeringWhenCl ass i
fi
cat
ionI
sUs ed 372
1
7.5 Class
ificati
onHar dwar eAndNetworkSwit
ches 372
1
7.6 SwitchingDecisionsAndVLANTags 374
1
7.7 Class
ificati
onHar dwar e 375
1
7.8 High-SpeedClas si
ficati
onAndTCAM 375
1
7.9 TheSi zeOfATCAM 377
1
7.1
0 Class
ificati
on-EnabledGeneral
izedFor
warding 378
1
7.1
1 Summar y 379

Cha
pte
r18 Mob
ili
tyAndMob
ileI
P 381

1
8.1 Introduc ti
on 381
1
8.2 Mobili
t y,Addressing,AndRout i
ng 381
1
8.3 Mobili
t yVi aHostAddr essChange 382
1
8.4 Mobili
t yVi aChangesI nDat agramForwarding 383
TheMobi leIP
1
8.5 Technol ogy 383
OverviewOfMobi leI POper ati
on
1
8.6 384
OverheadAndFr equenc yOf
1
8.7 Change 384
1
8.8 MobileI Pv4Addr essi
ng 385
1
8.9 IPv4For ei
gnAgentDi scovery 386
IPv4Regi s
trati
on
1
8.1
0 387
1
8.1
1I Pv4Regi s
trati
onMes sageFormat 388
1
8.1
2 Communi cati
onWi t
hAnI Pv4For ei
gn 388
Agent
1
8.1
3I Pv6Mobil
it
ySupport 389
DatagramTransmi
ssi
on,Recept
ion,And
1
8.1
4 Tunneli
ng 390
1
8.1
5 Asses
smentOfI PMobil
ityAndUnsol
v edPr
obl
ems 391
1
8.1
6 Alt
ernati
veIdenti
fi
er-Locat
orSeparati
onTec
hnol
ogies 395
1
8.1
7 Summar y 396
x
vi Cont
ent
s

Cha
pte
r19 Ne
twor
kVi
rtua
li
zat
ion:VPNs
,NATs
,AndOv
erl
ays 399

1
9.1 Intr oduc tion 399
1
9.2 Virtual i
zat ion 399
1
9.3 VirtualPr ivat eNet wor ks( VPNs ) 400
1
9.4 VPNTunnel ingAndI P-i
n- IPEnc apsulati
on 401
1
9.5 VPNAddr es singAndFor war ding 402
1
9.6 Ext endingVPNTec hnologyToI ndividualHosts 404
UsingAVPNWi thPr i
vat eIP
1
9.7 Addr es s
es 404
1
9.8 Net wor kAddr es sTr anslati
on( NAT) 405
1
9.9 NATTr ans l
at ionTabl eCr eat i
on 407
1
9.1
0 VariantOfNAT 409
1
9.1
1 AnExampl eOfNATTr ans l
at i
on 409
Inter actionBet weenNATAnd
1
9.1
2I CMP 411
Inter actionBet weenNATAnd
1
9.1
3 Appl i
c ati
ons 411
NATI nThePr es enceOf
1
9.1
4 Fragment at ion 412
1
9.1
5 Conc ept ualAddr es sDomai ns 41 3
Linux,Wi ndows ,AndMacVer sionsOf
1
9.1
6 NAT 41
3
1
9.1
7 Over layNet wor ks 41 3
1
9.1
8 Mul tipleSi mul t aneousOv erlays 41 5
1
9.1
9 Summar y 41 5

Cha
pte
r20 Cl
ie
nt-
Ser
verMode
lOfI
nte
rac
tion 41
9

20.
1I ntroduction 41 9
TheCl i
ent- Serv
er
20.
2 Model 420
20.
3 ATr ivi
alExampl e:UDPEc hoServer 420
20.
4 TimeAndDat eService 422
20.
5 SequentialAndConc urr
entServers 423
Server
20.
6 Complexity 425
20.
7 Broadcasti
ngReques ts 426
20.
8 Cli
ent-Serv erAlternati
vesAndExtensi
ons426
20.
9 Summar y 428

Cha
pte
r21TheS
ocke
tAPI 431

21
.1 I
ntr
oduc
tion 431
21
.2 VersionsOfTheSoc ketAPI 432
21
.3 TheUNI XI /OParadigmAndNetworkI/O 432
21
.4 AddingNet workI/Ot oUNIX 432
21
.5 TheSoc ketAbstr
ac ti
onAndSocketOper
ations 433
ObtainingAndSet tingSocket
21
.6 Options 438
HowASer verAcceptsTCP
21
.7 Connec tions 439
Co
nte
nts x
vii

21
.8 Ser versThatHandl eMul t
ipl
eServ i
ces 440
21
.9 Obt ainingAndSet ti
ngTheHos tName 441
21
.10 LibraryFunc ti
onsRel atedToSoc kets 442
21
.11 Networ kByteOr derAndConv ersionRoutines 443
21
.12I PAddr essMani
pul ati
onRout i
nes 444
21
.13 AccessingTheDomai nNameSys tem 444
ObtainingI nf
ormat ionAbout
21
.14 Hosts 446
ObtainingI nf
ormat ionAbout
21
.15 Networ ks 447
ObtainingI nf
ormat ionAbout
21
.16 Protoc ols 447
ObtainingI nf
ormat ionAboutNet work
21
.17 Services 447
21
.18 AnExampl eCli
ent 448
21
.19 AnExampl eServer 453
21
.20Summar y 460

Cha
pte
r22 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) 463

22.
1I ntroduc tion 463
22.
2 Histor yOfI Pv4Boot strapping 464
22.
3 UsingI PToDet ermineAnI PAddr ess 464
22.
4 DHCPRet rans mi
s s
ionAndRandomi zat i
on 465
22.
5 DHCPMes s ageFor mat 465
22.
6 TheNeedForDynami cConf i
gur ation 468
22.
7 DHCPLeas esAndDynami cAddr es sAs si
gnment 469
22.
8 Mul tipl
eAddr essesAndRel ays 469
22.
9 DHCPAddr essAc quisi
tionSt ates 470
22.
10EarlyLeas eTer mination 471
LeaseRenewal
22.
11States 472
22.
12DHCPOpt ionsAndMes s
ageType 473
22.
13DHCPOpt ionOv erload 474
22.
14DHCPAndDomai nNames 474
22.
15ManagedAndUnmanagedConf igur at i
on 474
ManagedAndUnmanagedConf igur at i
onFor
22.
16IPv6 475
IPv6Conf igur at
ionOpt i
onsAndPot enti
al
22.
17Conf lic
ts 476
22.
18IPv6Nei ghborDi scoveryPr otocol( NDP) 477
22.
19ICMPv 6Rout erSolici
tationMes sage 478
22.
2I CMPv 6Rout erAdv erti
sement
0 Mes sage 478
22.
21ICMPv 6Nei ghborSol i
citati
on 479
Mess
age
22.
2
2 ICMPv6NeighborAdv
ert
isementMes
sage 480
22.
2I CMPv6Redirect
3 Mess
age 480
22.
2
4 Summary 481
x
vii
i Cont
ent
s

Cha
pte
r23 TheDoma
inNa
meS
yst
em(
DNS
) 485

23.
1 Introduc ti
on 485
23.
2 NamesForComput ers 486
23.
3 FlatNames pace 486
23.
4 Hierar chicalNames 487
Delegat ionOfAut horityFor
23.
5 Names 488
23.
6 SubsetAut hority 488
23.
7I nter netDomai nNames 489
23.
8 Top- Lev elDomai ns 490
23.
9 NameSynt axAndType 492
23.
10Mappi ngDomai nNamesToAddr esses 493
23.
11Domai nNameRes olution 495
23.
12EfficientTr ans l
at i
on 496
23.
13Caching:TheKeyToEf fi
ciency 497
23.
14Domai nNameSys temMes sageFormat 498
23.
15Compr essedNameFor mat 501
23.
16Abbrev iationOfDomai nNames 501
23.
17Inver seMappi ngs 502
23.
18PointerQuer i
es 503
Objec tTypesAndRes ourceRec ord
23.
19Cont ent s 504
23.
2
0 Obtaini ngAut hor i
t yForASubdomai n 505
23.
21ServerOper ationAndRepl icati
on 505
23.
2
2 Dynami cDNSUpdat eAndNot ifi
cation 506
23.
23DNSSec urityExt ens i
ons(DNSSEC) 506
23.
2
4 Mul ti
c astDNSAndSer vic
eDi sc
overy 507
23.
25Summar y 508

Cha
pte
r24 El
ect
roni
cMa
il(
SMTP,POP,I
MAP,MI
ME) 51
1

24.
1I nt roduc
tion 51 1
24.
2 Elect r
oni
cMai l 51 1
24.
3 Mai l
boxNamesAndAl iases 51 2
24.
4 AliasExpansionAndMai lForwarding 51 3
24.
5 TCP/ IPStandardsForEl ec t
roni
cMai lSer
vice 514
24.
6 Simpl eMailTrans
ferPr ot ocol(
SMTP) 51 5
24.
7 Mai lRetri
evalAndMai lboxMani pulati
onProtoc
ols 51
7
24.
8 TheMI MEExt ensi
onsForNon- ASCI IDat
a 51 9
24.
9 MI MEMul ti
partMessages 521
24.
10Summar y 522
Co
nte
nts x
ix

Cha
pte
r25 Wor
ldWi
deWe
b(HTTP) 525

25.
1I ntroduc ti
on 525
Impor tanceOfThe
25.
2 Web 525
25.
3 Architectur alComponent s 526
25.
4 UniformRes ourceLoc ator s 526
25.
5 AnExampl eHTMLDoc ument 527
Hypert extTr ansfer
25.
6 Protocol 528
25.
7 HTTPGETReques t 528
25.
8 ErrorMes sages 529
25.
9 Persis
t entConnec tions 530
25.
10DataLengt hAndPr ogramOut put 530
LengthEnc odi ngAnd
25.
11Header s 531
25.
12Negot i
at i
on 532
25.
13ConditionalReques ts 533
25.
14ProxySer ver sAndCac hing 533
25.
15Caching 534
25.
16OtherHTTPFunc t i
onality 535
25.
17HTTP,Sec ur ity,AndE- Commer ce 535
25.
18Summar y 536

Cha
pte
r26 Voi
ceAndVi
deoOv
erI
P(RTP,RS
VP,QoS
) 539
I
ntr
oduc
tion
26.
1 539
26.
2 Digi
t i
zingAndEnc oding 539
26.
3 AudioAndVi deoTr ansmissi
onAndRepr oduct
ion 540
26.
4 JitterAndPl aybac kDel ay 541
Real-timeTr ans portPr otocol
26.
5( RTP) 542
26.
6 Streams ,Mi xing,AndMul ti
c asti
ng 544
26.
7 RTPEnc aps ul
at i
on 544
26.
8 RTPCont r
olPr otocol( RTCP) 545
26.
9 RTCPOper ation 545
26.
10IPTel ephonyAndSi gnali
ng 546
QualityOfSer vice
26.
11Cont roversy 549
26.
12QoS,Ut i
li
zat ion,AndCapac it y 550
Emer genc ySer vicesAnd
26.
13Preempt ion 551
26.
14IntSer vAndRes ourc eReserv at
ion 551
DiffServAndPer -Hop
26.
15Behav i
or 553
26.
16Traff
icScheduli
ng 553
Traff
icPoli
cingAnd
26.
17Shapi
ng 555
26.
18Summary 556
x
x Cont
ent
s

Cha
pte
r27 Ne
twor
kMa
nage
ment(
SNMP) 559

27.
1 Introduc ti
on 559
27.
2 TheLev elOfManagementProtocol
s 559
27.
3 Architec t
ur alModel 561
27.
4 ProtocolFr amewor k 562
27.
5 Exampl esofMI BVari
abl
es 564
TheSt r uctureOfManagementInformat
ion
27.
6 564
27.
7 FormalDefini
ti
onsUs i
ngASN. 1 565
StructureAndRepr es
entati
onOfMI BObj
ect
27.
8 Names 566
27.
9 MI BChangesAndAddi ti
onsForIPv6 571
SimpleNetworkManagement
27.
10Protocol 571
27.
11SNMPMes s
ageFor mat 574
27.
12AnExampl eEncodedSNMPMes s
age 577
27.
13SecurityInSNMPv 3 579
27.
14Summar y 580

Cha
pte
r28 S
oft
war
eDe
fine
dNe
twor
king(
SDN,Op
enFl
ow) 583

28.
1I ntroduc ti
on 583
Rout es,Pat hs,And
28.
2 Connec t
ions 583
28.
3 Traff icEngineer i
ngAndCont r
olOfPat hSel ec
tion 584
Connec t
ion-Or i
ent edNet worksAndRout i
ng
28.
4 Over l
ays 584
28.
5 SDN:ANewHybr idAppr oach 586
Separ ati
onOfDat aAnd
28.
6 Cont rol 586
TheSDNAr c hit
ect ureAndExt ernal
28.
7 Cont roll
ers 588
28.
8 SDNAc r
ossMul t
ipleDevices 589
28.
9I mplement i
ngSDNWi thConv entionalSwitches 590
28.
10OpenFl owTec hnology 592
28.
11OpenFl owBas i
cs 592
28.
12SpecificFieldsI nAnOpenFl owPat tern 593
28.
13ActionsThatOpenFl owCanTake 594
OpenFl owExt ensi
onsAnd
28.
14Additions 595
28.
15OpenFl owMes sages 598
28.
16UsesOfOpenFl ow 599
28.
17OpenFl ow:Exc i
tement ,Hype,AndLi mit
ations 599
28.
18Softwar eDef i
nedRadi o( SDR) 600
28.
19Summar
y 601

Cha
pte
r29 I
nte
rne
tSe
cur
ityAndFi
rewa
llDe
sign(
IPs
ec,S
SL) 605

29.
1I ntroduct
ion 605
Protecti
ng
29.
2 Resources 606
Co
nte
nts x
xi
Inf or mat i
on
29.
3 Polic y 607
29.
4I nt ernetSec ur i
ty 607
IPSec ur i
ty
29.
5( IPs ec) 608
29.
6I Ps ecAut hent i
cationHeader 608
29.
7 Sec ur i
t yAs soc i
ation 61 0
29.
8I Ps ecEnc aps ulati
ngSec urityPayload 61 1
Aut hent i
cat ionAndMut abl
eHeader
29.
9 Fields 612
29.
10IPs ecTunnel ing 61 3
29.
11Requi redSec ur i
tyAl gorithms 61 3
Sec ur eSoc ketLayer( SSLand
29.
12TLS) 61
4
29.
13Firewal l
sAndI nter netAc cess 614
Mul ti
pleConnec tionsAndWeakes t
29.
14Links 61
4
Firewal lImpl ement ati
onAndPac ket
29.
15Filter s 61
5
Firewal lRul esAndThe5-
29.
16Tupl e 615
Sec ur i
t yAndPac ketFi lter
29.
17Spec ification 617
TheCons equenc eOfRes tri
ctedAc ces
sFor
29.
18Client s 61
8
29.
19Stat ef ulFi rewal l
s 61 8
29.
2 Cont entPr ot ecti
onAnd
0 Proxi es 619
29.
21Moni tor i
ngAndLoggi ng 620
29.
2
2 Summar y 620

Cha
pte
r30 Conne
cte
dEmb
edde
dSys
tems(
TheI
nte
rne
tofThi
ngs
) 623
I
ntr
oduc
tion
30.
1 623
30.
2 Sensi
ng,Moni t
or i
ng,AndCont r
ol624
PowerCons ervat i
onAndEnergy
30.
3 Harvest i
ng 624
30.
4 AWor l
dOfI ntelli
gentEmbeddedDev i
ces 625
30.
5 TheI mpor t
anc eofCommuni c
ation 625
30.
6 Exampl e:El
ec t
r onicAdsInShoppingMall
s 626
30.
7 Coll
ectingDat aFr omEmbeddedSys t
ems 627
WirelessNet wor ki
ngAndI EEE
30.
8 802.15.4 627
30.
9 AMes hNetwor kForSmar tGr i
dSensors 628
30.
10AFor war di
ngTr eeForaSens orMesh 629
30.
11Usi
ngLayer2AndLayer3Pr ot oc
olsInAMes h 630
TheZi gBeeI
Pv6Protocol
30.
12 Stack 631
Forwar di
ngInAZigBeeRoute-Ov
er
30.
13 Mes h 633
Assess
mentOfUsingIPv 6Rout
e-OverForA
30.
14 Mes h 635
30.
15Summar y 637

Ap
pendi
x1Gl
oss
aryOfI
nte
rne
twor
kingTe
rmsAndAb
bre
via
tions 639

I
nde
x 681
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
For
ewor
d

Iti sar aretr eatt ob ea skedt owr i


teaf orewordt ot hes ix
t he di
tionof
DougCome rsnow c l
a ssi
cb ookonTCP/ I
Pa ndt heI nternet.I n201 2,t herea re
nearly3b il
-li
onpe opleonl ine.Some t hinglike6. 5b il
li
onmob il
ep hone sa reinus e
andma nyoft hesea r e s
ma rtphone s tha tha vea ccesstot heI nte rne tviat he
wireles
st el
ephonene t -
wor ka ndthr oug hWi - Fi
.I nf act
,t hewi rele s
ss ystemsa re
divert
ingt raff
ict oWi -Fiwhe nt hisi sp oss
ib l
ei nor dert oshe dl oa d.Themos t
recentda tafrom Te l
e geographyist ha t77Tb p
s( terabi
tsp ers e
c ond)f low a cr
oss
theI nternet.As ub s
t anti
alc ompone ntoft het r a
fficisv i
deo,b uti ncreasingl
y,
l
a rg
eda t
af i
lesaret ransferredtha tc ont ai
ng eneticsequencei nf orma ti
on,da ta
from te l
esc
opes,se nsors ystems,t heLa rgeHa dronCollider
,a ndot he rs c
ientifi
c
inst
rume nts.
Weha vele a
rnedal ota boutTCP/ IPi nma nyc ont exts,andt hist extc ol
lects
muc hoft hewi sdom.Weha velear nedt hatb uff erme mor yma ynotb eourf rie
nd
iflargea mount sofi tarel ocatedi nane two rkde vicewhe ret he r
ei sama jor
dropinc apaci
t y.Thisist hes o-calle
d bufferb loatp roblem describedinCha pter
11.Whe reahi gh-speedlinkme etsal ow- speedl i
nk ,larg ebuf fe
rst akeal ongt i
me
toe mp t
yg oi
ngi nt helow- speeddi r
e cti
on,whi chha st hee ffectofi ncreasi
ng
dela
ya nda ff
e cti
ngTCPf low cont rol
,g eneratings eriousc ongestionwi tha llits
negati
ves i
dee ffec
ts.Weha vealsol earnedt hatt herea rec ondit
ionsunde rwhi ch
TCP/IP wor ksp oorly.He reIa mt hinkinga b
outhi g hl
y di s
rupteda ndv a r
iably
dela
yede nv i
ronme nts. Ex amplesi nclude i nter- pl
ane tary communi ca
t i
on a nd
tacti
calc ommuni ca
t i
on ( incl
uding mob i
lea s we l
la s mi li
-tary). For t hese
condit
ions, ne w k inds of p rotoc ol
sc a l
l
ed delay a nd di sruption t olerant
networking( DTN)a rene ededt os up plementt hingsl ik
eTCP.I nf act,DTN c an
runov erTCPorUDPorv irtual
lya nyot hert ransmissions ubsystem.Thep rotocols
thatim- pl
eme ntt histypeofne t wor ki
nga rea lreadyi nus eont heI nterna t
ional
SpaceStationa ndont her oversnowonMa r
s!
Ne wi deass ucha sS oftwareDe finedNe tworki
nga ndt heOp enFlow p rotoc ol
fromS tanf ordUniver s
ity,descri
b edi
nCha pter28,area l
soc olori
ngt hef ut ureof
theI nterne t
.Whi l
et hesesys t
emsc anop eratetosuppor tc onv enti
onalI nt erne t
archi
tectur es,t heya r
ea l
soa bl
et og ob e
yond the c onv entionalnot ionsof
addressi
ngt os uppor
tc ontent-ba s
edr out i
ng ,amongothe rt hing s
.Ma nageme ntof
end-to-endf l
o wswor kswe llwiths uc hs ystems.Ina dditiont ot hat,i ts ee ms
timel
yt or evisitwirelesscommuni ca
t iona ndt oaskhow b r oadcastmode sc ould
infl
uencef urthere vol
ut i
onoft heInt ernet .Oneimag-iness atel
lit
es ra
ining I P
orUDPp ack et
sdownonhundr edsofmi l
lionsofr ec
eive
rs .Int errestr
ialcont ex ts,
the a b
il
ityt or a
diate 360 de greesa l
lowsmul t
ipl
er e cei
v e r
st or e-c
e i
v e one
t
ransmi
ssi
on.Adva
ncesi
nsha
ringofs
pec
trum andi
nt heus
eofb e
am-
for
ming
a
ntenna
sma kethi
sanev
enmoreri
cha
ndintr
igui
nga
reatoexpl
ore
.
x
xiv For
ewor
d

TheInternetconti
nue stoe x
pa nda ndcha
ng einune xpecte
dwa ys.Inaddit
ion
t
ode vi
cesthathuma nsus e,ane w wa veofs ensors,cameras,a nda ct
uatorsare
b
eingc on-nec
t e
dt hatwil
lg iv
eusr e
mot eacce
s sandc ontrolofe verythi
ngf r
om
s
cienti
ficdatat othelig
ht sinab uil
dingandma nufac
turingp rocess
es.Wer efer
t
ot hene wde vi
cesasanI nternetofThi ngs
;the ya r
ede sc
ribedinCha pter30.
AsIt hinkthi
sbookampl
ydemonstrates
,theInter
netissti
l
le x
cit
ing.The
re
i
sstil
lmuc hr ese
archt obecar
ried out insup
p or
to f ne
wa nd cha
lle
ngi
ng
a
ppl
i
c a
tions.Opp
or-tuni
ti
esf
orcol
la
borationgrowbytheday.
s
t
Welc
ometothe21 Ce
ntur
yInternetwhereinnova
tioni
ssti
llt
heorde
rof
t
he day.Thisb
ook pr
ovi
desthe b
ac k
ground you needto under
sta
nd and
p
art
ici
pate.

VintCerf
Inter
netEva
ngel
i
st,Goog
le
Presi
dent
,ACM

Ma
rch,201
3
Pr
efa
ce

I nt e
rne tworking a nd TCP/ IP now domi natea llof ne twor ki
ng e ven
tele
p honec omp aniest hatwe reonc et hee xcl
us i
veb astionsofc ircuitswi t
ched
networ ksha vea doptedI Pt ec
hnology.Two mor er evolutionaryc hangesa re
occurr ingt hatr el
yoni n-
t ernetwork i
ng:t hec loudc omp ut i
ngp aradigma ndt he
Interne tofThi ngs.I nt hec l
oudmode l
,c omput ati
ona nds tor agea rep erformed
incloudda tac ente rs
.Us ersr el
yont heI nternett oup l
oad,downl oad,a nda cces
s
theiri nforma ti
ona ndt osha r
eda tawi thot hers.Thep hraseI nt ernetofThi ngsis
usedt oc ha r
acterize a nI nternet of int el
l
igent ,e mb ed-ded de vi
ce sthata ct
autonomous lyr athe rt hande vices
,s ucha ss ma rtp hone sa ndl a p-
t ops
,t hata
huma n op e rate
s. Us ing I nt e
rnet t echnolog y a l
lows e mb edde d de vi
ce st o
communi catewi thr emot eserversa swe l
la swi thonea nothe r
;t her esul
ti
ngc yber
in-frast r
uct urea l
r ea
dyi ncludesde vi
c e
si nhome s,off i
ces,a nds tores,aswe l
las
sensor st hatme asuret hee nv i
ronme nta ndc ivilstructur ess uc ha sb ri
dgesa nd
dams .
Ma nyr eadersha ver eque s
t edtha tt het extb eup datedt or eflectr ecent
chang es;ma nyha v esug ges
teds p ec
ifi
ct op
ic sa nde mphasi
s.Twe ntyye a r
sa fterits
inv
e ntion,I Pv6i sf inall
yg aininga cceptance .Voicea ndv ideoha ver epla
c edf i
le
transfera sma jorus esoft heI nternet.Thes ixtheditio
nr espondst or eaders
sugge s
t i
onsb yr e organizi
nga ndup da t
inge x i
s t
ingc hapt
e r
sa ndi ntroducingne w
mat eri
a l.Inpa r
t i
c ul
a r
,c haptersont heea rlya ppli
cati
onsofTe l
neta ndFTPha ve
beene liminatedt oma kes pac
ef ornewe rma terial
.Ane wc ha pteront heInt ernet
ofThi ng sconsi
de rst heus eofTCP/ IPinawi re l
esssensorne twor k
.Ane wc hapter
onS oft wareDe fine dNe tworkinge xaminest heus eofOp enFlowwhi ch,a l
thoug his
itnota nI ETFs ta ndard,ha sb ecomea nimp ortantp artofne twor ka ndInt ernet
mana geme nt.
Tos atis
fya n oft-repea
tedr eque st,t hec hapteron p rotocollayeringha s
beenmov ede arl
ie
ri nthet ext
.Instruc torsa rewa rned,however,t hatlayeringis
notar i
gida rc
hitec-t
uret hatexpl
a insa l
lp rotocol
s.S tudent
ss houlds eeita sa
basi
cb uts omewha tsimpli
s-ti
cguide li
net ha the l
psusunde rst
a ndp rotocol
s.I n
Chapter30,f ore xample
,wel ear
nt hatt hep rotocolsforar oute -
overme shblur
theb oundari
esb etweenlayersbya ddi ngs himsa ndb le
ndingI Pf orwardingwi th
Layer2r eachabil
i
ty.
Eachchapterhasbeenupdatedt of ocusoni de
asa ndtechnologi
est hatare
now b e-
ing usedint he Inter
net.The mos ts ig
nifi
cant c
ha ngec onsis
ts of
i
ntegrati
ng the IPv
6 dis
cussi
on wit
ht ha tofI Pv4.Ea chchap t
e rde s
cri
besa
pri
ncip
le,e xp
lai
nsthe gene
r a
lde s
ign,a nd t
henp roceedstoe xpl
ai
n how t he
pri
ncip
lea p
pli
est oIPv
4a ndI Pv
6.Re ader swil
lseet ha
tt hetwov ers
ionsofI P
a
rec l
ose
lyint
e r
rel
atedand tha
ti tisimpos-
sib
let
o unde
rst
and t
hec
hang
es
i
ntr
oducedb
yI Pv6wit
houtunders
tandi
ngIPv4.
xx
vi
Pr
efa
ce

Li
k ee a
rli
e re dit
ions,whi c
hha v
eb eene x t
reme l
yp opular,t hee ntir
et ext
foc
us e
sonc onc eptsa ndp ri
ncip l
es.Ear l
yc ha ptersde s
cri
b et hemot i
vati
onf or
i
nternetworkinga ndg i
v ethef undament al
soft heTCP/ I
Pi nterne ttechnol
og y.
Wewi llseetha tinternet-workingi sap owerfula bstract
iont hata l
lowsust ode a
l
wit
ht hec omp lex
it yofmul tipl
eunde rl
yingc ommuni cati
ont e c
hnologiesbyhi ding
thede tai
l
sofne t workha rdwar e.Wewi llunde rst
andt hene t
wor kl ev
elservices
thata ni nternetp r
ov i
desa nd s ee how a pp l
i-ca
tionsus et he s ervi
ces.La ter
cha
pt ersfil
li n de ta
ils
.The t e xtr eviewsb otht he archi-
t ect
ur e ofne twor k
i
nterconnecti
ons a nd t he p r
inc i
ples unde rlyi
ng p rotocol
st hat ma ke s uch
i
nterconnectedne twor ksfuncti
ona sas i
ng l
e,uni fi
edc ommuni cat
ions yst
em.
Afterreadi
ngt heb ook,youwi l
lunde rs
tandhowi ti sposs
ibl
et ointerc
onne c
t
mul-tipl
ephysica
lne t worksintoac oordi
nateds yst
em,how i nter
ne tprot ocol
s
operateint hate nvironment,a ndhow a ppl
i
ca ti
on p rogramsus ether e
s ult
ing
syst
e m.Asas peci
fice x-a
mp l
e,youwi l
ll ear
nt hede ta i
lsoft heglobalTCP/ IP
Internet,i
ncludi
ngt hea rc
hitec-t
ureofi tsr outers ys t
ema ndt hea ppl
ic at
ion
protocol
sitsupports.I naddit
ion,youwi l
lunde rsta
nds omeoft helimit
ationsof
theinterne
ta pproacha ndtheTCP/ IPprotocol
s.
De s
ignedasbothac oll
eget exta nda sap rof
essionalrefe
rence,t hebooki s
writtena tana dva
nce dunde rgr
a duateorg raduatele vel
.Forp rofessi
onal
s,t he
bookp rovide
sac omp rehensi
v eintroductiont ot heTCP/ IPtechnologyandt he
archite
ctureoft heI nter-net.Al t
houghi tisnoti nt endedtor e
placeprotocol
standardsdocuments,theb ooki sa ne xcell
ents tar
tingp ointforl ear
ningabout
int
e rnetworki
ng becausei tp rovides a uni form ov ervi
ew t hate mp
hasizes
pri
nc i
ples.Moreove
r,i tg i
vest he r ea
de rp erspect
iv et hatcanb ee xtr
eme ly
dif
f i
culttoobtai
nf r
omi ndi
vidua
lp rotocoldocume nts.
Whe nus edint hec la
ssroom,t het extp rovi
desmor ethans uffici
entma te
rial
foras ing les e
me sterne twor kcours ea teithert heunde rgraduat eorg r a
duate
l
e v
el.Inag ra-dua tecourse ,Iur gep rofe
s s
orst oi ncl
udes ignif
icantde s
igna nd
implement ati
onp rojec
tsa swe l
la sr ea
dingsf rom t helite
ra t
ur et hatp rovi
dea
basi
sf orf urthere xpl
oration.Ma ny oft hee x
er c
isessugg ests uchsub tlet
ies
;
sol
ving t hem of te nr equiress t
ude ntst or e
adp rotocols tandardsa nd a ppl
y
creati
vee nergyt oc omp rehendc onsequences.Forunde rgraduatec ours
e s,ma ny
oft hede tai
lsa r
eunne ces
sa ry.Studentsshoul db ee x
p ec
t-edt og ra
spt heb asi
c
conceptsde scri
b edint het e xt,andt heys houldb ea bl
et ode scri
b eandus ethe
fundame nt a
lp rotocol
s.
Ata l
llevel
s,hands- one xperi
enc esha rpensthec onceptsandhe lp
ss tudents
gaini ntui
ti
on.Thus,Ie nc ourageinstructorst oinventp r
ojectsthatg ivestudents
oppor tuni
-ti
est o useI nternets erv i
cesa nd p rotocols.Ina n unde rgraduate
cours e,mostoft hep ro- j
ectswi l
lc onsistofwr iti
nga pp
li
cationst hatus et he
networ k.Inmyunde r
g radua tecourse,Iha v
es tudentswr iteas impli
fiedne twork
analyze r(i.
e.,giv
en ap acketi nb inary,p rintt he v al
ue ofe achf ie
ld).The
seme sterprojec
ti n my g radua
t eI nternet-wor ki
ngc oursea tPur duer equi
res
stude ntstobuil
dsigni
f i
ca ntI Pprotocols oftware;thet r
aditi
ona lprojec
ti nvol
ves
impleme nt
inga nI Pr out er.Wes up pl
y ha rdwarea nd t hes our c
ec odef ora n
oper
atings yste m,i
nc l
udi
ngde vicedriver
sf ornetworki nter
f a
ces;st
udentsbuil
d
awor kingr out erthatinterconnectsthreene tworkswi thdiffe
rentMTUs .The
cour
sei se xtremelyr i
gorous,studentswor kint e
a ms
,a ndt heresul
tshavebeen
im-pr
essive( ma nyindust
r i
esr ecr
uitg r
aduatesf rom thecourse).Al
thoug
hs uch
expe
rime n-tationissafestwhe nt heinstruct
ionallab
or a
toryne twor
ki si
sola
ted
fromp roduction
Pr
efa
ce x
xvi
i

c
omputi
ngf a
cil
it
ies
,weha vefoundthatst
udentsexhib
itthemostent
husi
asm,
a
ndbenefi
tthemos t,whentheyhav
ea c
ces
stot heglob
alInt
erne
tandcantest
t
hatthe
irprotoc
olsint
erop
erat
ewithcommerc
ialve
rsi
ons.
The b ook i sor ganizedi nt of i
v e ma i
np ar t
s .Cha p t
e rs1a nd 2 f orma n
introduc t i
on t hat p rovi
des a n ov erv i
ew a nd di scusse s e xisti
ng ne twor k
technol og i
es .I np art
icular,Cha pter2 r e
v i
e wsp hys i
calne twor kha rdwa re.The
intent i
on i st op rovideb as
ici ntui-tion a b outt hef unc tiona lityt heha rdwa re
suppliesa ndwha ti sp ossi
ble,nott os pendi nor dinatet imeonha rdwa r ede tails
.
Chap ter s31 1de scribet heTCP/ IPI nte rnetf rom t hev iewp oi ntofas inglehos t,
showi ngt hep rotocolsahos tc ontainsa ndhow t he yop e rat e.The yc overt he
interne ta bs tracti
on,t henot ion ofp rotoc oll aye ri
ng,t heb asicsofI nte rnet
addr essinga ndf or warding,a ndt r
ansp ortp rot oc ol
s .Cha pters1 21 4c ons i
d- ert he
architec tureofa nint ernetwhe nv i
e we dg lob al
ly.The ye xp lorer outinga rchitec-
turea ndt hep rotocolsr out ersus et oe xcha ng er outi
ngi nf or ma ti
on.Cha pters
1519c ons iderv ariations a nd e xtens i
ons of t he b asict echnol ogy,i ncluding
mult i
c asting ,p ack-etc las
sifica ti
on, ne twor kv i
r tual
ization, a nd mob ili
ty.I n
particula r,t hec ha p
te ronmo- bi
li
tye xp l
ainswhymob i
lit
yi sdi ffic
ul ti na nI P
networ k.Fi na l
ly,Cha p ters2030di s-c ussa pp l
icationl evelse rv i
c esa v
a i
lab l
ei nt he
Inter net( i
nc ludingne tworkma nage-me nt )
,ne twor ks ecurit y,a ndt heI nte rnet
ofThi ng s.The c hapt ersp re sentt he c li
ent -se rvermode lofi nteract i
on,g ive
severa le xamp l
esofa ppli
cationst hatus et hec lient -s
erve rmode l,a nds how how
cli
ent -se rveri ntera c
tiona ppliest ocomp uterb oot strapa ndne twor kma na geme nt.
Chap ter28e xpl
ainsane wa p proa c
ht one twor kma nageme ntk nowna sS oftwa re
Define dNe twor king( S DN)a ndt hec hiefp rot ocol,Op e nFlow.Al thoug hnota n
officialp artoft heTCP/ IPs ta nda r
ds ,S DNt e c
hnol og yha sb e eni nc l
ud- edb e cause
itha sg e nera tedc onsiderablee x cite
me nt .
Thec haptersha veb eenor ganizedb ot tom up .I nsteadofs tarti
ngb yv iewing
theI nt erne tasab l
ackb oxa ndl earninghow t ous ei t
,t het extb eginswi tha n
overv i
e w ofha rdwa rea ndc ontinuest oa ddt hec onc e
p t
sa ndp rotocolsne ededt o
createt heI nternet .Theb ottom- upv iew wi l
lappea ltoa nyonewhoi sinterested
ine ng i
ne eri
ngb e c
a useitf ol
lowst hep atternoneus eswhe nb ui
ldi
ngas ys
t em.I n
somec lasses,profe ss
orsp refert ob e
g inwi t hCha pters20a nd21onc li
ent-server
prog rammi ng ,whic hp er
mi tstheirs tudent st os tartwr itingne twor ka ppli
c a
tions
earl
y.Al t
houg hwr iti
nga ppli
cationst ha tus etheI nterne tisi mport ant,Iur ge
profe ssorst oa lsoi nclude a s
s i
gnme ntst hat helps tu- dents unde rstand t he
unde rlyingt echnolog y(i.e.
,p rotocolsa ndp a
ckets).I nonel abas-signme nt,f or
examp l
e ,Iha ves tudentsde vi
seav eryb a si
cp r
otocolt oc ont actanot here ndpoint
andt ransf ertwop a c
kets:onec ontainsaf il
ena mea ndt heot herc ontainsda ta
fort hef i
le.Be twe ent hes ende ra ndr ece i
ver,a na p
p l
icationr andoml ydr op s
,
dupli-ca tes,delays,a ndc hangest hec ont e
nt soft hep ack ets.Thee xperimenti s
carriedoutwi thUDP,ma k i
ngt hei mp leme ntati
ont ri
v i
al.Howe ver,t hest udents
becomek eenlyawa reofhowdi ffic
ulti tist ode si
g np rotocols.
Amodestbac
kgr
oundisrequire
dtounderst
andt hema t
eria
l.Reader
sdonot
needsop
his
tica
tedmathe
mati
cs,nordot he
yne e
dt ok nowinfor
ma ti
ontheor
yor
the
oremsfrom da
tacommuni
cations
;thebookdesc
rib
e sthephysi
calnet
worka sa
bl
ackb oxa r
oundwhichani nte
r networkc
a nbeb ui
lt
.Rea
dersa reexp
ecte
dt o
haveab asi
cunder-s
tandi
ngofc omp ut
ersyst
emsa ndtobef a
mi l
ia
rwithdata
st
ructuresli
kesta
cks,queue
s ,andt ree
s.I
na ddi
ti
on,areade
rs houl
dhavebas
ic
i
ntuit
iona b
outtheserv
ice
sanop e r
at-
xx
vii
i
Pr
eface

i
ngs yst
ems up
p l
i
esandt henot i
onthatp r
oces
sescanexe
cut
ec onc
urrent
ly.Pr
ior
unders
tandi
ngofI nte
rne ttechnol
ogyisnota ss
umed:thetex
ts tat
esa l
ldes
ign
pri
ncip
lescl
ear
ly,anddis
c us
sesmotiva
tionsandcons
eque
nces
.
Ma nyp eoplede s
ervecreditforc ontri
butings uggesti
onsandide astov a
r i
ous
edi
-tionsof t he text overt he ye ars
.For t hise diti
on,a s et of r e
viewers
comme ntedont heor gani
zat
ion,itemst hatne e dedt ob eup da
te d,andhe l
ped
checkt echnica
lde tail
s.It hankAnt honyBa rnar d,Tom Ca l
abres
e,Ra l
phDr oms,
Tom Edmunds ,Ra ymond Kelso,Le e Kirk,John Li n,Da ve Robe r
ts,Gus tavo
Rodri
g uez-Rivera,a nd Bha s
k arS harma who a l
lr e
viewed a dr aft of t he
manus cri
pt.Johna ndRa lp
hwe r
ee speci
allyhe l
pf ul.BarryS he
inc ontri
butedt he
examp l
ec l
ient-serv
e rcodeinCha pt
er21 .
Asalways,mywifeChri
sti
neprovi
dedthemosthelp.Shespe
nthourswith
thema nusc
r i
pt,i
dent
ifyi
ngambig
uiti
es,fi
ndi
ngincons
ist
enci
es,and s
moot
hing
wording
.

Doug
lasE.Come
r

Ma
rch,201
3
WhatOthe
rsHaveSai
dAb outTheS
ixt
h
Edi
ti
onOfInt
ernet
wor k
ingWithTCP/
IP

Thisi
stheb ookIg otoforcle
arexpl
ana
tionsoft
hebasi
cprinc
ipl
esand
lat
estdeve
lopment
si nTCP/I
Pt ec
hnol
ogi
es.It
samus
tha v
erefere
nce
fornet-
work i
ngprofe
ssi
onal
s.

Dr.Ral
phDroms
Ci
scoSyst
ems
Chai
roftheDHCPwor
kinggr
oup

Exc
ell
entb
ook
!Tha
nkyou!

Henri
kSundi
n
NTIGymnasi
et
Stoc
khol
m,Sweden

The 6th Edi


ti
on of Comer
sc l
ass
icInt
ernetworki
ng doc
umentst
he
ongoi
nganda c
cel
era
t i
ngevol
uti
onoftheInter
ne t
,whil
ep r
edi
cti
ngt
he
fut
urewithun-matchedunde
rst
andi
ngandcl
ari
t y.

Dr.PaulV.Moc
kapet
ris
Invent
oroftheDomainNameSys
tem

...at
ruema
ste
rpi
ece
.
Mr.Jav
ierSandi
no
Sys
temsEngi
neer

Theb e
st-wri
tten TCP/
IPb ook Ihavee verrea
d.Dr .Come rexpl
ai
ns
compl
exidea
sc l
earl
y,withexce
ll
entdiag
ramsande x
plana
tions.Wi
ththi
s
edi
ti
on,Dr.Come rmakesthi
sclas
sict
extbookc
ontemporary.

Dr.JohnLin
Bel
lLabor
atori
es

Thi
s updat
et o t he definit
iver ef
erenc
ef or the Int
e r
netskey
tec
hnol
ogi
escon-f
irmsDougCome r
srep
utati
onforc l
earanda c
cura
te
pre
sent
ati
onofe ssenti
alinformati
on;itshoul
dbet hecorners
toneof
anyInt
ernetpr
ofessi
onal
sli
-brary.

Dr.LymanChapi
n
Int
eris
leCons
ult
ingGr
oup
FormerIABChai
r

Oneofthegrea
t e
stb
ooksIhavere
ad.Trueg
e niusi
swhe nyouar
enot
onl
yfluenti
nyourf i
el
d,butcangetyourpointacros
ss i
mpl
y.Tha
nk
youDr.Come
rf orwr
iti
ngagre
atbook!

Marv
inE.Mi
ll
er
CI
O,TheACSCorpor
ati
on

Inawor l
dofc omp l
exi
ty,theabi
litytoc onv
eyk nowle
dgea soppose
dto
in-for
ma t
ionf rom asearc
he ng
inei squitehard.Few makei tseema s
easya sDougCome r,whosebookI nter
networki
ngVolume1c ont
inuest
o
pla
yak eyr ol
ei nteac
hingusa boutt herol
eofp r
otocol
sint heever
-
changingInt
e r
ne t
.
Dr.Bal
achanderKr
ishnamur
thy
AT&TLabs

Rapi
de vol
utionoftheI nter
ne ti
shappe
ninga stheenti
rewor l
dus est
he
Int
er-netonada il
y,hour ly,ore v
enc onti
nuousbasi
s( asist hecas
e
wit
h my g randc
hil
dren). Come r acc
ur at
ely trac
ks t he r el
eva
nt
tec
hnologi
calunderpi
n-ning
sf orthos
ebuildi
ngtheInterne
tt oday.
DanLynch
Founder
,INTEROP
Ab
outTheAut
hor

Dr.Doug lasComer,Di sti


nguishedProf
essorofComp ute
rS ci
enceat
Pur-due Uni ver
sit
y a nd f ormer VP of Re se
arch at Cisc
o, isa n
i
nterna ti
onall
yr ec
og-ni
zede xper
tonc omputernetworki
ng,theTCP/IP
prot
oc ols
,a ndtheInterne
t .Thea uthorofnumerousref
ereedarti
cl
esand
tec
hnic albooks,hei sap i
oneeri nt hedeve
lopmentofc urri
cul
um and
l
aborat ori
esforresea
rcha nde ducati
on.
Ap r
oli
fica ut
hor,Come r
sp opularbookshaveb ee
nt ransl
atedi nto
over1 5languages,anda reusedi nindus
trya swellascomputerscience,
engineeri
ng,a nd busi
nessdepa r
tmentsa round t
hewor ld.Hislandma rk
three-vol
ume s eri
es I nter
networking Wi th TCP/IP r evol
utionized
networ ki
ng a nd ne twork educati
on. Hi st e
xtbooksa nd innovat i
ve
l
a b
or at
ory ma nual
s ha ve a nd c onti
nue t o shape g r
aduate a nd
unde r
graduatecurric
ula.
Thea ccurac
ya ndi nsi
ghtofDr .Comersbooksrefl
ecthi
se xtensive
back-gr
oundi nc omput e
rs yste
ms .Hisrese
archspansbothhardwarea nd
soft
wa re.Heha sc r
ea t
edac omp l
eteoperati
ngs ys
tem,wr i
tten device
dri
vers,a nd i
mp le
-me nted networkp r
otocolsoftwareforconventional
computersa swellasne t
-wor kproces
sors
.Ther es
ulti
ngsoft
wareha sb e
en
usedbyi ndust
ryi nav ari
etyofp roduct
s.
Comerha scr eat
eda nd t eac
hesc ourseson ne twor kp r
ot ocolsand
c
omp utert e
chnol
og i
esf orav ari
etyofa udi
ences,includi
ngc oursesf or
e
ng i
neersa s wella sa c
a demica udienc
es. Hisi nnovati
vee ducati
onal
l
aborator
iesall
ow hima ndhi sst
ude ntstode s
igna ndi mple
me ntwor ki
ng
p
rototypesofl ar
g e,comple xsys-
tems ,andme asuret hep erfor manceof
t
her esul
tingprototypes
.Hec onti
nue stoteachati ndustri
es,uni vers
iti
es,
a
nd c onfere
ncesa round t he world.I na ddit
ion,Come rc ons ultsf or
i
ndustryont hede s
ignofc omp ut
erne tworksands ystems.
Forov e
reightee nye ar
s,Pr
ofess
orCome rserve
da sedi
tor
-in-
chiefof
theresea
rchjourna lS of
tware Practi
ceandExper i
enc
e.Hei saFe l
low
oftheACM,aFe l
low oft hePurdueTeachingAca
demy,a ndareci
pie
ntof
numerousawards
,i ncludi
ngaUsenixLif
etimeAchi
evementaward.
Addi
ti
ona
linf
orma
tionc
anb
efounda
t:

www.
cs.
pur
due
.edu/
peop
le/
come
r

a
ndi
nfor
mat
iona
boutCome
rsb
ook
sca
nbef
ounda
t:
www.
come
rbook
s.c
om
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
Ot
herBooksI
nt heInte
rne
tworki
ng
Ser
iesf
rom Dougl
asComera
ndPr e
nti
ce
Hal
l

I
nt e
rnetwor
kingWith TCP/
IP VolumeI I:De si
gn,I mple
me ntat
ion,a
nd
r
d
Inter
nals(
withDa
vidSteve
ns)
,3 editi
on:1999,I
SBN0-
13-
973843-
6
Vol
umeIIcont
inue
sthedi
scus
sionofVol
umeIbyus
ingc
odef
rom ar
unni
ng
i
m-p
lement
ati
onofTCP/IPt
oil
lust
ra t
eal
lthede
tai
l
s.

I
nternetworki
ngWithTCP/
IPVol
umeI
II:Cl
ie
nt-
Ser
verPr
ogr
ammi
nga
nd
Ap
plic
ations(wi
thDav
idStev
ens
)
LINUX/POS
IXVe rs
ion:2000,ISBN0-13-
032071-4
AT&TTLIVe rs
ion:1994,ISBN0-13-
474230-3
WindowsSocketsVersi
on:1997,I
SBN0- 1
3-84871
4-6
Vol
umeI IIdes
c r
ibesthef undamentalconce
ptofc l
ient
-ser
vercomput
ing
usedinallnetworkappli
cat
ions
.Thr eev
e rs
ionsofVol
umeIIIareavai
l
abl
eforthe
soc
ke tAPI( Uni
x),theTLIAPI( AT&TS ys
tem V),andtheWindowsSoc
ketsAPI
(Mi
crosoft)
.

Comp
ute
rNe
twor
ksAndI
nte
rne
ts,5th edi
ti
on:2009,I
SBN0-
13-
606698-
9
Abr oa
dintroduc
tiont odat
acommunicati
on,net work
ing,inte
r net
working,
and cl
ie
nt -
ser
vera ppl
icat
ions,t
he te
xte xa
minest he hardwarea nd sof
twa re
componentsusedin networ k
s,i
ncl
udi
ngwi r
eda nd wi r
ele
ssda tat ra
nsmis
sion,
LANs,a cce
sst e
chnol
og i
es,WANs,p r
otoc
ols(inc
luding TCP/I
P),a nd networ k
appl
i
cati
ons.

The Int
e r
net Book:Ever
ythi
ng you needt o know a bout comp uter
net
wor k-i
ngandhow t
heI nt
erne
twor ,4th edi
ks ti
on:2006,ISBN0-
13-
233553
-
0,p
ape
rba
ck
Ag e
ntleintroduc
tion t
hatexpl
ai
ns networ
k i
ng and t
he Inter
ne, The
t
I
nter
netBookdoesnotas s
umether
eaderhasatechni
calba
ckg
round.Thebooki
s
i
dea
lf orsomeone who want
stob e
come I
nte
rneta nd computer ne
twor
king
l
i
terat
e;anext
e ns
ivegl
oss
aryoft
ermsandab
bre
via
tionsi
sinclude
d.

Networ
kS ys
te msDe signUs
ingNe
twor
kPr
oce
ssor
s,I
nte
l2xxxVe
rsi
on,
2006,ISBN0-13-187286-9
Acomprehe
nsi
veovervi
ew ofthedesig
na ndengi
nee
ringofp ack
etprocessi
ng
s
ys-t
emswithnetworkproc
essortec
hnolog
y.Thet e
xtexpla
insnetworkprocess
or
a
rchi
tec
-tur
es,pres
entsdes
igns,a
ndg i
vesexa
mp l
ecodeforane t
wor kpr
oc e
ssor.

Forac
omp
let
eli
stofCome
rst
ext
book
s,s
ee:
www.
come
rbook
s.c
om
Chapt
erCont
ent
s
1
.1 TheMot i
vationForI nterne
twor ki
ng,1
1
.2 TheTCP/ IPI nt ernet
,2
1
.3 InternetS e
r vi
c es,2
1
.4 His
tor yAndS copeOfTheI nter
ne t,6
1
.5 TheI nternetAr chitectureBoard,7
1
.6 TheI ABRe or g
a nizat
ion,8
1
.7 InternetRe que stForComme nt
s( RFCs)
,8
1
.8 InternetGr owt h,9
1
.9 Transiti
onToI Pv 6,12
1
.10 Commi tteeDe s i
gnAndTheNe w Ve rs
ionofI
P,
12
1
.11 Rel
a t
ionshipBe twe enI Pv
4AndI Pv6,1
3
1
.12 IPv6Mi grati
on,1 4
1
.13 DualS tac
kS yst ems,1 5
1
.14 Organizati
onOfTheTe xt,15
1
.15 Summa ry,16
1

I
ntr
oduc
tionAndOv
erv
iew

1
.1TheMot
iva
tionForI
nte
rne
twor
king

Inter
netc ommuni cat
ion ha sb ecome a f undament alp art of life.S ocia
l
networks,suc ha sFa c
ebook,p r
ov i
dec onnecti
onsa mongag roupoff riendsa nd
all
ow themt os hareinter
e s
t s.TheWor ldWi deWe bcont ai
nsi nformationa bout
such dive
rses ubject
sa sp oli
tics,a tmosphericc ondi
tions,s toc kp r
ic e
s,c rop
producti
on,a nda ir
li
nef ar
e s
.Fa mi l
ya ndf ri
endsuset heI nternett osha rephotos
andk eepint ouc hwithVoI Pt el
e- phonec a
ll
sa ndlivevide ochats .Consume r
sus e
theI nt
ernett op urchasegoo dsa nds ervi
cesandf orp e
r sonalb anki
ng.Comp ani
es
takeordersa ndma kepayme ntse le
c tr
on-ical
l
y.Themov et ocloudc omp uti
ngwi l
l
putmor einforma ti
ona ndser vi
cesonl i
ne.
Althoug hita ppe
arst oop er
a t
ea sauni fi
edne t
wor k,t heI nterneti snot
engineeredf rom as i
nglenetwork i
ngt echnol
ogyb ec
ausenot echnol
ogys uff
ices
fora l
lus es.In-st
ead,networkingha r
dwa reisdes i
gnedf ors p
e c
ificsi
tua t
ionsand
budg e
ts.S omeg roupsneedhigh-speedwir e
dne twor k
st oc onnectc omp utersina
si
ngleb uildi
ng.Ot h-ersneedal ow-costwi r
elessne tworkf orap ri
va t
ehome .
Becausel ow-costha r
dwa r
et hatwor k swe l
linsideab uil
dingc annots pa nlarg
e
geographicdi st
ances,a nalt
e r
nat i
ve mus tb e usedt oc onne cts it
est hata r
e
thousandsofmi l
esapart.
Inthe1 97 0s,atechnologywa screatedthatma kesitposs
ibletoint erconnect
ma ny di
sparat eindiv
idualne tworksa nd operatet hemasa c oordi
na ted uni t
.
Knowna si nter-networking,thet ec
hnolog yformst hebas
isf ortheI nternetb y
accommoda ti
ngmul ti
ple,diverseunder l
yingha rdwaretechnologi
es,p r
ovidinga
wa yt oi nterconnectt he ne t-
wor k
s,a nd defini
ng a set of c ommuni c
a ti
on
conventi
onst hatt hene tworksus etoi nt e
r-operate
.Thei nt er
ne tt echnology
hidesthede ta i
lsofne twor khardware,a ndp ermitscomputerst oc ommuni c
ate
i
nde
pende
ntoft
hei
rphys
ica
lne
twor
kconne
cti
ons
.

1
2 I
ntr
oduc
tionAndOv
erv
iew Cha
p.1

Interne tt e
chnologyi sa nex ampleof op en system interconnecti
on.I tis
c
all
edop enbec ause,unlikep ropri
etaryc ommunic a
tions yst
emsa vail
a b
lefrom one
s
peci
ficv endor,t hes p
ec i
fica
t i
onsa rep ubl
icl
ya v
a i
la
b l
e.Thus ,anyi ndivi
dualor
c
omp anyca nb ui
ldt heha rdwa r
ea nds oftwarene ededt ocommuni catea c
rossthe
I
nternet.Mor eimp ortant,t hee ntir
et ec
hnology ha sb e
en designedt of ost
er
c
ommuni cation among ma chi
ne swi th divers
e ha rdwar ea rc
hitectures
,t o use
a
lmosta nyp acketswitchedne t
wor kha r
dwa re
,t oa ccommoda teawi dev ar
ietyof
a
ppli
cati
ons ,andt oa c
commoda tearbitrarycomp uterope r
atingsystems.

1
.2TheTCP/
IPI
nte
rne
t

Int he1 970sa nd1 980s ,U. S.g overnme nta gencie
sr eal
izedt hei mp ortance
andp o- tenti
a lofi nternett e chnology,a ndf undedr esearc
ht hatma dep ossi
blea
globa
lI nterne t
.Thi sb ook di scussesp ri
nci
plesa nd ideast hatr esultedf rom
researchf unde db yt heDe -f enseAdv anc edResearchPr ojectsAgency( DARPA) .
TheDARPA t e chnolog
yi n-clude sas etofne twor ks tandar
dst hats pecifyt he
detai
lsofhow c o
mp uter sc o mmuni- c
a t
e ,a swe llasas etofc onve nti
onsf or
inter
c onne c
tingne tworksa ndf orwa rdi
ngt raf
fic.Of fi
cial
l
y na medt he TCP/ IP
InternetPr ot ocolSuiteandc ommonl yr ef e
rredtoa sTCP/ IP( af
tert hena mesof
itstwo ma i
ns tandards),i tc anb e us edt oc ommuni cat
ea c
rossa ny s e
tof
inter
c onne c
tedne tworks.Fore xample,TCP/ IPcanb eusedt ointer-c
onne c tas et
ofne twor kswi thinas ing l
eb ui l
ding,wi thinap hysic
a lcampus,ora mongas etof
campus es.
Alt
hought he TCP/IPt echnologyisnot eworthy byi ts
elf,iti se s
peci
all
y
i
nte
resti
ngb ecauseitsvi
abi
l
ityha sb ee
nde monstr
at e
donal arges c
ale.Itforms
t
heb asetechnolo-g
yf ortheg l
ob a
lInt er
ne tthatc onnectsap p
roximatel
yt wo
b
il
li
onindiv
idual
si nhomes,schools
,c or
por ati
ons,andg overnmentsinv i
rtual
lyall
p
opula
teda re
asoft hep l
ane
t.Anout standi
ngs uccess
,t heInternetdemonstrate
s
t
hev i
abi
li
tyoft heTCP/I
Ptec hnol
o -
gya nds howshowi tc a
na ccommoda t
eawi de
v
ari
etyofunde rlyi
nghardwaret ec
hnol-ogies.

1
.3I
nte
rne
tSe
rvi
ces

One c annot appre


ciatet he techni
caldet
ail
s underl
ying TCP/I
P wit
hout
understand-ingt heservi
cesi tprov
ides.Thi
ss ec
tion r
evi
ewsi nte
rnetser
vic
es
bri
efly,highlig
htingthes erv
icesmostusersacc
ess,andleavestolaterc
hapte
rs
thedi scus
sion ofhow c om-puter
sc onnecttoaTCP/ IPinternetandhow the
functional
it
yi simple
ment e
d.
Muc hofo urdiscussi
onofs ervi
ceswillfocusons tandardscall
e dprotocols
.
Proto-colspeci
fi
cati
ons,sucha st hoseforTCPa ndIP,de fi
net hes yntacti
ca nd
semanticr ul
esf orcommunica ti
on.The yg ivet hedetail
sofme ssa g
ef orma ts
,
descri
behow ac omput e
rr e
sp ondswhe name ssagea r
rives
,a nds pecif
yhow a
compute rhandl
eserrorsorot hera bnormalconditi
ons
.Mo stimp or
ta nt,protocol
s
all
ow ust o dis
cussc omputerc ommun- ica
tion inde
pendent of a ny p a
rticul
ar
vendor
sne tworkhardwa r
e.Inas ense
,p r
otocol
s
Wewillfol
l
owt heus
ualconve
nti
onofc api
tal
i
zingI nt
ernetwhenreferr
ingsp
ecif
ical
l
yt ot
he
g
lob
alInt
ernet,andusel
owercasetoref
ert opri
vateinterne
tsthatuseTCP/IPtec
hnology.
Atvari
oustime
s,DARPAhasbeencal
le
dt heAdvancedResear
chProjec
tsAgency(ARPA).
S
ec.1
.3 I
nte
rne
tSe
rvi
ces 3

aret ocommunica t
ionwha ta l
gor
ithmsaretocomputati
on.Ana l
gori
thm al
lows
onet ospeci
fyorunde r
standac omputat
ionwit
houtk nowingthede ta
il
sofa
parti
cul
ar p ro-
g ramming l a
nguage or CPU instr
uction set.S i
mil
arl
y, a
communicati
onp rotoc
ola l
-l
owsonet ospeci
fyorunders
tandda t
ac ommunic
a ti
on
without depe
nding on de tai
ledknowle
dge of a par
ticul
arv endor
s network
hardware.
Hidingt hel ow- l
evelde tailsofc ommuni cati
onhe lpsimp rov ep roductivityi n
severalwa ys.Fi rst,b ec a
us et heyc an use higher-
levelp rot ocola bstractions,
program- me r
sdonotne edt olearnorr ememb erasma nyde tai
lsa boutag iv
e n
hardwa reconf i
gu-r ati
on.Thus ,theyc anc rea
tene wne two rka p p
lic
at i
onsqui ckly.
Second,b ecauses oftwar eb uil
tus inghighe r
-leve
la bs
tra c
tionsa renotr estri
c ted
toap arti
cularc omp utera rchi
tectureorap a
rtic
ularne twor kha rdwa r e
,t he
appli
cationsdono tne edt ob echang e
dwhe ncomp utersorne twor ksa rer epl
a ced
orr econfigured.Thi r
d,b ecaus eap- p
li
cationsbuil
tus i
nghi gher -
levelp rotocolsa re
independent o ft he unde rlying hardwa re,t heyc anb ep ortedt oa rbit
r ary
comp uters.Tha tis,ap rogramme rdoe snotne edt obuildas pecialver s
ionofa n
appli
cation for e a c
ht ype of c omp uter or e acht ype of ne twor k.I nstead,
appli
cationst hatus ehigh-levela b
stracti
onsa remor eg eneral
- purpose t hes ame
codec anb ec ompil
e dandr unona na rbi
trarycomp uter
.
Wewi l
lseet hatthedetai
l
sofe achservi
cea va
il
abl
eont heI nterne
ta re
g
ive
nb yas epara
tep r
otoc
ol.Thenextsecti
onsr e
fertop rot
oc ol
st hatspec
ify
s
omeoft heapp
lic
ati
on-l
evels
ervi
cesa
swe l
lasthoseusedtodefinene twork
-le
vel
s
ervi
ces
.Laterchapt
ersexp
lai
neachoftheprotocol
sindeta
il
.

1
.3.
1Ap
pli
cat
ionLe
velI
nte
rne
tSe
rvi
ces

From aus er
sp oi
ntofv i
ew,t heI nt erneta ppearst oconsis
tofas etof
appli
cati
onp rog r
amst hatuset heunde rl
yingne twor kt oc arryoutus ef ultasks.
Weus ethet ermi n-teroperabi
lit
yt or e
fe rt ot hea bi
li
t yofdi versec omp uti
ng
systemst oc ooperatei ns ol
v -
ingc omp utati
ona lp r
oblems.Be c
auset heI nter
net
wa s desi
gne d t o a ccommoda te he teroge ne
ous ne twor ks a nd c omp uters,
i
nt er
operabi
lity wa sa k eyr equire
me nt.Cons e-quently, Interneta ppli
cati
on
programsus uallyex hibi
tahi ghde greeofi nteroperabil
i
t y.I nfa c
t,mos tus ers
accessappl
icationswi t
houtunde rst
andingt het ypesofc omputersorne t
wor ks
beingused,t hec ommuni cati
onp rot
ocols,ore vent hep athda tat rav
elsf rom its
sourcetoi t
sde sti
na ti
on.Thus ,aus ermi ghta ccessawe bp agef rom ade skt
op
sys-temconne ctedt oac abl
emode m orf rom ani Padc onne ct
edt oa4Gwi re
less
network.
Themos tp opulara ndwi desprea
dI nterne tappli
cati
ons ervi
cesincl
ude :

Wor l
dWi deWeb.TheWebbec amet hela
rgestsourceoft ra
f f
icont heglob
al
In-terne
tb etween1994a nd1995,andr emainsso.Ma nyp opula
rs erv
ice
s,
inc
luding Int
e r
nets ear
ch( e.g
., Google
)a nd so c
ialne t
wor ki
ng (e.g.
,
Facebook)
,usewe bt ec
hnolog
y.Onee sti
ma t
ea ttri
butesap pr
oximatel
yone
quarterofa llInte
rnett raf
-fi
ct o Face
book .Although usersdist
ingui
sh
a
mongvari
ousweb-
b a
sedse
rvi
ces
,wewi
l
lse
etha
tthe
yal
lus
ethes
ame
a
ppl
i
cat
ion-
lev
elp
rotocol
.
4 I
ntr
oduc
tionAndOv
erv
iew Cha
p.1

CloudAc c essAndRemot eDes ktop.Cloudc omp uti


ngp l
acescomp utati
ona nd
storagef ac i
l
it i
esinc louddat acenters,a nda rrange sforuser stoa c
cesst he
ser-vic
esov e rt heI nt e
rne t
.Onea c
ces st echnology,k nown a sa r emot e
desktops er -
v ic
e,al l
owsaus ertoa cces
sac omp ute rinar emot eda tac enter
asift hec omp ut erislocal.Theus eronl yne edsa ninterfacede vicewi tha
screen,k eyb oard,mous eort ouchpad,a ndane t
wor kc onnection.Whe nt he
datac ente rc omp uterup datesthev i
de od isp
lay,t her emotede s
k tops e
r v
ice
capturest hei nforma ti
on,s endsita crosst heI nt ernet,anddi sp
laysi ton
theus erss c reen.Whe nt heus ermov est hemous eorp r
es s
e sak ey,t he
remot ede skt ops erv
ices endstheinforma t
iont ot heda tac enter.Thus ,t he
userha sf ulla ccesst oap owe rfulPC,b utonl y ne edst oc arry ab asi
c
interfacede v i
ces ucha sat abl
et.
Fi
leTransf
er.Thefil
et ra
nsferp r
ot ocola
ll
owsuserstosendorr ec
e i
vea
co
pyofada t
afil
e.Ma nyfil
edownl oads,i
ncl
udi
ngmov i
edownloads,invok
e
afil
et r
ansfe
rme c
hanism.Becauset heyofteninv
okefil
et r
ansf
e rfrom a
webpage,use
rsmaynotb eawar etha tafi
letra
nsfera
ppli
cati
onhasr un.
El
ect
roni
cMai
l(emai
l
).El
ect
roni
cma
il
,whi
ch onc
eac
count
edf
orl
arg
e
amountsofI nte
rnett ra
ffic,haslar
gel
yb e
enr epl
ac e
db ywe ba ppl
ic
ations.
Manyusersnowa cc
essemailthr
oughawe ba ppl
i
cationthatallowsaus erto
readmessa
gesint hei
rma il
box,sel
ectamessageforp roce
ssi
ng,a ndforwa r
d
theme s
sageors endar eply.Onceaus erspeci
fie
ss endi
ngame s
sage,the
under
lyi
ngs yst
em us e
sa ne mai
lt r
ansf
erp r
otocolt osendt heme ss
aget o
thereci
pi
entsmail
box.
VoiceAndVideoSer vi
ces.Bothstreamingv i
deoa ndaudioa lr
eadya ccount
foranont r
ivi
alfract
ionofb i
tstransportedacros
st heglobalInter
ne t
,a nd
thet r
endwi l
lconti
nue.Mor eimportant,as i
gnif
ica
ntc hangei soccurri
ng;
vide
oup l
oadisin-cre
asing,es
peci
all
yb ecauseusersareus i
ngmob il
ede vi
ces
tosendvideoofliv
ee vents
.

Wewi llr
eturntoadiscus
sionofappl
i
cati
onsinla
tercha
p t
e r
sandexaminethem
i
nmor edetai
l.Wewillseee xa
ctl
yhow appl
i
cati
onsuset heunde
rlyi
ngTCP/ I
P
protoc
ols
,a ndwhyhavings t
andar
dsforappl
ic
ati
onprotocol
shashelp
ede nsur
e
thattheyarewide
spr
ead.

1
.3.
2 Ne
twor
k-Le
velI
nte
rne
tSe
rvi
ces

Aprogramme rwhoc r
eatesnetworka ppl
icat
ionsha sane nti
rel
ydi f
f e
rent
vi
ew oft heI nternetthan aus erwho me relyrunsa ppl
icat
ionssucha swe b
br
owsers.Att hene t
-worklev
el,theInt
e r
ne tprovi
destwob roadser
vic
est hatal
l
ap
pli
cati
onp rogramsuse.Whileitisuni
mp ortantatt hi
st i
met ounderst
andt he
det
ail
soft hes e
rvic
es,the
ya refundamentaltoanov erv
iewofTCP/ I
P:

Connecti
onl
essPac
ketDel
i
verySer
v i
ce.Packe
tde l
i
ver
y,ex
plai
nedi
ndetai
l
t
hroughout the text
, for
ms t he b a
sis for al
linte
rnet s
erv
ice
s.
Connecti
onl
essdel
iv
eryisana bs
trac
tionoft hese
rvi
cet ha
tmos tpack
et-
swi
tchingnetwor
ksoffer
.Itme anssi
mp l
yt hataTCP/IPinter
netforwar
ds
smal
lme ss
agesfr
om onecom-put
ertoa notherbas
edona ddres
sinf
ormati
on
car
riedinthemessa
ge.Becaus
eit
S
ec.1
.3 I
nte
rne
tSe
rvi
ces 5

f
orwards e achp ac ke
ti ndependently, ani nternet does not gua
rante
e
r
eli
abl
e ,in-orderde l
iver
y.Howe ver,b ecaus
ei tma psdirect
lyontomostof
t
heunde rl
yingha rdwaret ec
hnologies,ac onne c
t i
onl
essdeli
veryser
vic
ei s
e
xtreme l
y e ff
ici
ent. Mor e i mp ortant, b ecause t he desi
gn ma kes
c
onnectionl
essp ac
ke tdeli
ver
yt heb asisforallinterne
ts erv
ice
s,theTCP/I
P
p
rotocolscana cc
ommoda t
eawi der angeofne twor khardware.
Reli
able St ream Tr ansport Ser vi
c e. Mos t a ppli
cations r equir
e t he
communi cati
ons oftwaret ore covera utomatic
allyf romt ransmiss
ionerrors,
l
os tpa c
k ets
,orf ai
luresofi nter me diateswitche sa l
ongt hep athbetween
sendera nd r e
ceiver. Conseque ntly, mos ta pp l
ic
a t
ions ne e
dar eli
abl
e
transports er
vic
et oha ndleprob -
le ms .TheI nterne t
sr e
liablestreamservic
e
all
owsa na ppl
icat
ionononec omp ut -ertoe sta bl
isha conne ct
iontoa n
appli
cation on anotherc omput er,a nda ll
owst hea ppl
icationstot ransfe
r
arbit
ra r
ilylargea mount sofda taa cr
osst hec onnecti
on a sifi twe r
ea
permane nt,directha r
dwa relink.Unde rneath,t hec ommuni cati
onp r
otocols
divi
det hes trea
m ofda taintos ma llp acke
tsa nds endt hem onea tat i
me ,
wa i
ti
ngf orther e
ceivertoa cknowl edg erecepti
on.

Manynetwork
sprovi
deb a
sicse
rvi
cess
imi
lart
othoseoutl
i
nedabov
e,soone
mig
htwonde rwhatdi
sti
ngui
shesTCP/I
Pser
vic
esfr
om ot
hers
.Thepr
imarydi
sti
n-
gui
shingfe
ature
sare:
Networ k Tec hnology Independence.Al
thoughi tisb a
sed on conventi
onal
pac
k ets witchingt echnol
ogy,TCP/ IPi
sindependentofanyp art
icul
arb rand
ort ypeofha r
dwa re;t heg l
obalInte
rnetinc l
udesav ari
ety ofne t
wor k
tec
hnol ogie
s.TCP/ IPp r
otocol
sde f
inetheunitofda tatra
nsmiss
ion,call
eda
datagram,ands peci
fyhow t ot ra
nsmitdatag
r amsonap arti
cul
a rnetwork,
butnot hinginada ta g
rami stie
dt ospec
ifi
cha r
dware.
Univers
alI nt erconnecti
on. The I nterneta l
l
ows a ny a r
bit
raryp a
ir of
comp ut
er stoc ommuni c
at e.Ea chc omp uterisa ssi
gneda na ddressthati s
univ
e rs
allyre cog-nize
dt hroug houtt heI nternet.Ev ery dat
agramc a r
ries
thea ddress
esofi tssourcea ndde st
ina t
ion.I nte
rme dia
tede vi
cesus et he
dest
inationa ddr es
st oma k
ef or-wardingde ci
sions;as enderonlyne edst o
know thea ddr essofar eci
pienta ndt heI nter
ne tt a
k escareoff orwardi
ng
datagrams.
End-to-End Acknowl
edgement s
. The TCP/IPI nternetp r
otocol
sp rovi
de
acknowl-edg
eme nt
sbetwe ent heorigi
nalsourcea nd ul
ti
ma t
ede st
inati
on
i
nsteadofb et
we e
nsuccessi
vema chi
nesalongt hep ath,evenifthes our
ce
andde s
tinati
ondonotc onnecttoac ommonp hysic
alne t
work.
Appli
cation ProtocolStandards
.I na ddit
ion t ot he b a
sict ranspor
t -
level
ser
vices( li
ker eli
abl
es tream connect
ions),t he TCP/IPp r otocol
si ncl
ude
sta
nda rdsf orma nyc ommona ppli
cati
ons,inc l
udingp rotoc
ol sthats peci
fy
how toa ccessawe bp a
g e
,t ra
nsferaf i
le,a nds ende ma il
.Thus ,whe n
desi
gninga ppli
cat
ionsthatuseTCP/ I
P,p r
ogra mme rsoftenfindt hatex i
sti
ng
appl
icationp r
otocol
sprovidethecommunications e
r vi
cestheyne ed.
La
tercha
pt e
rsdis
cus
sthedeta
il
softheservi
cesprov
ide
dtot
hep
rog
ramme
ras
wel
lasexample
sofappl
i
cat
ionprot
ocols
tandards
.
6 I
ntr
oduc
tionAndOv
erv
iew Cha
p.1

1
.4Hi
stor
yAndS
cop
eOfTheI
nte
rne
t

Pa rt of wha t ma kest he TCP/ IPt echnologys oe xcit


ing i si tsuni versa
l
adopti
on,a swe llast hesizea ndg rowt hrateoft heg lobalInterne t.DARPAb egan
workingt owa r
da nint e
rne tt ec
hnolog yint hemi d1 970s,wi tht hea rchit
ecture
andp r otocol
st a ki
ngt heirc ur rentf or ma round1 97779.Att ha tt i
me ,DARPA
wask nowna sthep r
imaryf undinga ge ncyforp acket
- switc
hedne t workr esear
ch,
andp ione ere
dma nyi deasi np ac
ke t-
swi t
chingwi t
hi tswe ll
-knownARPANET.The
ARPANET us edc onventi
ona lp oint-to-poi
nt l easedl i
ne interc onnections,b ut
DARPA a lsof unde de xpl
or ation of p ac
k e
t- switc
hing ov err adio ne twor ksa nd
satel
l
it ec ommuni cati
on c hanne ls
.I nde ed,t he grow- i
ng div e
rs ity of ne twork
hardwa ret echnologieshelpedf orceDARPAt os t
udyne tworki nter connecti
on,a nd
pushedi nternetwor kingfor wa rd.
Thea va
ilabil
ityofr esearchf undi
ngf rom DARPAc aughtt hea t
t enti
ona nd
imagi-na
t i
on ofs e
vera lr es
earchg roups,e speci
all
yt hoser e s
earc
her swho ha d
previ
ouse xperi-enceus ingp ackets wi
tchingo ntheARPANET.DARPAs cheduled
informal me e ti
ng s of r es
earcherst o s ha r
ei deasa nd di s
cussr es
ults of
experiments.I nforma l
ly,t heg roupwa sk nowna stheI nternetResear chGr oup.
By1 979,s oma nyr e
se archerswe rein-volvedint heTCP/ IPe ffortt hatDARPA
createda ni nforma lc ommi tteet oc oordinatea nd guide t he desi
g n of t he
protocol
sa nda rc
hitectur eoft hee mergi
ngI nter
net.Ca l
ledt heInternetCont r ol
andConf igurationBoar d( ICCB),t hegroupme tr eg
ula
r l
yunt i
l1983,whe nitwa s
reorgani
ze d.
The glob alInternetb egana round 1 980 whe n DARPA s tartedc onv erti
ng
computersa t t
achedt oitsr es
earchne twor kst ot hene w TCP/ IPprot oc ol
s.The
ARPANET,a l
r e
adyi npla
ce ,quic
klyb ec
amet heb ackboneoft hene wI nte rneta nd
wasus edf orma ny oft hee ar
lye xperi
me nt swi th TCP/IP.Thet r ansition t o
Internettec hnol
ogyb ecamec om- pl
eteinJa nuary1 983whe nt heOf f
ic eoft he
Secreta
ry of De fense ma nda
tedt hata llc omp utersc onne c
tedt ol ong -haul
networksus eTCP/ IP.Att hes amet ime,t he De f
enseCommuni c
at i
on Agenc y
(DCA)s pl
i
tt heARPANETi ntot wos epara
t ene twor ks,onef orfurtherr e
s ear
c h
and one f or mi l
itaryc ommunicati
on.The r esearchp artr eta
inedt he na me
ARPANET;t hemi l
itarypa rt,whichwa ss ome whatl arger,b ecamek nowna sthe
mil
itarynetwor k( MILNET) .
Toe ncourageuni versi
t yresear
che r
st oa dop ta ndus et hene wp rotocols
,
DARPA ma de a ni mp l
eme ntati
on avail
ablea tl ow c ost
.At t hatt ime ,mos t
universit
yc omputers cie
nc ede pa
rtment swe rer unni ngav e
rsion oft heUNI X
operating systema v
a i
lab
lei nt heUni vers
ity ofCa lifornia
sBe rkel
ey Sof tware
Dis
t r
ibut i
on,c ommonl yca l
ledBS DUNI X.Byf undi ngBol tBe r
ane ka ndNe wma n,
Incorporated( BBN)t oimp lementitsTCP/ IPp rot ocolsf orus ewi thUNI Xa nd
fundingBe rk e
leyt ointegratethep r
otocolswi thit ss of t
wa redis
t r
ibution,DARPA
wasa bl
et or ea
c hov e
r90% ofuni v
er s
ityc om- put ers ci
encede partme nts.The
newp rotocols oftwarec ame ata p artic
ularlys ignif i
cantt i
me b eca use ma ny
departme ntswe rejusta cquiri
ngsecondort hi
rdc omp ut ersandc on-nec ti
ngt hem
togethe r withl ocala r
ea ne tworks.The de partme nt sneededc ommuni c
a- ti
on
p
rot
ocol
stha
tpr
ovi
deda
ppl
i
cat
ions
erv
ice
ssuc
hasf
il
etr
ans
fer
.
Besi
desas etofuti
li
typr
ograms
,Berk
ele
yUNI Xc r
eate
dane w op
erati
ng
s
yst
e ma bs
tra
cti
onknownasasoc
kettoa
ll
ow app
li
cat
ionstoacc
esst
heInte
rnet
p
rotocol
s.A
S
ec.1
.4 Hi
stor
yAndS
cop
eOfTheI
nte
rne
t 7

g
enerali
zat
ionoftheUNI Xme chanis
mf orI/O,thesoc
k etint
e r
facehasopti
ons
f
orot h-ernetworkprotocol
sb esi
desTCP/IP.Theintroduct
ion ofthes oc
ket
a
bst
r a
c t
ion wasimporta
nt b eca
us eita ll
owedp r
ogramme r
st o us
e TCP/IP
p
rotocol
swithli
ttl
eeffor
t .Thesocketint
erfac
ehasbecomeadef ac
tostandar
d,
a
ndisnowus edinmostope r
ati
ngs yst
ems.
Re al
i
zing that networ kc ommuni ca
tion woulds oon beac rucialp art of
sci
entifi
cr esearc
h,theNa tiona lSci
enceFounda t
ion( NSF)tooka na ct
iver olein
expandingtheTCP/ IPInter nett oreac
ha sma nys c
ienti
stsaspossi
ble.Int helate
1970s,NS Ff undedap rojectk nowna st heComp uterSc i
enc
eNETwor k( CSNET),
whichha da si tsgoalconne ctinga llcomp ute
rs ci
entis
ts.Start
ingi n1985,NS F
began a p rogram to e stabli
s h acces
s ne tworksc e
ntered around i tss ix
supercomputerc ente
rs,a ndi n1 986e xpandedne t
wor ki
nge ff
ortsb yf undinga
new wi dea reab ack
bonene twor k,known a st he NSFNET backbone.NSF al so
provi
de ds ee
d mone yf or r egionalne twor k
s,e ac
h of whichc onne c
ted ma jor
sci
entifi
cr es
e a
rchinsti
tutionsi nag ivena rea
.
By1 984,theInternetreachedover1,000c omp uters
.I n1987,t hesi
zeg rew
t
o ov er10,000.By 1 990,t he si
ze toppe
d1 00,000,a nd by1 993,e x
ceeded
1
,000,000.In1997,mor ethan1 0,
000,000c omputerswe rep ermanentl
ya tt
ached
t
ot he Internet,and in 2001,t he s
ize exceede
d1 00,000,000.I n 2011
,t he
I
nternetreachedov
e r800,000,000p e
rmanently-attac
he dc omputers
.
Thee arlyg rowt hoft heI nterne tdidnotoc c
urme r
e l
yb ecaus euni
v e
rsiti
es
and g o
v ernme nt- f
unde d g r
oup s a dop t
ed t he p rotocol
s. Ma jor comp uter
corporationsc on- nectedt otheI nte rnet,a sdidma nyot herl a
r gec orporat
ions
i
nc l
uding oi lc omp anies,the a ut
oi ndustry,e lec
t r
onicsf i
rms,p harmaceutica
l
comp a
nie s,andt elecommunicati
onsc ar-
r i
ers.Me di
um a ndsma l
lc omp ani
esb egan
connecting int he1 990s .Ina ddition,ma ny comp a
niese xpe
rime ntedb y using
TCP/IPp rotocolsont heirinternalc orporateintranetsbeforet heyc hoset ob e
partoft heg l
ob alInt e
rnet.

1
.5TheI
nte
rne
tAr
chi
tec
tur
eBoa
rd

Becauset heTCP/ IPI nte


rne tp rotocols uitedi dnota ri
sef rom as pec
ifi
c
vendororf r
om ar ec og ni
zedpr ofes
s i
onalsoc i
et y,itisna turaltoa sk,whos et
the t ec
hnica
ldi r
e c
-t ion and de ci
de d whe np rotocolsbecame s tandar
d? The
answe risag roupk nowna st heI nternetAr chitect
ureBoar d( IAB)t hatwa s
forme din1983whe nDARPAr eor g
an- i
zedt heI nt ernetControlandConf igurati
on
Board.TheI ABp rovi
de dt hefocusa ndc oordinat i
onf ormuc hoft her ese
a rc
ha nd
devel
op mentunde rl
yingt heTCP/ IPp roto-cols,a ndg uide
dt hee voluti
onoft he
Internet.TheI ABde cidedwhic hp rotocol
swe rear equiredpa r
toft heTCP/ IP
sui
tea nds e
tof f i
cia
lp ol i
ci
es.
IABor
igi
nal
l
yst orI
oodf nter
netAc
tiv
iti
es
Boar
d.
8 I
ntr
oduc
tionAndOv
erv
iew Cha
p.1

1
.6TheI
ABRe
orga
niza
tion

Bythes umme rof1 989,b otht heTCP/ I Ptechnologya ndt heI nter netha d
grownb eyondt hei ni
tialr es
ea rchp rojec ti ntop roductionf acili
tiesup onwhi ch
thous a
ndsofp eop l
ede pendedf orda i
l
yb us i
ness.Itwa snol ongerp os si
blet o
introducene wi dea sbyc hangingaf ewi ns tal
lati
onsov ernight.Toal arg
ee xtent,
thehundr e dsofc omme r-c
ialcomp a
niest hatof fer
edTCP/ IPp roductsde t ermined
whe thert he i
rp roductswoul di nterope r a
t eb y de c
iding whe nt oi ncor porate
protocolc hangesi nt heirs oftwa re.Re se arche r
swhodr afteds pec
ifi
cat ionsa nd
testedne wi deasinl aboratori
esc ouldnol onge rexpectins t
anta c ce
pt a
ncea ndus e
oft heidea s.Itwa sir
onict hatt her esea rche rswhode signeda ndwa tchedTCP/ IP
developfoundt hems el
vesov ercomeb yt hec om- merci
als ucces
soft he i
rb ra i
nchil
d.
Ins hort,t heTCP/ IPprotocolsa ndt heI nte rnetbe-cameas uc cessfulpr oduction
technology,a ndt hema r
ket pl
aceb egant odomi nateitse vol
ution.
To r ef
lectt hep oli
ti
caland c omme rci
alrea l
it
iesofb oth TCP/ IPa nd t he
Int
e rnet,t heI AB wa sreorg
anizedi nt hes umme rof1 989.Re s earc
herswe re
movedf r
om t heI ABitse
lftoas ub si
diar
yg r
oupk nowna st heI nt ernetRes earch
Task For ce( IRTF),a nd a ne w I AB b oard wa sc o ns t
itut ed t o include
rep
r esentat
ivesf rom thewiderc ommuni t
y.Re sponsi
bi
lit
yf orp r ot ocolst
a ndards
andot hert echnic
a la
spectspas
sedt oag roupknowna stheI nter netEngi neering
TaskFor ce(IETF).
TheIETFex is
tedi nt heori
ginalIABs t
ruct
ure,a ndit
ss ucc e
ssp r
ovi
dedp a
rt
ofthemot iv
ationf orr eorgani
zati
on.Unl i
kemos tIABt askf orces
,whichwe re
l
imitedtoaf ewi ndivi
dualswhof ocusedonones pec
ifici
ssue,t heIETFwa sla
rge
b eforethere organi
zation,ithadg rownt oincl
udedoz ensofa c
t i
veme mber
s
whowor kedonma nyp roble
msc oncurrentl
y.Foll
owingther eorgani
zat
ion,the
IETFwa sdi
vi
dedi ntoov r20wor
e kinggroups,eac
hofwhi chf ocusedonas peci
fi
c
prob
lem.
BecausetheI ETFwa stool argef oras i
nglechai
rpers
ont oma nage,ithas
beendi -vi
dedint
oas etofa p prox
ima te
lyonedoze na rea
s,e ac
hwi thi t
sown
ma nager.TheIETFc hai
rpers
ona ndthea reamanagersconst
itutet heI nter
net
Engineeri
ngSteeri
ngGr oup( IESG),t hei ndi
vi
dual
sr es
ponsi
bl
ef orc oordi
nati
ng
thee ffortsofIETFwor kingg roups
.Thena meI ETFnow r ef
e r
st ot heenti
re
body,i ncl
udi
ng the cha
irper
son,a rea ma nager
s,a nd al
lme mbe r
sofwor ki
ng
groups.

1
.7I
nte
rne
tRe
que
stForComme
nts(
RFCs
)

Weha vesaidt hatnov endorownst heTCP/I


Pt echnology,nordoesa ny
profes-
s i
onals
oc i
etyors tandar
dsbody.Thus,thedocume ntat
ionofp rot
ocols
,
st
a ndards,and poli
cie
scannotb eob t
aine
df rom av e
ndor .Inste
ad,theI ETF
ma nag
est hestandardi
za-
tionp r
oces
s.Ther e
sul
ti
ngprotocoldocumentsarekept
i
na non-li
nereposi
toryandma deavai
lab
leatnocharge
.
Doc
ume
nta
tio
n of wor
k on t
he I
nte
rne
t,p
rop
osa
lsf
or ne
w or r
evi
sed
p
rotoc
ols,andTCP/IPp
rot
ocols
tanda
rdsal
lap
pea
rinaser
iesoftechni
calre
p or
ts
c
all
edInter tRe
ne -
ques
tsForComments
,orRFCs
.RFCsc
anb eshor
torl ong,can
c
overbroadconc
epts
S
ec.1
.7 I
nte
rne
tRe
que
stForComme
nts(
RFCs
) 9

orde tail
s,andcanbes ta
ndardsorme re
lyp r
oposal
sf orne wprot
ocols.Ther
eare
ref
er -encestoRFCst hroughoutt het ext
.Whi l
eRFCsa renotrefereedinthe
sa
mewa ya sac
ademicr e
searchp a
p e
rs,theya rer ev
ieweda ndedit
ed .Formany
year
s ,as ing
lei
ndi-
vidual
,thel a
teJonPos t
el,se
rv e
da st heRFCeditor.Theta
sk
ofe dit
ingRFCsnow f a
ll
st oa reama nagersoft heI ETF;theIESGa sawhole
appr
ov esne wRFCs.
TheRFCs eri
esi snumberedsequenti
all
yi nt hec hronologi
calorde
rRFCsa re
writ
- t
en.Ea chne w orrevis
edRFCi sassi
gnedane w numb er,soreader
smus tbe
car
efult oob tai
nt hehighestnumb er
edv ers
ionofadoc ument;a nRFCindexis
avai
l
a bl
et ohe l
pidentifythecorre
c tvers
ion.Ina ddi
tion,p rel
i
minaryvers
ionsof
RFCdoc ume nt
s,whicha reknownasI nter
netdr aft s
,a rea v
ail
able
.
RFCsa ndInternetDr a
ftscanbeob tai
nedf rom:

www.
iet
f.or
g

1
.8I
nte
rne
tGr
owt
h

TheI nternetha sg rownr ap i


dl
ya ndc ontinuestoe volve.Newp rotocolsare
bei
ngp roposed;oldone sa reb ei
ngr evi
sed.Themos tsignifi
cantdema ndont he
under l
yingt echnologydoe snota ri
sefrom a ddedne t
wor kconnecti
ons,b utf r
om
addit
iona lt ra
ffic.Asne w us e
rsc onnectt ot heI nter
ne ta ndnewa ppli
cati
ons
appear,t ra f
ficp atter
nsc hange.Fore xamp le,whe nt he Wor l
dWi deWeb was
intr
oduc ed, i tb e c
ame i nc re
dibly popular,a nd Internett raff
ici nc r
eased
drama ti
ca l
ly.Later,whe nmus i
cs hari
ngbe camep opul
ar,tr a
fficpat
te r
nsc hanged
agai
n.Mor echang esareoc c
urringa stheI nternetisus e
df ort el
ephone,v i
deo,
ands oci
a lnetworking.
Figure1.1summar
ize
se x
pansi
onoftheInte
rnet
,andil
lus
trat
esanimp
ortant
com-pone
ntofg rowt
h:muc hoft hechangeincompl
exi
ty ha
sa r
ise
nb e
cause
mult
iplegroupsnowmanagevar
iouspa
rtsofthewhol
e.

Numberof Numberof Numberof Numb


e rof
networks comp
uters us
ers managers
2 2 0
1
980 1
0 1
0 1
0 1
0
3 5 6 1
1
990 1
0 1
0 1
0 1
0
5 7 8 2
2000 1
0 1
0 1
0 1
0
6 8 9 3
201
0 1
0 1
0 1
0 1
0

Fi
gur
e1.
1 Gr
owt
hoft
heI
nte
rne
t.I
naddi
ti
ont
oinc
rea
sesi
ntr
aff
ic,c
om-
p
lex
ityha
sre
sul
tedf
romde
cent
ral
i
zedma
nag
eme
nt.
1
0 I
ntr
oduc
tionAndOv
erv
iew Cha
p.1

Thenumberofc omp
ute
rsatt
ache
dtot
heI
nte
rne
the
lpsi
l
lus
tra
tet
heg
rowt
h.
Fi
gure1.
2c ont
ainsapl
ot.

900M

.
.
800M .
.
.
.
.
.
.
.
.
.
.
.
.
700M .
.
.
.
.
.
.
.
.
.
.
600M .
.
.
.
.
.
.
.
.
.
.
.
.
500M ..
.
..
.
.
.
.
.
.
.
400M .
.
.
..
.
.
.
.
.
.
.
.
300M
.
.
.
.
.
.
.
.
.
.
.
.
.
.
200M .
.

.
.
.
..
.
.
...
.
.
1
00M ..
...
...
.
.
.
.
.....
....
....
..
....
....
....
....
....
....
....
....
....
....
....
....
....
....
...
0M

1
981 1
985 1
990 1
995 2000 2005 201
0

Fi
gur
e1.
2Comp
ute
rsont
heI
nte
rne
tasaf
unc
tionoft
heye
ar(
li
nea
rsc
ale
).

Thep l
otma ke
si tappe
artha
tt heInte
rnetdidnotstar
ttogrow untilthe
l
ate1990s.However,theli
nea
rscal
ehidesanimport
antpoi
nt:e
venint hee a
rly
I
nternet
,t hegr
owt hratewashi
gh.Fi
gure1.3showsthesa
medatapl
ott e
dona
l
ogsc
ale
.Thef i
g-ur
ereve
alst
hata
lthoug
hthec
ounto
fcomp
ute
rswa
smuc
h
s
mal
l
er,someofthemos
t
S
ec.1
.8 I
nte
rne
tGr
owt
h 1
1

r
api
dgrowt
hoccur
redint
hela
t e1980swhe
ntheI
nte
rne
tgr
ewf
rom1
,000
c
omput
erstoov
er10,
000compute
r s
.

9
1
0 .
.
.
... ....
.
.
. .
.
....
.
.
.
...
...
.
....
..
8
1
0 ..
..
.
.
..
....
..
....
.
...
7 .
1
0 ......
.
..
..
.
...
.
.
.
.
6
1
0 ........
. .
...
.
.
...
..
5 .
..
1
0 .
.
.
.
.
.
.
...
.
.
..
4 .
1
0 .
..

.
.
.
.
.
.
.
.
..
.
.
.
3
1
0 .
...
.
...
.
..
..
.
.
.
..
.
.
.
.
2
1
0 ....
.
.

1
981 1
985 1
990 1
995 2000 2005 201
0

Fi
gur
e1.
3Comp
ute
rsont
heI
nte
rne
tasaf
unc
tionoft
heye
ar(
logs
cal
e).

Thec
ountofc
omp
ute
rsi
snott
heonl
ysi
gni
fi
cantc
hang
e.Be
caus
ethe
te
chnol
ogywasdevel
opedwhenasi
ngl
epers
onatDARPAha
dc ont
rolofalla
spect
s
of t
he Int
er-ne
t,t he de
sig
nsof many s
ubs
yst
emsdepended on c
entral
i
zed
manage
mentandcontrol
.
1
2 I
ntr
oduc
tionAndOv
erv
iew Cha
p.1

AstheI nternetg r
ew,r e
spons
ibi
li
tya nd controlweredivi
dedamongmul ti
pl
e
or
gani
za-tions.Inp art
icul
ar,ast heI nternetb ec
ameg l
oba
l,theoper
ationand
manag
eme ntne ed-e
dt os panmult i
pl
ec ountri
es.Muchoft heeff
orts i
ncethe
ea
rly1990sha sbeen direc
t-edtowa rdf i
ndi
ngwa ystoextendthedesig
nt o
ac
commoda tedecentra
li
zedma nage
- ment .

1
.9Tr
ans
iti
onToI
Pv6

Evolut ionofTCP/ IPt e


chnologyha sa l
wa ysb e
e nintertwinedwi t
he voluti
on
oft heg lob alI
nternet
.Wi thbil
li
onsofus ersa ts i
tesa roundt hewor l
dde pendi
ng
ont heg lobalInterne
ta sp artoft hei
rda i
lyr outine
,i tmi ghtappeart hatwe
havep a
s sedt hee arl
ys tagesofde velopme nta nd now ha v erea
c hed as tabl
e
productionf ac
il
it
y.De sp
itea p
-pear a
nces ,howe v er,neithert heInt
e rnetnort he
TCP/ IPp r otoc
olsuiteiss tat
ic.I nnova-tion c ontinuesa sne wa ppli
cati
onsa re
developeda ndnewt ec
hnologi
esar eus e
dt oim- proveunde r
lyi
ngme chanis
ms .
One oft he mostsigni
fi
canteff
ortsinvol
vesa r e
vis
ion ofthe I
nte
rnet
Protocol,thefounda
tionofa l
lInt
ernetcommunica
tion.Thec hang
ema ysee
m
surp
r i
sing,gi
venthesucc
essoftheexi
sti
ngver
s i
onofIP.
Whyc hange?Thec urrentversi
onoft heI nternetPr otocol,I Pv4,ha sbeen
remark-a
b l
e.Itwa st hefirs
twor ki
ngv er
sion,a ndha sre
ma i
neda l
mos tunchanged
si
nceitsin-cepti
onint hel at
e1970s.Itslong e
vityshowst hatI Pv4i sfle
x i
bleand
powerful
.S i
ncet het i
meI Pv4wa sdesig
ned,p rocessorper forma nceha sincrea
sed
overfouror dersofma gnit
ude,typic
alme mor ys i
zesha vei ncreasedb yaf ac
tor
of2000,b andwidthoft hehighes
t-speedl i
nksi nt heI nt e
rne tha sr i
senb ya
fact
orof1 ,000,000.Wi rel
esstechnol
-ogiesha vee merge d,a ndt henumb erof
host
sont heI nternethasr i
senfromaha ndf ultohundr edsofmi ll
ions.
De s
pit
et hes uccessofI Pv4,cr i
ticsstartedarguingint hee arl
y1 990st hat
IPv4 wa sinsuffi
cie
ntf orne wa ppli
c ati
ons,sucha sv oi
cea ndv ideo,a ndt hat
growthoft heI nter-netwo ul
dqui cklye x
haustt hes etofa v
ail
a b
lea ddress
e s
.
Sincet hen, two t hings haveb ecome a p
p a
rent:a ppli
cati
ons sucha s digita
l
tele
phony do wor kwe lloverI Pv4,a nd r
e-visi
onst ot heI nter
ne ta ddres
sing
me c
ha ni
smp roduces uffi
cie
nta ddressest olastanoth-erd e
cade.Howe ver,ifwe
assi
gna nI Pa ddres
st oeachde vi
ce( e.g.,eachsma rta p
pli
-ance,e achc ar,each
mob i
lephone),thea ddressspacewillindeedrunout .

1
.10Commi
tte
eDe
signAndTheNe
wVe
rsi
onofI
P

Ittooks everalyear
sf ortheIETFt oformulateane wv ers
ionofI P.Beca
use
theIETFp roducesopen standar
ds,representat
ivesfrom thema nycommunitie
s
wereinvit
edt op arti
cipa
tei nthep roces
s.Comp uterma nufacturers
,ha r
dware
andsoftwarev endors
,us ers
,ma nage
rs,prog r
amme rs
,t e
lephonec ompani
es,and
thecabl
et el
evis
ionindustryallspe
cif
iedthe i
rr e
quir
ementsf ort henextversi
on
ofI
P,a
nda
llc
omme
nte
dons
pec
if-
icp
rop
osa
ls.
S
ec.1
.10 Commi
tte
eDe
sig
nAndTheNe
wVe
rsi
onofI
P 1
3

Ma nydesi
gnswerep r
op ose
dt os er
veap a
rtic
ula
rp urp
oseorap a
r t
icul
ar
commu-ni
ty.Int hee
nd,t heg roupp r
oduce
dane xtende
dde s
igntha
ti ncl
uded
i
deasfrom s
evera
lear
li
erp roposal
s.TheIETFas
sig
nedt herev
isi
onofIPv ersi
on
number6,andnameditIPv6.

1
.11Re
lat
ions
hipBe
twe
enI
Pv4AndI
Pv6

Althoughp rop onents wa ntedt oc reateac omp l


et e new I nternet,I Pv 6
i
nhe ri
tedma nyoft hedesignp r
incip l
esa ndf eaturesofI Pv4.Cons equently,IPv 6
cannot b e un-de rstood ini sol
ation we ne edt or evi
e wg ener alprincip
le s
,
understand ho wt heya rei mpleme ntedi nI Pv4,a nd the nsee how t heya re
mod i
fi
edore xtende dinI Pv6.Fore x-amp le,IPv6us esahi erarc
hic aldesig
nf or
address
e stha ti si nherit
edd i
rectlyf r
om I Pv 4c l
assl
essa ddre
ssing;t heus eof
addressma sksa nde vensomeoft het ermi nolog
yha sb eende ri
vedf r
om I Pv4.I n
fact,IPv6inc l
ude sa lltheexisti
ngI Pv4a ddressesasones ub s
etoft henews etof
address
e s. Theref ore,t hroughout t he t ext, we wi l
ldi scus
sp r i
n-ci
plesa nd
concepts,studyt he i
rimp l
eme ntationi nI Pv4,a ndt henlooka tI Pv6e xten-sions
andmodi fic
a ti
ons.
How doe sIPv6diffe
r?Thes tandardssta
tet hatIPv6r etai
nsma nyf eatures
thatcont r
ibutedtot hesuc
cessofI Pv4.Infact,thede s
ignerscharact
erizeI Pv6
asb ei
ngb a-si
cal
lyt hesameasIPv4wi t
honlymi normodificat
ions
.Fore xamp l
e,
bothI Pv4a ndI Pv6useac onnec
tionles
sdeli
veryp ara
digm,a l
low thes e
nde rt o
chooset he siz
e of datab ei
ng sent,a nd requi
ret he sendert os peci
fyt he
max i
mum numb erofhop sada ta
gr amc anma keb e
foreb ei
ngt erminated.I Pv6
ret
a i
nsma nyoft heotherIPv4f aci
li
ties
,sucha sfragmentati
on.Thei mp ortant
poi
nti s:

Becaus
eI Pv
6inher
itsmanyofthec oncept
s,princ
ipl
es,andmecha
-ni
sms found inI Pv
4, we cannot understand IPv6 wi
thout
unders
tand-i
ngIPv4;bot
harepresentedthroughoutthetext.

Desp
itec once
ptualsimil
ari
ti
es,I
Pv6c hange
smos toft hep rot
ocoldeta
il
s.
I
Pv6usesla r
ge raddr
e s
sesa ndcompl
ete
lyr ev
isesthefor
ma tofp ac
kets
.The
c
hange
sintro-ducedbyIPv 6canbegr
oupedintoseve
nc a
teg
or i
es:

Lar
gerAddr
ess
es.Thenew addr
esss
izei
sthemos
tnot
ice
abl
echa
nge
.
I
Pv6qua
drup
lest
hes
izeofa
nIPv
4addr
essf
rom32b
itst
o128b
its
.
Ext
ended Addr
essHi
erar
chy.I
Pv6 us
est
hel
arg
era
ddr
esss
pac
eto
c
rea
teaddi
ti
onall
eve
lsofa ddr
ess
inghi
erar
chy(e
.g.
,toa
ll
ow a
nIS
P
t
oall
oca
tebl
ock
sofa ddr
ess
estoea c
hcus
tomer
).
NewHeaderFor
mat
.IPv
6us
esa
nent
ire
lyne
wandi
ncomp
ati
bl
epa
cke
t
f
orma
ttha
tinc
lude
sas
etofop
tiona
lhe
ade
rs.
Toav
oidconf
usi
onandambigui
ty,ve
rsi
onnumb
er5wa
ssk
ipp
ed;p
rob
lemsha
dar
ise
nfr
oma
s
eri
esofmis
tak
e sa
ndmis
unde
r s
tandi
ngs.
1
4 I
ntr
oduc
tionAndOv
erv
iew Cha
p.1

I
mpr
oved Opt
ions
.IPv
6al
l
owsap
ack
ett
oinc
lud
eop
tiona
lcont
rol
i
nfor
-ma
tionnota
vai
l
abl
einI
Pv4.
Pr
ovi
si
onForPr
otoc
olExt
ens
ion.I
nst
eadofs
pec
ifyi
nga
llde
tai
l
s,t
he
IPv
6e x
tens
ioncapa
bili
tya
ll
owstheIETFtoa
dap
tthep
rot
ocolt
one
w
net-
workhardwa
rea ndne
wa p
pli
cat
ions
.
Suppor
tForAut
oconf
igur
ati
onAndRenumber
ing.I
Pv6a
ll
owsas
itet
o
c
hang
ef r
om oneI
SPt
oanot
herb
yaut
oma
tingt
her
equi
si
tea
ddr
ess
c
hang
es.

Suppor
tForRes
our
ceAl
l
ocat
ion.I
Pv6i
ncl
ude
saf
low a
bst
rac
tiona
nd
a
l-l
owsdi
ffe
rent
iat
eds
erv
ice
s

1
.12I
Pv6Mi
gra
tion

How cantheInternetcha
ng efrom IPv
4t oIPv6?Thede s
ignersconsi
der
ed
thequesti
onc a
ref
ull
y.Byt he1990s,theInte
r ne
tha dal
rea
dyg rownt oola
rgeto
si
mp l
yt akeitoff
li
ne,c ha
ngee ve
ryhos tandr oute
r,andt henr e
boot.So,the
des
ignerspla
nnedtop haseinthec hang
eg radual
lyoverti
me .Weus et heterm
IPv6migrati
ontocapturetheconcept
.
Many gr
oupsha
vep roposedpl
ansfor I
Pv6 mi
gra
tion.The p
lansc
anb
e
g
roupe
dintothr
eemajora
p p
r oa
che
sasfol
lows
:

As
epa
rat
eIPv
6Int
erne
trunni
ngi
npa
ral
l
el
I
Pv6i
sl
andsc
onne
cte
dbyI
Pv4unt
ilI
SPsi
nst
allI
Pv6
Ga
tewa
yst
hatt
rans
lat
ebe
twe
enI
Pv4a
ndI
Pv6

Paral
lelInternets.Conceptuall
y,t hep l
anc all
sf orISPst ocreateap aral
le
l
Inter-
ne tr unning IPv6.I np r
a c
tice,I Pv6a nd IPv 4cans hare many oft he
underl
ying wi re
sa nd ne twork devices( p
rovidedt he devi
cesa r
e up gr
adedt o
handl
eI Pv6).Howe ver,ad-dres
singa ndrout i
ngus e
db ythetwop rotoc
olv e
rsi
ons
wil
lb ec omp l
etelyindependent.Pr oponentsa rg
uet hatbecauseIPv6of fersso
manya dvant a
ges,everyonewi l
lswitcht oIPv6,me aningtheIPv4I nter
netwi l
lbe
decommissionedquickl
y.
I
Pv6I s
lands.Thep la
na llowsi ndi
vidualor ga
ni zat
ionst os t
artus i
ngI Pv
6
b
eforea l
lI SPsr unIPv6.Eachor ganizat
ioni sa nIPv 6islandi nthemi ds
tofa n
I
Pv4oc ean.Tos endada tagr
amb et weeni sl
ands,t heI Pv6da t
agrami swrappe
d
i
nsi
dea nI Pv4da -ta
gram,senta cr
os stheI nternet,a ndt henunwr appedwhe nit
r
eachesthede sti
nati
onis-l
and.AsI S PsadoptI Pv6,s it
esc a
ns tartsendi
ngI Pv
6
t
omor eandmor edesti
nati
onsuntilt hee nti
reI nt
e rnetisus ingIPv6.SomeI Pv
6
e
nthusias
tsdonotl iketheapproac
hb eca
us eitdoe snotp r ovi
dee nougheconomic
i
ncenti
vef orI SPstoadoptIPv6.
Gat
ewaysAndTr
ans
lat
ion.Thet
hir
dap
proa
ch us
esne
twor
kde
vic
est
hat
t
ransl
atebetwee
nIPv4andIPv6.Forexampl
e,ifasi
tec
hoosest
ouseIPv6b
ut
t
heirISPsti
l
lusesI
Pv4,aga
t e
wa ydev
iceca
nb epl
ace
dbetwe
enthes
iteandt
he
I
SPt oper
form
S
ec.1
.12 I
Pv6Mi
gra
tion 1
5

translat
ion.Theg a
teway wil
la cc
e p
toutgoi
ngI Pv6p a
c k
ets,cr eatee qui
val
ent
IPv4p ackets,andsendtheIPv 4pa c
ket
stot heISPforde l
iv
ery.S imil
arly,when
anI Pv4p acketarri
vesfrom theISP,thegatewaywillc
r e
atea ne quiva
lentIPv6
packeta nds endtheIPv6p acke
ti ntotheorgani
zati
on.Thus,c omp ute
r sinthe
organizati
onc anrunIPv6eveni ftheISPsti
l
lus e
sIPv4.Alter
nat i
vely,as i
tecan
useI Pv4e v
eni ftheres
toft heInterne
thasa dop
tedIPv6.
Eachs t
r a
teg yformi g
ra t
ionha sadvantagesa nddi s
a dv a
ntages.Int hee nd,a
cen-tra
lque sti
ona ri
ses:wha teconomicincenti
vedoe sac onsume r,enterpri
se,or
anI SPha vet oc hange?S urpri
singl
y,t hereisl ittl
ee v idencet hatIPv 6of fers
muc htot hea ver-ageconsume r,organi
za t
ion,orp rovide r.Ofc ourset her
ea re
excepti
ons.Fore xampl
e ,ac omp anywhos eb usinessmod elinvol
vest hes aleof
i
nf or
ma ti
ont oa dver
tis
erswi l
lbenefitgreatl
yife ac
hi ndiv i
dualusesas eparateI P
address
,b ecauset hecomp anywi l
lb eablet ot rackindi vidualhabitsmuc hmor e
accurat
elyt hanwhe naf amil
ys haresonec omp uteroronea ddress
.Int hee nd,
eachoft hemi g r
ati
on strategi
esha sb een usedi ns omep lac
e s
,b utnoneha s
eme r
geda sawi delyacceptedconsensus
.

1
.13Dua
lSt
ackS
yst
ems

Ma
nyc
hap
ter
sint
hist
extdi
scus
spr
otoc
ols
oft
war
e,c
ommonl
yknowna
sa
pr
oto-
cols
tac
k.Thei
mpe
ndi
ngc
hang
etoI
Pv6ha
saf
fec
tedt
hewa
ypr
otoc
ol
soft wareisde si
g ned,especi
al
lyfori ndi
vidualcomp ut
ers.Mos top erati
ngs ystems
(e.g.,Linux,Wi ndows ,a ndOS-X)a realreadyclass
ifi
eda sdua lstack.Thati s,in
addi ti
ont oallthes oftwareneededforI Pv4,thes yst
emc ontainsa l
lthes oftware
ne ededf orIPv6.I nmos tsyste
ms ,thet wov er
sionsdonoti nteract.Thati s,each
sideha sa nIPa ddressande ac
hs idec a
ns enda ndr ec
eivepa c
k e
ts.Howe v er,the
addr ess
esdiffera ndneithersi
deus estheot her(orise v
ena wa ret hattheot her
side e xi
sts)
.The dua l
-sta
cki de
ai sc l
oselyre -
late
dt ot he pa r
a l
l
elI nternet
ap p
r oachdisc
usse da b
ove.
Dual
-st acksyste
msa l
low a ppli
cationst oc hoosewhe thert heywi llus
eI Pv4,
IPv6,orb oth.Oldera ppl
icationsc ont i
nuet ous eI Pv4.Howe ver
,adua l
-stack
me chanis
m a l-l
ows ana p p
lication t oc hoos
e dyna micall
y, ma ki
ng mi gr
at i
on
automa ti
c.Fore xample,considerab rows e
r .Ifag ivenURLma p stob othanI Pv4
addr es
sa nda nIPv6a ddress,t heb rows ermi ghtt ryt oc ommunicateus i
ngI Pv6
fir
s t.Ift he a t
temptf a i
ls,t he b rows e
rc ant ryI Pv4.I ft he computeri s
conne ct
edt oanI Pv6ne t
wor kt hatr eachesthede sti
na -t
ion,IPv 6communi c
at i
on
willsucceed.I fnot,theb rows era utoma ti
call
yf all
sba c
kt ous i
ngI Pv4.

1
.14Or
gani
zat
ionOfTheTe
xt

Thema t
e r
ialonTCP/I Phasbeenwr i
tte
nint hr
eev ol
umes.Thisvolumeint
ro
-
duc
estheTCP/IPtechnology.Itdis
cuss
esthefundamental
sofp r
ot oc
olsli
keTCP
a
ndIP,pr
esentspack
etf ormats,andshowshowt hepr
ot oc
olsfi
tt ogethe
rinthe
I
nte
rnet.Inaddi
ti
ont
oex
ami
ningi
ndi
vi
dua
lpr
otoc
ols
,thet
exthi
ghl
i
ght
sthe
g
enera
lpri
nci
pl
es
1
6 I
ntr
oduc
tionAndOv
erv
iew Cha
p.1

under l
yingne t
wor kprotoc
ols
,a ndexpl
ai
nswhyt heTCP/I
Pp rot
ocol
sadapte a
sil
y
tos o ma ny underl
ying physi
calnetworkt echnol
ogi
es.The textc oversthe
archi
t ec
t ureo ft he gl
obalInt e
rnet,and consi
dersprotoc
olsthatp ropag
ate
routingi nfor
ma t
ion.Final
lythet ex
tp re
sentse xa
mplenetworkappl
ic
a t
ionsand
expla
inshowa ppl
icat
ionsusetheTCP/IPprotoc
ols.
Thes ec
onda ndt hir
dv olume sf ocusoni mp l
eme nt ati
on.Vol umeI Iex amines
the imp le
me ntati
on ofTCP/ IPp rotocolst he msel
ves.The v olume e xpl
ainshow
protocols of
t wareisor g
anized.I tdi scuss
esda tastr ucturesa swe llasf a c
il
iti
es
sucha st i
me rma nageme nt.Thev olumep r
ese ntsalgorithmsa ndus e
se xamp l
e sof
codef romawo r
k- i
ngs yste
mt oill
us tr
a tethei deas.Vol umeI IIconsidersne twork
appl
icationsa ndex -pl
ainshow t heyus eTCP/ IPf orc ommuni cation.I tfocuseson
the client-serverp ara-digm, t he b asisf or a l
ldi s tri
butedp rogrammi ng.I t
dis
cussest hei nt
er f
aceb etwee np ro-gra msa ndp rotoc ols
,a nds howshow c li
ent
ands erverpr ogr
amsa r eorganized.
Sof ar,weha vetalk eda boutt heTCP/ IPt echnologya ndt heI nter ne tin
gene ralt erms,s umma rizing t he s er vi
cesp rovide da nd t he hist
ory of t hei
r
develop me nt.Thene xtcha pterp rov i
de sab riefsumma ryoft het ypeofne t work
hardwa reus edt hroughoutt heI nte r
ne t.Itsp urpos eisnott oil
luminatenua nc es
of a p a r
t ic
ula
rv endors ha rdwa re,b ut t of oc us on t he features of e a
ch
technol ogyt hata re ofp rimar yi mp ortancet oa nI n-terneta rchi
tect.La te
r
chapte rsde l
veintot hepr otocolsa ndt heInt e
rnet ,f ulf
il
li
ngt hreep urposes:t hey
exploreg eneralconc ept
sa nd r e
v iew t he Inter neta rc
hitect
ur almode l,t hey
exami ne t he detail
s of TCP/ IPp rotocols
,a nd t he yl ook ats ta
nda rds f or
appli
ca tions ervi
ces.La te
rc hapte r
sde scri
bes ervi
c est hats panmul t
ipl
ema c hines,
inc
ludi ng t he p r
op agat
ion of r out i
ng i nforma tion, na me r esol
ut i
on, a nd
appli
ca tionss uc
ha st heWe b.
Ana pp
endixthatfoll
owst hema i
nt ex
tc ontai
nsa
na lphabet
icalli
stoft e
r ms
anda bb
revia
t i
onsuse
dt hroug
houtt heli
teratureandthet ext
.Be c
a us
eb eg
inners
ofte
nf i
ndt hene wterminol
ogyov erwhel
minga nddi
f f
iculttor emember,t hey
aree nc
ouragedt ousethea l
phabe
ticalli
stinste
adofs canni
ngb ac
kt hrought he
text
.

1
.15S
umma
ry

An i nter netc ons i


sts of a s et of c onnect e
d ne tworkst ha ta cta sa
coordinat edwhol e
.Thec hiefadv antag
eofa ni nterneti stha titprovidesuni ver
s a
l
interconne ction whi lea l
-l
owi ng indivi
dualg roupst o us e wha teve r ne twor k
hardwa rei sb e
sts ui tedt ot heirneeds.Wewi l
le x aminep rinci
pl
e sunde rl
ying
internetc ommuni c a
t ioni ng e
ne ralandt hede -tail
sofonei nternetp rot ocolsuite
inpar ticular.Wewi lla l
sodiscusshowi nt e
rne tp r
o- tocolsareus edina ni nternet.
Our e xamp l
et echnol ogy, calle
d TCP/ IPa fteri t
st wo ma inp rot oc ols
, wa s
developedb yt heDe fenseAdv ance
dRe sear
c hPr ojec t
sAg ency.Itp rov idest he
basi
sf ort he g lobalI nternet,whi ch now r eachesov ert wo b i
ll
ion p eoplei n
count rie
sa roundt hewor l
d.Thene xtv ersionoft heI nternetPr otoc ol( IPv6)
drawshe av i
lyonc onc e p
ts,t erminol
ogy,a ndde t
ailsint hec urrentve rsion( IPv4).
There fore,c ha pte
r st hroughoutt hetextwi l
le xamineb othv er
sions.
Vol
umeIIIisav
ail
ableintwov e
rsi
ons
:onetha
tusest nuxs
heLi ocketi
nter
fac
e,andas
econd
t
hatusestheWi
ndowsSocket
sInter
facedef
ine
dbyMicr
osof
t.
Ex
erc
ise
s 1
7

EXERCI
SES

1
.1 Ma
keal
i
stofa
llt
heI
nte
rne
tap
pli
cat
ionst
hatyouus
e.Howma
nya
rewe
b-b
ase
d?
1
.2 Pl
otthegrowthofTCP/I
Ptec
hnologya
ndInterne
tacc
essa
tyouror
gani
zat
ion.How
manycomp
ut e
rs,us
ers
,andnetwork
swereconnec
tedea
chyea
r?
1
.3 Start
ing in 2000,ma j
ort el
ep honec ompani
esb eg
an mov i
ng t
heirne
twork
sf rom
conven-
tionalt e
lep
hone switching toI P-
b a
sed networki
ng.The maj
or t
elep
hone
networkswillrunonlyIPprotoc ol
s.Why?
1
.4 Findoutwhe nyours i
teswitc
he dt oIPv6orwhe nitplanstoswi
tch.
Chapt
erCont
ent
s
2.
1 Introduct i
on,19
2.
2 TwoAp proa c
hesToNe t workCommunica
t i
on,20
2.
3 WANAndLAN,21
2.
4 Hardwa reAddr es
singS cheme s
,21
2.
5 Ethernet( I
EEE802. 3),22
2.
6 Wi-Fi( I
EEE802. 1
1) ,26
2.
7 ZigBee( IEEE802.1 5.4),26
2.
8 OpticalCa rri
erAndPa ck etOverSONET(OC,POS)
,27
2.
9 Point-To- Poi
ntNe twor k s,28
2.
10 VLANTe chnolog
yAndBr oadcas
tDomai
ns,28
2.
11 Bridgi
ng ,29
2.
12 Cong est
ionAndPa ck etLos s,30
2.
13 Summa r
y,31
2

Overv
iewOfUnderl
ying
NetworkTec
hnol
ogi
es

2.
1Int
roduc
tion

The I nt e rne tint roducedak e


yc hangei n our t hink i
ng about c omp uter
networ k
ing.Ea r l
ie
re ffor tsallaimeda tp r
oducingane wk indofne t
wor king.The
Internetint r o- ducedane w me thodofi nt er
connecti
ngi ndiv i
dualnetwor ksa nda
setofp rot oc olst hata llowedc omp uterst ointerac
ta crossma nyne tworks.Whi l
e
networ kha r dwa rep la
ysonl yami norr ol
ei nt heove ral
lde s
ign,unde rstanding
Internette chnol ogyr equi r
esonet odistinguis
hb etweent hel ow- l
evelme chanisms
providedb yt heha rdwa rei t
selfa ndt hehi gher-l
evelf acil
itie
st hatt heTCP/ IP
protocol
sp r ov ide.I tisa l
soimp ortantt ounde rsta
ndhow t heinterfac
e ss uppl
ied
by unde rlying p acket-s wit
chedt echnologya ffect our c hoic
e of hi gh-le
v e
l
abst
r act
ions .
Thisc hapt eri ntroduc esb a
sicpacket-switchingc oncep tsandt er
mi nology,a nd
thenr eviewss omeoft heunde rl
yingha rdwa ret echnologiestha thaveb eenus ed
in TCP/ IP i nt ernets. La terc hapters de scribe how p hys
ical networ ksa re
interc
onne cteda ndhow t heTCP/ IPp rotocolsa ccommoda tev astdifference sin
theha rdwa re.Whi l
et hel is
tp resentedhe r ei scertainlynotc omp r
e hensive,it
cle
a r
ly demons t rate
st hev ari
etya mong p hysica
lne twor ksov erwhi ch TCP/ IP
operates.Ther eaderc ans a fe
lysk i
pma nyoft hete c
hni c
a ldetail
s,buts houldt ry
tog raspt hei de aofp ac ketswitchi
nga ndt r yt oima gineb uil
dingahomog eneous
communi cations ystem us i
ngs uchhe terogeneousha rdwa re.Mos timpor tant,t he
readers houldl ookc l
os e l
ya tt hede tai
lsoft hea ddr e
s s
ings chemest ha tv ari
ous
technol
og i
e sus e ;late
rc hap t
erswi l
ldiscussinde tailhowhi gh-le
velprot o-colsuse
theha rdwa rea ddr ess
e s
.
1
9
20 Ov
erv
iewOfUnde
rlyi
ngNe
twor
kTe
chnol
ogi
es Cha
p.2

2.
2TwoAp
proa
che
sToNe
twor
kCommuni
cat
ion

Fr o m aha rdwa r ep erspective,ne twor ksa reof tenc l


assifiedb yt hef ormsof
ene rg yt heyus ea ndt heme diaov erwhi cht hee nergyt ra vel
s( e.g.,e le
c tri
c a
l
signa lsov e rc opperwi re,li
ghtp ulsesov eropticalf i
ber,andr adiof r
e quenc ywa ves
tra nsmi tte d t hr oug h s pace). Fr om a c ommuni cati
on p erspective, ne twor k
tec hnol ogiesc anb e di vi
d- edi nt ot wo b r
oa dc ategoriest hat de pend on t he
int erfa cet heyp rov i
de:c onnec t i
on- or i
ented (some ti
me sc alledc ircuit-swit ched)
and c onnec ti
onless( some ti
me sc alledp acket -switc
hed) . Conne cti
on- or i
ent ed
ne twor ksop erateb yf ormingade dic atdc
e on-nection orc ircui
tbet we ent wo
poi nts.Ol de rt elephone s ystemsus e dac onne cti
on-oriente dt echnol ogy a
tele phonec alle s
t abli
shedac onne ctionf rom t heor igi
nat i
ngp honet hroug ht he
l
oc a ls wi tchingof fice,a crosst runkl ines,t oar emotes witchingof -fice,a nd
fina l
lyt ot hede s ti
na ti
ont elephone.Whi l
eac onne cti
onwa si np lace,t hep hone
equi pme nts entv oi
c es ig
na l
sf rom t hemi crophonet ot her ecei
ver .Be causei t
de dicat esonep at hi nt hene twor kt oe achp airofc ommuni cati
nge ndp oi
nt s,a
conne ction- or i
ente ds ystemc ang ua ra nteet hatc ommuni cationi sc ontinuousa nd
unb r
o- k en.Tha ti s,onc eac ir
c ui
ti se stabl
ished,noot he rne twor ka ct i
v i
tywi l
l
de crea set hec apacity oft hec irc
ui t.Onedi sadvantageofc onne cti
on- or i
ent ed
tec hnol ogya ri
sesf rom c ost:c i
rcuitc ostsa r
ef i
xed,i ndep endentofus e .For
ex amp le,t her atec hargedf orap honec allr emainedf ixed,e vendur ingt i
me s
whe nne ithe rp a
rt ywa stalking.
Connecti
onl es
sne t
wor ks,t het ypeof te nuse dt oc onne ctc omp uters,takea n
entire-lydif
fe renta p proac h.I nac onnectionles
ss ystem,da tat ob et r
ansferred
acrossane t-wor kisdi vide di ntos mallpiecesc alledp acket st ha ta remul ti
plexed
ontohi ghcapa cit
yi nterma chinec onnections.A p acke t,whi chus uallycontains
onlyaf ewhundr edb ytesofda t
a,c arri
esi denti
f icati
ont hate na b l
est henetwor k
hardwa retok now how t os endi tt ot hes pec
if i
edde stination.Fore xamp l
e,a
l
a r
g ef il
et ob et ransmit tedb etwee nt woma chi nesmus tb eb rokeni ntoma ny
pack et
st hata res enta c ros st hene tworkonea tat i
me .Thene twor kha r
dwa re
deli
v ersthep acketst ot hes peci
fied de s
t i
nation,whe res of t warer eas
sembles
themi ntoas inglef il
e.Thec hiefadv a
nt ageofp acket-swi tc
hi ngi st hatmul ti
p l
e
communi cati
onsa mongc omp ut ersc anp roceedc oncurre ntly,wi thi nter-machine
conne cti
ons sha redb ya llp air
s of c omp uterst ha ta rec ommuni cati
ng.The
dis
a dvantag
e, of c ours e,i st hata sa ctiv
ity i nc reases,a g iven p a
ir of
communi cati
ngc omput ersr eceiveslessoft hene twor kca pacity.Tha tis,whe never
ap a cketswitc hedne twor kb ec
ome sov erloaded,c omp ut ersus ingt hene twor k
mus twa itbefor ethe yc ans enda dditi
onalp ackets.
Despi
tet he p otenti
aldr awback ofnotb eing a bl
et og uarantee net
wor k
capac
ity,c onnectionle
ssne tworksha veb ecome e x t
remelyp opular.The chief
motivati
onsf ora dopti
ngp acketswitchi
nga r
ec osta nd per
forma nce.Because
multi
plecomp utersc anshar
et heunde rl
yingne t
wor kc hannel
s,fewe rconnec
tions
arerequireda ndc ostiskep
tl ow.Be c
ausee ngi
nee rshaveb e
ena bletob ui
ldhigh-
spee
dp ac
ke ts witchi
ngha rdware,c a
p a
cityisnotus ual
ly ap r
ob l
em.S oma ny
computeri nterconnecti
onsus ec onnecti
on-le
ssne tworksthat,t hroughoutt he
r
emai
nder of t
hist ex
t, we wil
la s
sume the t
erm net-
wor
kre
fer
stoa
c
onne
cti
onl
essnetwor
kt ec
hnol
ogyunl
essot
her
wisesta
ted.

Hybri
dt ec
hnol
ogi
esa
rea
lsop
oss
ibl
e,b
uts
uchde
tai
l
sar
euni
mpor
tantt
oour
di
scus
sion.
S
ec.2.
3WANAndLAN 21

2.
3WANAndLAN

Dat
ane tworksthats panlargeg e
ographi
caldist
anc e
s( e.
g .
,t hec ontinental
U.S.
)a r
ef undamental
lydiffere
ntf r om thosethats p
ans hortdi s
t a
nc es(e.g.,a
si
ngleroom).Tohe lpcha r
acte
rizet hedifference
si nca p
aci
t ya ndintende dus e
,
packetswit
chedt e
chnol-ogi
esareof t e
ndi vi
dedintot wob roadc ategorie:Wi
s de
AreaNetworks( WANs)a ndLo-calAr eaNet works(LANs).Thet woc ategorie
sdo
notha v
ef ormalde f
init
ions.Inste
a d,v endorsapplyt hete rmsloos el
yt ohe l
p
cust
ome r
sdisti
ngui
sha mongt ec
hnolog i
es.
WAN t echnol
ogies
, s ome ti
me s c all
e d l ong haul net works, p rovi
de
communi cati
on ov erlong dista
nce s
.Mos t WAN t ec hnol
ogiesdo not l i
mitt he
dist
ances p
anne d;aWAN c a
na l
low t hee ndpoint
sofac ommunica ti
on tob e
arbit
r a
r i
l
yf a
ra par
t.Fore x-amp l
e,aWAN c a n useop ticalfi
berst os pana
continentora noc ea
n.Us ual
ly,WANsop era t
ea ts lowe rspeedsthanLANs ,and
havemuc hg reaterdela
yb e
twe enc onnections.Typ icalspeedsforaWAN r ange
from 100Mb ps(mil
li
onb i
tsp ersecond)t o10Gb ps( bil
li
onb it
sp e
rs e
c ond).Del
ays
acrossaWANc anvaryf r
omaf ewmi l
li
secondst os everaltenthsofas econd.
LANte chnologie
sp rovi
det hehi
ghestspeedconnect
ionsamongc omputers
,but
sac
rifi
cet hea b
ili
tyt os panlongdistances
.Fore xample,at ypi
calLAN spansa
smal
la r
eal i
k eas ingl
eb uil
dingoras ma l
lcampus,andt ypi
cal
l
yop erate
sb et
wee n
1Gb psand1 0Gb ps.Bec a
useLANt ec
hnologie
scovershortdistanc
e s
,t heyoffer
l
owe rdela
yst hanWANs .Thede l
ayacrossaLANc anbea sshortasaf e wtenths
ofami l
li
secondora slonga s10mill
i
seconds.

2.
4Ha
rdwa
reAddr
ess
ingS
che
mes

Wewi l
ls eet hatI nternetp rotocolsmus tha ndl eonep arti
cul
ara spec tof
networ khar dware:he terogeneousa ddr es
sings che me s
.Ea c
hne tworkha rdwa re
technologyde -f
inesa na ddressi
ngmec hanismt ha tc omp utersuset os peci
fyt he
desti
nat i
onf orap ack-et.Ev eryc omp ut e
ra tt a
c hedt oane t
wor kisa ss
igne da
unique address,whi c
hwec ant hinkofa sa ni nt eg er.A p acketsenta c
r ossa
networ kinc
ludest woa ddre s
ses:ade st
i-nationaddr es stha tspeci
fi
est heinte nded
recip
ient,andas ourceaddr esst hats pecifi
est hes e nde r.Thede sti
nationaddr ess
isplacedint hesamep osi
tionine achp acket,ma k -i
ngi tp ossi
blefort hene twor k
hardwa retoe xaminet hede s
tination a ddresse a s
ily.A s endermus tk now t he
addressoft hei ntendedr ecipi
ent ,a ndmus tp la
c et her ecipi
ent
sa ddressint he
desti
nat i
ona ddres
sf i
eldofap ack etb e
f oret r
ans mit tingt hep a
cket.
Thene
xtsec
tionsex
aminef
oure
xamp
lesofne
twor
kte
chnol
ogi
est
hatha
ve
b
eenusedi
ntheInter
net:
Et
her
net(
IEEE802.
3)
Wi
-Fi(
IEEE802.
11)
Zi
gBe
e(I
EEE802.
15.
4)
Wi
deAr
eaPoi
nt-
to-
Poi
ntNe
twor
ks(
SONET)
Exce
ptional
lylong del
ayscanr
esultfrom WANstha
tc ommuni
cat
ebys
endi
ng s
igna
lst
oa
s
ate
ll
iteor-b
itingtheear
t handb
ackt
oa not
herloc
ati
ononear
th.
22 Ov
erv
iewOfUnde
rlyi
ngNe
twor
kTe
chnol
ogi
es Cha
p.2

Ourdi
scus
sionoft e
chnol
ogieswil
lgl
ossov
ermanyofthehardwa
redetai
l
sbe
-
causethepurposeist ohighl
i
ghtwa ysinwhic
ht heunde
rlyi
nghardwa
rehas
i
nfl
uenc
eddesi
gnc hoi
cesintheprotoc
ols
.

2.
5Et
her
net(
IEEE802.
3)

Ether neti st hena meg iv


e nt oap opula rp acket-s witchedLAN t echnology
invent eda tXe roxPARCi nt hee arly1 970s .Xe roxCor pora ti
on,I nt elCor pora t
ion,
andDi gitalEqui pmentCor por
ations ta ndardizedEt herne tin1 978;t heI nstitute
forEl ect r
icalandEl ectronicEngi neers( I
EEE)r el
e a
s edac omp atibl
ev ersionoft he
standa rdus ingt hestandardnumb er802. 3.Et hernetha sb ecomet hemos tp opular
LANt e
chnol og y;itnow a ppearsi nv irtua l
lya l
lc orpor atea ndp ersona lne twor k
s,
andt heEt he rne tpacketf ormati ss ome t
ime suseda crosswi dea r
eane twor ks.The
curre ntv ersionso fEtherneta rek nowna sGigabitEt her net( GigE)and1 0Gi gabit
Ether net( 10Gi gE)bec auset heyt ransf erda taa t1Gb p sa nd1 0Gb p s,r espectivel
y.
Nex tg enera tion technologiesop e
ra tea t40 a nd 1 00 g ig
a bi
t sp ers econd.An
Ether netne t wor kcons i
stsofa n Et hernets witcht owhi chmul tipl
ec omp uters
attach.As ma l
ls wi
tchc a nconne ctf ourc omp ut ers;al a rges witch,s ucha st he
switche sus edi nda t
ac e
nt ers
,c a nc onne cthundr edsofc om- puters.Conne ctions
betwe e
nac omp utera ndas wit chc onsistofc opp erwi resf orl owe rs peedsor
optica lf i
b ersf or highers peeds.Fi gur e 2. 1i l
l
us trate st he t op ology of a n
Ether net.

S
wit
ch

c
opperoropt
ical
c
abl
es

Comp
ute
rA Comp
ute
rB Comp
ute
rC

Fi
gur
e2.
1Il
lus
tra
tionoftheconnecti
onsus
e dwi
tha
nEt
her
net
.Ea
chc
om-
p
uterconne
ctstoac ent
ralswi
tch.
Wewil
lde
scri
benet
worksa
sc onnect
ingc
omp
ute
rs,b
utt
heyc
ana
lsoc
onne
ctde
vic
es,s
ucha
s
p
rint
ers
,tha
thavenet
workc
onnec
tions.
S
ec.2.
5 Et
her
net(
IEEE802.
3) 23

AnEther
netswit
chi sane lec
tronicde vi
cethatus ual
lyresi
desinawi ri
ng
cl
oset.Whenusi
ngcoppe
rwi re,thec onnect
ionb e
twe e
nas witchandac ompute
r
mustb ele
sstha
n100me terslong;op ti
calconnecti
onscane x
tendfarther.Ea
ch
computermusthaveaNe tworkI nterfaceCar d(NIC)t ha
top er
atesa sanI/O
devi
cethatca
nsendandr ec
eiv
ep ackets.

2.
5.1Et
her
netCa
pac
ity

Wesa i
dt hataGi gabi
tEt hernett ransfer sda taa tag i
gabi
tp ersecond( 1
000
me ga-bi
tsp erse cond).Cons equently,thef or malna me1 000Base-Tisa ppl
i
e dt o
thev ersi
ont hatus e stwiste
dp ai
rc opperwi r ing.Ar elatedI EEEs t
andardk nown
as1 000Base-Xs pecifi
esEt hernett ransmis
sionov erop ti
calf i
ber
.I ne s
sence,t he
opticalversi
onc on- vert
sa nEt herne tpacketi ntop ul
se so fli
ght,whicha ret hen
transferr
e da cr
os sa nop tic
alf ibe
r .Thec hie fa dvantage sofop tic
alf i
bera r
e:
highercapacitya ndi mmuni t
yt oelec-tri
cali nt er
fe r
enc e.Thec apaci
tyofaf iber
issuffic
ientt osup portb i
tr atesmuc hhi g
he rt han1 0Gb p s
.Ther e
fore,engineers
arede vel
oping40a nd1 00Gb psEt hernett ec hnol-ogi
e stha toperateoverop tical
fib
e r.

2.
5.2Aut
oma
ticNe
got
iat
ion

A mode rnEt hernets witchisnotre str


ict
edt oones peed.Instea d,thes witch
canop eratea t1 0,1 00,1 000ore ven1 0000Mb ps.As etofs peedsi sa vai
labl
ei n
mostNI Csa swe llass witches.Theimp ortantaspectofmul ti
-speedEt hernetl i
es
ina utoma t-e
dc onf i
gur a
t i
on.Whe n ac ableisp lugge
di n,b othe ndse nt
e ra
negotiati
onp hase .Thene g oti
ati
onde terminesthet ypeofc a
b l
e( st
r aightt hr
oug h
orc ross
-over)a ndt hema x-imum speedt hattheot hersi
deoft hec onnectionc an
support.Thet wos i
de sag reetoop eratea tthema xi
mum s peedt ha tbot hs i
des
canha ndle.Automa ti
cne gotiati
onp r
o-v i
desb a
ck wardcompatibi
lit
y ac omp uter
witha n ol
d,s low NI Cc a na t
tacht o aGi g
ab i
ts wit
ch withouta ny changes.
Ethernetp acketf orma tdoe snotde pe ndont hel i
nks p
eed,whi chme anst hat
TCP/I Pprotocol
sc anr emainuna wareoft hene goti
atedli
nks peed.

2.
5.3I
mpor
tantPr
ope
rti
esOfAnEt
her
net

Broadcas
tCapabil
i
t y.Ethernetsup
portsbroadcas
t,whic
hme ansasendercan
spec
ifyt hatagive
np acketshouldbedeli
vere
dt oallcomp
utersthatareattac
hed
tothene t
work.Inp r
a ct
ice
,s witc
hesusual
lyimple
me ntbr
oadca
stb ymakingone
copy oft hep a
cketf ore achc omput
er.Wewi llseethatTCP/ I
P dep
endson
Ethernetbroadc
ast.
Best-
EffortDel
i
verySemanti
cs.Ethernetussb
e est-ef
for tdeli
verysemantic
s,
whic
hme ansthatthene tworktri
est odeli
verpack
ets,theha rdwaredoesnot
guar
a ntee del
iv
erya nd doesnot infor
m as e
nderi ft he packetc annot be
del
i
ve re
d.I fthedes
tina-
tionmachi
neha ppe
nstob epowere ddownori tsc ab
leis
unpl
ug g
ed,p acke
tssentt othemachinewillbelos
ta ndt hes enderwillnotb e
not
ifi
ed.Morei
mpor
tant,i
fmult
ipl
ec omputer
sat
temp
ttos
endp
ack
etst
oa
gi
vencomput
era
tthesameti
me,aswit
c hc
a n
24 Ov
erv
iewOfUnde
rlyi
ngNe
twor
kTe
chnol
ogi
es Cha
p.2

b
ecomeover
runandst
artdis
cardi
ngpack
ets.Wewills
eelate
rt ha
tbe
st-
eff
ort
s
eman-
tic
sformakeyconc
eptinthede
signofTCP/
IPprot
ocol
s.

2.
5.448-
BitEt
her
netMAC(
Har
dwa
re)Addr
ess
es

IEEEdefinesa48- bitMACa ddres


sings chemet hatisus edwithEt he
rneta nd
other networkt echnologi
es.The a bb
r e
v i
atio
n MAC s ta nds for Me di
a Access
Control,andi susedt oc l
arifythep urposeoft hea ddr ess.A MAC a ddres
si s
assi
gnedt oe ach networki nter
facec ard.To i ns
ur e uni queness
,a n Ethernet
hardwarema nufacture
rmus tpurcha
seab lockofMACa ddressesfrom IEEEa nd
musta ssi
gnonea ddres
st oe ac
hNI Cthati sma nufactur
e d.Thea ss
ignmentme ans
thatnot woha rdwareinterfac
eshavethes ameEt he r
neta ddress
.
Beca
usee a
cha ddres
sisass
ignedtoaha r
dwa
redevi
ce,wesome
time
suset
he
t
erm hardwareaddressorphysicaladdres
s.Forourpurpos
es,wewil
lus
ethe
t
ermsinter-
change
a bl
y.
Notethefoll
owingimpor
tantp rope
rtyofaMACa ddr
ess:

AnEt hernetaddressisassi
gnedt oanetwor
ki nter
fac
ec ard,not
toac omputer;movingt heinterf
acecar
dtoanew c omput eror
repl
acingani nter
facec ardt hathasf
ail
edchangesac omputer
s
Ethernetad-dress
.

Knowi
ngthatachangei
nhardwareca
nc ha
ngeanEtherne
taddr
esse
xpl
ai
nswhy
hi
gherl
evelp
rot
ocol
sarede
signe
dt oa
ccommoda
teaddr
esscha
nges
.
TheI
EEE48-
bitMACa
ddr
ess
ings
che
mep
rov
ide
sthr
eet
ype
sofa
ddr
ess
es:

Unicas
t
Broadcas
t
Multic
ast

Auni
c astaddr
essisauniqueva
luea s
signedtoane tworki
nter
facec a
rd,as
des
cri
beda bove.Ifthedes
tinati
onaddr
e s
sinap ack
etisaunicas
ta ddres
s,the
pac
ketwillb edel
iv
eredtoexactl
yonecomp uter(ornotde l
i
ver
edata ll
,ifnone
ofthecomp ut-
ersonthenetworkhavethesp e
cif
iedaddr
ess)
.
Abr oadcastcons
ist
sofa l
l1s
,andisre
serv
edfortra
nsmi
tti
ngtoalls
tati
ons
si
mul-taneously.Whenas wi
tchrec
eiv
esap ac
ketwit
ha l
l1sinthedest
ina
tion
addre
ssf iel
d,t heswitc
hde l
i
versacopyofthepac
kettoeachcomput
eront he
networke xceptthesender
.
Amul t
icastaddres
sprovi
desalimit
edf orm ofbroadcas
tinwhi chas ub
setof
thecomp ute
r sonane tworkagreetolis
tent oag iv
enmul ti
casta ddres
s.Thes e
t
ofp art
ici
-patingcomputersi
scall
edamul t i
castgroup.Thei nterfacecardona
computermus tb econfi
guredtoj oi
n amul tica
stg rouport hei nte
rfacewill
ignor
ep acke
t ssenttotheg r
oup.Wewi lls
eet hatTCP/ I
Pprot ocol
susemul ti
cas
t
a
ndt
hatI
Pv6de
pendsonmul
-ti
cas
t.
S
ec.2.
5 Et
her
net(
IEEE802.
3) 25

2.
5.5Et
her
netFr
ameFor
matAndPa
cke
tSi
ze

Be causet het ermp ac


ketisg eneri
ca ndc anr efert oanyt ypeofp a
cket ,we
uset he t erm f rame t or efert oap ackett hati s defi
nedb y ha rdwa re
tec hnolog i
es.Et hernetframe sarev ar
iablel ength,wi thnof r a
mes mall
ert han
64 oc tet s
orl ar
g e
rt han1 514 octet
s( heade ra nd da t
a ).Ase x p
ec t
ed,e ach
Et herne tf ramec ontai
nsaf ie
ldthatholdst he48- bita ddre
s sofade stinati
ona nd
anot he rf i
eldt hatholdsthe48- bi
ta ddr
es soft hes ender.Whe nt ransmitte
d,t he
fra mea l
soi ncl
udesa4- octetCyc l
i
cRedundanc yChec k( CRC)t ha tisus e dt o
che ckf ort ransmissi
on error
s.Be causet heCRC f i
e l
di sa ddedb yt hes e nding
ha rdwa rea ndc heckedb yther ec
eivi
ngha rdwa re ,theCRCi snotv i
sibl
et ohi gher
l
a ye rsofp rotocolsoftwar
e.Figure2. 2il
lust r
ate sthep erti
ne ntpartsofa nEt her
-ne tf ra me.

De
stina
tion Source Frame
Addres
s Addr
ess Type Fr
amePa
yloa
d(Da
ta)
..
6oc
tet
s 6oc
tet
s 2oc
tet
s 461
500oc
tet
s .

Fi
gur
e2.
2Et
her
netf
ramef
orma
t.Fi
el
dsa
renotdr
awnt
osc
ale
.

Int hef i
gure,thef i
r s
tthreef i
e l
dsconsti
tuteaheaderf orthef rame ,and
there maini
ngf i
eldisthep ayl
oad.Thepac ketsusedi
nmos tne twor
kt echnologi
es
fol
low thes amep atter
n:t hep ac
ketc ons
istsofas mal
lhe a
de rwithf i
xe df i
el
ds
fol
lowe db y av ari
able
- s
izepayload.Thema ximum si
zeoft hep ayl
oa di na n
Ethernetf ramei s1500oc tet
s.Be causeEthernethasbeenuni ver
sall
ya dopte
d,
mostI SPsha vetunedt hei
rnet-wor k
st oaccommodatetheEt herne
tp ayload.We
cansumma r
ize:

TheEt her
netpayl
oadsizeof1500octetshasbecomeadef acto
stan-
dard;eveniftheyuseothernetworki
ngt echnol
ogi
es,ISPs
trytodes i
gnthei
rnetworkss
oapac ketcanhold1 500octet
sof
data.

Ina dditiont ofieldst ha tidentif


yt hes ourcea ndde st i
na t
ionoft hef rame ,
anEt her-ne tf ramec ontainsa1 6-bitintegert ha ti dentifiest het ypeofda ta
beingc ar
r i
edi nt hef r ame.Mos tp acke
tt echnolog i
e sincludeat ypef i
e l
d.Fr om
theI nternetsp oi
ntofv ie
w,t hef ramet ypef i
e ldi se ss
e ntialb ec
ausei tme a ns
Ethernetf rame sa res el
f -i
dent i
fying.Whenaf ramea rri
ve sa tag i
venma chi
ne ,
protocolsoftwa reuse st hef ramet ypet odeterminewhi chp rotocolmodul eshoul d
processthef r a
me .Thec hiefa dvan-tage
sofs e
lf-ident i
fyingf r a
me sa ret ha
tt he y
all
owmul ti
plep rotocol
st ob eus edtogeth-eronas ingleco mp utera ndt heya l
low
mul t
ipl
ep rotocolst ob ei ntermixed on the s a me p hys ic
a lne twork wi thout
i
nt erfer
ence .Fore xamp le,onec anhavea nap pl
ic
a tionp ro-
Thet ermf r
amederivesf rom communi
cati
onoverser
iall
inesinwhicht hese
nderfra
mesthe
da
tabya ddi
ngs pe
cialc
harac
te r
sb eforeandaf
terthetra
nsmitt
edda ta.
Te c
hnic
all
y, the te
rm b yter e
fersto a har
dware-dependent c
haract
ers i
ze; ne
twork
ing
pr
ofes
sional
susethet e
rm octetbeca us
eitre
ferstoan8-bi
tqua ntit
yona l
lcomputer
s.
26 Ov
erv
iewOfUnde
rlyi
ngNe
twor
kTe
chnol
ogi
es Cha
p.2

g
ram onac omputerusi
ngI nt
ernetp rot
ocolswhileanothera ppli
cati
onont he
s
amecomp uteruse
sal oc
a lexperi
mentalprotocol
.Theop e
r a
t i
ngs yste
me xamines
t
hetypef iel
dofe acharri
vingf r
amet ode ci
dewhi c
hmodul es houldproc
e s
st he
c
onte
nts.Wewi llseetha
tt het ypefiel
dc anbeus e
dt odefinemul ti
pleprotocol
s
i
nthesa mef amil
y.Fore x
a mpl
e,b e
causet heTCP/ I
Pp rotocolsincl
udes evera
l
p
rot
ocol
st ha
tc anb esentov era nEthernet,TCP/ I
Pde fi
ne sse v
eralEthernet
t
ypes
.

2.
6Wi
-Fi(
IEEE802.
11)

IEEE ha sdevel
oped as er
iesofs ta
ndardsf orwi r
e l
essnetwor k
st ha tar e
closelyr e-late
dtoEt her net
.Themos twe ll
-knownha v
eI EEEs tandardnumb e r
802. 11f ol
lowedbyas uffix(e.g,802.
. 11
gor802. 1
1n).Thes etofs tandardscan
interope ra
t e,whi
chme ansawi rel
essde vi
cecani ncl
udeha r
dwaref ormul t
iple
standa rds,a nd c
a nc hooset he standardt hatg ivest he maximum s peed.A
consor ti
umofne t
wor ke quip
me ntven-dorshasadop t
edt hema rk
etingt em Wi
r -Fi
toc overe qui
pmentt hatus est heI EEE wire-
lessstand a
rds,and ma ny Wi -Fi
de v
icese xist.
Each of the Wi -Fistandardsc anb e us edi ntwo f orms :asa na cc
e s
s
te
chnologyi n whichas i
ngleba s
es tation (calle
da na cces
spoi nt)connec
tst o
multi
pl
ec l
ie
nts( e.g.
,us erswithl apt
op s),ori nap oi
nt-to-pointconfi
gurat
ion
us
edt oc onnecte xa
ctlytwowi reles
sr adios.IEEEha sals
ode finedahigher-
speed
te
chnologyi nt
e ndedp ri
maril
yf orp oi
nt -to-p
oi ntinter
connections.Market
eda s
Wi-MAX andas si
gnedt hes t
andar dnumb er802. 16,thet echnologyisofmos t
i
nteresttone tworkp rovi
dersorc orp
ora ti
onst hatneedt oconne cttwosi
tes.

2.
7Zi
gBe
e(I
EEE802.
15.
4)

I
na ddit
iont oconne ct
ingc onv e
ntionalcomp uters
,a ninter
netc anbeusedby
em-bedde ddevic
e s
.Thec onceptofc onnecti
ngde v
icesissometi
me srefe
rredtoas
anIn- ternetofThi ngs.Ofc ourse,e achde vic
et ha
tc onnectstot heInter
net
mustha v eane m- beddedp rocessora ndmus ti ncludeane t
worki nt
erfac
e.IEEE
hascr e
a teds tandard 802. 1
5.4f ora l ow- p
owe rwi rele
ssne tworkt ec
hnol
ogy
i
ntendedt osupportc onnecti
onsofs ma l
lemb eddedde vi
ces.Thelow-poweraspec
t
makes802. 15.4r a
diosa ttr
activef orde v
icesthatr unonb atterypower.
Aconsorti
um ofv e
ndorshaschos
ent het e
rm Zi
gBeetor efertop roducts
t
hatuseI EEEs802.
15.
4s t
andardforradiosandrunas pecif
icprotoc
ols ta
ck
t
hatincl
udesI Pv
6p l
usprot
ocol
sthata l
l
ow as etofwirel
essnodestoor gani
ze
t
hemsel
vesintoame s
hthatcanforwar
dp acke
tstoandfromt heInter
net.
TheIEEE802.15.
4t echnol
ogyprovi
desaninteres
tingexampleofe xtr
emes
forTCP/I
P.Thep a
ck e
ts i
zeis127octets
,butonly102oc te
tsa r
ea v
ail
ablefora
payl
oad.Inaddi
ti
on,t hestandar
ddefinestwoaddres
sf or
ma t
s,oneus es64-bi
t
MACa ddr
esse
sandt heotheruses16-
bitMACa ddre
sses
.Thec hoi
ceofa ddre
ssi
ng
mod
eisha
ndl
eda
tst
art
up.
S
ec.2.
8 Op
tic
alCa
rri
erAndPa
cke
tOv
erS
ONET(
OC,POS
) 27

2.
8Op
tic
alCa
rri
erAndPa
cke
tOv
erS
ONET(
OC,POS
)

Phonec omp ani


esor i
gi
na l
lyde s
igneddi
gitalcir
cuitst ocarr
ydigit
izedv oi
ce
ca
ll
s;onl yla
t e
rdi dt hephonec ompanydigi
talci
rcuitsbecomeimport
antf ordata
networks.Conse quentl
y,t heda taratesofa v
a i
l
ablec i
rcuit
sarenotp owe rsof
te
n.I nstead,t heyha veb eenc hose
nt ocarrymul tipl
esof64 Kb psb e
c a
usea
di
giti
zedv oi
cec allusesane ncodi
ngk nownasPulseCodeModul ati
on(PCM)whi ch
pr
oduc es8000s amp l
espers ec
ond ,whereeac
hs ampleis8b it
s.
Theta
blei
nFi
gur
e2.
3li
stsaf
ewc
ommonda
tar
ate
sus
edi
nNor
thAme
ric
a
a
ndEur
ope
.

Na
me Bi
tRa te Voi
ceCircui
ts Loc
ati
on
0.
064Mb ps 1
T1 1.
544Mb ps 24 Nor
thAme
ric
a
T2 6.312Mbps 96 Nor
thAme
ric
a
T3 44.736Mbps 672 Nor
thAme
ric
a
T4 274.
760Mb ps 4032 Nor
thAme
ric
a
E1 2.
048Mb ps 30 Eur
ope
E2 8.
448Mb ps 120 Eur
ope
E3 34.
368Mb ps 480 Eur
ope
E4 139.
264Mb ps 1920 Eur
ope

Fi
gur
e2.
3Exampledat
ar a
tesavai
l
abl
eond
igi
talc
irc
uit
sle
ase
dfr
oma
t
ele
-phonecompany.

Hig
he r-
ratedi
g i
talcircui
tsrequir
et heuseoffi
b er
.I naddi
ti
ont ostandards
thatspecif
yt hetrans
mi s
s i
onofhighda tarat
esove
rc opper,thephonecompanies
havede v
e l
opedstandardsf ortr
ans mi
ssi
onoft hesamer a
tesoveroptic
alf i
ber.
Fig
ur e2.4l i
stsex
a mpl
e sofOp t
icalCarrier(
OC)standardsandtheda t
ar ateof
each.As uffi
xonOCde note
sac apaci
ty.

Op
t i
calStanda
rd BitRa t
e Voi
ceCi rc
uit
s
OC-1 51.
840Mb ps 810
OC-3 1
55.520Mb ps 2430
OC-12 622.080Mb ps 9720
OC-24 1
,244. 160Mbps 1 9440
OC-48 2.
488Gb p
s 38880
OC-96 4.
976Gb p
s 64512
OC-192 9.
952Gb p
s 129024
OC-256 13.271Gbp
s 172032

Fi
gur
e2.
4Ex a
mpl
eda
tar at
esavai
l
abl
eonhi
gh-
cap
aci
tydi
gi
talc
irc
uit
s
t
hatus
eopti
calfi
ber
.
28 Ov
erv
iewOfUnde
rlyi
ngNe
twor
kTe
chnol
ogi
es Cha
p.2

The t
ermS ONET r e
fe r
st oaf ra
mi ng prot
oc olthata l
lowsa c arr
iert o
multi
plexmul
tipl
edigit
alv oi
cetelephonec all
sontoas i
ngleconnec
tion.SONETi s
typi
call
yusedacrossOCc onnect
ions.Thus ,ifanI SPl eas
esa nOC-3c onnecti
on,
theI SPmayne edt ouseS ONET f raming.Thet er m PacketOverSONET ( POS)
ref
erst oatec
hnolo-g
yus edt osendp ac
k e
t susi
ngS ONETf rami
ng.

2.
9Poi
nt-
To-
Poi
ntNe
twor
ks

From TCP/I
Pspoi
ntofv ie
w,a nyc ommunic
a t
ionsys
tem us
edtopas
spack
e t
s
i
scl
assi
fi
eda sa network.Ift hecommunicationsyste
mc onnec
tsexa
ctl
yt wo
e
ndp
oints
,itisknowna sap oi
nt-to-
pointnetwork.Thus,alea
sedda
tacir
cui
tis
a
nexampleofap oi
nt-
to-poi
ntne t
wor k
.
Pur i
stsob j
e c
tt o using thet er
m network t o des
cribeap oint-to-poi
nt
conne c
t i
onb e
c ausetheyr eservethet ermf ort echnologi
est hatal
low as e tof
comp uterst oc om- munic
ate.Wewi l
lsee,howe ver
,t hatc l
assi
fyi
ngac onnecti
on
asane twor khe lp
sma in-tai
nc onsi
ste
ncy.Fornow,weonl yne edtonot et hata
point-to-pointne tworkdi ffersfrom ac onve nt
ionalne t
wor kinones igni
fica
nt
way:b ecauseonl yt woc omp uter
sa t-tach,noha rdwarea ddres
sesa r
ene eded.
Whe nwedi scussinterneta ddres
sb i
nding,t hel a
ckofha rdwa r
ea ddresse
swi ll
ma kep oi
nt -
t o-poi
ntne tworksa nexcep
tion.
Dialup p r
ov i
de sa ne xa mp l
e of a p oint-to- point network.Ea rlyI nterne t
accessus eddialupc onnec ti
onsi nwhi chadi alupmode misus edt op l
aceap hone
cal
lt oa nothermo de m.Onc et hep honec onnec ti
onwa si nplac
e ,thet womode ms
couldus ea udiot one stos endda t
a .From t hep ointofv ie
w ofTCP/ IP,dial
inga
tel
e phonec al
lise qui va
lentt or unningawi r e.Onc et hec al
lhasb eena nsweredb y
amode m ont heo th-ere nd,t he reisac onne cti
onf rom onee ndpointt oanothe r,
andt hec onnect i
ons taysi np la
cea sl onga sne e ded.Mode rns wi tchedop t ica
l
technol ogyp rovidesa not herf orm ofp oint-to- p
ointne twork.Ane twor kma na ger
canr eques tthata nop ticalp athb es etupt hr oug has eriesofop t i
ca lswi
t che s
.
From TCP/ I
Psp ointofv i
ew,t hep athisahi gh-ca paci
typ oi
nt-to-p oi
ntne twor k
analogoust oal ea s
e dcir c
uitoradi alupc onne ction.La tercha p
te rsdi s
cusst he
conce ptoft unne l
inga ndov erlayne tworks,whi c hp rovi
dea notherf orm ofp oi nt-
to-pointc onnections.

2.
10VLANTe
chnol
ogyAndBr
oadc
astDoma
ins

Wes ai
dt hatan Et hernetswitc
hf ormsas i
ngl
eLoc a
lAr e
aNe tworkb y
connect
ingas etofc omp uter
s.Amor eadvancedfor
m ofs wi
tch,k nowna sa
Virt
ualLocalAreaNet work( VLAN)switc
h,a ll
owsama nagertoc onfig
uret he
switc
ht ooperateli
kes ev e
ralsmal
lerswitches
.Wes ayt hatthema nage
rc an
createoneormor evirtualnet -
worksbys peci
fyi
ngwhichcomputersa ttac
ht o
whichVLAN.
Ama
nag
erc
anus
eVLANst
ose
par
atec
omp
ute
rsa
ccor
dingt
opol
i
cie
s.Fore
x
-
amp l
e,ac
omp
any c
an ha
veaVLAN f
ore
mpl
oye
esa
ndas
epa
rat
eVLAN f
or
v
isi
tors
.
Se
c.2.
10 VLANTe
chnol
ogyAndBr
oadc
astDoma
ins
29

Comput
ers on t
he empl
oyee VLAN c
anb
egi
ven mor
eac
ces
spr
ivi
l
eget
han
comp
utersonthevi
si
torVLAN.
Ak eytounde rst
andingVLANsa ndt hei
rinteract
ionwi t
hI nte
rnetp rotocol
s
i
n- v
olvesthewa yaVLAN s witchhandle
sb roadcas
ta ndmul ti
cas
t.Wes ayt hat
eachVLANde fi sab
ne roadcastdomain,whi chmeanst hatwhenac omp utersends
ab roa
d-castpacket,thep ac k
etisonlyde li
ver
e dtot hesetofc omputersint he
s
a meVLAN.Thes a
mede finiti
onholdsf ormul ti
cas
t.Tha tis,VLAN t e
chnology
emulatesasetofi ndepende ntphysi
calne t
works.Thec omputersinag ivenVLAN
s
ha rebroadca
sta ndmul tic
a stacces
sb ut,justa sins e
parat
ep hysi
calnetwor ks
,
broadc
astormul ti
castsentonag i
venVLANdoe snots prea
dt ootherVLANs .
How shoul
dI nt
e r
netp r
otoc
olsha
ndl
eVLANs ?Theans
werist hatInter
net
pr
oto-
cols do not di
sti
ngui
shb et
ween a VLAN a
nd a
ni nde
pendent phys
ica
l
net
work.Wec ansumma r
ize:

Fromthepoi
ntofviewofInternetprotoc
ols
,aVLANi
str
eat
ed
exac
t-l
yli
keasepar
atephysi
calnetwork.

2.
11Br
idgi
ng

Weus ethetemb
r ri
dgingtorefertotec
hnol
ogi
esthattranspor
tac opyofa
fra
me f rom one net
workt oanother,and t
he term bri
dge t ore
fe rtoa
mechani
smt hatimpl
e-mentsbri
dgi
ng .Themoti
vati
onf orbri
dgi
ngi stof or
ma
si
nglela
rgene t
workbyusingbri
dgestoconne
ctsmal
lernetworks
.
Ak e yideaist hatwhe ni tt r
ansf
e r
sac opyofaf r
ame ,ab ri
dgedoe snot
ma kea nyc hanges .I nstead,t hef r
amei sme rel
yr ep
li
cate
da ndt ra
nsmitte
dov er
the ot he r networ k.I np arti
cular
,a b ridge does not alt
e rthe source or
desti
na tiona ddressesi nt hef ra
me .Thus,c omputersont het wone t
work scan
communi catedirect l
y.Fur thermore,comp ut -er
sus eexactl
yt hesameha rdware
inter
f ace ,fra
mef orma t ,andMACa ddress
e swhe ncommunicatingoverabridgeas
whe nc ommuni cating l ocall
y t he comp ut ersarec ompletel
y unawaret hat
bridgi
ng ha so ccur red.To c apturethe c onc ept
,we s ayt hatthe bri
dg eis
transpar ent(i.
e.,inv isi
ble)toc omputersusingt henetwork.
Origi
nall
y,ne twor ke quipment v endorss ol
db ri
dgesa sse p
aratep hys i
cal
devi
ces.Wi ththea dve ntofmode r ns witchedne tworks,bridgeswe renol ong e
r
feas
ible
.De spi
tet hec hangei ntechnolog y,br i
dgi
ngi sstil
lusedinma nyne twork
syst
ems .Thedif f
e r-enc eist hatb ridgi
ngi snow e mb e
ddedi not herde v
ices
.For
example,ISPst hatp rovides erv
icet or esi
dencesa ndb usi
ne s
sesus eb r
idgi
ngi n
equip
me nts ucha sc ablemodemsand Di gitalSubscri
berLi ne (DSL)har dwa re.
Ethernetframest ra nsmittedov ert heEt herneta tar esi
dencea rebridgedtot he
ISP,andv i
cev ers
a .Comp utersatt hehous eus ethelocalEtherneta siftheI SPs
routerisc onnecteddi rect
ly;ar out e
ra ttheI SPc ommuni catesov erthel ocal
Ethernetasifthec ust omerscomp utersa relocal
.
From ourpoi
ntofview,t hemostimport
antpoi
ntt
o unde
rst
and a
bout
b
ridg
ingari
sesf
romther
esult
ingcommuni
cat
ionsys
tem:
30 Ov
erv
iewOfUnde
rlyi
ngNe
twor
kTe
chnol
ogi
es Cha
p.2

Becaus
ebri
dgi
nghidesthedet
ail
sofi
nterconnec
tion,as
etof
bri
dgedEt
hernet
sac t
slikeas
ingl
eEt
hernet.

Infac
t,bri
dgesdomorethanr epl
ica
tef r
amesf romonene t
wor ktoanothe
r:
abri
dgemakesinte
ll
ig
entdeci
si
onsa boutwhichframe stoforward.Forexampl
e,
i
faus erhasac ompute
ra ndprinte
ra tt hei
rr e
sidenc
e,t hebridgeinac abl
e
mode
m wil
lnotsendcopi
esofframest otheISPifthef ramesareg oi
ngfr
om the
us
er
scompute
rt otheuser
spri
nterorv i
ceversa
.
How doe
sab
ridg
eknow whe
the
rtof
orwa
rdf
rame
s? Br
idg
esa
rec
all
ed
adapt
ive or l
ear
ning br
idg
esb
eca
uset
hey us
epa
cke
ttr
aff
ict
ole
arn whi
ch
comp utersareone ac
hne t
wor k.Recal
lthataf ra
mec ont
ainsthea ddressoft he
sendera swe l
lasthea ddressofar ecei
ver.Wheni trecei
vesaf rame ,thebridge
recordst he48- bi
tsour cea ddres
s.On at ypic
alne twork,e a
chc omputer( or
dev i
ce)willsendatl e
a stoneb r
oadcastormul-t i
cas
tf rame,whi chme anst he
bridgewi l
llearnthec omp uter
sMAC a ddres
s.Onc eitlearnsthea ddres
sesof
comp uters
,ab ri
dgewillexa mineeachframeandc heckthelis
tb e
f oreforwarding
ac opy.Ifb oththesendera ndr ec
eive
ra reonthes amene twork,nof orwarding
isne ede
d.
The adva
ntagesof ada
ptiv
eb ri
dgi
ng shouldb e obvi
ous.Becaus
eit uses
a
ddres
sesfoundinnormaltraf
fic,abri
dgi
ngme c
hanis
mi sbothtransp
are
ntand
a
utomati
c hu- mansdonotne edtoconfi
gureit.Becauseitdoe
snotf orwa
rd
t
raff
icunneces
sari
l
y,abri
dgehe l
psi
mproveperformance.Tosummarize
:

AnadaptiveEt hernetbri
dgeconnect
st woEt hernet
s,f orwards
framesf rom onet otheother
,and us essourceaddr essesin
packetstol earn whichcomputer
sar e on which Ethernet.A
bridgeusesthel ocati
onofcomputerstoeli
mi nateunnec ess
ary
forwardi
ng.

2.
12Conge
sti
onAndPa
cke
tLos
s

Inp ract
ice,mostne twor
kingt ec
hnologywor kss owe l
lt hatitise asyto
assumec ompl
e t
er el
ia
bil
ity.Howe v
er,unlessapa c
ke tsystempre r
ese
r ve
sc a
paci
ty
beforee ach use,thes ystemi ssuscept
ibl
et oc ongesti
on and packetloss.To
under s
tandwhy,c on-si
derat rivi
alexample:anEt hernetswit
c hwithonlyt hr
ee
comp utersatta
ched.Sup posetwoc omputerssendda tat oat hir
da sFigure2.5
i
llust
r at
es.
Assume eac
h oft he connec
t i
onstothe s
wit
ch opera
tesat1Gb ps
,a nd
c
onsi
der wha t happ
ens ifc omputersA and B send dat
atoc omputerC
c
onti
nuously.Aa ndBwillf
or war
dda taa
tana g
grega
t er
ateof2Gbps.Because
t
hec onnecti
ontoC c anonlyha ndl
ehal
fthatrate
,t heli
nktoC wil
lbecome
c
ongested.
S
ec.2.
12 Cong
est
ionAndPa
cke
tLos
s 31

Comp
ute
rA S
wit
ch

Comp
ute
rC

Comp
ute
rB

Fi
gur
e2.
5AnEt
her
netwi
tha
rrowsi
ndi
cat
ingt
hef
lowoft
raf
fic
.

Tounde rstandwha thappenstot r


affi
c,reca
llthatEt hernetusesbest-ef
fort
del
iverys e
ma ntics
.Thes witc
hha snowa yt oinf
orm Aa ndBt hata nout p
utl i
nk
iscongested,a ndnowa yt os topincomi
ngt raffi
c.I nternal
l
y,as witc
hha sa
fi
nitea mounto fb uf
fers p
a c
e.Oncea l
lbuffersareus e
d,t heswitc
hmus tdis
card
addi
tionalframe sthatarri
ve.Thus,evenwi t
honlyt hreec omputer
sc onnecte
dt o
anEt hernet,itisposs
ibl
et hatpack-
etswillbedropped.
Att hi
spoi
nt,iti
sonlyimport
anttounder
standtha
tc ong
esti
onandlos
scan
i
ndeed occur i
np ac
ket networks
.A laterc hap
tere x
a mi
nes TCP a
nd the
mec
hanismsthatTCPuse
st oavoi
dcong
est
ion.

2.
13S
umma
ry

I
nternetp rotoc
olsaredes
ignedtoacc
ommodateawidevari
etyofunderl
ying
har
dwa retechnologi
es.Tounderst
andsomeofthedes
igndec
isi
ons,i
tisnec
essary
tobef a
mili
arwi ththeb a
sic
sofne twor
khardwar
e.
Packe
ts witchi
ngt echnologi
esareb roadl
ydi vide
dintoc onnec
tion-ori
ent
ed
andc onnecti
onle
sstyp e
s.Ap acketswitc
hingne tworkisfurtherclassi
fie
da sa
WideAr eaNe tworkorLoc alAr eaNe
t work,dependingonwhe thertheha rdwar
e
s
up p
or tscom-munica
tionov erlongdi
stancesorislimit
edtoshortdistanc
e s
.
Were v
ieweds e
v e
raltechnol
ogie
sus edint heInterne
t,inc
ludi
ngEther
ne t,
Wi-Fi
,Zig
Be e,andt heleas
eddi g
ita
lc i
rcui
tst hatcanbeusedforlong
-di
stance.
Wea ls
oc on-si
dere
dVLANsa ndb ri
dgedne two r
ks.Whil
et hedetai
l
sofs pe
c i
fi
c
ne
twor kt
e chnol
-ogi
esa r
enoti mport
ant,ag enerali
deahasemer
ged:

TheInternetprotoc
olsareextremelyflexi
bl
e;awidevar
ietyof
under-l
yinghardwaretec
hnologieshasbeenusedt
ot r
ansfer
Inter
nett raf
fic
.

Eachhardwaretechnol
ogyde f
inesana ddr
ess
ingschemeknowna sMACa d-
dress
e s
.Differ
encesaredr amati
c:Et he
rnetuses48-bitMAC address
es,whil
e
802.15.4net
wor k
scanus e16-b
itor64- bi
tMACa ddres
ses
.Bec
a us
et hegoali
sto
int
erconnec
ta rbi
trar
y ne t
workha rdware,theInter
netmusta ccommodateal
l
typesofMACa d-dres
ses.
32 Ov
erv
iewOfUnde
rlyi
ngNe
twor
kTe
chnol
ogi
es Cha
p.2

EXERCI
SES

2.
1 Ma
keal
i
stofne
twor
kte
chnol
ogi
esus
eda
tyourl
oca
tion.
2.
2 I
fEther
netf ramesar
ese
ntov eranOC-192le
ase
dc i
rcui
t,how l
ongdoe
sittak
et o
t
rans
mitt hebitsfr
om t
hel ar
gestpos
sibl
eEther
netf r
ame ?Thesmal
les
tpos
sib
le
f
rame?(Note:youmayex
cludetheCRCfromyourcal
culat
ions
.)
2.
3 St
udyEt her
netswit
cht e
chnol
ogy.Whati hes
st panni
ngtreealg
ori
thm,a
ndwhyi
sit
neede
d?
2.
4 ReadaboutIEEE802.1
Q.Wha tdoesVLANta
ggi
nga cc
omp
li
s h?
2.
5 Whati
sthemaxi
mum p
ack
ets
izet
hatc
anb
ese
ntov
ert
he4G wi
rel
essne
twor
ks
us
edbyce
llp
hone
s?
2.
6 I
fyours it
eus esEt
her
net,fi
ndthesizeofthel
arge
standsmal
l
es tswit
ches(i.
e.,
the numb e
r of por
tsto whic
hc omput
erscanatt
ach)
.How ma ny switc
hesa re
i
nterconnecte
d?
2.
7 Whati sthema x
imumamountofda
t at
hatcanbet
ransmi
tte
dinaWi -Fipa
cket?
2.
8 Whati sthema x
imumamountofda
t at
hatcanbet
ransmi
tte
dinaZigBeepacket
?
2.
9 Whatchara
cte
ris
ticofas
ate
ll
it
ecommuni
cat
ion c
hanne
lismos
tde
sir
abl
e? Le
ast
de
sir
-ab
le?

2.
10 Fi
ndalowe
rb oundont heti
meitta
kest
ot ra
nsf
eragig
abyt
eofda
taa
cros
sa
ne
twor
kthatopera
tesa
t:100Mbp
s,1
000Mbps
,and10Gb
ps.
2.
11 Dothepro
cess
or,di
sk,andinter
na lb
usonyourcompute
rop e
ratefas
te nought o
re
addat
af r
omaf i
leondis
ka ndsendita
cros
sane
t wor
ka t1
0g i
gabi
tspersecond?
2.
12 Awi rel
essr out
e rt hatus e
sWi -Fit ec
hnologytoc onne c
tl aptopcomputerstot he
Inte
rnetha sa nEt herne tc onnecti
ona ndwi rel
essc onnect
ionst omulti
p l
elapt
op s
.
Consi
derda taflowingf rom t helaptopstot heEthernet.Ift heEthernetconnec
tion
opera
t e
sa t1Gb p
s,how ma nyl a
p t
op smustb econnectedt ocausecongesti
onont he
Ethernet?(Hint
:wha tisthema xi
mumda tar a
teofas i
ngleWi -
Ficonnec
tion?)
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
Chapt
erCont
ent
s
3.
1 Introduction,35
3.
2 Appli
cation-LevelInterconnect
ion,35
3.
3 Ne t
wor k-LevelInterc
onne cti
on,37
3.
4 PropertiesOfTheI nt
e rnet,38
3.
5 InternetAr chit
ecture,39
3.
6 Interconne c
tionOfMul t i
pleNetwork
sWi
thI
PRout
ers
,
39
3.
7 TheUs ersView,41
3.
8 Al lNetwor ksAr eEqual,42
3.
9 TheUna ns weredQue s
tions,43
3.
10 Summa r
y,43
3

Int
ernetworki
ngConc ept
AndArchit
ecturalModel

3.
1Int
roduc
tion

Sof a
r,we ha vel ook eda tt he low- l
e v
elde ta
ilsof t ransmi ss
ion across
i
ndividualdat ane tworks,t hef oundati
ononwhi c
ha l
lc omputerc ommuni cati
oni s
buil
t.Thi sc hap t
erma kesag iantc onceptuallea pbyde scr
ibi
ngas chemet hat
all
owsust oc oll
ectt hedi versene t
wor kt echnologi
esi ntoac oordinatedwhol e.
The p ri
maryg oalisa s ys -
temt hathi dest he de ta
ilsofunde r
lying networ k
hardwa r
e,whi l
ep rovi
dinguni versalcommuni cati
ons ervices.Thep rima r
yr esultis
ahi gh-l
evela bstr
action thatp rovi
dest hef rame workf ora l
lde sign de c
isi
ons.
Succeedi
ngc ha ptersshowhowweus et hea bs
t rac
- ti
onde scri
bedhe ret ob uil
dt he
necessar
yl aye rsofint er
ne tcommuni cati
ons oftwa rea ndhow t hes oftwa rehides
the unde rl
yi ng p hysica
lt ransport me chanisms. La t e
rc ha
p terss how how
appli
cati
onsus ether esul
tingc ommuni cat
ions ystem.

3.
2Ap
pli
cat
ion-
Lev
elI
nte
rconne
cti
on

Whe nfacedwi thhe terogeneouss ystems,e arl


y de s
ignersre
liedon s pecia
l
appl
ica
- t
ion programs,c all
eda ppli
cati
on gat eways ,t o hide the unde rl
ying
dif
ferencesandp ro
- vi
det heap pearanceofuni formity.Fo rexample,oneoft he
earl
yincomp a
tibi
l
iti
esa rosefrom c omme rc
ialema i
lsystems.Ea c
hve ndordesigned
thei
rowne mails
ystem.Thev endorc hoseaf or
ma tf orstoringemail
,c onve
ntions
foridenti
fyi
ngar e
c i
pi
ent,a ndame thodf ortransferri
nga nemai
lme s s
agefrom
the sendert ot he r eci
pie
nt. Unf ortunate-l
y, the s ystems werec ompl
et e
ly
i
ncomp
ati
bl
e.

3
5
36 I
nte
rne
twor
kingConc
eptAndAr
chi
tec
tur
alMode
l Chap.3

Whenac onne
ction be
tweene mai
lsystems wa
s nee
ded, a
na ppl
ic
ati
on
g
atewa
ywa sused.Theg at
ewaysoftwa
rer unsonacomputert
hatconne
ctsto
b
othemai
lsys
-temsa sFi
gure3.
1il
lus
tra
tes.

Computerrunni
ngan
a
ppl
ica
tiongatewa
y

Use
r1s Use
r2s
c
omput
er c
omput
er
Ema
ils
yst
em1 Ema
ils
yst
em2

Fi
gur
e3.
1Il
lustr
ati
onofana
ppl
ic
ati
ongatewa
yuse
dtoa
ccommoda
tea
p
a i
rofhete
rog
ene
ousemai
lsys
tems.

The app
lic
a t
ion g at
e way mus t unders
tand the de t
ail
s of the ne
twork
connecti
onsandt heme ssagep rotoc
olsaswe llasthef ormatofe mai
lmessag
es
usedont hetwoe mailsystems.Whe nus e
r1s e
ndsa ne mai
lme ss
agetouser2,
user1semai
lisc onf
ig-uredt osendt heme s
sagetot heappli
cat
iongat
eway.The
appl
icat
iongatewa ymustt ra
nslatetheme ss
agea ndtheema i
laddres
stotheform
usedbye mai
lsystem2,a ndthenf orwardtheme ss
agetous er2.
Usi
ng a pp
li
cat
ion p rograms to hide networ k det
a i
l
s ma y se
e m quite
reasonabl
e.Becaus
ee v e
ryt hi
ng canb e handl
edb yana ppl
i
cation,no speci
al
hardwarei sneeded.Fur thermore
,t he origi
nale mai
ls yst
emson t he user
s
comp ut
ersremainunchang e
d.I nfact
,ne i
thert heusersnort hee mai
lsoftware
ont heusers
computerscant el
lthattheotherus e
rhasadi ffere
nte mai
lsyste
m.
Unf ortunatel
y,t hea ppli
cati
on g a
tewaya pproachi sb othc umb ers
omea nd
l
imited.Thep rimarydi sadvantagea ri
sesbecauseag ive
na p
p l
icat
iong atewa ycan
onlyha ndleones pecifica p
p l
icat
ion.Fore xamp le,eveni fane ma i
lgatewa yisin
plac
e,t heg ate
-wayc annotb eus edt otr a
ns ferf i
l
es,c onnectc hats es
sions,or
forwar dt ext messages.A s econd disadvantagea ri
ses whe n di ff
erenc e
si n
functionali
typ reventi nteroperati
on.Fore xamp l
e,i fe mailsystem 1p er mitsa
sendert oa ttac
haf i
let oame ssage,butema ilsys-te
m 2doe snot ,ana ppli
cati
on
gatewa y wi l
lnot b ea blet ot ransfer messagest hati n- c
lude f i
le
s.A t hi
rd
disa
dva ntagea ri
sesf rom t hef requencyofup gr
ades.Whe nevere i-
therv e
ndor
change stheiremailsoftwa re,theg atewaymus tbeup datedt oha ndl
et hec hange
.
Thus,a p p
li
cati
ong atewa ysmus tb eupdatedfr equentl
y.
Our examp l
e onlyc onsidersa na ppl
ica
tion gat e
wayt hatc onne ctst wo
syste
ms .Userswhoa reexper i
encedwi thne tworki
ngunde rst
andt ha tonc et he
si
ze g r
owss uf
fi-c
ient for a wor ld-wide communica t
ion system a nd mul ti
p l
e
vendorse a
chc reatet hei
ro wn a p
p l
icati
on software,i twi l
lb ei mp os
sibl
et o
ma i
ntai
n a s e
t of a ppl
ic
at i
on g ateways t ha
ti nterconnecta ll ne twork s
.
Furthermore,toa voi
db ui
ldi
nga p
pli
c a
tiong at
e wa
ysf ora l
lp oss
ibl
ec omb i
na t
ions,
thes ys
tem quickl
ye vol
vest ous eas tep-a
t-a-ti
mec ommuni -
cati
onp aradi
gmi n
whichame ssag
ei ss e
ntt ot hefirsta ppl
ic
ationgat ewaywhi cht ransla
t esand
s
endsi
ttot
hes
econd
,ands
oon.S
ucc
ess
fulc
ommuni
cat
ionr
equi
res
S
ec.3.
2 Ap
pli
cat
ion-
Lev
elI
nte
rconne
cti
on 37

cor
re ctoperat
ionofa llappli
cat
iong ate
waysalongthep at
h.Ifanyoft hemf ail
top e
r-form t he transl
ati
on c orr
ectl
y, t
he me ssa
ge willnot be de l
i
v ere
d .
Furthermore,thesourc eandde sti
nati
onmayr emainunabl
et odet
ectorc ontrol
the proble
m.Thus ,s ys-temst hatus eappl
ic
ation gat
ewayscannotg uar a
nte e
rel
i
ab l
ec ommunicat
ion.

3.
3Ne
twor
k-Le
velI
nte
rconne
cti
on

The a lt
e r
na ti
vet o us i
ng a ppl
i
c a
tion- l
evelg ate waysi sa s ystemb ased on
networ k-levelint erconne cti
on.Tha ti s,wec ande v i
seas ystemt hatt ransfers
packe t
sf rom t heiror iginalsourcet ot hei
rul ti
ma tede st
ina t
ionwi t
houtus i
ng
interme diatea pp l
ic
at i
onp ro-grams.S wi tc
hingp ack etsinsteadoff i
lesorl ar
g e
me ss
a ges ha ss e v
era la dvantages.Fi r
s t,t he sche me ma p s dir
ec tl
y ont ot he
unde rl
yingne twor kha rdwa re,ma ki
ngi te x-tr
eme lye ffic
ient.S econd,ne twork -
l
e velint erconne cti
on s eparatesda tac ommuni c
ation a cti
vitiesf rom a p
p l
icati
on
progr ams,p ermit ti
ngi nte r
me dia
tec omp uterstoha ndlene t
- workt raffi
cwi thout
unde rstandingt hea pp l
i
c ati
onst hata res endi
ngorr eceivi
ngme s -s
ages.Thi rd,
usingne twor k-
le v
elc ommuni cati
onk eep sthee ntir esystemf lex
ible,ma k-ingi t
possibl
et ob ui
ldg e
ne ralp urposecommuni cati
onf acili
tiestha tarenotl i
mit edt o
specifi
cus e s
.Four t
h,wewi llseethatt hes chemea llowsne tworkma nagerst oadd
orc hang ene twor kte chnologieswhil
ea pp l
icati
onp rog ra
msr e mainunc hanged.
Thek eyt odesi
gninguni vers
a lnetwork -
levelinterconnecti
onc anb efoundin
ana b str
actc ommunic ation system c onceptk nown a si nternetworki
ng. The
int
ernet c on-cep
t i s e xtre
me ly p owerful.I t de taches t he notions of
communi cation fr
om t he detail
sof ne tworkt echnologi
esa nd hideslow- l
evel
detai
lsf r
om us ersanda ppli
cati
ons.Mor ei mportant,i tdrivesa l
lsoft
wa r
ede si
gn
deci
sions and e xpl
ains how t o ha ndlep hysic
a la ddressesa nd routes. Afte
r
revi
ewi ngba si
cmot i
v a
t ionsfori nternetworking,wewi l
lconsiderthep roper
ties
ofani nterne tinmorede tai
l.
We b egi
n with two f
unda
ment
al ob
ser
vat
ions a
bout t
he de
sig
n of
c
ommuni
cat
ionsys
tems
:
Nos
ing
lene
twor
kha
rdwa
ret
echnol
ogyc
ans
ati
sfya
llc
ons
tra
int
s.
Us
ersd
esi
reuni
ver
sali
nte
rconne
cti
on.

The f i
rst obser
vation ise conomica s we l
la st ec hnical
.I nexpensi
ve LAN
technol
ogie
st hatp r
ov i
dehigh-spe
e dcommunicati
ononl yc overshortdista
nce s
;
widea re
ane tworkst hatsp
anl ongdi s
tancescannots upplylocalcommuni c
ati
on
cheapl
y.Iti spossi
bl
et oachievea nytwoofhi ghspeed,l ongdistanc
e ,andlow
cost,butnotp oss
ibl
et oachi
e veallthree
.The r
efore,b ecausenos ing
lene t
wor k
technol
ogys ati
sfi
esa llne
eds ,we a ref or
cedt oc ons i
dermul tip
le underl
ying
hardwaretechnol
ogies.
Thes
econdobse
rvat
ioni
sse
lf-ev
ident
.Ana rbi
tra
ryuse
rwouldl i
ketob e
a
bletocommunic
ate witha
na rb
itrar
ye ndp
oint
,e it
heranot
her us
er or a
computers yste
m.Gi vent he de
sir
ef or mob
il
ea c
ces
s,we ca
ns ayt hata n
arbi
trar
yus erwouldli
ket oen-ga
geincommunica
tionfroma
narbi
trar
ylocati
on.
Asac onse
que nce,wedesi
reac om-munic
ati
onsystemthati
snotcons
trai
nedb y
theboundarie
sofp hys
ica
lne t
works.
38 I
nte
rne
twor
kingConc
eptAndAr
chi
tec
tur
alMode
l Chap.3

Theg oalist ob uildauni fied,c ooperativ


ei nterconnecti
onofne tworksthat
sup-port
sa uni versalc ommuni cati
on s ervi
c e
.Ea c
hc omputerwi l
la tta
cht oa
spe
cific ne t-wor k,s ucha st hose de scri
bedi n Cha pter 2,a nd willuset he
tec
hnolog y-dep endentc om- municationf a
cil
iti
esoft heunde rl
yingne t
work.Ne w
sof
twa re,i nsertedb etwe e
nt het echnology-dependentc ommunicati
onme chani
sms
anda ppl
ica ti
onp r
ogra ms,wi l
lhidea l
llow- l
eveldetail
sa ndma kethec ol
lect
ionof
networksa ppeart ob eas ingl
e,l argene twor k.Sucha ni nt
erconnec
tionschemeis
cal
ledani nt ernetworkorani nt ernet.
Thei deao fbuil
di
nga ni nternetf ol
lowsas tandardpatternofs ystem des
ign:
res
earc hersi magi
ne a high- l
evelf acil
i
t yand wor kf r
om a vail
abl
e unde rl
ying
tec
hnol -ogi
e stor eali
ze the ima g
inedg oal
.I n mos tc ases
,r e
searcher
sb ui l
d
sof
twa r ethatp r
o-vi
dese ac
hoft hene e
dedme chanisms.Ther e
searchersconti
nue
unti
lt heyp roduce a work i
ng s yste
mt hatimp lementst he envi
sioneds ys
te m
eff
iciently.The ne xts e
ction showst he fi
rsts t
ep of the de s
ignp rocessb y
defi
ning t he goalmor ep r eci
sely.La ters ec
tions explai
nt he a pproac
h,a nd
suc
cess i
vec hapt
ersexplai
np rinci
plesandde ta
il
s.

3.
4Pr
ope
rti
esOfTheI
nte
rne
t

Thenot ionofuni ve rsalser vic


ei simp ortant,b uti ta lo
nedoe snotc a p
tur ea l
l
thei deasweha vei nmi ndf orauni fiedi nterne t.I nf act,t herec anb ema ny
i
mp leme nta-tionsofuni versals e r
v i
ces.Oneoft hef irstp ri
nc i
plesinourde sign
focusesone ncapsu-l
ation:wewa ntt ohi det heunde r l
yingi nterneta r
c hi
te c
t ure
from us ers
,a nd p e
rmi tc om- muni c
at i
on wi thout r e quir
ing k nowledge of t he
i
nt er
ne tss tructure.Tha ti s ,wedonotwa ntt or equireus er sora ppl
ication
progra ms t o und e
rstand t he de tai
ls of unde rl
ying ne t
wor k s or ha rdwa re
i
nt er
c onne c
tionst o uset he i nternet.We a lso do not wa nt t o ma n-datea
networ ki nterconnecti
ont opo l
og y.Inp art i
cular,a ddi
ngane wne tworkt ot hei n-
ternets houldnotme anc onne ct i
ngt oac entralizedswi tchingp oint,nors houldi t
me ana ddingdi rectphys i
calc onne cti
onsb e twee nt hene wne tworka nda llex i
sting
networ ks.Wewa ntt ob ea b l
et os endda taa crossi nterme di
a t
ene t
wor kse ven
thoug ht heya renotdi rec t
lyc onnectedt othes ourceorde sti
na ti
onc omp ute rs
.
We wa nta l
lc omp utersi nt he i nternett os ha re a uni vers
a ls e
tofma chine
i
de ntifi
ers( whichc anbet houg htofa sna mesoraddr es ses)
.
Ournot i
on ofauni fiedinter
neta ls
oi ncl
udest hei deaofne tworka nd
comp ut
eri n-dependenc
e.Tha tis
,wewa ntthesetofop erationsus edtoe st
a bli
sh
communi cati
on ort ot r
ansferdatat or emainindependentoft heunde rlying
networkt e c
hnologiesandt hedesti
nati
onc omputer.Aus ers houldnotne e dt o
know aboutne tworksorr emotecom-puterswheni nv
ok i
nga na ppl
ic
ation,a nda
programme rs houl
dnotha vet ounders
tandt henetworkinter connecti
ont opology
ort het ypeofar e
mot ecomputerwhe ncreati
nga ppl
i
c at
ionst ha
tc ommuni cate
overouri nternet.
S
ec.3.
5 I
nte
rne
tAr
chi
tec
tur
e 39

3.
5Int
erne
tAr
chi
tec
tur
e

Weha ves ee
nhow c omput ersc onnecttoi ndivi
dua lnet works.Theque s
tion
ari
ses:how a rene tworksinte r
c onnectedt oforma ni nterne twork?Thea ns
we r
hast wop a
rt s
.Phys i
cal
ly,t wone t workscannotb ep lugge dt oget
herdi rectl
y.
Inste
a d,theyc anonlybec onne ctedb yac omput ersystemt hathast heha r
dwa re
neededt oconne cttoe a
c hne t-wor k.Ap hysi
cala tta
chme ntdoe snotp r
ov i
det he
i
nterconnectionweha vei nmi nd,howe ver
,b ecauses uchac onnect
iondoe snot
guaranteet hatac omput erwi llc ooperat
ewi t h otherma chinest hatwi sht o
communi c
a t
e.Toha veav i
ablei nternet,wene e
ds pe- c
ialc omputerst hata re
wil
li
ng t ot ransferp ac
k et
sf rom one ne t
wo rkt oa nothe r.Com- puterst hat
i
nterconnectt wone t
wor ksa ndp assp a
cketsfr om onet ot heot hera rec al
led
i
nternetr outersorI Prouters.
Tounders
tandthei
nter
connec
tion,consi
dera
ne x
amp
lec
ons
ist
ingoft
wo
p
hys
ica
lne
tworksa
ndarout
era ss
howni nFig
ure3.
2.

Ne
t1 R Net2

Fi
gur
e3.
2Twop
hys
ica
lne
twor
ksi
nte
rconne
cte
dbya
nIPr
out
er,R.

I
nt hefig
ure,routerRconnectstobot
hne twork1andnetwork2.ForRt o
ac
ta sar outer
,i tmus tcapt
urep ack
etson network 1thata r
eb ound f
or
machi
nesonne twork2a ndt
ransf
ert he
m.S i
mil
ary,Rmus
l tcapturepacke
tson
net
wor k2t ha
ta redes
tinedf
orma chi
nesonnetwork1andtrans
fert he
m.
I
nt hefig
ur e
,cloudsa r
eus edtodenotephys
icalnetwor ksb e
causethee xact
hardwa r
ei sunimportant.Eachne t
workc a
nb eaLANoraWAN,a nde a
chma y
havema nycomputersa tt
achedoraf ewc omputersa tt
ac hed.Theus eofc louds
emp hasi
zesanimp or
ta ntdiff
erencebet
we enrout
ersa ndb ri
dges ab ri
dgec an
onlyc onnecttwo ne tworkst hatusethes a
met echnology,b utar outerc an
connecta r
bit
rarynet works.

3.
6Int
erc
onne
cti
onOfMul
ti
pleNe
twor
ksWi
thI
PRout
ers

Althoughitil
lust
ratesthebasi
cconnec
tionstrategy,Figure3.2ise xt
remel
y
s
impl
isti
c.Ar eal
is
ticinte
rnetwilli
ncl
udemul t
ipl
ene t
wor ksa ndrout
e rs
.I nsuc
h
aca
s e
,e achrouterneedstoknowa boutnetworksbeyondt henetworkst owhic
h
i
tc on-nects di
rect
ly.For e x
ample,consi
der Fig
ur e 3.3 whichs hows thre
e
ne
twor
ksi
nte
rcon-
nec
tedb
ytwor
out
ers
.

Theori
gi
nall
i
ter
atur
eus
edt
het
ermI
Pgat
eway.Howev
er,v
endor
sha
vea
dop
tedt
het
erm
IProut
er.
40 I
nte
rne
twor
kingConc
eptAndAr
chi
tec
tur
alMode
l Chap.3

Ne
t1 R1 Ne
t2 R2 Net3

Fi
gur
e3.
3Thr
eene
twor
ksi
nte
rco
nne
cte
dbyt
wor
out
ers
.

Intheexamp l
e,routerR1mus tt rans
ferfrom ne
twork1t one twork2a l
lpacke
ts
des
-ti
nedforc omp uter
sone i
therne t k2orne
wor twork3.S imil
arl
y,routerR2
musttra
nsf e
rp ac
ke t
sf rom network3t hataredes
tinedfore i
thernetwork2or
net
work1 .The i mpor-tant point i
st hatar outer must handlep a
cketsfor
net
workstowhi cht her outerdoesnota tta
ch.Inal argeinternetcomposedof
many ne
twor ks,ther outerst as
k ofma ki
ng de-c
isi
onsa boutwhe ret osend
pac
ketsbecomesmor ecomp l
ex.
Theideaofar oute
rs e
emssimpl
e,butitisimpor
t antbec
auseitprov
idesa
wayt oi nt
e r
connectne t
works
,notj us
tc omput
e r
s.I nf a
ct,weha v
ea lre
ady
di
scover
edt heprin-
c i
pl
eofinte
rconne
cti
onusedthroughoutanint
ernet
:

InaTCP/IPinter
net
,s pec
ialc
omputersystemscal
l
edI
Prout
ers
pro-
videi
nterc
onnec
tionsamongphysi
calnetwor
ks.

You mi ghtsus p
ectthatr outers,which musteachk now how t of orwa
rd
packet
st o-
wa rdt hei
rdesti
nation,a relarg
ema chi
neswithe noughp r
imaryor
sec
ondar yme moryt oholdinforma t
iona b
oute v
erycomput e
ri nt heinter
netto
whicht heya tta
ch.I nfact,rout e
rsus edwithTCP/IPinternetsc anbemode s
t
compute r
ss i
mila
rt oade s
k t
opPC.The ydono tneedesp
e c
iall
yl argedi
skstora
ge
nordot hey needahug ema in me mory.Thet ri
ckthata llowsr oute
rst obe
reas
onab l
es i
zeliesinthefol
lowingc onc
ept:

Router
sus et
hedes
tinati
onnet
wor k,nott
hedes
tinat
ion
computer
,whenfor
war di
ngapacket.

Bec
ausepacketforwardi
ngisb as
edonne t
work
s,theamountofinformat
iontha
t
aroute
rne e
dst okeepisproporti
ona
ltothenumberofnetwork
sintheinter
net,
notthenumb erofcomp ut
ers.Aswel e
arnedi
nCha p
ter1,therea
r etwoorders
ofmagnit
udef ewe
rne tworksintheInt
ernett
hancompute
r s
.
Becausethe yplayak eyrolei ninter
ne tcommuni ca
tion,wewi llreturnt o
routersinlaterchapter
stod i
scussthede t
a i
lsofhowt he
yop e
rateandhowt hey
l
e a
rna boutr e
- motedesti
nati
ons.Fornow,wewi l
la s
sumet ha
titisp os
sibl
ea nd
pract
icalforea chroutertohavec orr
e c
tr outesfora l
lne tworksinaninternet.
We wi l
la ls
oa ss
ume that onlyr out
e r
sp r
ovide connecti
onsb etweenp hysica
l
ne
twor
ksi
nani
nte
rne
t.
S
ec.3.
7 TheUs
er
sVi
ew 41

3.
7TheUs
er
sVi
ew

Recal
lthataninterne
ti sdesi
gnedtop rovi
deauni v
ers
alinter
connect
ion
amongc ompute
rsi
ndependentofthep a
rtic
ularnetworkstowhichtheya tta
ch.
Wewa ntaus ert
ov i
ewa nint
ernetasas i
ngl
e,v i
rtualnet
workt owhicha l
l
machinesconne
ctdesp
itet he
irphysi
calconnect
ions
.Fi g
ure3. 4il
l
ustrate
st he
i
dea.

I
nte
rne
t I
nte
rne
t

Physi
cal
Rout
er net

Hos
ts Hos
ts

(
a) (
b)

Fi
gur
e 3.
4( a)Theus er
sv i
ew ofaTCP/ I
Pi nt
erne
tin whic
he ach
c
ompute
ra ppearstoa t
tachtoas i
ngl
elar
genetwork,and
(
b)the str
ucture of phys
ica
lnet
worksand r
outersthat
p
rovi
deint
erconnec
tion.

Int hefigure,part(a)showst hev iewthatus ershave.Theythinkoft he


inter
ne tasauni fi
edcommuni c
ations ystem.Theus er
sviewsimpl
i
fiesthede tai
ls
and ma kesite a
syt oc onceptua l
ize communication.Pa r
t( b)ill
ustra
t e
st he
consti
tuentne tworksandt heiri nterconnec
tion withr outer
s.Ofc ourse,e a
ch
comput erthatconnec
tstoa ninte rnetmus truns oftwarethatenforce
st hev i
ew
ofas ingle
,physic
alnetwork.Thes oftwaremus thidede t
ail
sandall
owa ppli
cati
on
programst osenda ndrecei
vep ack etstoa rb
i-tra
r ylocati
onsasifthec omp ute
r
wa sconnecte
dt oas i
ngl
ene twork.
The advantage of provi
ding i
nterc
onne ct
ion att he networkl eve
lnow
becomesclea
r.Be caus
ea pp
lic
ationprogr
amst hatc ommunicat
eov ertheinternet
donotk now thede tai
l
sofunde rl
yingconne cti
ons,t
he yc a
nb erun without
changeona nyc omputer
.Be causethedetail
sofe a
chmac hi
ne
sp hysi
calnetwork
connect
ionsa rehiddenint hei nter
nets oftware,onl
yt heinternetsoftware
needstorea
ctwhennewphysi
calconne
c-tionsar eaddedorex
isti
ngconnec
tions
ar
er emov
ed.Forexa
mpl
e,aportabl
edevic
ec anc onnecttoaWi-Fine
tworkina n
ai
rport
,beturnedof
fforafl
ight
,a ndthenc on-
42 I
nte
rne
twor
kingConc
eptAndAr
chi
tec
tur
alMode
l Chap.3

nec
tedt oaWi -
Finetworki
na not
herairp
ortwi thouta ff
ectingt hea ppl
ica
tions
i
na nywa y.Mor
eimporta
nt,i
tisposs
ibl
etoc hanget heinter
na lstruc
t ur
eoft he
i
nterne
t( e.g
.,byaddi
ngane t
workorar oute
r )whi l
ea p
pli
ca ti
onp rogramsa re
ex
ecuti
ng.
As e conda dvantageofha v
ingc ommuni ca
t i
ona tt hene tworkl evelismor e
subtl
e :us ersdonotha vet ounde r
s t
a nd,reme mb e
r,ors peci
fyhow ne twor ks
conne c
t,wha tt raf-fi
ctheyc arry,orwha ta pp l
i
cationst heys uppor t
.I nf a c
t,
i
nt ernalne twor ksdo not k now a bout a p
pli
c ati
ons t hey mer elyt ransport
packets.Asar e s
ult,prog
r a
mme rswhodonotk nowa b outt heinte
r nets tr
uc ture
canc reatea pp
licat
ions,andt hei nterne tdoesnotne edt ob emodi f
iedwhe na
newa ppli
c a
tioni sc r
eated.Asar esult,ne t
wor kma na g
ersa ref reet oc hange
i
nt eri
orp artsoft heunde r
lyingi nterneta rchite
ctur ewi thouta nye f-f
e cton
appli
cations oftware.Ofc ourse ,ifac omp utermov est oane wt ypeofne t work,
thec omp uterwi llneedane w ne t worki nterfacec a
rda ndt hea s
soc i
ateddr i
ver
software ,b utt hati sme rel
ya n up gradeint hec ap abi
li
tie
soft hec omp uter
rathert hanac hangeduet ot hei nterne t.
Fi
gur e 3.4b i
ll
us t
ra tesa p oint a bout internett opology:r outersdo not
provi
dedi rec
tc onnecti
onsa monga llpai
rsofne twor ksina nint er
ne t
.Itma yb e
necess
aryf ort raff
ict ra v
eli
ngf r om onec omput ert oa nothert op assthrough
sever
alr outersa sthet r
afficc ros s
esi ntermediatene twor ks.Thus ,networks
parti
ci
patingina nint erneta rea na l
o-goust oas ys te
m ofr oads.Localnetworks
feedtrafficintolargerne twork s
,j ustaslocalroa dsconne cttohi ghways.Major
ISPsp r
ovidene twork st hatha ndlet ra
ns i
tt ra
f fi
c,j usta st heU. S.inter
state
syst
emf ormsab ackboneofhi ghwa ysthatha ndl
et r a
fficg oi
ngl ongdista
nces.

3.
8Al
lNe
twor
ksAr
eEqua
l

Cha p t
er2r eviewe de xa
mp l
esoft hene twor kha rdwa reusedt obuildTCP/IP
inter -ne ts
,a ndil
l
us tratedtheg rea tdiv
er s
ityoft echnologies
.Weha vede s
cri
bed
ani nter neta sac oll
ect i
ono fc ooperati
ve,i nterconnecte dnetworks.I tisnow
imp orta ntt ounde r-standaf unda mentalc oncept:f rom t heinternetp oi
ntof
view,a nyc ommunic a
t i
on sys-temc a
pableoft r
a nsferr
ingp a
cketsc ountsasa
singlene twork,i
nde pendento fitsde l
aya ndt hroug hputc hara
cteri
sti
cs,ma xi
mum
pa c
k ets i
ze,org eog r
a phi
cs cal
e.I np arti
cular,Fi gure3. 4bus esthes ames mal
l
clouds ha petodepicte a chphysi
c alnetworkb e
c auseTCP/ I
Pt reat
st heme qual
ly
de s
p it
et heirdi
ffer
e nces.Thep oi
nti s:

TheTCP/ IPinternetprotocol
st r
eatallnetworksequall
y.ALocal
AreaNet works uchasanEt hernet,aWi deAreaNetwor kusedas
abac kbone,awi r
eles
snet worksuchasaWi -Fihot s
pot,anda
point
- to-
pointl i
nkbet weentwoc omputerseachc ountasone
networ k.
Readersunaccus
tomedt oi nter
neta rc
hit
ect
ure mayf ind i
t di
ffi
cul
tt o
ac
cepts uchas impli
sti
cv i
ew of ne twork
s.I ness
ence, TCP/I
P defi
nesa n
ab
stra
ctionofnetworkthathide
st hedet
ail
sofphys
ica
lnetworks.Inprac
tic
e,
net
worka rc
hit
ect
smus tchoose
S
ec.3.
8 Al
lNe
twor
ksAr
eEqua
l 43

atechnologytha
ti sappropri
ateforeac
h use.Wewil
llea
rn,howev
er,tha
t
a
bst
ra c
tingawayfrom de
ta i
l
she l
psmak
et heTCP/
IPp
rot
ocol
sext
reme
lyfl
exi
bl
e
a
ndp owerful
.

3.
9TheUna
nswe
redQue
sti
ons

Ours k et
chofi nte rnetslea v
e sma nyuna ns were dque sti
ons.Fore xamp l
e,you
mightwonde ra boutt hee x ac
tf or m ofi nterne ta ddr es s
esa ss
ignedt oc omputers
orhow s ucha ddressesr elatet ot heha rdwa r ea ddr esses( e.
g .48-bitEt hernet
MACa ddr esses
)de scr
ibedi nCha p
t er2.Cha pter s5a nd6c o
nfrontt heque sti
onof
addressi
ng .Theyde scrib
et hef orma tofI Pa dd resses ,a ndill
ustratehows oftware
onac omp ut erma psbe t
we e ninte r
ne taddr e
s sesa ndp hys i
caladdresse
s.Youmi ght
als
owa ntt ok now exa ct-lywha tap acketloo k sli
k ewhe nitt ravel
st hrougha n
inte
rne t,orwha thapp enswhe np acketsa r
rivet oof astf orac omp ute
rorr outer
toha ndle.Cha pter7a nswe rst heseque s
tions .Fi na l
ly,you mi ghtwonde rhow
multi
plea ppl
icat
ionp rog ramse xecutingc onc ur re
nt lyonas ingl
ec omp uterc an
senda ndr eceivep ac
ke tst omul t i
plede sti
na tionswi thoutb ec
omi nge ntangl
edi n
eachot herstransmiss
ions ,orhowi nt ernetr out ersl ear naboutr outes.Alloft he
questi
onswi l
lbea nswe r
e d.
Althoughi tmayseemv ag
uenow,t hedirect
ionwea ref ol
lowingwillletus
l
e a
rna b outb oththestr
ucturea ndus eofinterne
tp rotocols oft
wa r
e.Wewi l
l
examinee ac
hp art,l
ooki
nga tt hec once
ptsandp rinci
pl
e sa swe llast ec
hnica
l
detai
ls.Web ega
nb ydescr
ibi
ngt hep hysi
calcommunicati
onl a
ye ronwhi cha n
inte
rneti sbuil
t.Eachoft hef ollowingchapt
e r
swi llexpl
or eonep artoft he
inte
rnets oftwareunti
lweunde r
st andhowa llt
hep i
ecesfitt ogether.

3.
10S
umma
ry

An inte
rne ti s moret hanac oll
ecti
on of ne tworksint erc
onnectedb y
computers.In-ternetworkingi mp l
ie
st hatt hei nte
rconnec
teds ystemsa gr
eet o
convent
ionst hata ll
ow ea ch hos ttoc ommuni cate wit
he ve
r y otherhos t
.I n
parti
cul
ar,ani nternetwillall
ow t wohos tcomput erstocommuni c
atee ve
ni fthe
communicati
on p athb et
we ent hemp assesa c
ros sane tworkt o which neit
her
connect
sdirectl
y.S uchcoop e
r ationisonl
yp ossi
b l
ewhe nhostcomp uter
sa gre
eon
as e
tofuni versa
lidenti
fiersa ndas etofp ro-ceduresformovi
ngda tatoitsfina
l
desti
nati
on.
Inani nte
rnet,interc
onnecti
onsa mong ne
tworksar
eformedbys p
ecia
l-
purpos
ec omputers yst
ems c a
ll
edI Pr oute
rst hatatt
achtot wo or more
networks
.Ar oute
rf or-wardspac
ketsbetweennetwor
ksbyre
cei
vi
ngthemf r
om
onenetworkandsendingthemt oanothe
r.
44 I
nte
rne
twor
kingConc
eptAndAr
chi
tec
tur
alMode
l Chap.3

EXERCI
SES

3.
1 Comme
rcia
lvendor
ssel
lwir
ele
ssr
oute
rsf orus
einahome.Reada
b outsuc
hr out
ers
.
Whatpr
ocess
orsareus
ed?Howmanybit
sp ers
econdmus
tsuc
har outerhandl
e?
3.
2 Ap
prox
imat
elyhow ma
nynetwor
kscons
tit
utet
hep
artoft
heI
nte
rne
tatyours
ite
?
Ap
prox
-ima
telyhowmanyr
outers
?
3.
3 Fi
ndoutaboutthelar
gestr
out
eruse
dinyourc
omp
anyoror
gani
zat
ion.How ma
ny
ne
t-wor
kconnec
t i
onsdoe
sther
out
erhav
e?
3.
4 Cons
idert
hei
nter
nalstruc
tureoftheexa
mp l
einte
rnetshowninFi
gur
e3.
4b.Whi
ch
rout
ersar
emostcri
ti
caltocor
rec
toper
ationoftheint
ernet?Why?
3.
5 Changingtheinf
ormationi narouterc a
nb etri
ckybec
auseiti
simp
oss
ibletochange
allrouter
ssimul
taneously.Inve
stig
atea l
gori
thmstha
tg uar
ant
eetoeitherins
talla
changeonas etofcomp utersorinst
alli
tonnone.
3.
6 Inaninterne
t,r outer
sp er
iodica
llyexc
ha ngeinformati
onfrom t
hei
rrout
ingtabl
es,
maki
ngitp os
sib
lef orane wr outertoapp e
ara ndb eg
inro
ut i
ngpac
ket
s.Inv
est
igat
e
theal
gor
ithmsus edtoe x
changer out
inginformation.
3.
7 Comparet
he orga
niza
tion of a TCP/
IPi
nte
rne
ttot
he XNS s
tyl
e of i
nte
rne
ts
des
igne
dbyXe
r oxCorp
orati
on.
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
Chapt
erCont
ent
s
4.
1 Introduction,47
4.
2 TheNe e
dForMul tip l
ePr otocol
s,47
4.
3 TheConc e
p tualLa ye rsOfPr otocolS
oftware,49
4.
4 Functionali
t yOfTheLa yers,49
4.
5 ISO7- Laye rRe ferenc eMode l,50
4.
6 X.25AndI t sRelationToTheI SOModel,51
4.
7 TheTCP/ I
P5- LayerRe ferenceModel,52
4.
8 LocusOfI nt el
l
igenc e,56
4.
9 ThePr otoc olLaye ringPr i
nc i
ple
,57
4.
10 TheLa yeringPr incip l
eAp pli
edToANe twork
,58
4.
11 LayeringI nMe s
hNe tworks,60
4.
12 TwoI mp ort antBounda riesInTheTCP/ IPModel,62
4.
13 Cross-LayerOp ti
mi zations,63
4.
14 TheBa sicIde aBe hindMul ti
plexi
ngAndDe mult
ipl
exi
ng,64
4.
15 Summa r
y,66
4

Pr
otoc
olLayer
ing

4.
1Int
roduc
tion

The p re v
ious c hap t
er r evi
ews t he a rchit
e c
tural f ounda t
ions of
i
nte
r networkinga nddescribestheinterconnect
ionofne t
wor k
swi thr outers.This
c
hapterc ons
iderst hestruc-tur
eoft hes oftwa
r efoundinhos tsandr out e
rst hat
c
arri
e soutne two rkcommuni ca
t i
on.I tp re
sentstheg enera
lp ri
ncipl
eofl a
yering,
s
howshow l ayeringma kesp rot
oc olsoftwareeasiertounde rst
a ndandb ui
ld,a nd
t
racest hep atht ha
tp ac k
etst aket hrought hep rotocolsoftwarewhe nt hey
t
raverse a TCP/ IPi nt
er net.S ucce
s s
ivec hap
t er
sf il
li n detail
sb ye xplai
ning
p
rotocol
sa te achlayer.

4.
2TheNe
edForMul
ti
plePr
otoc
ols

Wes aidt hatp rotocolsall


ow onet os pe ci
fyorunde rstandc ommuni cation
withoutk nowi ngt hede tail
sofap art
icula
rv endor
sne tworkha r
dwa re.The ya re
toc omp ute rc ommuni cati
onwha tp rogrammi ngl anguag esaret ocomp uta tion.The
analogyf i
tswe l
l.Likea s
se mbl
yl anguage,s omep r
otoc ol
sde scri
bec ommuni cation
acrossa p hysi-calne twork .Fore xample,t he deta i
lsoft he Et herne tf rame
forma t,t heme aningofhe aderfields,theor deri nwhi chb i
tsa ret ransmi ttedon
the wi re,a nd t he wa y CRC e rrorsa re ha ndledc onstit
ut eap rotoc olt hat
describ
e sc ommuni c a
tionona nEt hernet.Wewi llseet hattheI nternetPr otocolis
l
ike a hi ghe r-le
v ella nguag etha t dealswi tha bs
tra cti
ons,i ncl
uding I nternet
addresses,t hef orma tofI nter
netp ac
k ets
,a ndt hewa yrout e
rsf orwa rdp ac
ke ts
.
Neitherl ow- l
evelnorhi gh-leve
lp rotocolsares uffi
cientb yt hemselves;b ot hmus t
bep resent .
4
7
48 Pr
otoc
olLa
yer
ing Cha
p.4

Ne twor
kc ommunica
t i
on i
sa c omp l
exp rob
lem wit
h many a
spects
. To
unde
r s
tandt hecomple
xity,thi
nkofs omeoft hep r
obl
emstha
tcana r
isewhen
computersc
ommuni -
cateov e
radatane t
work:

Har
dwar
e Fai
l
ure. A c
omp
ute
r or r
out
er ma
yfa
ile
ithe
r
becauset heha rdwa ref ailsorb ecauset heop erati
ngs yste
m
cra
s hes.Ane t
-wor ktr ansmissi
onlinkma yf a i
lora cci
dental
ly
becomedi sconnect- e
d.Pr otocolsof
t warene edstode tec
ts uch
fai
luresa ndr e
cov erf r
omt hemifp ossi
bl
e.
Networ kConges tion.Ev e n whena l
lha rdwarea nd software
operatesc orrec
tly,ne t wor kshavef ini
tec ap
a ci
tyt hatcanb e
ex-ceeded.Pr otoc ols oft ware needst oa rrange a wa yt o
detectc ong es
-tion a nd s uppre
ssf urt
he rt raff
ict oa v
oid
mak i
ngt hes i
tuationwor se .

Pac
ketDel
ayOrPac
ketLos
s.Somet
ime
s,p
ack
etse
xpe
rie
ncee
x
-treme l
ylongde l
aysora rel ost
.Pr otocols oftwa reneedsto
l
e ar
na boutf ail
uresora daptt olongde lays.
Data Cor ruption. El
ect ri
ca l or ma gne t
ici nterfer
ence or
hardwa refa i
l
ur escanc auset ransmis si
one r rorst hatcorrup
t
the c ontents of t ra
ns mitted da ta ;i nte rferencec an be
especi
all
ys evere on wi rel
e s
s ne twor ks. Pr otocols oftwar
e
needst odet e
cta ndrecov e
rf roms uc he rrors.
DataDupl icati
on OrI nv erted Arrivals.Net wo rksthatof fe
r
multi-
p l
er outesma yde liv
erp ac
ketsoutofs equenceorma y
deli
ver du- pl
icatesof p ackets.Pr ot ocols oftwa re needsto
reorderp a
c ket
sa ndremov ea nydup licates.

Ta kent oge t
her,thep robl
emss eem overwhelming.Itisi mpossibl
et owritea
s
in- g
lep r
otoc ols p
eci
fi
c at
iont hatwi l
lha ndl
et hema l
l.From t hea nalogywi th
p
r ogram- mingl a
nguages,wec ans eehow t oc onquert hec omp l
e xi
ty.Pr og ram
t
ra nsla
t i
onha sb ee
np arti
tione
di ntofourc onceptualsubproblemsi dentifi
edwi th
t
hes oftwaret hathan-dle
se achsubprobl
e m:comp i
ler,ass
emb ler,li
nke dit
or,a nd
l
oa der.Thedi v i
si
on ma ke
si tp oss
ibl
ef ort hede sig
nert oc oncentrateon one
s
ub prob l
ema tat i
me,a ndf orthei m-pl
eme nt
ert ob uil
da ndt es
te a c
hp i
eceof
s
of twar einde p e
ndentl
y.We wi l
ls eet hatp ro-tocolsof t
wa rei sp arti
tioned
s
imi l
arly.
Two f i
nalob s
erv ationsf rom ourp rogrammi ng la
nguagea nal
ogy wi l
lhe l
p
c
lar
ifytheor ganization ofp rotocols.Fi rst
,i ts houldbec l
eart hatp iece
sof
t
ransl
ati
ons oftwaremus ta greeont hee xactf orma tofda tapassedb etween
t
hem.Fore xamp l
e,t heda tap assedf rom ac omp i
l
e rt oanassemble
rc onsis
tsofa
p
rogram defi
nedb yt hea ss
emb lyp rogr amminglang uage.Thet r
ansla
tionp roce
ss
i
nvol
vesmultipl
er epre se
nt a
tions.Thea nal
og yholdsf orcommunicati
ons oftware
b
ecause multi
pl
ep rot ocol
sde f i
ne t he r epres
ent ati
onsof da tap asseda mong
c
ommunicati
ons oftwa remodul es.Sec ond,t hefourp artsofthet ra
nslatorforma
l
i
nears equencei n whi ch out put f rom t he comp il
erb e-c
ome sinp ut tot he
a
sse
mbl
er,a
nds
oon.Pr
otoc
ols
oft
war
eal
sous
esal
i
nea
rse
que
nce
.
Se
c.4.
3 TheConc
ept
ualLa
yer
sOfPr
otoc
olS
oft
war
e
49

4.
3TheConc
ept
ualLa
yer
sOfPr
otoc
olS
oft
war
e

Wethinkoft hemodul esofp r


otocols
oftwar
eone achc omp
ute
ra sb
eing
s
tac
kedv ert
ical
lyi ol
nt ayers
,a s Fig
ure 4.1ill
ust
rat
es. Eachlaye
rtakes
r
esp
ons
ibi
l
ityf orha
nd-l
ingonep ar
toft heprob
lem.

S
ende
r Re
cei
ver

La
yern La
yern

... ...

La
yer2 La
yer2

La
yer1 La
yer1

Ne
twor
k

Fi
gur
e4.
1Thec
onc
ept
ualor
gani
zat
ionofp
rot
ocols
oft
war
einl
aye
rs.

Conceptual
ly,sendi ngame ssa
g efrom anappl
ic
ati
onononec omp ut
ert oa n
a
ppli
-cati
onona notherme anstransfe
rr i
ngtheme s
sagedownt hroughsuc c
essi
ve
l
ayersofp rotocols oftwareon t hesender
sma c
hine
,f orwa
r di
ngt heme ss
age
a
crossthene t
wor k,a ndt r
ansfe
rringtheme s
sag
eupt hroughsuccess
ivelayersof
p
rotocolsof
twa reont herece
iver
smachine.

4.
4Func
tiona
li
tyOfTheLa
yer
s

Onceade cisi
onha sb eenma det opar t
iti
ont hec ommunicati
onp robl
e ma nd
organ-i
zet heprotoc olsoftwareintolayersthateac hha ndleonesubproblem,t wo
int
errela
ted questionsa ri
se:how ma ny layerss houl db ec re
ated,a nd wha t
functi
onali
tyshouldr e-si
deine achlayer?Theque sti
onsa renoteasyt oa nswe r
fors ever
alr e
asons .Fi rs
t,g iven as etofg oal
sa nd c onst
rai
ntsg overning a
parti
cula
rc ommuni ca t
ionp robl
em,i tisp oss
ibl
et oc hoos ea norgani
za t
iont hat
wil
lop ti
mizeprotoc olsoftwa r
ef orthatp robl
em.S e
c ond,e ve
nwhe nc onsidering
generalnetwork-l
ev elservi
c e
ss uchasr e
li
a bl
et r
ans -
p ort,itispossi
bl
et oc hoose
fr
om amongfunda
menta
ll
ydis
tinc
tapproache
st osol
vi
ngt heprob
lem.Thi
rd,t
he
des
ignofnet
work(ori
nter
net
)a r
chi
tec
t ur
ea ndtheorga
nizat
ion
50 Pr
otoc
olLa
yer
ing Cha
p.4

oft heprotocolsoftwar
eareinter
rela
te d;onecannotbedesi
gne
dwi t
houtthe
other.Twoa pproac
he st
opr
otocolla
yeringdomina
t ethef
iel
d,andthenextt
wo
se
c t
ionscon-s
iderthem.

4.
5IS
O7-
Laye
rRe
fer
enc
eMode
l

Thef irs tlayeringmode lwa sb asedone arlywor kdoneb yt heI nternati


onal
Organ-izationf orS tandardizati
on( ISO),a ndi sk nowna sI SOsRe f
er enceModel
ofOpen Sys -t
em I nt erconnection.I ti sof tenr ef erredt oa st he I SO model.
Unfortuna tely,t he I SO mode lp redateswor k on t he Internet,a nd doe snot
descri
bet he I nterne tp rotocol
swe ll.I tc ontai
nsl ayersnotus edb y TCP/I
P
protocols
.Fur thermor e,inp laceofal ayerde vot-edt oi
nt ernet,t heI SOmode l
wa sde si
gne df or a s ingle networ ka nd ha sa netwo r
kl aye r.De spi
tei ts
shortc
omi ng s,thema rk
e t
inga nds al
esdi vis
ionsofc omme rcialven- dor sstil
lrefe
r
tot he I SO mode la nd introducef urtherc onf
us i
on b yc l
a i
ming t hati t has
somehow b een us edi nt hede sign oft he
iri nterne tp roducts.TheI SO model
contai
ns7c onceptua llayersorganizeda sFigur e4.2s hows.

La
yer Func
tiona
li
ty

7 Ap
pli
cat
ion

6 Pr
ese
nta
tion

5 S
ess
ion

4 Tr
ans
por
t

3 Ne
twor
k

2 Da
taLi
nk

1 Phys
ica
lHa
rdwa
re

Fi
gur
e4.
2TheI SO7-l
ayerr e
fer
e nc
emo de
l.Bec
a useitwasdesi
gnedto
de
scr
ibeprotoc
olsinas ing
lenetwork,t hemodeldoesnot
de
scr
ibetheorgani
zat
ionofTCP/IPprotocol
swell
.
S
ec.4.
6 X.
25AndI
tsRe
lat
ionToTheI
SOMode
l 51

4.
6X.
25AndI
tsRe
lat
ionToTheI
SOMode
l

Al
t houg
hi t wa s desi
gnedt op rovi
de a concep
tualmode land not a n
i
mp l
eme nta-t
iong uide,theI S
Ol ayeri
ngschemewa susedast hebas
isf ore a r
ly
prot
ocoli mpl
emen- t
a t
ions.Amongt heprot
ocol
scommonlya s
soci
ate
dwit ht heI SO
model,t hesuiteofp rot
ocol
sk nowna sX.25wa sprobab
lyt hemostrec ognized
andwi delyused.X.25wa sestabl
is
heda sarecommendati
onoft heInternational
Tel
ecommuni
cati
onsUnion
(I
TU),anor g
aniza
tiontha
tre
comme
ndss
tanda
rdsf
ori
nte
rna
tiona
lte
lep
hone
s
erv
ice
s.X.25wasadop
tedbypub
li
cda
tane t
wor
ks,andbec
amee
spe
cia
ll
ypop
ula
r
i
nEurope
.Consi
der
ingX.25wi
l
lhel
pexp
lai
nISOl
ayer
ing.
Int he X.25 view,a ne twor k op eratesmuc hl i
k eat elep
hone system.A
networkc onsi
stsofp ack
e ts
wi tchest hatc ontai
nt heintel
li
genceneededt oroute
packet
s.Com- putersdo not a ttac
h di rectl
yt oc ommunicati
on wiresof t he
network.I ns
tead,ea c
hc omput e
ra tta chest ooneoft hepacketswitc
hesus i
nga
seri
alcommuni cati
onl i
ne.Inones ense ,thec onnecti
onb etweenahos ta nda n
X.25p a
cke tswitchisami ni
aturene t- workc onsi
stingofones eri
alli
nk.Thehos t
mus tfoll
ow ac ompli
catedp roceduret ot ransf
erp a
cketsa c
rossthene twork.
Layersoft he protocolstandards p ecifyv ari
ousa s-pec
tsoft he networka s
foll
ows.

Phys
ical Layer
. X.
25 s
pec
ifi
es a s
tanda
rd f
or t
he p
hys
ica
l
i
nte
rconnect
ionbetweencompute
rsa ndne tworkpacketswitc
hes
.I n
t
he refer
ence model
,la r 1s
ye pe
cif
iest he phys
ica
li nt
erc
onnec
tion
i
ncl
udi
nge l
ectr
ica
lchara
c-t
eri
sti
csofv ol
tageandcurrent.
Dat
aLi
nkLayer
.Thel
a r2 p
ye ort
ionoft
heX.
25p
rot
ocols
pec
ifi
es
how da tat r avel
sb e
twe enac omp ut era ndt hep acketswitcht owhi ch
itconne cts.X. 25us esthet e
rmf r amet or efert oauni tofda taa si t
trans f
erst oap acketswit ch.Becaus et heunde rlyinghardwa rede l
i
v ers
onl
yas tream ofb its,thel ayer2p rotocolmus tde fi
net hef ormatof
frame sa nds p
ecif
yhow t het woma c
hine srecognizef r
ameb oundarie s
.
Beca uset ransmissi
one rror sc a
nde s
- t
r oyda ta,t helayer2 p rotocol
inc
lude se rrorde tec
tion(e .g.
,af r amec heck-sum)a swe l
la sat i
me out
mec hanismt hatcausesac omputert or e s
endaf rameunt ilithasb e en
trans f
err e
d s ucces
sfull
y. I t i si mp ortant t o unde r-stand t hat
succe s
sfult ransfera tlaye r2 me a nsaf rameha sb e
enp a s
sedt ot he
networ kp ac ketswitch;itdoe snotme a nthatt hepackets witchwa s
abl
et of orwa rdorde li
vert hep ac
k et.
Net
wor
kLayer
.TheI
SOr
efe
renc
emode
lsp
eci
fi
est
hatt
het
hir
dla
yer
con-tai
nsfunct
iona l
it
ythatcomple
testhedefi
nit
ionoft heintera ct
ion
between hosta nd network.Cal
ledthe network or communi c at
ion
subnetlayer,thelayerdefi
ne st
heb a
sicunitoft ransfe
ra crosst he
network,a nd incl
udesthe conce
ptso f de
sti
nation addres
sing a nd
forwardi
ng.Beca us
elayer2a ndla
yer3a reconcep
t ual
l
yi nde
pe ndent,
thes i
zeofal a yer3p ack
etc anbelargerthant hes i
zeofl a yer2
f
rames(i
.e.
,acompute
rc ancr
eateala r3p
ye ack
eta ndthe
nla
yer2
c
andivi
det hep
ack
e tint
os mal
l
erpie
cesf ort
ransf
ert othepac
ket
s
witc
h).

TheITUwa
sfor
mer
lyk
nowna
sthe
CCITT.
52 Pr
otoc
olLa
yer
ing Cha
p.4

Tr
ans
por
tLayer
.La
yer4p
rov
ide
send-
to-
endr
eli
abi
l
ityb
yha
vingt
he
des-t
ina
t i
on c
omput ercommunicatewiththes ourc
ec omput
e r
.The
ide
ai sthatevent houghlowerlayer
sofp rotoc
olsprovi
dereli
abi
li
ty
checksateac
ht r
ansf e
r,thetr
ansportla
yerprovi
desane x
tracheckto
ins
urethatnoma chineinthemiddl
efail
ed.
Ses
sionLayer
.Hi
ghe
rla
yer
soft
heI
SOmode
lde
scr
ibehow p
rot
ocol
soft
wa reca nbeor gani
zedtoha ndleallthef unc
tional
ityne ededb y
appl
ica
-tion programs.Whe nt he I
SO mode lwa sf or
me d,ne tworks
wereus edt oc onnec
tat erminal(i.
e.,as c
ree nandk eyboa r
d)t oa
remotec ompute r
.I nfact
,t hes e
rviceoffere
db ye ar
lyp ubli
cda ta
networksf ocus
e donp rov
idi
ngt erminala
c c
ess.Laye r5 ha ndl
est he
detai
ls
.
Pr
esent
ati
onLayer
.IS
Ola
yer6i
sint
ende
dtos
tanda
rdi
zet
hef
orma
t
ofda tat hata pp
lica
tionp rog r
amss endov e
rane twork.Oneoft he
disadv a
n-tages of s tandardizi
ng da taf orma t
si st hati ts t i
fl
es
innov ati
on ne wa ppl
i-c
ationsc annotbede pl
oyedunt i
lthe i
rda ta
forma tha sb e
ens t
andardized.Anot herdisadvantag
ea ris
esb ecause
specific g r
oupsc l
aim t he r i
g ht t o standardi
ze r e
presentati
ons
appr opri
atef ort hei
ra ppli
cat i
ondoma in(e.g.,theda t
af ormatsf or
digi
t alv i
deoa res p
ecifi
edb yg roup sthatha ndl
es ta
ndardsforv i
deo
rathe r t han g r
oup st hat s tandardi
ze ne tworks)
. Cons e
que ntl
y,
prese ntati
onstandardsa reusua l
lyig nor
ed.
Appl
i
cat
ionLayer
.IS
Ola
yer7i
ncl
ude
sap
pli
cat
ionp
rog
ramst
hatus
e
t
he net
work
. Ex
amp
lesi
ncl
ude e
lec
troni
c ma
ila
nd f
il
etr
ans
fer
p
rog
rams.

4.
7TheTCP/
IP5-
Laye
rRe
fer
enc
eMode
l

Thes econdma jorl ayer


ingmodeldidnota ri
sefrom afor malst a
ndardsb ody.
In-st
ead,t hemode la rosefrom res
earc
he rswhode s i
gnedt heI nterne
ta ndt he
TCP/IPp ro-tocolsuite.Whe ntheTCP/IPp rotocol
sbecamep opular,propone ntsof
theolderI SOmode lattemptedt ost
retc
ht heI SOmodeltoa ccommoda teTCP/ I
P.
Howe v
er ,thef actr e
ma insthattheori
ginalI S
Omode ldidnotp rovideani nt e
rnet
l
a ye
r,a ndins t
e a
dde -finedsessi
onandpr e
se ntati
onlayer
stha ta renotp er ti
nent
toTCP/ IPp rotocol
s.
One oft he ma jorc oncept
ualdi ffe
re nce
sb etweent he I SOa nd Internet
l
a ye
r i
ngmode lsarise
sf rom thewa yi nwhi chtheywe rede fi
ned.TheI SOmode l
wa sp rescrip-ti
ve s tandar
ds b odi
e sc onvened ac ommitt e
et hat wr ote
speci
fica
tionsf orhow p roto-c
olsshouldbeb ui
lt
.The ythens t
a rtedtoi mpl
eme nt
protocol
s.Thei mportantpointisthatt hemod elpredate
dt heimp lementati
on.By
contrast,t he Internet mode li s de s
crip-ti
ve r es
earcherss p e
nt ye ars
understanding how t o s t
ructure t he p r
otocol
s, b uildi
ng p rototype
i
mp l
e mentations,a nd documenting ther esult
s.Af terre s
earcherswe ref inal
ly
c
onv
inc
edtha
tt heyunde
rst
oodt
hede
sig
n,amode
lwa
scons
truc
ted.Thep
oint
c
anbesumma
rized:
S
ec.4.
7 TheTCP/
IP5-
Laye
rRe
fer
enc
eMode
l 53

Unli
ket heI
SOmodel,whi c
hwasdefi
nedbyc ommi t
teesbefore
proto-
colswer
ei mplement
ed,t
he Int
ernet 5-l
ayer refer
ence
modelwasf or
-mali
zed aft
erpr
otoc
olshad been desi
gned and
test
ed.

TCP/I
Pp r
ot o
colsa reor gani
zedi ntofi
vec once
ptuallayer
s f ourlaye
rs
de
finep a
cketproces
singa ndaf if
thlayerdefi
nesconventi
onalnet
workhardwar
e.
Fi
gure4. 3showst hec onceptualla
yer sandli
ststhef orm ofdatathatpass
es
be
twe eneachs
uc ce
s-siv
ep a
iroflayers
.

La
yer Func
tiona
li
ty

5 Ap
pli
cat
ion
Mess
age
sor
St
reams
4 Tr
ans
por
t
Tr
ans
por
tPr
otoc
ol
Pa
cke
ts
3 I
nte
rne
t
I
PPa
cke
ts
2 Ne
twor
kInt
erf
ace
Network-
Spe
cif
ic
Fr
ame s
1 Phys
ica
lHa
rdwa
re

Fi
gur
e4.
3The5- l
ayerTCP/
IPre
fer
e nc
emode
lshowi
ngt
hef
ormof
ob
jec
tsp a
ssedbe
twe
enlayers
.

Thef
ollowi
ngpara
graphsdes
cri
bethegenera
lpurpos
eofeac
hlaye
r.La
ter
c
hap
t e
rsfi
llinmanydeta
il
sa ndexa
minesp
ecif
icprot
ocol
sate
achla
yer.

Appl
i
cat
ion Layer
. At t
he hi
ghe
stl
aye
r, us
ersi
nvok
eap
pli
cat
ion
programst hata cce
ssservi
cesavai
la
b leacrossaTCP/ I
Pi nternet.An
appli
cati
on in-terac
tswi t
h oneoft het rans
por tlayerp r
otocolst o
se
ndorr ecei
veda ta.Eachappl
ic
ationp rogramc hoosesthes tyleof
transpor
t ne eded, whic
hc anb ee i
theras equence of individual
me s
sagesorac onti
nuousstre
am ofb ytes
.Thea ppli
cati
onp r
og ram
passesdataint herequi
redformtot het r
ansportlayerforde l
ivery.
Tr
ans
por
tLayer
.Thep
rima
rydut
yoft
het
rans
por
tla
yeri
stop
rov
ide
com-munica
tion from one a ppl
ication prog
ram t oanother.S uch
communicat
ioniscall
edend-to-end,bec aus
eitinvol
vesapp
lic
ati
onson
twoe ndpoi
ntsrath-erthani nterme di
ateroute
rs.At ra
nsportlayer
mayr egulateflow of inf
or -mation.I t maya ls
op r
ovide re
li
a b
le
t
rans
por
t,e
nsur
ingt
hatda
taa
rri
ves
54 Pr
otoc
olLa
yer
ing Cha
p.4

withouterrora ndinseque nce.Todos o,transportp rotocols


oftware
ar-range
st oha vether e c
eivi
ngs i
des endbacka cknowl e
dg ement
sa nd
the sendi
ng s i
de ret
ra nsmitl ostp a
ck e
ts.The t ransportsoftware
divi
dest he stream of da tab eing trans
mi tt
e di ntos mal
lp ie
ces
(someti
me sc al
l
e dpack- ets)and p as
se seachp acketa l
ong witha
desti
nati
ona ddres
stot hene xtl a
ye rf
ort ra
ns mi
s s
ion.
Asde scribedb elow,a g eneralp urpos ec omp uterc a
n ha ve mul t
ip l
e
appl
ica
- tionsac c
e ssinga ni nterneta to net ime .Thet ransportl a
ye r
musta cceptda taf rom se vera
la pplicationsa nds e
ndi tt ot hene xt
l
owe rla yer.Todos o,ita ddsa dditionali nfor mati
ont oe achp acket,
inc
ludi
ngv al
uest hati dentifywhi cha p p
licationp rogra
ms entt heda ta
andwhi cha p
plic
a tionont her e-cei
v inge nds houldreceivet heda ta.
Transportp rotoc ol
sa ls
ous eac heck -sum t op rot
ecta ga i
nste rrors
thatca useb i
tst oc ha nge.Ther e
ceivingma c
hineus esthec heck s
um t o
veri
fyt ha tt he p a cketa r
rivedi nt act,a nd us est he de sti
nation
inf
orma t i
ont oide nt i
fyt hea ppli
cationp rogr a
mt owhi chits houldb e
del
iver
e d.
I
nter
netLayer
.Thei
nte
rne
tla
yerha
ndl
esc
ommuni
cat
ionf
rom one
com- putert oa not her.Itac cep
tsar equestt osendap acketf r
om t he
transportla yera longwi tha nidentifi
c a
t i
onoft hec omp utert owhi ch
the p ackets houl db es ent.I nternets oftwa ree ncapsula
test he
transportp ack etina nI Pp acket,fil
lsint hehe a der,a nde it
hers e
nds
theI Pp acketdi rectlyt othede s-ti
nat i
on( i
ft hede s ti
nationisont he
l
oca lne twor k
)ors endsitt oar outert ob ef orwa rdeda crosst he
i
nte rnet( i
ft hede s
tinati
oni sr emote )
.I nt ernetl ayers oftwa r
ea lso
handlesi ncomi ng I Pp acke
t s,che c
king t he i
rv a li
di
t ya nd us i
ng t he
forwa rdi
nga l
gorithm t odecidewhe thert hep ack
e ts houldb eprocessed
l
oca l
ly or f or warded.For p ackets de st
ine dt ot he l ocalma chine,
softwa reint hei nternetlaye rchoosest het r
ansp ortp rotocolthatwi l
l
handlet hep acket.
Net
wor
kInt
erf
ace Layer
. The l
owe
st-
laye
r of TCP/
IPs
oft
war
e
comp ri
sesa ne tworki nterfac
el ayer,responsib
lef or ac
c e
pting IP
packetsa ndtransmit-ti
ngt hem overas pecifi
cne twork.Ane twork
i
nt erfa
cema yc onsi
stofade -vi
cedr i
ver(e.
g.,whe nt henetworki sa
l
oc a
la reane twor kto whi c
ht hec omputera ttaches)orac omp l
ex
subsystemt hati mpl
eme ntsada tal i
nk pro-tocol.Somene twor k
ing
professi
onal
sdonotdi st i
ngui
shb etweenthet wot ypes
;t heys i
mp l
y
uset heterm MACl ayerordat ali
nklayer.

Inpracti
ce,TCP/IPInte
rnetp rotocolsoftwa reismuc hmor ec omp l
ext han
thesim-pl
emo delofFig
ure4.3.Eachl ayerma kesde c
isionsaboutthec orrec
tness
oftheme s
-sageandchoos
esa nappropriat
ea ctionb as
e dont heme ss
a getypeor
des
tinat
iona d-dr
ess
.Fore xample
,t hei nternetl aye
ront herecei
vingma chine
mustdecidewhe t
hertheme s
sagehasinde edr e
a chedthec orrec
tde s
tinati
on.The
tra
nsportlayermustdeci
dewhicha p
p l
i
c ati
onp rog r
ams houldrecei
vetheme s
sage.
Ap r
imarydiff
erenceb etweenthesi
mpli
sti
cmode loflayersil
lus
trat
edin
Fi
gure4.
3a ndthep r
otocolsoft
wa r
einar e
alsystemari
sesbeca
useac ompute
r
orarout
e rcanha
vemul t
iplenetworki
nte
rface
sa ndmult
ipl
eprotoc
olscanocc
ur
atea
chlayer
.To
S
ec.4.
7 TheTCP/
IP5-
Laye
rRe
fer
enc
eMode
l 55

unde
rstands
omeoft
hecompl
exi
ty,consi
derFi
gure4.
4,whi
chs
howsa
compar
isonb
etwe
enl
aye
rsandsoft
wa r
emodules.

Conc
ept
ualLa
yer
s
S
oft
war
eOr
gani
zat
ion

5 Ap
pli
cat
ion a
pp1 app2 a
pp3 a
pp4 a
pp5 a
pp6

4 Tr
ans
por
t Pr
otoc
ol1 Pr
otoc
ol2 Pr
otoc
ol3

3 I
nte
rne
t I
Pmodul
e

2 Ne
twor
kInt
erf
ace I
nte
rfa
ce1 I
nte
rfa
ce2 I
nte
rfa
ce3

1 Phys
ica
lHa
rdwa
re Ne
twor
k1 Ne
twor
k2 Ne
twor
k3

(
b)
(
a)

Fi
gur
e4.
4Ac ompa
ris
onof( a)conc
eptualprotoc
ollaye
ringand(
b)a
morereali
sti
cv i
ew of protocolsoftware wit
h mul
ti
pl
e
net
workinter
-fa
cesandmulti
pleprot
ocols
.

Thec once
p t
ualdi
agraminFigure4.4(a)s howsfivelayersofp rotocolswi tha
si
n- gl
eb oxde pi
cti
nge ac
hlayer.Themor er e
ali
sti
cill
ustrationofs oftwa rei n
Fi
g ure4.4(b)showsthatthe
rema yindeedb eal ayerwithonep rotocol(La yer3).
Howe ver,therec anbe multi
plea p
pli
cati
onsa tLa yer 5,a nd mor et ha n one
appli
cati
onc anus eag i
ventranspor
tp rotocol.Wewi l
llearnt hatt heI nternet
protocol
s have multip
let r
ansportp ro-t
ocol sa t Layer 4, mul t
iplep hysica
l
networ k
sa tLayer1,andmulti
plenetworkinte rfa
cemodul e
sa tLa yer2.
Networ
king profes
sionaluset he terms hour gl
ass and narr
ow wai stto
des
cribether ol
eoft heI nter
netPr otoc
olint heTCP/ I
Ps ui
te.Figure4.4(
b)
makest heterminol
ogy ob vi
ous a l
thoughmul tip
leindependentprotocol
scan
exi
sta b
oveIPa ndmul ti
plenetwor
ksc ane xi
stbelow I
P,alloutgoi
ngori ncomi
ng
tr
afficmustp as
sthroughI P.
I
fac once
ptuallayeri
ngdi a
gr a
m doe snota ccuratelyrefle
ctt heor gani
za ti
on
ofs oftwaremodul es,whyi situs e
d?Al thoughal ayeringmode ldoesnotc aptur e
allde-tai
ls,itdoeshe l
pe xpl
ains omeg eneralconcepts.Fore xamp l
e,e vent hough
itdoe snotg i
vet he detai
lsa bouts pecifi
cp rotocols,Figure 4.4(a)he lpsus
unde r
standt hata nout -g
oingme s
s a
gewi lltraversethr e
ei ntermedia
t ep rotocol
l
a yersb e
for ebei
ngs entov erane twork.Fur t
her more,wec anus et hel a
ye ri
ng
mod elt oe xpl
aint hedifferenceb e
twee ne nd systems( userscomp uters)a nd
intermediatesyste
ms( routers)
.Fi gure4.5s howst helayeringusedi na nint e
rne t
witht hreene t
worksc onnecte
db yt wor outers.
56 Pr
otoc
olLa
yer
ing Chap.4

Comp
ute
rA Rout
er1 Rout
er2 Comp
ute
rB

S
ende
r Re
cei
ver

Tr
ans
por
t Tr
ans
por
t
I
nte
rne
t I
nte
rne
t I
nter
net I
nte
rne
t

Ne
tIf
ace
. Ne
tIf
ace
. Ne
tIf
ace
. Ne
tIf
ace
.

Ne
t1 Ne
t2 Ne
t3

Fi
gur
e 4.
5 Concep
tuall
ayer
sofp r
otoc
olsneede
di nc omputersand
route
rst ot r
ans
fer a mess
agef r
om a na ppl
i
c a
tion on
computerAtoanap-
pli
cat
iononcomputerB.

Int hef i
gur e,as endinga ppli
cationonc omp uterAus esat ransportprotocol
tose ndda tat oar ece
iv i
nga ppli
cationonc omp uterB.Theme ssagep ass
esdown
thep rotocolstackonc omp uterA,a ndi st r
a nsmittedacrossnetwor k1t oRout er
1.Whe nitr eachest hef ir
s trouter,t hep ac k
e tpassesupt ot hei nter
netlaye r
(La
ye r3) ,whichf orwar dst hep a
c k
etov e rne twork2t oRouter2.OnRout er2,
theme ssagep ass
e supt oLa yer 3,a ndi sf orwardedo verne twork3t ot he
des
tina ti
on.Whe nitr eachest hef i
na ldes ti
na t
ionma chine,theme ssagepasse
sup
tot het ransportl a
ye r
,whi chde li
ver st heme ssag
et ot her e
ce i
vinga ppl
i
cation.
Laterc hapter
se xplai
nhowI Pha ndlesf or warding,ands howwhyat ransi
tp a
c ket
doesnotus ethet ransportp rotocolonar out e
r .

4.
8Loc
usOfI
nte
ll
ige
nce

TheI nter
netr epr
esentsas i
gnif
ica
ntde pa
rtur efrom e a
rli
erne tworkde s
igns
be-c
a usemuc hoft heintell
igenceisp l
acedoutsideoft hene tworki nt heend
sys
tems( e.g.
,us er
scomp uters).Theor i
gi
nalvoicet e
lephonene tworki l
l
us t
rates
thedi f
ference.Inthea nalogt ele
phonene t
wor k
,a llthei ntel
l
igencewa slocated
i
n p hone s witc
hes;t ele
- phones onlyc ontai
nedp ass
ivee l
ectronic
s( i.e.
,a
micr
op hone,earpi
ece,andame cha-nis
mus edtodia l
).
By contr
ast ,the TCP/I
Pp rotocol
sr equirea tta
c hedc omputerst orun
tr
ansportpro-tocol
sa ndap
pli
cat
ionsa swe l
lasLa yer3a ndLaye r2p r
otocol
s.We
havealr
eadyme nti
onedthattra
nsp ortprotocol
si mpl
eme ntend-to-e
ndr el
ia
bil
i
ty
byr etr
ansmitti
ng l os
tp a
ckets
.We wi l
ll e
a r
nt hatt rans
por tprotoc
olsa r
e
c
ompl
ex,andthatacomput
erat-
tac
hedt
otheI
nte
rne
tmus
tal
sop
art
ici
pat
ein
f
orwa
rdingbe
causet
hecomput
ermust
S
ec.4.
8 Loc
usOfI
nte
ll
ig
enc
e 57

c
hoosearout
ert ousewhe nse ndi
ngp acke
ts.Thus,unl
iketheanal
ogt e
lep
hone
s
yste
m,aTCP/ I
Pi nte
rnetc a
nb ev i
eweda sar el
ati
vel
ys i
mplepacke
tde l
ive
ry
s
yste
mt owhi
chintel
l
igenthostsa t
tach.Theconce
ptisfunda
me nt
al:

TCP/IP prot
ocols pl
ace much of the i
ntel
l
igenc
ei n hos
ts
router
si ntheI nternetforwardInter
netpackets
,butdonot
part
ici
pateinhigher-
layerser
vic
es.

4.
9ThePr
otoc
olLa
yer
ingPr
inc
ipl
e

Indepe
nde
ntoft hep a
rti
cula
rl ayeri
ngsc he
meort hefuncti
onsofthela
yers,
t
heoper
ati
onoflayere
dp rot
ocol
si sb a
sedonaf unda
me nt
a li
dea.Thei
dea,cal
l
ed
hel
t ayeri
ngpri
nci
ple,canbestateds ucc
inc
tly:

Layeredprotoc
olsar
edesi
gnedsothatl
ayernatthedes
tinat
ion
re-cei
vesexact
lythesameobj
ects
entbylayernatthesourc
e.

Al
thoughi
tma ys eem obvi
ousoreventri
via
l,thel
ayer
ingp
rinc
ipl
eprov
ides
a
ni mporta
nt foundat
ion t ha
t hel
ps us de
sig
n, imp
leme
nt,and unde
rstand
p
rot
ocols
.Spec
ifi
cal
ly,thelayeri
ngpr
inc
ipl
eoffers
:
Pr
otocoldes
igni
ndepe
ndence
Def
ini
tionoftheend-
to-
e ndpr
ope
rty

Pr otocolDes i
gnI ndependenc e.Bypl acingag uaranteeont heitemsp assi
ng
betwe ene ac hpa i
rofl aye rs,thel ayeri
ngp rincipl
ea ll
owsp rotocoldesigner
st o
wor kon onel ayera tat i
me .A p rotoc olde s
ignerc anf ocuson t heme s
sage
exchang ef orag ive
nl a ye rwi t
ht heas sura ncet hatl owerlayer swil
lnota l
ter
messag es.Fore xamp l
e,whe nc r
ea ti
ngaf il
et ransf e
ra ppl
icati
on,ade s
igneronly
needst oima g
inet wo c opiesoft hef ilet ransfera ppli
cati
on r unni
ng on t wo
comput ers.The i nterac tion betwe ent he t wo c op i
esc anb ep l
anned without
thi
nk inga boutot herp rot ocol
sb ecauset hede signerc a
na ssumee achme ssag
ewi ll
bede live
rede x
actlyasi twa ssent .Thei de at hatt hene t-
wor kshouldnotc hange
messag essee mss oobvioust oa ppli
cati
onp rog ramme rst hatmostoft hemc annot
i
ma gineb uildi
ngne tworka p
p l
i
cationswithouti t.
For t
unately,t he layeri
ng p ri
nci
pl
e wor ksf or the de sign of l owerl a
ye r
pr
otoc olsaswe l
l
.Ate achlayer ,ade si
gne rcande pendont hel ayeringprinc
iple
bei
nge nforc
edb ylowe rl a
ye r
s;a llade s
ignerhast odoi sg ua rante ethelayeri
ng
pr
inciplet othene xthi gherlaye r.Fore xample,whe nap rot ocolde si
gnerwor ks
onane wt ransportp rotocol
,t hede s
ignerc ana s
sumet het rans portprotocol
moduleont hede stinat
ionma chinewillreceiv
ewha t ev
erme s s
ag ei ssentb ythe
tr
ans p
or tp rotocolmodul e on t he se
nding ma c
hine.The k eyi deai sthata
tr
ans p
or tp r
otocolca nbede si
gne dindependentofot herprot ocols.
58 Pr
otoc
olLa
yer
ing Cha
p.4

Def i
ni t
ionOfTheEnd- To- EndPr oper ty.Informall
y,wec las
sif
yane twork
tech-nolog ya se nd-to-end ift het echnologyp r
ovidescommuni cati
onf rom the
origi
nals our cetot heul timat ede s t
ina t
ion.Thei nformaldefinit
ionisuse dwith
protocolsa swe ll.Thel ayeringp rincipl
ea llowsust ob emor ep reci
se:wes a
ya
protocoli se nd-to-endi fa ndonl yi ft hel ayeri
ngp ri
ncipl
ea ppl
iesb e
twe e
nt he
origi
nals ourcea ndul ti
ma ted estination.Ot herprotocol
sa r
ec l
assi
fiedasma chi
ne-
to-mac hi
nebec a
us ethel ayeringp r
incipleonl yapp
lie
sa cr
ossonene tworkhop .The
nexts ectione xpl
ainshowt hel aye r-i
ngp ri
nc i
pl
eappli
estoI nte
r netprotoc
ols.

4.
10TheLa
yer
ingPr
inc
ipl
eAp
pli
edToANe
twor
k

Tounderst
andhow t
helaye
ringpr
inci
pl
eappl
iesinpracti
ce,c ons
idertwo
c
omput-
ersconnec
tedtoanet
work.Fi
gure4.6i
ll
ustr
a t
esthelayersofp rot
ocol
s
oft
warerun-ni
nginea
chcomput
erandthemess
agesthatp
a s
sbe t
we enlayer
s.

Comp
ute
r1 Comp
ute
r2

Ap
pli
cat
ion Ap
pli
cat
ion

i
denti
cal
mess
age
Tr
ans
por
t Tr
ans
por
t

i
denti
cal
packet
I
nte
rne
t I
nte
rne
t

ident
ical
I
Ppac ket
Net
wor k Net
wor k
I
nterf
ace i
dent
ical I
nterf
ace
f
rame

Phys
ica
lNe
twor
k

Fi
gur
e4.
6Thel a
ye ri
ngpr
inci
pl
ewhenamessa
gepas
sesac
ros
sa
net
wor kfromanappl
ic
ati
onononecomp
utertoan
ap
pli
cationonanot
her.
S
ec.4.
10 TheLa
yer
ingPr
inc
ipl
eAp
pli
edToANe
twor
k 59

4.
10.
1La
yer
ingI
nATCP/
IPI
nte
rne
tEnv
ironme
nt

Ourill
ustr
ationofthel ayer
ingpri
ncip
leisinc ompl
e t
eb ec
auset hedia
grami n
Fi
g-ure 4.6 onlys hows layeri
ng for two comp ut
ersc onnecte
dt oas ingl
e
network.How doest helayeri
ngp r
inci
pleappl
yt oa ninternett hatcant ra
ns f
er
messagesacros
smul t
i-pl
ene tworks
?Fi g
ure4. 7a nswerst heque st
ionb yshowing
ane xamplewhe r
eame s-sa
g efrom ana ppl
i
cationp rogram ononec omputeris
se
ntt oa nappl
icat
ionprogramona nothercomput erthroug har outer.

Comp
ute
r1 Comp
ute
r2

i
denti
cal
Ap
pli
cat
ion Appl
ic
ati
on
mess
age

i
denti
cal
Tr
ans
por
t Tr
ans
por
t
packet

Rout
erR

I
nte
rne
t I
nte
rne
t I
nter
net
ident
ical ident
ical
I
Ppac ket I
Ppac ket

Net
wor k Net
wor k Net
wor k
I
nterf
ace i
dent
ical I
nterf
ace i
dent
ical I
nterf
ace
f
rame f
rame

Phys
ica
lNe
twor
k1 Phys
ica
lNe
twor
k2

Fi
gur
e4.
7Thelaye
r ingpri
ncipl
ewhenames
sagepas
sesfro
ma na
ppl
ic
ati
on
ononecomp ut
er,throughar
out
er,andisde
li
vere
dtoanapp
li
ca
-
ti
onona nothe
rc ompute
r.

Asthef i
g ureshows ,me s s
agede li
veryusestwos eparatenetwor kframes,one
fort het ransmissi
onf r
om c omp uter1t orouterRa nda nothe
rf rom routerRt o
comp uter2.Thene t
wor kl ayeri
ngp rinc
ipl
estatest hatt heframede li
veredt oR
isidentic
alt ot hefr ames entb yc omputer1,andt hef r
amede li
veredt ocomp uter
2i si denti
c a
lt ot hef rames entb yr outerR.Howe ve r,thet wof ra
me swi l
l
de f
inite
lydi ffer.Byc ontras t
,f ort hea p
pli
cati
ona ndt rans
portp rotocol
s,t he
l
a yeringprincipleap p
liesend- to-end.Thatis,theme ss
ag edel
iver
e donc omp uter
2i se xa
ctlyt hes a
meme s
saget hatt hepeerpro-tocolsentonc omp uter1.
60 Pr
otoc
olLa
yer
ing Cha
p.4

Iti se asyt ounde rst


a ndt hatf orhi g
he rl aye r
s,t hel aye ringp ri
nc ipl
ea p
p li
es
end- to-end,a ndt ha ta tt hel owe stla ye r,ita ppliestoas ing lema c
hinet ransfer.
Iti snota se asyt os eehowt hel ayer ingp r
inc ipl
ea p pl
i
e stot hei nterne tlaye r.On
theoneha nd,t heg oaloft heI nte r netde signi st op res ental ar ge,v irtual
net wor k,wi tht hei nternetl ayers e nding p acketsa crosst hev irtua linter net
ana l
og oust ot hewa yne t wor kha rdwa res e ndsf ramesa c
r os sas i
ng l
ene twor k.
Thus ,i ts e
emsl ogicalt oi
ma ginea nI Pp acke tb eings entf rom t heor iginalsour ce
allt hewa yt ot heul ti
ma tede s
tinat ion,a ndt oi mag -i
net hel ayeringp rinc i
p l
e
gua rantee i
ngt hatt heul tima tede stina ti
onr e
c eiv
e se xactlyt heI Pp ackett hat
theor i
ginals ourc es ent.Ont heot he rha nd,wewi l
ll ear nt ha
ta nI Pp a
c ket
cont ainsf i
eldss ucha sat imet ol i
v ec ount e rt hatmus tb ec ha nge
de acht imet he
pack etp a s
sest hr oug har out er.Thus ,t heul ti
ma tede s
t i
na t i
onwi l
lnotr eceive
exac tlythes a
meI Pp acke
ta st hes our ces ent.Wec oncludet ha talthoug hmos tof
theI Pp ackets t
a ysi nta
c ta si tp as se sac rossaTCP/ IPi nt ernet,t hel aye ring
princ i
pleonl ya ppliest opac ketsa crosss ingl
ema chinet ransfe rs.The ref ore,Figur e
4.7s howst hei nterne tlayerp rovidingama chi
ne -to-ma chines ervic
er athert ha n
ane nd-to- e
nds ervice.

4.
11La
yer
ingI
nMe
shNe
twor
ks

The ha rdwa ret echnolog i


esus e
di n mos tne twor ksg uarante et hate very
attache d c omp uter c an r each other c omp ut ers dire c
t l
y. Howe ver,s ome
technolog i
es do not g ua rantee directc onne cti
ons .For e xamp l
e ,t he ZigBe e
wire l
esst echnologyde scr i
bedi nCha pter2 us esl ow- p
owe rwi re l
essr adiost hat
havel imitedr ange.Cons eque ntl
y,ifZigBees ystemsa rede ployedi nv ari
ousr ooms
ofar e s
idence,i nterf
er encef rom me t
alst ructure sma yme ant hatag ivenr adio
ma yb ea blet or eachsome ,b utnota l
lotherr a-dios.Simila
r l
y,al a rgeIS Pmi ght
choos etol easeas e
tofp oint-to-poi
ntdigita lci
rc uitstoint erc
onne c tma nys i
tes.
Althoug he achZi gBeera dioc anonlyr eac
has ubse toft henode sa nde achdi git
al
cir
c uitonlyc onne ctstwop oints,wet al
ka boutaZi gBee net-wor ka nds ayt hat
anI SP ha sa networ k.To di sti
nguis
hs ucht echnol
og i
e sfr om c onve nt
ional
networ king t echnologi
es,we us et he term me sh networ kt oc haracteri
ze a
communi cati
ons ystemc ons tructedfromma nyi ndividualli
nk s.
How doesame s
hne tworkf i
ti ntoourlayeri
ngmode l
?Thea ns
we rdepends
onhow p acke
tsa ref or
wardeda crosstheli
nks.Ont heoneha nd,ifforwarding
occursatLayer2,t hee ntir
eme s
hc anbemo dele
da sas i
ngl
ep hysi
calnet
wor k.
Weus etheterm mesh-undertode s
cri
besuchas i
t uati
on.Ont heot he
rhand,i f
IPha ndl
esforwardi
ng ,theme s
hmus tbemode l
eda sindi
vidua
lne tworks
.Weus e
thete rmIProute-over,ofte
ns hortenedtoroute-over,todescri
besuchcases
.
Rout e-over
.Mos tISPnetworksuseroute-ov
e r.TheISPus e
sl ea
seddigi
t a
l
c
ir-
cuitst ointerconnectroute
rs,andanindi
vidualroute
rviewst heeachcir
cuit
a
sas inglene t
wor k.IP handl
esa l
lforwar
ding,a ndther out
erus esstandard
I
nternetr outi
ng p rot
o-col
s( des
cri
bedinl aterc hapt
ers
)t oc ons
truc
tt he
f
orwa r
dingt abl
es.
Mesh-
under
.TheIEEE802.1
5.4tec
hnol
ogyusedinZig
Beenetworksc
anbe
c
on-
figure
dtoa cta
sindi
vi
dua
lli
nksorasacompl
etenet
wor k
.Tha
ti s
,theyc
an
orga
nizet
hems
elv
esi
ntoas
ing
leme
shne
twor
kbya
gre
eingt
odi
scov
erne
ighb
ors
andforma

AsCha
pte
r9e x
pla
ins
,itispos
sib
let
ouseananonymousl
i
nkmec
ha ni
smt
hatdoe
snota
ssi
gna
n
I
Ppr
efi
xtoeac
hli
nk;usi
ngunnumberedl
i
nksdoe
snotc ha
nget
hel
aye
ring.
S
ec.4.
11 La
yer
ingI
nMe
shNe
two
rks 61

La yer2me s
h- underne t
wor kthatf orwardspa c
ke t
swi t
houtus ingI P,ort hey
canf ormindi
v idualli
nksa nda l
l
ow I Pt ohandlef orwardi
ng .Int e
rmsofour
l
a yeringmodel
,t heonl
yc hangetheme sh-unde
ra pproachint
r oduc
e sisas of
tware
mod uleaddedt ot henet-workinter
fa c
et ocontrolforwardi
ngoni ndiv
iduall
ink
s.
We s aythatt he news oftwarecont r
olsintra-networkf orwarding.The new
sof t
wa reiss ome ti
mesr eferre
dt oa sa ni n-tranet s
ublayer as Figure 4.8
i
llustrate
s.

Conc
ept
ualLa
yer
s
S
oft
war
eOr
gani
zat
ion

Ap
pli
cat
ion
a
pp1 a
pp2 a
pp3 a
pp4 a
pp5 a
pp6

Tr
ans
por
t Pr
otoc
ol1 Pr
otoc
ol2 Pr
otoc
ol3

I
nte
rne
t I
Pmodul
e

Ne
twor
kInt
erf
ace I
nte
rfa
ce1 I
nte
rfa
ce2 I
nte
rfa
ce3
. ..................
.............................
.... p
oint-
to-poi
nt
I
ntr
ane
tSub
laye
r for
wa r
ding

Ne
twor
k1 Ne
twor
k3
Phys
ica
lHa
rdwa
re

(
b)
(
a)

Fi
gur
e4.
8(a)Conc e
pt ua
lposit
ionofani ntrane
ts ub
layertha
thandl
es
f
or-
war di
ng us i
ng a me s
h-undera pp
roach, a
nd (b
)t he
c
orr
espondingsoftwareor
gani
za t
ion.

Be s
idesani ntrane ts ublayert hat handle
sf or war
d ing acros
st he set of
i
ndividualli
nks,noot he rc hangesa rerequiredtot heov er a
lllayer
ingschemet o
accommoda tet he me sh-unde ra p
proach. Interes
tingl
y, Zi gBee uses a minor
mod i
ficati
on oft hei deasde s
c r
ibeda bove.Althoughi tr ec
omme ndsus i
ng the
route-overappr oach,t heZi gBeec onsorti
um doesnotr ec omme ndus i
ngstandard
IPr outingprotoc ol
s.I nstead,t heZi g-
Be estackus esas p ec
ialrouti
ngp rot
ocol
thatl earns about de s t
inati
ons i nt he ZigBee me sha nd t henc onfi
guresI P
forwa r
dingacros sthei ndiv
iduallinks.
Thema in di
sadv
antageoft heroute
-overa p
proachi sthatitproli
fer a
tes
manyrout
esa tt heIPl a
yer(oneforeachc onne
ctionbetweent woma chines)
,
ca
usi
ngIPf or-wardi
ngtable
stob el
arge
rt ha
nne ces
s a
ry.Thema indi
sadvantage
ofthemesh-undera pp
roachisthatitusesas epar
a teforwar
dingtablea nda
s
epa
r a
t erouti
ngp rotoc
olt o upda
tethef orwardi
ngt a
ble
.Thee xt
rarouti
ng
p
rotocolmeansaddi
tiona
ltraffi
c,butb
e -
causetheme s
hne tworki
smuchsma
ll
er
t
hant heInterne
ta ndma ybemuc hmores ta
tic
,as pec
ial
-purp
osemeshr
outi
ng
p
rotocolca
nb emoree ff
ici
entthanageneral
-purpos
eIP
62 Pr
otoc
olLa
yer
ing Cha
p.4

routi
ng prot
ocol.A fi
naldi
sadva
ntage of t
he me
sh-undera p
proachistha
t
intr
anetrout-i
ngp r
eempt
sIPr outi
ngwhichc a
nma k
er outi
ngp rob
lemsmor
e
dif
ficul
ttodiag
noseandre
pai
r.

4.
12TwoI
mpor
tantBounda
rie
sInTheTCP/
IPMode
l

The l
ayering modelincl
udest wo conceptualboundar
iest hatmay notb e
obvi
ous:a p rotocoladdres
sb oundar
yt hats ep
arateshigh-l
eveland l
ow-le
vel
address
ing
,a nda noper
ati
ngs yst
emb ounda r
yt hatsepara
t e
sp rot
ocols
oftware
from appl
ica
tionp r
ogr
ams.Figure4.9i llus
tratestheb o
unda r
iesandthene xt
sect
ionsexpl
aint hem.

Conc
ept
ualLa
yer Bounda
ry

Ap
pli
cat
ion Softwar
eoutsidetheoperat
ing
system
Sof
twarei
nsidetheoperati
ng
Tr
ans
por
t
system

I
nte
rne
t
Onl
yInt
ernetaddr
ess
esus
ed
Net
wor k Phys
icaladdr
ess
esus
ed
I
nterf
ace
Phys
ica
l
Hardware

Fi
gur
e4.
9Twoc
onc
ept
ualb
ounda
rie
sint
hel
aye
ringmode
l.

4.
12.
1Hi
gh-
Lev
elPr
otoc
olAddr
essBounda
ry

Cha pter2 d es
crib
est he address
e s usedb yv arious types of ne twork
hardwa re.Laterc
ha p
tersdes c
rib
eI nternetp r
otocol
sa ndI nter
neta ddres
sing.It
i
si mpor ta
ntt odi
s-ti
nguis
hwhe r
et hetwof ormsofa ddressi
nga r
eus ed,andt he
l
aye r
ingmode lmakesitclear:thereisac oncept
ualb oundaryb etweenLa yer2
andLa yer3.Ha r
dwa re(MAC)a ddre
ssesa reuseda tLa yes1a
r nd 2,b utnot
above.I nternetaddres
sesa re usedb y La ye
rs3 t hroug h 5,butnotb yt he
underlyinghardwar
e.Wec ansumma ri
ze:

Appl
ic
ati
onprogramsandallprotoc
olsoftwarefrom t
heinter
net
l
ayerupwarduseonlyInternetaddress
es;addres
sesusedbythe
net-
workhardwarearei
solatedatlowerlayer
s.
S
ec.4.
12 TwoI
mpor
tantBounda
rie
sInTheTCP/
IPMode
l 63

4.
12.
2Op
era
tingS
yst
emBounda
ry

Figure 4. 9i l
l
ustratesa notheri mpor tant b
ounda ry:t he divis
ion b etween
protocols of t
wa ret hati simp l
ementedi na n oper
atings ystema nda ppl
icati
on
softwar et hatisnot .Althoug hresearchersha veexperiment edb yma kingTCP/ IP
partofa na ppl
icati
on,mos timplementationsp l
acethep rotocolsoftwa reint he
operatings yst
em whe rei tcanb es ha r
edb ya l
la ppl
ications.Theb ounda ryis
importa nt,b ecausep ass
ingda taa mongmodul eswithint heop erati
ngs yste
mi s
muc hl esse x
pens i
vet hanp a
ssi
ng da tab e t
weent heop er a
ting sys
t e
ma nd an
appl
ication.Fur thermore,as peci
alAPIi sne ededt op e
r mita na pplic
a t
ion to
intera
ctwi thp rotocols oft
wa re.Cha pter21di s
cussest he b oundaryi n more
detail
,a ndde scribesane xampleinter
f acet hatanop e
ra ti
ngs ystemp rovidest oap
-pli
cati
ons .

4.
13Cr
oss
-La
yerOp
timi
zat
ions

Weha ves ai
dt ha tl ayeringi saf unda me nt a
li deat hatp rovide st heb a s
isf or
proto-colde si
gn.I ta l
l
owst hede signert o div i
deac omp l
icat edp roblemi nt o
subproblemsa nds olvee a cho nei nde pende ntl
y.Unf ortuna tel
y,t hes of twa retha t
result
sf r om stric
tl a yeringc a nbee xt r
e melyi nefficient .Asa ne xamp le,c onsi
de r
thej ob oft het ra nspor tla yer.I tmus ta c ceptas t rea
m ofb yt esf rom a n
appli
cationp rog ra
m,di videt hes treami ntop a ckets,a nds e
nde a chp a cketa cross
theunde rlyi
ngi nterne t.Toop ti
mi zet ransfer,t het r
a nsportl aye rs houl dchoos e
thel a
r g
e stp ackets i
zet hatwi l
lallowonep ack ett ot rav eli
nonene twor kf rame .
Inp arti
c ular
,i fthede stinationma c
hinea tt
a chesdi rectlyt ot hes amene twor ka s
thes our ce,onlyonep hysicalne t wor kwi llb ei nvo l
vedi nt het ransf era ndt he
senderc a nop ti
miz ep acke tsizef ort hatne twor k .I fp rotocols of twar ep reser
v es
stri
ctl aye ri
ng ,howe v
er ,t he t ransp ortl ayerc annotk now how t he interne t
mod ul
ewi llforwar dt r
af fi
co rwhi chne twor ksa tta c
hdi rec
tly.Fur the rmor e,t he
trans-por tlayerwi llnotunde rst
a ndt hep acketf or mat sus e
db yl owe rl ayers,nor
willitb ea blet ode terminehow ma nyoc t etsofhe a derwi llb ea dde dt ot he
me ss
ag ei ts ends.Thus ,s t
r i
c tla yeringwi l
lp reventt het r ans portl aye rf rom
optimizi
ngt ransfers.
Usuall
y,imp lementersrelaxt hes tri
c tlaye
rings che mewhe nb uildingp rotocol
softwa re.The ya l
low upperlaye r
sofap rot
ocolstackt oo bta
ininf orma t
ions uch
ast hema xi
mum p acketsizeort her out ebeingus e d.Whe na l
locat i
ngp a
c k
e t
buf f
e rs
,t rans-por tlayerp rotocolsc an uset he i nforma t
ion t o op t i
mize
proce s
singb yl eavingsuffi
c i
ents p ac
ef orhe a
de r
st ha twi llbea dde db yl owe r-
l
a yerp rotocols
.S i
mi l
arl
y,lowe r-l
a yerpr otocol
softe nr etainallthehe a dersona n
incoming f rame whe n p assi
ng t he f rame t o hi ghe r
-layerp r otoc ol
s.S uch
op t
imiza t
ionsc anma k
edr ama t
ici mp r
ov ementsine ff i
- ci
encywhi l
er eta i
ningt he
basiclayereds tructure.
64 Pr
otoc
olLa
yer
ing Cha
p.4

4.
14TheBa
sicI
deaBe
hindMul
ti
ple
xingAndDe
mul
ti
ple
xing

La
yer
edc
ommuni
cat
ion p
rot
ocol
s us
eap
air of t
echni
que
sknown a
s
mul
ti
pl
exi
nganddemul
ti
pl
exi
ngt
hroug
houtt
hel
aye
ringhi
era
rchy.Whe
nse
ndi
ng
amessa
ge,thesourcec
omputerinc
lude
se xtrabitsthatstoremeta-
data,suchas
themess
agetype,thei
dent
ityoftheapp l
i
cati
onp rogr
amt ha
tsentthedata,and
thesetofp rot
ocol
sthathaveb e
e nused.Att her ece
ivingend,ade st
inati
on
comp
uterusesthemeta
-datatoguideproces
sing
.
Ethernetp rovi
desab as
ice x
amp l
e.EachEt hernetframei ncludesat ypef i
eld
thats peci
fieswha tt heframec arrie
s.I nlaterc hap
ters,wewi l
ls eet hata n
Ethernetf ramec ancontai
na nI Ppacket,anARPp acket
,oraRARPp ack et
.The
senders etsthet yp
ef ie
ldint heframet oindica
tewha tisb eings ent.Whe nt he
framea r
rive
s,p rot
ocolsoft
wa reont her ec
e i
vi
ngc omputerus est hef r
amet ype
toc hooseap rotocolmodul
et op r
ocessthef rame .Wes ayt hatt hes oftware
demultipl
exesincomingframes.Figure4.10il
lustr
atesthec oncept.

I
PModul
e ARPModul
e RARPModul
e

De
mult
ipl
exi
ngBase
d
OnFrameTyp
e

Fr
ameAr
riv
es

Fi
gur
e4.
10Il
lus
tra
tionoff r
amede mul
ti
plexi
ngthatuse
sat yp
efi
eldi
n
the frame header. Demul
tip
lexi
ng is used wi
th mos
t
networ
ks,in-
cludi
ngEtherne
ta ndWi-Fi
.

Multi
ple
xing a nd demulti
plex
ing occur ate achl a
yer.The de multi
ple
xing
i
ll
ustrat-edinFi gure4. 1
0oc cursa tthene tworkinterfa
cel a
yer,Layer2.To
underst
andde mul -ti
plex
inga tLa yer3,c onsi
deraf r a
met hatcontai
nsa nI P
packet
.Weha v ese enthatf ra
mede mult
ipl
exingwil
lp as
st hep a
ckett otheI P
modulef orp rocess
ing.Onc eitha sv e
rifi
edt hatthep acketisv a
li
d( i
.e.
,ha s
i
ndeedb eende l
iveredtot hecorrectdesti
na-ti
on),IPwilldemulti
ple
xf urt
herb y
pass
ingthep ackett othea p
propri
atet r
anspor
tp ro-
tocolmodule.
S
ec.4.
14 TheBa
sicI
deaBe
hindMul
ti
pl
exi
ngAndDe
mul
ti
pl
exi
ng 65

How c a
nI Ps oftwarek now whichtrans
portp rot
ocolthe s ender use
d?
Analog
oust oanEt hernetfra
me ,eachIPpackethasat ypefi
eldi nt heheader.
Thes enderset
st heIPt yp
ef i
eldtoindi
cat
ewhi chtrans
portprotocolwa sused.
Inlaterchapter
s,wewi lll
ear
na boutTCP,UDP,a ndICMP,eachofwhi c
hc anb e
sentina nIPpacket.Fig
ure4.11il
l
ustra
teshowI Pdemult
ipl
exe
sa mongt het hree
examples.

I
CMPPr
otoc
ol UDPPr
otoc
ol TCPPr
otoc
ol

I
PModul
e

I
PPa
cke
tAr
riv
es

Fi
gur
e4.
11I
ll
ust
rati
onofdemul
ti
ple
xingincomi
ngI
Ppa
cke
tsb
ase
don
thetyp
ef i
el
dintheIPheade
r .

Ourdi s
cussionofde mul ti
p l
exingl eave sma nyque st
ionsuna ns wer ed.How c an
wei nsuret ha tt hesende ra ndr ec ei
vera g reeont hev aluesus edi nat ypef i
eld?
Wha tha p- p
ensi fa ni ncomi ngp a cketc ont a
insat yp eot hert ha nt het ypest he
recei
ve r c an ha ndle? La ter c hapter s p rovide mor e inf orma tion a bout
demultipl
e xi
ng ,b utwec a ng i
v es horta ns werst ot hea b oveque sti
onsnow.I fa
recei
ve r doesnot unde rstand t he t ypei na na r -ri
ving pack et,t he r ec
eiver
dis
cardst hep ac
k et.Tog uarante euni versalagr ee
me ntont ypes,standa rdsbodies
speci
fyv aluest ob euse d( e.
g .
,I EEEs p e
c i
f i
est hes etofv al
uesf orEt he rne ttypes
andt heI ETFs p ec
ifi
esv al
ue sf ort heI nterne tp rotocol).Prov i
deds e ndersa nd
recei
ve rse acha greet of oll
ow t he sta ndards,no p rob l
emsa ris
e.Ofc our s
e,
resear
c herss ome ti
me sc onducte xp e
rime ntst hatus euna s
sig
ne dt yp e
s .Ther ule
thatc omp utersdr opunk nownp ac ketshe lps e veni far esearcherb r oa dca
stsa
packetwi tha ne xper
ime ntalt ype,noha rm wi l
loc curb ecausec omp ute r sthatdo
notunde rs t
andt hetyp ewi l
ldi s
ca rdthep acket.
66 Pr
otoc
olLa
yer
ing Cha
p.4

4.
15S
umma
ry

Protocolsaret hes tanda rdstha tspeci


fya l
la s
pectsofcommuni ca
t i
ona cr
oss
ac om- puternet work.Pr ot ocol
ss p ec
ifyb ot
ht hes yntax(e .
g.,thef ormatof
messages)a swellast hes ema ntic
s( e.g.,how twoc omputer
se xcha
ngeme ss
ages)
.
Protocolsincl
udede -tai
lss ucha sv ol
tages,how b i
tsa resent,how e rrorsare
detect
e d,a nd how t he s ende ra nd r ec
eive
ra g
re ethat a me s
sage ha sbeen
transf
e rre
ds uccessf
ully. To s i
mp lif
y p roto-
c ol desig
n a nd implementati
on,
communi cati
oniss egreg a
t e
di ntos ubprobl
emst hatc a
nb es ol
vedindependentl
y.
Eachsub probl
emi sassig
ne dt oas ep arateprotocol.
The i
dea of l aye
r i
ng isf undamentalb ec
aus ei tp rovi
desa c oncept
ual
frameworkf or p r
otocolde si
g nthata ll
ows us t o di vi
de t he probl
em into
mana g
eabl
ep iece
s.I n al ayered model
,e achl ayer ha ndl
e sone p ar
t of the
communicati
onp robl
em.Pr otocol
sfoll
ow thelayer
ingp rinciple
,whi chstat
esthat
softwareimple
me nti
ngl ayern ont hede sti
nati
onma c hiner eceiv
ese xac
tlythe
messagese
ntb ys of
twarei mple
me nt
inglayernont hesour cema chi
ne.
Weex a
minedt he5- l
ayerInt e
rnetreferencemode laswe l
la stheolderISO7
-la
yerr efer
ence mode l
.I nb ot hc as
es,t he la
yering mode lp rov
ides onlya
conce
ptualframe
- wor kforprotocolsoftwar
e .Inp r
actice,multipl
ep r
otocolscan
occurate achlayer ,andp rotocolsoftwareus e
sde multi
pl
ex i
ngt odi s
tingui
sh
amongmul t
ipl
eprot ocol
swithinag i
venlaye
r .Thep rese
nceofmul ti
pleprotocol
s
ate a
chlayerma kesp rotoc
olss oftwar
emor ecomplext hant helayeri
ngmode l
s
sugge
st.

EXERCI
SES

4.
1 Oneofthemai
nobj
ect
ionstola
yer
edprot
ocolsa
ris
esfrom t
hea
ppa
rentov
erhe
ad
cop
y-i
ngocc
ursate
achlaye
r.Howcanc
opyingbeel
imi
nated?
4.
2 Layere
dp rotocol
shide a
llunderl
ying de
tai
l
sfrom a
ppl
i
cati
ons.Coul
da p
pli
cat
ion
softwar
eb eo pti
mize
difa napp
li
cat i
onknewab
outtheunder
lyi
ngnetwor
ksb e
ing
used?Expl
ain.
4.
3 Shoul
dt heI
nte
rnetprot
ocol
sincl
udeapr
ese
nta
tionl
ayerthatsp
ecif
iesst
anda
rds
foreachdat
atype(e
.g.,agraphi
cima
getyp
e,adigi
talmus
ictype
,e tc
)?Whyor
whynot?
4.
4 Bui
ldac asethatTCP/I
Pi smovi
ngtowardasix
-laye
rprotoc
ola
rchi
tect
urethat
i
nclude
sap re
senta
tionlaye
r.(
Hint:v
ari
ouspr
ogramsusetheXDR pr
otocol
,XML,
andASN.1
.)
4.
5 Findouthow aUNI
Xsys
tem us
e he mb
st ufs
truc
tur
etoma
kel
aye
redp
rot
ocol
soft
waree
ffi
ci
ent
.
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
Chapt
erCont
ent
s
5.
1 Introduc ti
on,69
5.
2 UniversalHos tI de nt i
f i
e rs
,69
5.
3 TheOr i
g i
nalI Pv4Cl a ssfulAddr ess
ingS c
heme ,71
5.
4 DottedDe ci
ma lNo tationUs e
dWi thIPv4,72
5.
5 IPv4S ub netAddr essing,72
5.
6 Fix
edLe ngthI Pv 4S ub ne ts,75
5.
7 Vari
a ble-Lengt hI Pv 4S ubne ts,77
5.
8 Impleme ntationOfI Pv 4S ubne tsWi thMa sks,77
5.
9 IPv4S ub netMa skRe presenta tionAndS l
ashNot ati
on,78
5.
10 TheCur rentCl a sslessI Pv4Addr ess
ingScheme ,79
5.
11 IPv4Addr essBl oc ksAndCI DRS l
ashNot a
tion,82
5.
12 ACla ssl
e s
sI Pv 4Ad dr essi
ngEx a mple,82
5.
13 IPv4CI DRBl oc ksRe ser ve
dForPr ivateNetwor ks,83
5.
14 TheI Pv6Addr e ssingS cheme ,84
5.
15 IPv6Col onHe xa de ci
ma lNot ation,84
5.
16 IPv6Addr essS pa ceAs si
gnme nt ,85
5.
17 Emb eddingI Pv 4Addr essesI nI Pv 6ForTr ansit
ion,86
5.
18 IPv6Uni c
astAddr esse sAnd/ 64,87
5.
19 IPv6I nt er
fa ceI de ntif i
ersAndMACAddr es
s e
s,88
5.
20 IPAdd re ss
es,Hos t s,AndNe twor kConne ctions,89
5.
21 SpecialAddr esses ,90
5.
22 We aknes s
esI nI nt e rne tAddr es si
ng,94
5.
23 InternetAddr e ssAs signme ntAndDe leg
ationOfAut hor
ity,
96
5.
24 AnEx a mp l
eI Pv 4Addr essAs signme nt,96
5.
25 Summa ry,98
5

I
nter
netAddr
ess
ing

5.
1Int
roduc
tion

Chapte
r 3 de f
ines a TCP/IPint
erneta sa v ir
tualnetworkbuiltb y
int
erconnect
ingphysi
calnet
workswithrouters.Thi
sc hapt
erb e
ginsadi
scuss
ion
ofa ddre
ssi
ng,ane sse
nti
alpartofthede si
gnt hathelpsTCP/IPsof
twar
ehi de
physi
calnetworkdetai
lsandma k
estheresul
tinginte
rne tapp
eart obeasingl
e,
unif
or mentit
y.
Ina ddi
tion to dis
cuss
ing tr
aditi
ona lInte
rneta ddres
sing,t he chap
ter
i
ntroduce
sI Pv6 addres
ses
. The t r
aditiona
la ddres
s i
ng s c
he me, whic
h wa s
i
ntroduce
dwi thversi
on4 o ftheInte r
ne tProt
ocol,iswi del
yus ed.Thene xt
ve
rsionoft heI nt
ernetProtoc
ol,ver
sion6,ha sa l
readys t
artedt oa p
pear,and
wil
le v
entual
lyrepl
aceIPv4.

5.
2Uni
ver
salHos
tIde
nti
fi
ers

TCP/IPusest het em hos


r ttor e
fert oane ndsystemt hata t
ta c
hest othe
Internet.Aho s
tc anbealarge,powerful
,g e
ne ral
-purposecomputeroras ma l
l
,
speci
al-p
urposes ys-t
em.Aho stma yhavea ninte r
facet hathumansus e( e
.g.,a
scree
na ndk e
yboa rd)ormaybea nemb e
ddedde vice,suc
ha sane tworkp r
inter.A
hostc an usewi red orwire-
lessnetworkt echnology.I nshort,t heI nter
net
div
idesa l
lmachinesintotwoc l
ass
es:routersandhos ts.Anyde vi
cet hatisnota
routeri sclas
sifie
da sa hos
t.We wi llus et he terminol
ogyt hroughout the
remainderofthet e x
t.
Acommuni
cat
ions
yst
emissai
dtosuppyuni
l ver
salc
ommuni
cat
ionser
vic
eif
t
hes
yst
emall
owsanat
tac
hedhos
ttocommunic
atewitha
nyothe
rattac
hedhost
.
Tomakeourcommuni
cat
ionsys
tem uni
ver
sal
,itne
edsag
lob
all
yac
cep
tedme
thod
ofi
dent
ifyi
ngeac
hhosttha
ta t
tac
hestoit.

6
9
70 I
nte
rne
tAddr
ess
ing Chap.5

Often, i dent
ifiersarec l
ass
ifi
eda s names,a ddress
es, or routes.Shoch
suggeststha tana meidenti
fieswha tanobj ectis,ana ddres
sidenti
fieswhereit
i
s,a ndar out etelshow t
l og e
tt here.Al t
hought he yarei nt
uiti
vel
ya ppeal
i
ng,
thede fi
nitionsc anb emi s
leadi
ng.Na me s
,a ddress
es,a ndr outesr e
all
yr efe
rt o
success
ivel
yl ower-le
velrepresent
a t
ionsofhos tident i
fie
rs.I ngeneral,humans
prefert ous ep ronounceab
lena mest oidentifycomp uters,whilesoftwareworks
moree ffic
ie ntl
ywi thc ompactb i
naryi denti
fier
st hatwet hinkofa sa ddr
esses
.
Eit
he rcouldha veb eenchosenast heTCP/I Phostidentifi
ers.

Thede ci
si
on wa sma det ostandar
dizeo ncompact
,b ina
r yaddre
ssesthat
makec omputati
onss ucha sthesel
ecti
onofane xthopeffic
ient.Fornow,wewi l
l
onl
ydi s-
cussbinarya ddres
ses,post
poni
ngunt i
lla
terthequesti
onsofhowt oma p
bet
we enb i
narya ddresse
sa ndpronounc
eablenames,a
ndho wt ouseaddres
sesfor
for
wa rdi
ngp ac
k e
t s.

Wet hi
nkofa ninte
rneta salargene tworkli
kea nyotherp hysi
calnetwork.
Thediffere
nc e
,ofc ours
e ,i
st hataninternetisav i
rtualstr
uc t
ur e
,imaginedb y
i
tsde s
igner
sa ndimplementedb ypr
otocolsoftwarerunningonhos tsandrout e
rs.
Bec
ausea ni nter
-netisv i
rtua
l,itsdesig
ne rsarefreetoc hoosep ack
etf ormats
and si
zes,a ddres
ses
,de li
veryt ec
hniques,a nd s
o on;not hing isdicta
t e
db y
har
dwa re.
The de si
gne r
sof TCP/ I
Pc hos
eas cheme a nalogoust op hysicalnetwor k
a
ddressi
ngi nwhi che ac
hhos tona ninternetisa ss
ignedauni quei ntegeraddress
c
all
edi sI
t nternetPr otocoladdressorI Paddr ess.Thec l
everp a
r tofi nternet
a
ddressi
ng ist hatt he in-tegersa r
ec ar
efullyc hose nt o ma k ef orwarding
e
ffi
cient.S pe
cific
a l
ly,anI Pa ddres
sisdi vi
dedi ntot wop a
rt s
:ap re
f i
xoft he
a
ddressidenti
fiest henetworkt owhichthehosta t
tache sandas uffi
xi dent
ifi
esa
s
peci
fichos tont hene twork
.Tha tis,a l
lhostsa t-tachedt ot hes amene twor k
s
hareac ommonp refi
x.Wewi llseelate
rwhyt hedi vi
sionisimp ort a
nt.Fornow,
i
tissuffic
ienttor ememb e
r:

Each hos
ton an I Pv4interneti
sas s
igned auni queInt
ernet
addres
sthati
sus edinallcommunic
ati
onwi tht hehost
.Tomake
forwardi
ngef
fici
ent,apr ef
ixoftheaddressidenti
fi
esanetwork
andas uff
ixi
den-ti
fiesahostonthenetwor k.

Thede si
gnersal
sodec i
dedt omakeIPaddressesfixedsize( 32bit
swa schosen
forI Pv4a nd1 28 bi
tsf orI Pv6)
.Conceptual
ly,e acha ddressi sap air( neti
d,
hos
tid),whe rene ti
didentifi
esane tworka nd hosti
di dentifi
e sahos tont hat
net
wor k.Oncethede c
i-s
ionsa remadet ousef ixed-
sizeI Pa ddres
sesa nddi v
ide
eac
ha ddres
sintoane twor kIDa ndhostID,aque st
iona rise
s:how la r
g eshould
eac
hp artb e?Thea nswerde p
endsont hes i
zeofne t
wor kswee xpecti nour
i
nterne t.All
oca
t i
ngma ny b i
tst othene t
wor kp re-fi
xa l
lowsouri nternett o
conta
inmanynetworks
,b utli
mit
st hes
izeofe
achnetwor
k.All
oca
tingmanybi
ts
toahos tsuf
fixmeansag iv
enne t
workc a
nbelar
ge,butli
mitsthenumberof
network
sinourint
ernet.

J.F.Shoc
h,
Int
erne
twor
kNa
ming
,Addr
ess
ing
,andRout
ing
,Pr
oceedi
ngsofCOMPCON
1978.
S
ec.5.
3 TheOr
igi
nalI
Pv4Cl
ass
fulAddr
ess
ingS
che
me 71

5.
3TheOr
igi
nalI
Pv4Cl
ass
fulAddr
ess
ingS
che
me

Thi
ss ec
t i
ondesc
ribe
stheori
gina
lI Pv
4a ddres
singme chani
sm.Al
thoughmost
ofiti snol ongerused,wepresentithe r
eb ecauseite x
pla
inshow theIPv4
mult
icasta d-dre
sss pac
e wasc hos
en. Ita l
so helps us under
stand sub
net
addr
e s
sing,cover
edint henextsecti
on,whiche volv
edt ot hecurre
ntc l
ass
les
s
addr
e s
singscheme.
Tounde rsta
nda ddr
ess
ing,ob servethata ninte
rneta l
lowsarb
itrarynet work
tech-nol
ogies,whichme ansitwillc onta
inami xtureofl a
rg eandsma l
lnetwork s
.
Toa c-commoda t
et hemixture,t hede s
ignersdi dnotc hooseas i
ng l
ediv
isionof
thea ddress
.I ns
te a
d,t heyinvent edac lass
f uladdress
ings c
hemet hatal
lowe da
giv
e n networkt ob elarg
e ,me dium,ors ma l
l.Figur
e5. 1i l
l
ust
ra te
show t he
ori
g i
nalcl
a s
sfulschemedividedeac hIPv4a ddr e
ssintotwop arts
.

01234 8 1
6 24 31
Cl
assA 0 ne
tid hos
tid

Cl
assB 10 ne
tid hos
tid

Cl
assC 1 10 ne
tid hos
tid

Cl
assD 1 11 0 mul
ti
cas
taddr
ess

Cl
assE 1 11 1 r
ese
rve
dforf
utur
eus
e

Fi
gur
e5.
1Thefivefor
msofInte
rnet(I
P)addr
ess
esus
edwi
tht
he
or
igi
nalI
Pv4cl
ass
fuladdr
ess
ings
cheme.

Int hec l
a s
sfula ddres
sings cheme,e acha d dressissai
dt ob es elf
-identi
fying
be-ca
us et heb ounda ryb etwe enp refi
xa nds uffixc a
nb ec omp utedf rom t he
addres
sa l
one,wi thoutr eferencetoe xterna linforma ti
on.Inp ar
t i
cular,thec l
ass
ofa na ddressc anb edeterminedf rom thet hr eehigh-ord
erb it
s,wi tht wob i
ts
bei
ngs uffici
entt odi sti
nguisha mongt het hreep r
imaryc l
asses
.Cla ssAa ddress
e s
,
16
usedfort heha ndf uloflarg ene t
-wor kst hatha vemor ethan2 ( i
.e.,65,536)
hosts
,de vote7b i
t stone twor kIDa nd24b itst ohos tID.ClassBa ddresses
,us ed
8 1
6
forme dium sizene tworkst hatha vebetwe en2 ( i.e
.,256)a nd2 hos ts,al
locate
14b i
tst ot hene twor kI Da nd1 6b i
tstot hehos tID.Finall
y,classCa ddress
e s
,
8
usedforne t
wor kst hathavel essthan2 hos ts,a l
locat
e21b itstot hene tworkI D
andonly8b itstot hehos tI D.
72 I
nte
rne
tAddr
ess
ing Chap.5

5.
4Dot
tedDe
cima
lNot
ati
onUs
edWi
thI
Pv4

Whenc ommunica
tedtohumans,ei
therint e
chnic
a ldocument
sorthrough
a
ppl
ica
-ti
on p r
ograms,IPv
4a ddr
ess
esa re wri
ttena sf our dec
ima
lint
e g
ers
s
epa
ratedbyd eci
malpoi
nts
,whereeachint
egergive
st hev al
ueofoneoct
etof
t
headdres
s.Thus,the32-b
iti
nte
rnetaddr
ess

1
0000000 00001
010 0000001
0 0001
111
0
i
swr
itt
en
1
28.
10.
2.30

Wewi llusedot te
dde ci
ma lnotat
ionwhe ne x
p re
ssi
ngIPv4a ddress
est hroughout
the remainder of the text.Indeed,mos t TCP/IPsoft
wa ret hat dis
p l
aysor
requi
resahuma nt oe ntera nIPv4a ddres
sus esdotte
dde c
imalnot at
ion.For
example,appli
cati
onp ro-
gr a
mss ucha sawe bb r
owserall
ow aus ert oe ntera
dotte
d de ci
malv al
ue inst
e a
d ofa c omputerna me.Asa ne xample ofdot ted
deci
mal,thet ableinFigure5.2s umma ri
zest hedott
edd eci
ma lval
uesf ore ach
addres
sc l
ass.

Cl
ass Lowes
tAddr
ess Hi
ghes
tAddres
s
A 1.0.0.0 127.0.0.0
B 128.0.0.0 1
91.255.0.0
C 192.0.0.0 223.255.255.0
D 224.0.0.0 239.255.255.255
E 240.0.0.0 255.255.255.254

Fi
gur
e5.
2Therang
eofdotte
ddeci
malval
uestha
tcor
res
pondt
oea
ch
oft
heori
gi
nalI
Pv4addr
essc
las
ses.

5.
5IPv
4Sub
netAddr
ess
ing

Inthee arl
y1 980s
,a sLocalAr eaNe t
wor k
sb e camewi delyavai
l
able,itbecame
ap-par
entt hatt hec l
assfuladdressi
ngs chemewoul dhavei nsuff
ici
entne twor k
addres
ses,especi
a ll
yc l
assBp refixes
.Theque sti
ona ros
e:how c anthet echnol
og y
accommodateg rowt hwi t
houta b
andoningt heo ri
g i
na lcl
assfuladdre
ssi
ngs cheme ?
The firs
ta nswe r wa sa t e
chnique c a
ll
eds ubnet addr essi
ng or subnetting.
Subnetti
ng a l
l
owsa s i
ngle net-wor kp ref
ixt ob e usedf or multi
plep hys
ic a
l
networks.Al t
houg hita p pe
arst ov i
olatet he a ddress
ing scheme,s ubnetting
becamep a
rtoft hes ta
ndar dandwa swi del
yde -ployed.

Tounde rs
tandsub nett
ing,i tisi mporta
nttot hi
nka bouti ndi
vidualsi
tes
connect
edtot heInternet.Ima g
ine,fore xampl
e,t
hatauniversitysta
rtedwi t
ha
si
ngleLocalAreaNe tworka ndob tai
neda nIPv4prefi
x.Ift heuni ve
r s
ityadds
anotherLAN,t heor i
g i
nala ddress
ing sche
mewoul drequi
ret heuniversi
tyt o
obtai
nas econdnetworkI Df ort hesecondLAN.However,s
up posetheuni v
ersi
ty
onl
yha
saf
ewc
omp
ute
rs.Asl
onga
s

Alate
rsect
iondi
scus
sesc
olonhe
xnot
ionus
edf
orI
Pv6
addr
ess
es.
S
ec.5.
5 I
Pv4S
ubne
tAddr
ess
ing 73

t
heuni ve
rsi
tyhide
sthedetai
lsf
rom theres
toft heInt
ernet
,t heuniver
s i
tyca
n
as
sig
nhos taddr
ess
esandarr
angeint
ernalf
orwardi
nghoweveritchoose
s.Tha ti
s,
asitecanchoosetoass
ignanduseIPv4addre
ssesinunusua
lwa ysinternal
lyas
l
onga s
:
Allhos
tsa ndrout
erswi
thi
nthes
itea
gre
etohonort
hes
ite
s
addres
singscheme
.
Ot
hers
ite
sont heInte
rnetc
ant rea
taddr
essesa
sst
anda
rda
ddr
ess
es
wi
thanetwor
kp re
fixtha
tbelong
st ot
hesit
e.

Subne ta ddre
s s
ingt ak e
sa dvantageoft hef re
edomb ya llowingas i
tet odi vi
de
thehos tp ortionoft hei
ra ddres
sesa mongmul tipl
ene t
wor ks.Thee as
iestwa yt o
seehow s ub neta ddr es
singwor ksist oc onsidera ne xa
mp le.S upposeas i
teha s
beena ss
ignedas i
ng leclassBp r
efix,128.10.0.0.Ther esto ft heI nterneta ssumes
eacha ddressa tt hes i
teha sonep hys
icalne twor kwitht he1 6-bi
tne t
wor kI D
128.1
0.I ft hes i
teob tainsas ec
ondp hys icalnetwork,t hes itec anus es ubnet
addressi
ngb y usingap ort i
on oft hehos tI Df iel
dt oi de nti
f y whichp hysica
l
networkt ous e.Onl yhos tsa ndr outersa tt hesitewillk now t hatt herea re
multip
lep hys i
calne twork sa ndhow t ofor wa rdtraffi
ca mongt hem;r outersa nd
hostsint her esto ft heI nternetwi l
lassumet hereisas i
ng lep hysi
c a
lne twor kat
thes i
tewi t
hhos t sa tt
ac hed.Figure5.3s howsa ne xampleus i
ngt het hi
rdoc tet
ofea c
ha ddr esstoi denti
f yas ubnet.

Ne
twor
k128.
10.
1.0
1
28.
10.
1.1 1
28.
10.
1.2
RESTOFTHE H1 H2
INTERNET R

Ne
twor
k128.
10.
2.0
1
28.
10.
2.1 1
28.
10.
2.2
Al
ltr
aff
ict
o H3 H4
1
28.
10.
0.0

Fi
gur
e5.
3I l
l
ust
rati
onofIPv
4subne
ta ddr
essi
ngusi
ngthet
hir
doc
tet
ofanaddre
sst
ospec
ifyaphysi
calnet
work.

Inthefi
gure
,t hes i
tehasde
cide
dt oas
sig
ni t
st wonetwork
st hesub
net
numb
ers1and2.Allhos
tsonthefi
rstnet
wor
kha veaddr
ess
esoftheform:

1
28.
10.
1.*

whereana st
eri
skdenote
sahostID.Forexa
mp l
e,thefi
gureshowstwohos
tson
net
-wor k1withaddre
sse
s128.
10.
1.1a
nd128.1
0.1
.2.Si
mil
arl
y,hostsonne
twork2
hav
ea ddre
ssesoftheform:
1
28.
10.
2.*
74 I
nte
rne
tAddr
ess
ing Chap.5

Whe nrouterRr ec
eivesap acket
,itcheckst hedesti
nat
ionaddre
s s
.Ift headdr
ess
star
tswith1 28.
10.
1,t herouterdeli
versthep ackettoahostonne twork1;ifthe
addres
sstartswith128.10.
2,t herouterdeliversthepack
ettoahos tonne twork
2.Wewi l
llear
n mor ea bouthow r outer
sf orwardpacke
ts;a tp r
esent,itis
suffi
ci
entt ounderst
a ndthatar outera tthes i
tecanusethet hi
rdoc te
toft he
addres
st ochoos
eb etweent hetwone t-wor
k s.

Conceptuall
y, a ddi ng subnets onlyc ha nge
st he interpret
a t
ion of I Pv4
addres
sess li
ghtly.I ns t
e adofdi vi
dingt he32- bitI Pv4a ddres
si ntoane twork
prefi
xa ndaho sts uff i
x ,subnetti
ngdividest headdr e
ssintoa ninternetpor ti
on
andal ocalpor t
ion.Thei nte
r p
retati
onoft heinternetpo rti
onr e
ma insthes ame
asf orne tworkst ha tdonotus es ub
ne t
ting( i
.e.
,i tco ntai
nsane twor
kI D).
Howe v
er,inter pre
ta tionoft helocalporti
onofa na ddre
s sisleftupt othes it
e
(wit
hint he c onstraintsof t he formals tandardf or sub-neta ddr e
ssi
ng).To
summa ri
ze:

Whenus ingsubnetaddr es
sing,wet hi
nkofa32- bitIPv4addres s
ashav i
ngan i nternetpor ti
on andal oc
alport
ion,wheret he
int
ernetpor-tionidentifi
esas it
e,possi
blywit
hmul ti
pl
ephysic al
networks,andt helocalportionident
ifi
esaphysi
calnetworkand
hostatthats i
te.

Thee x
a mp l
einFi gur
e5.3s howssubneta d
dr es
singwithac l
assBa ddr
e s
st hat
hasa2- octeti nte
r netporti
ona nda2- oc
tetl oca
lp or
t i
on.Toma kef orwarding
amongt hep hysi
calne twork
se ff
ici
ent
,t hes itea dmini
stratori n oure xamp l
e
chosetous eoneoc tetofthelocalport
iont oidenti
f yap hys
icalnetworka ndt he
othero c
tett oi dentifyahostont hatnetwor k.Figure5. 4ill
ustrateshow our
exampledivi
de stheI Pv4addres
s.

I
nternet l
oca
l
(
a)
por
tion p
orti
on
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. .

.
I
nternet phys
ica
l
(
b) hos
t
por
tion network

Fi
gur
e5.
4( a)Theint
erpret
ati
onofa32- bi
tI Pv4addres
sfrom Fi
gure
5.3whensubnett
ingi
sus e
d,and(b)theloc
a lp
ort
iondiv
ided
i
ntot wofiel
dsthatide
ntifyaphysic
alnetworkatthes i
te
andahostont ha
tnetwork.
S
ub nett
ing i
mp os
esaf orm of hi
erar
chi
cal addr
ess
ing tha
tl ea
ds to
hi
erarchic
alrout
ing.Rout
erst
hroug
houttheInter
netus ethetoplev
elofthe
hi
erar
chytoforwar
dap a
c k
ett othec
orr
ects
ite
.Onc
ethep
ack
ete
nte
rst
he
si
te,l
oca
lrout
ersus
ethephysi
cal
S
ec.5.
5 I
Pv4S
ubne
tAddr
ess
ing 75

network octe
tt os
elec
tt he c
orr
ectnetwork.Whenthe p
ack
etr eac
hesthe
cor
r e
ctne t
-work
,arouterus
esthehos
tporti
ontoide
nti
fyapar
tic
ula
rhost.
Hierar
chi
caladdre s
singi snotne w;ma nys yst
emsha veusedi tbefore.For
exam-ple,theU.S.tel
e phones ys
t e
mdi videsa1 0-digi
tphonenumb eri nt
oa3- digi
t
areac ode,3-di
gite x c
ha nge,a nd 4-digitconne cti
on.The adva ntage ofus i
ng
hier
archica
laddress-i
ngi st hatita ccommoda tesl a
rgeg r
owthwi t houtr e
quiri
ng
routerstounderstandde tail
sa b
outdi stantdes t
inati
ons.Onedis
a dv a
ntageisthat
choosi
ngahi er
archicalstructureisc omp l
ic
ated,a nditoftenbecome sdiffi
cultto
changeonc eahie
r a
rchyha sbeene st
a b-
lis
hed.

5.
6Fi
xedLe
ngt
hIPv
4Sub
net
s

Int hee xamp l


ea b
ov e,as itewa sa ss
igneda1 6- bi
tne tworkp r e
f i
xa nduse d
thet hi
rdoc tetoft hea ddre s
st oide nti
fyap hysic alnetworka tt hes ite.The
TCP/IPs ta
n-da r
df ors ub neta ddress
ingr ecogni
ze st hatnote verys itewi llhavea
16-bi
tp re
fixa nd not e v
e r
ys i
t e willha v
et he s ame ne e
dsf or a na ddress
hie
rarchy.Cons equently,t hes t
andar da l
l
owss i
tesf l
exib
il
ityinc hoos inghow t o
ass
igns ubnets.To unde rstand why s uchf l
exi
b i
li
t yi sde s
irab
le,c ons i
dert wo
examp l
es.Figure5. 3r ep rese
nt sonee xamp l
e,as i
t et hatonlyha st wop hysi
cal
networks.Asa nothere xamp l
e,i ma gi
ne a c omp any t hat ownst we ntyl ar
g e
buil
di
ng sandha sde pl
oye dtwe ntyLANsi ne ac
hb uilding.Sup-poset hes ec
onds i
t e
hasas i
ngle1 6-bitnet wor kp r
efixa ndi twa nt st ous es ubnettingf ora llits
networks.Hows houldt he1 6-bitlocalporti
onoft hea ddres
sb edividedi ntof i
elds
forap hysic
alne tworka ndhos t?
The divi
si
on shown i n Figure 5.
4r esul
tsi na n 8-bitphysicalnetwork
i
dentifi
era nda n 8-bi
thos ti dent
ifi
er.Usinge ig
htb itst oidenti
fy ap hys
ica
l
net
wor k me a
nsa ma nagerc ang enera
te up t o 256 unique physi
calnetwork
numb er
s.Simil
arl
y,wi theightb i
tsforahos tI D,ama nagercang e
nerateupt o
256hos tIDsforea c
hne twor k
.Unf ort
una t
e l
y,thedivis
iondoesnots uf
ficefor
thec ompanyi nours econde x a
mpleb e-c
aus ethec ompanyha s400 ne t
wor ks
,
whic
he xceedsthe254p ossi
b l
enumb ers
.
Top er
mitf l
exi
bil
ity,thesubnetstandarddoesnotspeci
fythatas i
temus t
alwaysuset het hi
rdoc tettos pe
cif
yap hysic
alnetwork.Ins
tead,as i
tec an
choosehowma nyb i
tsoft heloc
alporti
ont odedic
atetothephysi
calne
tworka nd
how ma nytode di
catet othehostID.Oure xa
mp l
ecompanywith400ne tworks
mightchoosethedi v
isi
ont ha
tFigure5.5i l
lus
tratesb
ecausea10-bi
tfiel
da l
l
ows
upt o1022ne t
wor k
s.

6
1
6bi
ts 1
0bi
ts bi
ts

I
nterne
t physi
cal
hos
t
por
tion network

Fi
gur
e5.
5Adi
vi
si
onofa1
6-b
itl
oca
lpor
tiont
hata
ccommoda
tes400
ne
t-wor
ks.

I
nprac
tic
e,thel
i
mitis254sub
netsof254hos
tsp
ers
ubne
tbe
caus
ethes
tanda
rdr
ese
rve
sthe
a
ll1
sanda
ll0ssub
netandhos
taddre
sse
s.
76 I
nte
rne
tAddr
ess
ing Chap.5

Thei de aofa l
lowingas i
tet oc hoosead ivi
si
onf ort helocalpor
t i
onofi ts
addre ssa ndt henus i
ngt hed i
vi
siont hroughoutthes i
teisk nowna sfixed-l
ength
subnet ting.Fi x
ed-l
e ngthsubnettingi seasyt ounde r
standb ecauseitp ar
titi
ons
thel oc alp orti
onofa na ddressb e
twe enne tworksandhos t
s.I nessence
,a sa
ma nag erc hoos
eshow ma ny networ kst he si
tec an hav e
,t he mana ge
ra l
so
deter mine st he max i
mum numb er of hos tson a g i
ven ne twork.Figure 5.6
il
lustra t
e st hepos
siblechoi
c e
sifas i
teus esfixe
d-le
ngths ubnetti
ngwit ha1 6-b
it
l
oc alp ortion.

Ne
twor
kBi
ts Numb
erofNe twor
ks Hos
tsp
erNe t
wor
k
0 1 65534
2 2 16382
3 6 81 90
4 14 4094
5 30 2046
6 62 1022
7 1 26 510
8 254 254
9 510 1 26
10 1 022 62
1
1 2046 30
12 4094 14
13 81 90 6
14 1
6382 2

Fi
gur
e5.
6Thep oss
ibl
ewayst odi
videa1 6-
bitl
ocalport
ionofanIPv
4
a
d-dr
e s
swhe n us
ing f
ixed-l
engthsubnet
ting
.A sit
e must
c
hoos
eonel i
neinthetable
.

Asthefigureill
ustrates,anor ga
niza
tionthatadoptsf i
xed-l
eng t
hs ubnetti
ng
mustc hooseac omp r
omi s
e.I ft he org
anizat
ion optsf ora la rg
e numb erof
physi
calne t
works , none of t he networksc anc ontai
n ma ny hos ts;ift he
organi
zati
one xp
ec tstoc onnec
tma nyhoststoane twork,thenumb e
rofp hysi
cal
networksmus tb es mall.Fore xamp l
e,all
ocati
ng3b it
st oidentif
y ap hysi
cal
networkr es
ultsi n up to 6 ne tworksthate achs up
-portup t o 8190 hosts.
All
ocat
ing12b it
sr esultsinupt o4094ne tworks,butr e
s t
ric
tst hesizeofe a
ch
to14hos t
s.
Its houldb ec l
earwhyt hedesi
g ner
sdidnotc hooseas pe
cif
icdivis
ionf or
subnet-ting:nos ingl
ep arti
ti
onoft heloca
lp artoft hea ddres
swor ksf ora l
l
organiza
t ions
.S omene ed ma ny networkswithf ew hos t
sp ernetwork,whi le
othersne e dafewne t-workswi t
hma nyhostsattachedt oea c
h.Mor eimportant,
si
t e
sdonota llrecei
vea1 6-bitpre
fix,sothes ubnetti
ngs tandardhandlescases
whe reas iteisdiv
idi
ngf ewerb i
ts(e.
g .,t
hesit
eonl yha san8- bi
tlocalporti
oni n
itsaddresses)
.
S
ec.5.
7 Va
ria
ble
-Le
ngt
hIPv
4Sub
net
s 77

5.
7Va
ria
ble
-Le
ngt
hIPv
4Sub
net
s

Mos ts itesusef i
xed-lengths ubnetti
ng b e
c ausei ti ss traightforwa r
dt o
unde r s
tanda nda dminist
er.Howe ver,thec omp romi sede scribeda bovema kesfixed
-leng ths ubnet-ti
nguna t
trac t
ivei fas itee xpe c
t sami xtureofl argea nds ma l
l
ne twor ks.Whe nt heyi n-vent e
ds ubnetti
ng ,t hede si
g nersr eali
ze dt hatf ixed-
l
e ngt hs ubnetti
ngwoul dnots uf f
icef ora llsitesa ndc reatedas t
a ndardt hat
prov idesmor ef l
exi
bili
ty.Thes tandards p
ecifie
st hata nor ganizationc anse l
ecta
subne tp arti
ti
on on ap er-networ kb asi
s.Al thoug ht het ec
hniquei sk nown a s
variable-lengthsubnetting,t hena mei ssli
g htl
ymi sleadingb e-c a
us et hep arti
tion
doe snotv ar
yov ert ime onc eap ar
titi
onha sb eens el
ectedf orap arti
cular
ne twor k,t hep ar
tit
ion ne verc hang es
.Al lho stsa ndr outersa tt a
che dtot hat
ne twor kmus tfoll
ow t hede ci
si
on;i ft hey donot ,da t
a g
ramsc anb el ostor
mi s
r outed.Wec ansumma r
ize :

Toal l
ow maximum flexi
bi
lit
yi nchoosi
nghow t opar ti
ti
ons ubnet
ad-dress
es,t heTCP/IPs ubnetstandardpermitsv ari
able-
length
subnet-ti
nginwhi c
hapar ti
tioncanbec hos
eni ndependentl
yf or
each physi-c
alnet work. Onc eas ubnet parti
tion has been
sel
ected,allmachi
nesont hatnetworkmus thonori t.

The c hief adva ntage of v ariable


-length s ubnetting isf lexi
bil
ity: an
orga nizati
onc anha veami xtur eofl argea nds ma l
lne tworks,a ndc ana c
hiev
e
highe rut i
li
zati
onoft hea ddre ssspa ce.Howe ver,v ar
iable-l
engths ubnettingha s
seriousdi s
advantages.Themos ts ev e
r edisadvantagea r
isesb e
causet hes c
he mecan
bedi ffi
culttoa dminister.Thep artiti
onf ore achs ubneta ndt hev aluesc hos
en
fors ubnetnumb er
smus tb ea ss
igne dc areful
lyt oa voida ddressambi guity,a
si
tua tion in whi c
ha na ddr essi si nterpreted dif-f
ere ntl
y on t wo p hysi
cal
networ ks
.I nparti
cula r,becaus et hene twor kf i
eldusedo nonep hys i
calne t
work
canb elargerthant hene t
wo rkf i
e l
dus edona notherne twork,s omeoft hehost
bit
sont hes e
condne tworkwi llbei nterpreteda snetwor kb i
tsont hef i
rstne t
-
wor k.Asar es
ult,inv al
idv ariable
- l
e ngths ubnetsma yma keitimp ossi
blef orall
pai
r sofhos t
sa tthes i
tet oc ommuni cate.Fur t
hermor e,thea mb i
g uityc annotbe
resolve dex-ceptbyr enumb ering.Thus ,net workma nagersa redi scourage dfrom
usi
ngv ar
iabl
e-l
engths ub ne
t t
ing .

5.
8Imp
leme
nta
tionOfI
Pv4S
ubne
tsWi
thMa
sks

Thes ubnettechnologyma ke sconf i


g urationofeitherfi
xe dorv a
riab
lelength
sub-netse a
sy.Thes tandardspe ci
fiest ha ta32- btma
i skisus edt ospeci
fyt he
div
isi
on.Thus ,as i
teus i
ngs ubne ta ddres s
ingmustc hoosea32- b
itsubnetmas k
fore achnet-work.Thema skcov erst hei nternetp
ortionoft headdressaswe l
las
thep hysi
calnet-
wor kp ar
toft hel ocalp orti
on.Thati s
,b i
tsint hesubnetma sk
ares etto1i fma chinesont hene twor kt r
e a
tthec orres
pondingb i
tint heI P
addre
s saspartoft
hes
ubne
tpr
efi
x nd0i
,a fthe
ytr
eatt
heb
ita
spa
rtoft
he
hostident
ifi
er.
78 I
nte
rne
tAddr
ess
ing Chap.5

Asa
nex
amp
le,t
hef
oll
owi
ng32-
bits
ubne
tma
sk:

1
111
111
111
111
1111
111
111
100000000

s
peci
fi
esthatthefi
rstt
hreeoc
tetsi
denti
fyt hene
twor
kandt
hef
our
thoc
tet
i
dent
ifi
esahos
to nt
hatnet
work.S
imi
lar
ly,themask
:

1
111
111
111
111
1111
111
111
111
000000

cor
r e
spondstot he p
arti
ti
on tha
t Fi
gur
e 5.
5il
l
ust
rat
eswhe
ret
he p
hys
ica
l
networkpor-
tionoc
cupi
es10bi
ts.
Anint
eresti
ngtwis
tinsubnetaddr
e s
singaris
esbec
auset
heor
igi
nalsta
nda
rd
di
d notrest
rictsubne
tma sk
st os el
ectc onti
guousbit
softhe addr
ess
.For
ex
ample
,ane t-
workmightb
ea ss
ignedthema sk
:

1
111
111
111
111
1110001
1000 01
000000

whichs ele
ctst hef i
rstt wooctets,twob i
tsfrom thet hirdoctet,andoneb i
t
from t he four t
h.Al thought he st
andar
da l
l
ows one t oa r
rangeinter
esti
ng
assi
gnme ntsofa d-dre
sse s
,doi
ngs omakesnetworkma nagementa l
mostimp
ossi
bl
e.
Therefore,itisnowr ec ommendedthatsi
tesonlyus
ec ont
iguoussubne
tma s
ks.

5.
9IPv
4Sub
netMa
skRe
pre
sent
ati
onAndS
las
hNot
ati
on

Speci
fyings ub ne tma sksinb i
naryi sb otha wkwa r
da ndp ronet oe rror s
.
Therefore,mos ts of twarea l
lowsa lte
r nati
ver epr
esentati
ons.Fore xa
mp l
e,mos t
softwarea l
lowsma na gerst ousedot t edde c
imalrepresentati
onwhe nspeci
f ying
IPv4s ubnetma s
ks.Dot tedde c
ima lhast hea dv
antageofb ei
ngf a
mili
ar,butt he
dis
advantageofma kingi tdiff
icultt ounde rst
andb itp at
te rns.Dottedde cimal
work swe l
li fas i
t ec ana li
g nt hes ubnetb oundary on octe tboundari
es.The
examp l
einFi gure5. 4bs howshow e asyi tist ounderstands ubnetti
ngwhe nt he
thi
rdoc tetofa na ddressisuse dt oidentifyap hysi
calnetwor ka ndthef our th
octeti susedt oi de nt
ify ahos t.I ns uchc ases
,t hes ubnetma skhasdot ted
deci
ma lrepr
e sentation255. 255.255.0,maki ngiteasytowr itea ndunder-st
a nd.

Theli
ter
atureals
ocontai
nsexa
mpl
esofs
ubne
taddr
ess
esa
nds
ubne
tma
sks
r
epr
e s
ent
edinb r
ace
sa sa3-
tuple
:

{<ne
twor
knumb
er>,<s
ubne
tnumb
er>,<hos
tnumb
er>}

Inthisrepr
esent
ation,e
achsec
tionc
anberepre
sent
edi
nd ot
tedde
cima
l,a
ndt he
vaue1me
l ansa
llones
.Forexamp
le,i
fthesubne
tmaskforacl
assBnetwork
i
s
255.255.
255.0,i
tc anbewri
tten{1
,1,0}.
S
ec.5.
9 I
Pv4S
ubne
tMa
skRe
pre
sent
ati
onAndS
las
hNot
ati
on 79

Thechi
efa dvant
ageisthatitabst
ractsawayf rom thedetai
lsofbi
tf i
el
ds
and em-phas
ize
st he v
alue
s of the thr
eep a
rts of the addre
ss.The chi
ef
dis
advant
ageist hatitdoesnotaccura
tel
ys peci
fyhow ma nyb i
tsareusedfor
eachpartofthea ddr
ess
.Forexample
,the3- t
uple:
{1
28.
10,1
,0}

denot
esa naddr
esswithanetworknumber128.1
0,allonesint hesubne
tf ie
ld,
andallzer
oesinthehostfi
el
d.Theaddres
scouldcorres
pondtoas ubnetwhe re
theboundaryoc
cursafte
rthethi
rdocte
torc oul
dc or
respondtoasituati
onlike
theoneshowninFig-
ure5.5wher
etheboundaryall
ocat
es1 0bi
tstothene t
wor k
and6b i
tstothehost.
Toma k eite as
yf orhuma nst oe x
p ressandunde rs
tanda ddres
sma sks,the
IETFi n-
ve ntedas ynta
c ticformt hatisb othconv e
nie
nta nduna mbiguous.Known
informal
lya ss l
ashnot ati
on,t hef orms peci
fi
eswr iti
ngas l
ashf oll
owe db ya
decimalnumb erthatgivest henumb erof1 sinthema sk.Forex ampl
e ,inste
adof
wr i
ting thedot ted dec i
malv alue255. 255.255.0,ama nage
rc an write/24.
Figure5.7l i
stseachpos si
bleslashv a
luea ndt hedottedde ci
ma lequivale
nt.The
nex tsec
tione xplai
nshowv ari
able-
lengths ubnett
inghasb ee
ng eneral
izeda ndhow
sla
s hnotationisusedina l
lrouters.

5.
10TheCur
rentCl
ass
les
sIPv
4Addr
ess
ingS
che
me

Wes ai
dthatsubneta ddressi
nga rosei na na ttemptt oconser
vet heIPv 4
a
ddresss p
ace.By 1993,itb e c
amea ppa
r entt hats ubnet
tinga l
onewoul d not
p
revent Inter
netg rowthf rom quicklye xhausti
ng t he addre
sss p
ac e,a nd
p
reli
minarywor kbeganond e
- fi
ninga ne ntir
e l
yne wv ersi
onofI Pwi t
hl arger
a
ddresses
.To a cc
ommoda t
eg r
owt h un-tilt he new v ers
ion of IPc oul
db e
s
tandardi
zedandadopted,at e
mp orarysolutionwa sinvente
d.
Knowna sclas
slessaddress
ing,t het e
mporar
ya ddres
ss c
hemedoe sawaywi th
cl
assA,B,a ndC a ddresse
s.I np l
aceoft het hr eecla
sses
,t hene ws c
heme
extendstheideaus edins ubneta ddressi
ngtop ermitane tworkp ref
ixtob ea n
ar
b i
trarylength.La terc hapt
erse x pl
aintha
ti na ddi
ti
on toane wa ddres
sing
mode l
,thede si
gnersmodi -fi
edf orwa rdi
ngandr out epropaga
tiontechni
quest o
handlecl
ass
lessaddresse
s.Asar esul
t ,theent
iretec hnol
ogyhasb ec
omek nowna s
Class
les
sInt
er-
Domai
nRout
ing
(CIDR).
Tounde r
standthei mpactofCIDR,onene edstok nowthreefacts.Fir
st,the
cl
ass-fuls cheme did not divi
de networ ka ddres
sesintoe qualsize cl
asses
alt
houg hf ewert hans eventee
nt housandc lassB numb e
rswe rec reat
ed,mor e
thant womi l
l
ionc l
assCne t
wor knumber swe recrea
ted.Second,becauseclas
sC
prefixe
sonl ys uffi
cef ors mallnetwor
k sa nda renota mena b
letos ubnetti
ng,
dema ndf orclassCp refi
xeswa smuc hs mal
lert handemandf orcla
s sBp ref
ixes
.
Third,studiesshowedt hata ttheratec l
assBnumb er
swe rebeingassi
gned,clas
s
Bp
ref
ixe
swoul
dbee
xha
ust
edqui
ckl
y.

Cl
ass
les
sa ddr
ess
ingp
res
erv
esc
las
sDa
ddr
ess
es,whi
cha
reus
edf
orI
Pv4
mul
tic
ast.
80 I
nte
rne
tAddr
ess
ing Chap.5

S
las
hNot
ati
on Dot
tedDe
cima
lEqui
val
ent
/0 0 . 0 . 0 . 0
/1 128 . 0 . 0 . 0
/2 192 . 0 . 0 . 0
/3 224 . 0 . 0 . 0
/4 240 . 0 . 0 . 0
/5 248 . 0 . 0 . 0
/6 252 . 0 . 0 . 0
/7 254 . 0 . 0 . 0
/8 255 . 0 . 0 . 0
/9 255 . 128 . 0 . 0
/10 255 . 192 . 0 . 0
/11 255 . 224 . 0 . 0
/12 255 . 240 . 0 . 0
/13 255 . 248 . 0 . 0
/14 255 . 252 . 0 . 0
/15 255 . 254 . 0 . 0
/16 255 . 255 . 0 . 0
/17 255 . 255 . 128 . 0
/18 255 . 255 . 192 . 0
/19 255 . 255 . 224 . 0
/20 255 . 255 . 240 . 0
/21 255 . 255 . 248 . 0
/22 255 . 255 . 252 . 0
/23 255 . 255 . 254 . 0
/24 255 . 255 . 255 . 0
/25 255 . 255 . 255 . 128
/26 255 . 255 . 255 . 192
/27 255 . 255 . 255 . 224
/28 255 . 255 . 255 . 240
/29 255 . 255 . 255 . 248
/30 255 . 255 . 255 . 252
/31 255 . 255 . 255 . 254
/32 255 . 255 . 255 . 255

Fi
gur
e5.
7Addres
smasksexpr
ess
edinsla
shnota
tiona
longwi
tht
he
dot
tedde
cimale
quiva
lentofeac
h.
S
ec.5.
10 TheCur
rentCl
ass
les
sIPv
4Addr
ess
ingS
che
me 81

Oneoft hefir
stus esofc las
sles
sa ddress
ingwa sknowna ss uper netti
ng.The
i
nt entwa st ogroupt og etheras etofc ontiguousc l
a s
sCa ddressest obeus ed
i
nst eadofac l
assBa ddr ess.Tounde rsta
ndhow s upernett
ingwor ks,c onsi
dera
me dium-si
ze do r
ganiza-tiont hatj oi
nst heI nte r
net.Unde rt hec lassfulscheme,
sucha nor gani
zati
onwoul dr e
-que s
tac las
sBp ref
ix.Thes up ernett i
ngs cheme
all
owsa nIS Ptoa s
signt heor ganiza-t
ionab l
ockofc l
assCa ddre s
se sinstea
dofa
si
ng leclas
sBnumb er.Theb l
ockmus tb elargee nought onumb era llthene tworks
i
nt heor gani
zati
ona nd( a swewi llsee)mus tli
eonab oundaryt hati sap owe rof
2. For e xample
,s upp oset he organizati
on e x
pectst o ha ve 200 ne twor ks
.
Sup ernett
ing cana ssi
gnt heor gani
zation ab l
ock of256 c ontigu- ousclassC
numb er
s.
Althought hef irs
ti nte
ndedus eofCI DRi nvol
vedb l
ocksofc l
assCa ddress
es,
thede si
gnersr eal
izedt hatCIDRc ouldbeappliedinamuc hb r
oaderc onte
xt.The y
en-vi
s i
onedahi era r
chicaladdres
singmode lin whi c
he achc omme rci
alInternet
Servi
cePr ovider(ISP)c ouldbeg i
venal ar
g eb l
ockofI nter
neta ddress
esthatt he
ISPc ouldthe nall
oc atet osubscr
ibers.Be
c a
us eitp e
rmitsthene tworkp re
fixt o
occurona na rbi
-traryb itboundary,CIDRa l
lowsa nISPt oassi
gne achsubscr
iber
ablockofa ddres
se sappropri
atetot hesubscr
ibersneeds
.
Likes ubneta ddressi
ng,CI DR usesa32- bta
i ddressmas kt os peci
fyt he
boundaryb e t
we enp r
e f
ixa nds uffi
x.Cont i
guous1b i
tsint hema s
ks peci
fyt he
si
zeoft hep ref
ix,a nd0 b it
si nt hema skc orres
pondt ot hes uffi
x.Atf i
r s
t
gla
nc e,a CI DR ma ska p p
earst ob eidenti
calt oas ubnet ma sk.The ma jor
dif
fe re
ncei sthataCI DRma s
ki snotme rel
yk nownwi thinasite.Instead,aCI DR
masks peci
fiesthes i
zeofane tworkp re-
fix,andt heprefixi
sk nowng lobal
ly.For
examp l
e,sup pos
ea nor gani
zati
oni sassi
gnedab l
ockof2048c ontig
uousa ddres
s e
s
starti
nga ta ddress128.211.
168.0.Thet abl
ei nFigure5. 8li
stst heb i
naryv al
ues
ofa ddres
sesint herang e
.

Dotte
dDe ci
mal 32-bi
tBinaryEquiva
lent
Lowe s
t 128.
211.
168.
0 1
000000011010011101
0100000000000
Highes
t 128.
211.
175.
255 100000001101001
1101011
1111
111
111

Fi
gur
e 5.
8 An e x
ampleIPv4 CIDR bl
ockt hatc ont
ains 2048 host
addre
sses
.Thet a
bleshowsthelowestandhighestaddres
ses
intherangeex
-pres
sedasdott
edde c
ima
la ndb i
naryval
ues.

1
1
Beca
use2048 is2 ,e l
eve
nb it
sa r
ene ede
df orthehos tp or
tion ofan
a
ddres
s.ThatmeanstheCIDRaddr
essmaskwil
lhave21bi
tss e
t(i.e
.,thedivi
si
on
s
t
b
etweennetworkpre
fixandhos
tsuffi
xoccur
sa ft
erthe21 b i
t).Inbinar
y,the
a
ddres
sma s
kis:

1
111
111
111
111
1111
111
1000 00000000
82 I
nte
rne
tAddr
ess
ing Chap.5

5.
11I
Pv4Addr
essBl
ocksAndCI
DRS
las
hNot
ati
on

Unli
ketheorigi
nalcl
a s
slessscheme,CIDRa ddress
esa r
enots elf
-identif
ying.
Fore xampl
e,ifar outere ncountersaddre
ss1 28.21
1.1
68.1,whic
hi soneoft he
address
esint heexampleb lock,ar outercannotk now thep os
iti
onwhe ret he
boundaryliesunl
essexterna linf
ormati
oni spr e
sent.Thus,whe nconfiguringa
CIDR b l
ock
,ane t
wor k ma nagermus tsuppl
yt wo pie
cesofi nformation:t he
star
tingaddres
sanda naddre ssmaskthattel
lswhichb i
tsareinthep r
e f
ix.
As noteda bove, us
ing binary or dotted deci
ma lfor a maskisb ot
h
i
nconveni
e ntande rr
orp rone.The re
fore,CIDRs peci
fi
esthatama nage
rs houl
d
uses l
ash notati
on tos peci
fyt he ma sk.Synt
actica
ll
y,the format
,whi chi s
someti
me scal
ledCIDRnot ati
on,c onsi
stsofas tar
tingaddres
sindotteddecimal
fol
lowedb yama sksizeins l
ashnot a-t
ion.Thus
,inCI DRnotati
on,theb l
ockof
addres
sesinFigure5.8isexpres
sed:

1
28.
211
.168.
0/21

whe
re/21de
not
esa
naddr
essma
skwi
th21b
itss
ett
o1.

5.
12ACl
ass
les
sIPv
4Addr
ess
ingExa
mpl
e

Thet abl
ei nFi gure5. 8i l
lus tratesoneoft hec hi
efa dv antagesofc lass
les
s
address-
ing :comp let
ef lexib
ili
tyi na l
locatingb l
oc ksofv ar
iouss i
zes.Whe nus i
ng
CIDR,t he ISPc anc hoos et oa s
signe achc ustome ra na ddressb l
oc k of an
appropri
a tesize( i
.e.,thes i
zet hec ustome rneedsr ounde dt ot hene are s
tp ower
of2) .Ob s
e r
vet hataCI DRma kofNb
s itsde fi
nesa na ddressb l
ockof32Nhos t
addresse
s .Therefo re
,as malle
ra d-dressb lockhasal ongerma s
k.Ift heI SPowns
aCI DRb l
ockofN b its
,t heI SPc anc hoos etoa ssignac us
t ome ra nyp i
e ceofi t
s
addresss paceb yus ingama skl ongert ha nN b its.Fore x amp l
e,i ft heI SPis
assi
gned1 28.211.0.0/1 6,t heI SPma yc hooset og iveoneofi t
sc ustome rsthe
2048a ddr essint he/21r anget hatFi gure5. 8sp eci
fies.Ift hes ameI SPa l
sohas
as ma l
lc ustome rwi th onlyt wo c omp uters,t he I SP mig htc hooset oa ssi
gn
anotherb lock128. 21
1.1
76. 212/30,whi chc overst hea ddressr anget hatFigure
5.9
sp
e ci
fi
e s.

Dotte
dDe ci
mal 32-b
itBina
r yEqui
val
ent
Lowest 128.
211.
176.
212 1
00000001 1
010011101
1000011
010100
Highe
st 128.
211.
176.
215 100000001101
00111011
00001101
0111

Fi
gur
e5.
9Ane
xamp
leI
Pv4CI
DRb
loc
k,1
28.
211
.17
6.21
2/30.

Onewaytot hi
nka boutcl
ass
les
sa ddre
ssesisasifeachcustomerofanISP
obta
insa(var
iabl
e-l
ength)sub
netoft heISPsCIDRbloc
k.Thus,ag i
venbl
ockof
addr
e s
sesc
anb esub
div
idedona narbi
trarybitbounda
ry,andar oute
rattheISP
c
anb econfi
g-ur
edtofor
war
dcor
rec
tlyt
oea
chs
ubdi
vi
si
on.Asar
esul
t,t
he
g
roupofcomputer
sona

Thet ab
lei
nFi
gur
e5.
7onp
age80s
umma
rize
sal
lpos
sib
lev
alue
sus
edi
nsl
ash
nota
tion.
S
ec.5.
12 ACl
ass
les
sIPv
4Addr
ess
ingEx
amp
le 83

gi
v ennetworkwillbea ss
igneda ddr
e s
sesinac onti
guousr ange
,b utt herange
doesnotne edt
oc orres
pondt otheol dcla
ssA,B,andCb oundari
es.Ins
t e
ad,the
schemema kess
ubdiv
isi
onf l
exibl
eb ya l
lowi
ngonet ospeci
fyt heexactnumb e
rof
bi
t stha
tc or
res
pondt oap ref
ix.Tos umma r
ize
:

Class
lessIPv4 address
ing,whic
hi snow us ed thr
oughout the
Internet,ass
ignseachI SPaCI DR bl
ockandal l
owst heISPt o
parti
tionad-dres
sesintoconti
guoussubbl
ocks,wherethelowest
addressinas ub-
blockstar
tsatapoweroft woandt hesubbl
ock
containsapoweroft woaddress
es.

5.
13I
Pv4CI
DRBl
ocksRe
ser
vedForPr
iva
teNe
twor
ks

How shoulda ddressesb ea ssigne donap ri


vat
ei ntranet( i.
e.,ona ni nternet
thatdoesnotc onne ctt ot heglob alI nte rnet )?Int he ory,a rb
itra r
ya ddr e ss
esc an
beus e
d.Fore xa mple,ont heg lob alI nterne t ,theI Pv 4a ddressb l
ock9. 0.0.0/8
hasbeena ss
igne dt oI BM Cor por ation.Al thoug hpriva teintranetsc ouldus eI BMs
addres
sb l
ocks,e x-perienc ehass hownt ha tdoi ngsoi sda ngerousb eca usep ackets
tendt oleako utont ot heg l
ob a lI nterne t,a ndwi lla ppeart oc omef rom v ali
d
source
s.To a voidc onflic t
sb et we ena ddr e ssesus ed on p rivatei nt rane t
sa nd
addres
sesusedont heg lob alI
nt e rne t,t heI ETFre serveds everala ddre ssp refi
xes
and recomme ndsus i
ng t hem on p rivatei ntranets.Col - l
ectiv
ely,t he r eserved
prefi
xesa rek nowna sp r i
vat
eaddr ess
esornonr out ablead- dresses.Thel atter
termisus edb ecaus et heI ETFp r ohib i
tsp a cketstha tus ep ri
va tea d-dr essesf r
om
appeari
ng on t heg l
obalI nterne t.I fap a cketc ont ai
ning oneoft hep r
ivate
addres
sesisa ccident al
lyf orwarde dont ot heg l
obalInt ernet,ar outerwi lldetect
theproblema nddi s
c a
rdt hep acke t.
Whe nclas
sle
ssa ddres
singwa sinve
nted,t hesetofr es
erve
dI Pv4p re
fix
e swas
redefi
neda nde xtended.Fi gure5.10lis
tst hev al
uesofp ri
vatea ddres
sesus i
ng
CIDR notation aswe llast hedot tedde c
ima lval
ueoft helowesta ndhi ghe
st
address
esint heb l
ock.Thel as
ta ddre
ssb l
oc kint helis
t,169.254.0.0/1 6,is
unusualbecauseiti susedb ys yst
emst hata utoc
onfigur
eI Paddresses
.Although
autoconfi
gurati
oni ss e
ldom us edwithIPv4,al a
terc ha
pterexplai
nshow i thas
becomea nintegralpartofI Pv6.

Pr efi
x LowestAddr es
s HighestAddr es
s
1
0.0.0.0/8 1
0.0.0.0 10.255.255.255
1
72.16.0.0/12 1
72.16.0.0 172.31.255.
255
1
92.168.0.0/16 1
92.168.0.0 192.168.255.255
1
69.254.0.0/16 1
69.254.0.0 169.254.255.255

Fi
gure 5.
10 The pr
efi
xesr
ese
rv e
df or us
e withp r
iva
te
i
ntra
nets not c
onnect
-edtot he g
lob
alI nt
ernet
.I fa
dat
agr
am se
nt t o one of t
hes
ea d-
dres
sesa
cci
dent
all
y
re
ache
stheInt
ernet,anerr
orwil
lre
sul
t.
84 I
nte
rne
tAddr
ess
ing Chap.5

5.
14TheI
Pv6Addr
ess
ingS
che
me

Wes ai
dt hateachI Pv6addressocc
upie
s1 28 bits(16 oc
te t
s )
.Thel a
rge
a
ddressspaceg uar
anteest ha
tI Pv6 c
an t oler
a t
ea ny reasonableaddres
s
a
ssi
gnmentscheme.Inf a
ct,ifthec ommuni
tyde c
idestoc hang
et headdr
essi
ng
s
cheme la
ter,t he addres
ss pac
ei ssuff
ici
e ntl
y l a
rget oa ccommodatea
r
eass
ignme
nt.
Itisdi f
ficultt oc ompre hendthes izeoft heI Pv6a ddresss pac
e.Onewa yt o
l
ooka ti trelat
e st hema gnitudet ot hes izeoft hep opulati
on:t headdr essspaceis
solarget hate v e
r yp ersono nthep lane tca nha ves uffic
ienta ddresse stoha ve
thei
rowni nternett hreetime saslar gea sthec urrentI nterne t.As ec ondwa yt o
thi
nkofI Pv6a ddr essi
ngr elatesitt ot hep hys i
cals pacea va il
abl
e:t hee ar
ths
8
surf
a c
eha sa pprox i
ma tey 5.
l 11 0 s qua rek il
ome te
rs,me a ningt ha tt herea re
24
over1 0 addr essesp ers qua reme te roft hee arthss urface.Anot he rwa yt o
understandt hes izer elate
si tt oa ddre sse xha ustion.Fore xa mp l
e,c onsiderhow
1
28
l
ongi twoul dta ket oa ss
igna l
lposs
ib l
ea ddresse s.A1 6-octeti nt e
gerc a nhold2
38
val
ues.Thus ,t he a ddresss paceisg r eatert ha n 3.4 1 0 .I fa ddr ess
esa re
ass
igneda tther ateofonemi l
li
ona ddr ess
e se verymi crosecond,i twoul dt ake
20
over10 year st oa ssi
gna l
lp ossi
bl
ea ddr ess
es .

5.
15I
Pv6Col
onHe
xade
cima
lNot
ati
on

Al
thoughi tsol
vest hep robl
em ofha v
ing i
nsuffi
cientcapaci
ty,thel arge
addr
e s
ssizeposesani nteres
tingne wp rob
lem:huma nswhoma nagetheInternet
mustr ead,enter,andma ni
pulates uc
ha ddres
ses.Obviousl
y,b i
narynotat
ioni s
untenabl
e.The dotted de ci
ma lnot at
ion usedf or I
Pv 4 doesnot makeI Pv
6
addr
e s
sessuffi
cie
ntl
yc om-pacte it
her.Tounde rs
t a
ndwhy,c onsi
derane x
a mple
128-
b i
tnumbe rexpr
e s
se dindot -
tedde c
imalnotat
ion:

1
04.
230.
140.
100.
255.
255.
255.
255.
0.0.
17.
128.
150.
10.
255.
255

Tohel
pma kea ddres
sesslight
lymor ecompactande as
iertoe nt
er,theI Pv6
des
ignersc
reatdc
e olonhexadecimalnotati
on(abbr
evia
tedc ol
onhex)inwhi c
ht he
val
ueofe ach16-bi
tqua nti
tyi sr e
pr e
sent
edinhe xa
decimalsepar
atedbyc olons.
Fore xa
mpl
e,whe nthev al
ues howna boveindot
tedde c
imalnotati
onistr
a nsl
a te
d
tocolonhexnotat
iona ndpri
nt edusingthesamespaci
ng,itbecomes:

68E6:
8C64:
FFFF:
FFFF:
0:1
180:
96A:
FFFF

Col
onhexnot a
tionhastheobv
iousadva
ntageofr equi
ringfewerdi
git
sa nd
f
ewersepar
atorcharac
terstha
ndotteddeci
mal.Inaddi
t i
on,col
onhe xnotat
ion
i
ncl
udestwotechni
questhatmakei
te xtr
emelyusef
ul.Firs
t,col
onhe xnotat
ion
a
lowsze
l rocompress
ioninwhichastri
ngofrepeat
edze rosisre
plac
edbyap ai
r
ofc
olons
.Fore
x-a
mpl
e,t
hea
ddr
ess
:
FF05:
0:0:
0:0:
0:0:
B3
S
ec.5.
15 I
Pv6Col
onHe
xade
cima
lNot
ati
on 85

c
anb
ewr
itt
en:
FF05:
:B3

Toe nsuret ha
tze roc ompres
sionp r
oducesanuna mbiguousi nte
rpretati
on,
thes t
an-da r
dss pec
ifyt ha
ti tc anb ea ppl
i
edonly onceina ny addres
s.Ze ro
compressi
oni sespe-c
ial
l
yus e
fulbecauset heIPv6ass
ignmentswi llcreat
ema ny
addres
sest hatcontai
nc on-ti
guouss tr
ingsofzeros
.S eco
nd,c olonhe xnot a
tion
inc
orporatesdotteddecimalsuf-f
ixes;suchcombi
nati
onsa reintendedt ob eused
duri
ngt het rans
iti
onf rom IPv4toI Pv6.Fore x
ample,thef ol
lowings t
ringisa
val
idcolonhe xnotati
on:

0:
0:0:
0:0:
0:1
28.
10.
2.1

Notethatalthoughthenumb erssepara
tedb ycolonse a
chspeci
fythev a
lue
ofa1 6-b
itquanti
ty,numbersinthedott e
dde c
imalportioneachspe
cif
ythev a
lue
ofoneoc -t
et.Ofc our
se,zer
oc ompres
sioncanb eus
e dwi ththenumberabov
et o
produceanequiv
alentcol
onhexs t
ringthatlooksqui
tes i
milartoanIPv4addres
s:

:
:128.
10.
2.1

Fi
nal
l
y,IPv6exte
nds CIDR-l
i
ke notat
ion b
ya l
lowing anaddr
esstob e
f
oll
owedbyas
las
handaninte
g e
rthatspe
cif
iesanumb
e rofbit
s.Forexa
mpl
e,

1
2AB:
:CD30:
0:0:
0:0/
60

sp
ecif
iesthefi
rst60b
itsoft
hea
ddr
esswhi
chi
s12AB00000000CD3i
n
hexa
decimal
.

5.
16I
Pv6Addr
essS
pac
eAs
signme
nt

Theque s
tionofhow t op ar
titiont heI Pv6a ddre ssspaceha sge nera
tedmuc h
dis
- c
ussi
on.The rear etwoc entralissues:howhuma nsma nagea ddressassi
gnment
andhow r outersha ndl
et hene cessaryf orwa rdingt a bles
.Thef irs
ti ss
uef ocuses
ont hep rac-t
icalprob l
em ofde v
isingahi era rchyofa uthority.Unli
k ethec urre
nt
Internet,whic husesat wo- l
evelhi erar
chyofne twor kp r
e f
ix( a
ssignedbya nI SP)
andhos ts uffix( as
- s
ignedb ya nor ganization),t hel argea ddresss p
acei nIPv 6
permitsamul ti
-levelhierar-chyormul tipl
ehi e r
a rchies.La rgeISPsc anstartwit h
l
a r
g eblocksofa ddr es
sesa nda s
- si
gns ub bl
ock st os econd-levelISPs,whi chca n
eacha ss
igns ub bl
ocksf rom t hei
ra l
loca-ti
ont ot hird-levelISPs,a nds oon.The
secondissuef ocusesonr outere ffici
ency,a ndwi llbee xpl
ainedlater.Fornow,i t
issuffi
cientt ounde rs
t a
ndt hatar oute rmus te x a
m- i
nee achda tagram,s othe
choiceofa ssi
gnme ntc ana ffectthewa yr out e
r sha ndlef or-wa r
ding.

TheI
Pv6a
ddr
esss
pac
eha
sbe
endi
vi
dedi
ntob
loc
ksofa
ddr
ess
esa
nal
ogoust
o
t
heorigi
nalc
la s
sfulsc
hemeuse
dwi thIPv
4.Thefir
s t8bi
tsofa na
ddr
essare
s
uff
ici
enttoidentif
ythebas
ictyp
es.Li
keIPv
4cla
ssfula
ddr
ess
ing
,IPv
6doesnot
p
art
iti
onthea d-
86 I
nte
rne
tAddr
ess
ing Chap.5

dr
essspac
eint
oequa
l-s
izes
ect
ions
.Fi
gur
e5.
11l
i
stst
heI
Pv6p
ref
ixe
sandt
hei
r
mean-
ing
s.

BinaryPre
fix TypeOfAddr e
ss Fr
act
ionOfAddr e
ssS
pac
e
00000000 Re se
rve d( I
Pv4c ompati
bil
it
y) 1
/256
00000001 Una ss
igned 1
/256
0000001 NS APAddr e
sses 1
/128
000001 Una ss
igned 1/64
00001 Una ss
igned 1/32
0001 Una ss
igned 1/16
001 GlobalUni cast 1
/ 8
010 Una ss
igned 1
/ 8
011 Una ss
igned 1
/ 8
100 Una ss
igned 1
/ 8
101 Una ss
igned 1
/ 8
110 Una ss
igned 1
/ 8
1110 Una ss
igned 1/16
11110 Una ss
igned 1/32
111110 Una ss
igned 1/64
111111
0 Una ss
igned 1
/128
111111
100 Una ss
igned 1
/512
111111
1010 Link-Loc alUnic
astAddresses 1/1
024
111111
1011 IANA-Re serve
d 1/1
024
111111
11 Mul ti
ca s
tAddr esse
s 1
/256

Fi
gur
e5.
11Pref
ixesusedt
odivi
detheIPv
6addr
esss
pac
eint
obl
ock
sand
t
hep urpos
eofea
chb l
ock
.

Asthef i
gureshows,only1 5% oft headdre
ssspacehasbeena s
signed.The
I
ETF willuset he remai
ning porti
onsa sde mand gr
ows .Desp
itet he spa
rse
a
ssi
gnment,ad-dres
seshaveb e
enc hosentoma kep r
ocess
ingmoreeffi
c i
ent.For
e
xample
,t hehi
gh-orderoct
e tofana ddressdi
sti
ngui
shesbetwe
enmulticast(al
l1
b
its
)andunicas
t( amix-t
ureof0 sand1s)
.

5.
17Emb
eddi
ngI
Pv4Addr
ess
esI
nIPv
6ForTr
ans
iti
on

Toe nabl
et ra
nsit
ionf r
om I Pv
4t oIPv6,t hedesigner
sha veal
loca
tedas mal
l
frac
- ti
onofa ddress
esint heIPv 6spa
cet oe ncodeI Pv4addres
ses
.Fore xampl
e,
anya ddres
sthatb egi
nswi th80ze robi
tsf ol
l
owe db y1 6bit
sofa l
lonescontai
ns
anI Pv4a ddres
si nthel ow-order32 bi
ts.I na ddi
tion,as etofa ddre
ssesare
res
erv e
df orusewi ththeS tat
e- l
essI
P/ICMPTr ans
lati
onpr ot
ocol(SI
IT).Fi
gure
5.1
2i l
lustr
atesthetwof orms.
S
ec.5.
17 Emb
eddi
ngI
Pv4Addr
ess
esI
nIPv
6ForTr
ans
iti
on 87

Embedding a
nI Pv4a ddr
e ssina nIPv6a ddresswil
lbe used duri
ng the
trans
iti
onf rom I
Pv4t oI Pv6f ortwor e
asons.Fir
st,ac o
mputermayc hoos
et o
upgradef r
om IPv4t oI Pv6s oftwarebefor
ei thasb e
ena s
sig
nedav al
idIPv6
address
.S ec
ond,ac omp uterr unni
ngIPv6s oft
wa remayneedt ocommunicate
withac omputertha
tr unsonlyI Pv4sof
twa r
e.

32
64zer
obi
ts 1
6bi
ts 1
6bi
ts bi
ts
0000.. .... .......0000 0000 FFFF I
Pv4Addr
ess
0000.. .... .......0000 FFFF 0000 I
Pv4Addr
ess

Fi
gur
e5.
12Twowaystoe
mbeda
nI Pv
4a ddre
ssi
na nI
Pv6addr
ess
.The
sec
ondfor
misus
edforStat
ele
ssIP/
ICMPTra
nsl
ati
on.

Hav
ingawa ytoemb e
da nIPv
4a ddr
essina nIPv6addre
ssdoe snotsolvethe
p
robl
em of making the two versi
ons inter
operat
e.I na ddit
ion toa ddres
s
e
mbeddi
ng,pa
ckettransl
ati
onisneededt oconvertbetweenIPv4andI Pv6p ac
ket
f
ormats
.Wewi l
lundersta
ndt heconvers
iona f
terlaterchap
t e
rse xp
lai
nt het wo
p
acketfor
mats
.
Itma ys e
e mt hatt rans l
ati
ngp r
otocoladdress
e sc oul df a
ilb eca
us ehi g
he r
l
a yerp ro-t
ocol
sv erifyaddr essinte
g ri
ty.Inp art
icul
ar,wewi l
lseet hatTCPa nd
UDPc he ck
sum c omp utati
onsus eap seudo-
headert hati ncludest heI Ps ourcea nd
de s
tina ti
on addr ess
e s.Asar esul
t,i twoul dseemt ha tt r
ansl
a tinga na ddre s
s
woul di nval
idat
et hec hecksum.Howe ver,thed e
signersp l
a nnedc ar eful
lyt oa l
low
TCPorUDPona nIPv 4ma chinet ocommuni ca
tewi tht hec orr
espondi ngt ransport
protoc olona nI Pv6ma c
hine .Toa voidchecks
um mi sma tch,t heI Pv 6e ncodingof
anI Pv 4a ddressha sb e
enc hosensot hatt he16-bitone sc omp leme ntc hecksum
forb otha nIPv 4a ddres
sa ndt heI Pv6e mbeddedv e rsion oft hea ddr essa re
identical.Thep ointi s
:

In addit i
on toc hoos i
ng technic
aldet ai
lsof a new I nternet
Protocol,theI ETFwor konI Pv6hasf ocusedonf i
ndingawayt o
transi
tion from thec urr
entpr otocolt othenew pr otocol.In
parti
cular,IPv6pr ov i
desawayt oembedanI Pv4addressinan
IPv6addr esssucht hatchangi
ngbet weent hetwof ormsdoesnot
affectt hepseudo-headerchecksumus edbyt r
ansportprotocol
s.

5.
18I
Pv6Uni
cas
tAddr
ess
esAnd/
64

TheI
Pv6s
che
mef
ora
ssi
gni
nge
achhos
tcomp
ute
rana
ddr
esse
xte
ndst
he
IPv
4s cheme.Ins
teadofdi
vidi
nganaddr
e s
sint
otwop a
rts(anet
workI Da nda
hos
tI D),anIPv6addr
essi
sdivi
dedi
ntothreec
onc
ept
ualpar
ts:aglob
all
y-unique
pre
fixusedto
88 I
nte
rne
tAddr
ess
ing Chap.5

i
dent
ifyas i
te,asub
netIDusedtodist
ing
uis
ha mongmulti
pl
ep hysi
calnetworks
a
tt he de
s t
inat
ionsit
e,and aninter
faceID usedt oident
ifyap artic
ula
r
c
omputerconnec
tedtothes
ubnet
.Fig
ure5.13il
l
ustra
testhepar
t i
ti
oning.

Nbi
ts 64Nbi
ts 64bi
ts
GLOBALROUTI
NGPREFI
X S
UBNETI
D I
NTERFACEI
D

Fi
gur
e5.
13Thedi
vi
sionofanIPv
6uni
castaddre
ssint
othre
econc
ept
ual
part
s.Theint
erfa
ceIDal
waysoccupi
es64bi
ts.

Notetha
tthethre
e -
lev
elhier
arc
hyf or
ma l
ize
stheide
aofs ubneta ddre
ssi
ng
f
rom IPv4.Unl
ik
es ubnett
ing
,howe ve
r,t he IPv6addres
ss tructur
ei s not
r
est
ric
tedtoasi
n-gl
esite.I
nstea
d,theaddres
ss t
ruc
tur
eisrecognize
dg lob
all
y.

5.
19I
Pv6I
nte
rfa
ceI
dent
ifi
ersAndMACAddr
ess
es

IPv6 use
sthe te
rmi nt
erf
aceident
ifi
er (
int
erf
aceID)ra
the
rthan hos
t
i
dent
ifi
ert oemp
has
izetha
tahos tc
anhavemultip
lei
nte
rfac
esa
ndmul
ti
pl
eI Ds
.
As t
he nexts e
c-ti
on s
hows
,IPv
4and I
Pv6s
har
ethe c
onc
ept
; onl
ythe
te
rminol
ogydi
ffer
s.
InFi gure5. 13,t helow-or der64b i
tsofa nIPv 6unicasta ddressidenti
fie
sa
speci
ficne twor ki nterface.TheI Pv6s uffi
xwa sc hosent ob el argee nought o
all
owaha rdwa re( MAC)a ddr
e sstob eus edast heuniqueI D.Aswewi l
ls eelat
er,
emb e
ddingaha rdwa rea ddressi na nI Pv6a ddressma k esfindingt heha rdware
addressof a c omp ut e
rt ri
v i
al.Of c ourse,t og uaranteei nteroper
a bi
li
ty,a l
l
comput erson a ne t work mus ta gre
et o uset he s a
me r ep res
entation for a
hardwar ea ddress.Cons e quently,t he I Pv6s tan-dardss pec
ifye xact
ly how t o
repres
e nt v ar
ious f orms of ha r
dwa rea ddr e
sses.I nt he s i
m- ple
stc as
e,t he
hardwar ea ddressi sp l
ace dd i
rectl
yi nt hel ow-orderb i
tsofa nI Pv6a d-dress
;
somef orma tsusemor ec omplext ransforma t
ions .
Twoe x
amp l
eswil
lhel
pcla
rifytheconcept .IEEEde f
inesastanda r
d64- bi
tg l
o
-bal
ly uniqueMAC a ddre
ssformatk nown a sEUI - 64.Theonl yc hangene ede
d
whenus -inga nEUI-64addr
essina nIPv6a ddressc onsi
stsofinv ert
ingb i
t6i n
thehigh-orderoctetoftheaddres
s.Bit6i ndica
t eswhe therthea ddressi
sk nown
tob egloball
yunique.Amorec omple
xc hangei sr equiredforac onv enti
onal48-
bitEthernetaddres
sa sFi
gur
e5. 1
4ill
ustra
t es.
Ast hefigures hows,bit
sf r
om t heor i
ginalMACa ddre
s sar
enotc ontig
uous
i
nanI Pv6add ress
.I nst
ead,16b i
tswi thhexa deci
malv a l
ueFFFE16 areinse
rtedin
t
hemi d-dl
e.I na dditi
on,bit6,whi chi ndi
cat e
swhe thert headdr e
ssha sg l
obal
s
cop
e ,ischangedf rom 0t o1.Rema i
ningb i
tsoft hea ddres
s ,i
ncludi
ngt heg r
oup
b
it(l
a b
eledg )
,t heI Doft hecomp anyt hatma nufacturedt heinterfa
c e(l
abele
d
c
),andt hema nufacturer
sex-t
ensiona recopieda sshown.
S
ec.5.
19 I
Pv6I
nte
rfa
ceI
dent
ifi
ersAndMACAddr
ess
es 89

0 8 24 47
cc
ccc
c0gc
ccccccccccccc
cc e
xte
nsi
on

(
a)

0 8 24 40 63

cccccc1
gccccccccccc
ccccc
11111
111111
11110 e
xte
nsi
on

(
b)

Fi
gur
e5.
14(
a )Thef or
matofa48- bi
tEthe
rnetaddr
e s
s,withbi
tsthat
i
de nt
i-fyamanufa
cturerandext
ensi
on,and(b)theaddr
ess
whe np l
ace
dinthel ow-or
der64 bi
tsofa nIPv6unic
ast
address
.

5.
20I
PAddr
ess
es,Hos
ts,AndNe
twor
kConne
cti
ons

Tos impl
ifythedi scuss
ione arl
ie ri
nt hechapter,wes ai
dt hata nIPv4a ddress
i
de n-ti
fiesahos t
.Howe v
er,t hede sc
ripti
onisnots tr
ict
lya ccurate
.Cons idera
routert hata t
-tachest ot wop hysicalnetworks
.How c a
nwea ss
ignas ingleI P
addressi fe verya d- dre
ssi nclude s a networki denti
fiera s we l
la s a hos t
i
de ntif
ier?Inf a
ct,we c annot.A s i
mila
rs it
uat i
on exis
tsf ora c onvent i
onal
comp uterthatha st woormor ep hysi
calnet-workc onnecti
ons( s
uchc omp uters
arek nowna smul ti-homedhos ts)
.Ea choft hec omputer
sne tworkc onne ct
ions
mus tb eass
ignedana ddressthati dentif
iesane t
wor k.Theideai sfundame ntalin
bothI Pv4andI Pv6a ddressi
ng :

BecauseanI Paddressidenti
fi
esanet workaswellasahos ton
thenet work,anaddressdoesnotspeci
fyanindi
vi
dualcomputer
.
Ins
t ead,anaddres
sidenti
fiesaconnec
tiontoanetwork.

Ar outert hatc onnectstonne twor ksha snd i


sti
nctI Paddres
ses;onef oreach
networ kc onne c
t i
on.IPv6ma ke st hedi s
tincti
oncle
a rbyusingthet emi
r nterf
ace
address( i.e.,a na ddres
si sa ssigne dt ot heinterfacefrom ac omputert oa
networ k).ForI Pv6t hesit-uationi sevenmor ec omp l
exthanmul ti
pl
ene twork
connections:t oha ndlemigrationf rom oneI SPtoa nother
,I Pv
6s peci
fi
est ha
ta
givenint erfacec anhavemul ti
p l
ea d-dressesatthes ametime.Fornow,weonl y
needt ok ee pinmi ndthate a
c ha ddr essspeci
fi
esane tworkconnect
ion.Chapter18
willconsidert heissuefurther.
90 I
nte
rne
tAddr
ess
ing Chap.5

5.
21S
pec
ialAddr
ess
es

BothIPv
4a nd I
Pv6 hav
es p
e ci
ali
nte
rpr
etati
onsf orsomeaddres
ses
.For
e
xample
,aninter
netaddr
esscanrefert
oane tworkaswe l
lasahost
.Thenext
s
ect
ionsde
scr
ibehowthetwovers
ionsha
ndl
especi
aladdr
e s
ses
.

5.
21.
1IPv
4Ne
twor
kAddr
ess

Byconve
ntion,inIPv
4,hos
tI D 0isnev
erass
igne
dtoa ni
ndi
vi
dualhos
t.
Ins
tead,anIPv4a ddr
esswit
hzerointhehostp
orti
onisus
edtorefe
rt othe
networki
tse
lf.

AnIPv4addres
sthathasahos
tIDof0i
sres
erv
edt
oref
ert
o
thenet
-work.

5.
21.
2IPv
4Di
rec
tedBr
oadc
astAddr
ess

IPv4inc
l sadi
ude r
ec t
edbroadcas
taddres
sthatissome
timesc
all
edanetwork
br
oadcas
taddres
s.Whenus e
dasade sti
nat
ionaddre
ss,itref
erst
oa l
lcomput
ers
on anetwork.Thestandardspec
ifi
esthatahos ti
d ofall1sisres
erve
df or
di
rec
tedb
roa
d-c
ast
.
Whe nap ac k
e tiss entt osuchana ddr
ess,as ingl
ec opyoft hep acketis
t
ransf
erredacrosst heinternetfromthes ourc
et othede st
ination.Routersalong
t
hep athuset hene tworkp orti
onoft hea ddresswi t
houtl ookingatt hehos t
p
orti
on.Oncet hep acketr eac
hesar oute rattac
hedt ot hef inalnetwork,t he
r
outerexamine
st hehos tporti
onoft hea ddres
sa ndifitf i
ndsa ll1
s,ther outer
b
roadcas
tsthep ackett oa l
lmachi
nesont hene t
wor k
.
On some net workt e
chnolog
ies( e
.g.
,Et hernet
),t he under
lyi
ng hardware
s
upport
sb roadc
asting.Onot hertechnol
ogi
es,softwareimplementsbroadc
a s
tb y
s
endi
nga nin-di
vidualcopytoe ac
hhos tont henetwork.Thep oi
ntisthatha vi
ng
a
nI P direct
e db roadc
asta ddres
s does not guarant
eet hat deli
very wil
lb e
e
ffi
cie
nt.Ins umma ry,

IPv4support
sdi
rectedbroadcasti
nwhi c
hapac ketissenttoal
l
com-puter
sonas peci
fi
cnet work;har
dwarebroadcas
ti sus
edif
avai
l
able.A dir
ected broadcas
t addr
ess has a val
id net
work
port
ionandahosti
dofall1 s.

Dir
ectedbroadca
sta ddres
sesprovi
deap owerf
ulandda
ngerousme chanis
mb e
-
causeana rbi
tra
rys e
nde rcantransmitasi
ng l
epacke
ttha
twi l
lb ebroadcaston
t
hespecif
iednetwork.Toa voidpotenti
alp
roblems,manys
ite
sc onfi
gurer oute
rs
t
or e
jectalldi
rect
edb r
oa dc
astpackets
.
Anearl
yrel
eas
eofTCP/I
Pc odet ha
ta cc
ompani
edBe r
kele
yUNIXinc
orrec
t l
yusedahos
tidofa
ll
zer
oe sforbr
oadc
ast
.Bec
ausethee r
r orsti
lls
urvi
ves
,TCP/IPs of
twa
reofte
ni ncl
ude
sanopti
onthat
al
l
owsas i
tetous
eahos
tidofallzeroesfordir
ect
edb r
oadcas
t.
S
ec.5.
21 S
pec
ialAdd
res
ses 91

5.
21.
3IPv
4Li
mit
ed(
Loc
alNe
twor
k)Br
oadc
astAddr
ess

Ina dditi
on tone twork-sp
ecificbroadcas
ta ddressesde s
cribeda bove,IPv4
supportsl i
mitedbr oadcasti
ng,some ti
mesc al
le
dl oc
alne tworkb roadcast
.Al imit
ed
broadcast me a
ns a p acketi sb roadcas
ta crosst he localne twork.The l ocal
broadcasta ddresscon-sist
soft hirty-wo1
t s(hence,itiss ometi
me sc al
l
e dtheall
1sb r
oa dca s
ta ddress).Aswewi llsee,ahos tca n uset hel i
mitedb roadcas
t
addres
sa ts tart
upb e
foret hehostl ea
rnsitsIPa ddressort heI Pa ddressofthe
network.Onc et hehos tl ear
nst hec orrectIPa d-dressf orthel ocalne twork,
dire
ctedb roadcas
ti spreferre
d.
Tos umma ri
ze:

AnI Pv4li
mitedbroadcas
taddres
sc onsi
stsofthi
rty-two1bi t
s.A
packetsentt othel i
mitedbroadcastaddres
swi llbebroadcas
t
acrossthelocalnetwork,andc anbeus edats tartupbeforea
computerlearnsi
tsIPaddress
.

5.
21.
4IPv
4Sub
netBr
oadc
astAddr
ess

I
fas i
teusess
ubnetti
ng,I Pv
4 de
fine
sac or
resp
onding s
ubnetbr
oadcas
t
addr
ess.A s
ubne
tbroadc
asta ddres
sconsi
stsofa networkprefi
x,a sub
net
numb
er,a
nda
ll1
sint
hehos
tfi
el
d.

As ubnetbroadcastaddressisused t
o broadc
aston a s i
ngle
net
wor kwi
thinas i
tethatusess
ubnetti
ng.Theaddres
sc ont
ains
anetworkands ubnetpref
ixandhasal
l1sinthehostfi
eld.

5.
21.
5IPv
4Al
l-
0sS
our
ceAddr
ess

Anaddressthatconsi
stsofthir
ty-twoze robit
sisrese
r ve
df orcaseswherea
hostneedst ocommunicate,butdoe snotye tknow itsownI Pa ddress(i
.e.
,a t
sta
rtup).Inp ar
tic
ular,wewi l
lseet hattoob ta
ina nIPa ddres
s,ahos tsendsa
datagr
amt ot heli
mit-edbroadca
sta ddre
ssandus esaddre
s s0t oidenti
fyitsel
f.
Ther e
ceiv
erunde r
standsthatthehos tdoesnotye thavea nIPa ddr
e s
s,andt he
rece
iverusesaspecia
lme t
hodt osendar epl
y.

I
nIPv4,anaddr
esswitht
hir
t y-
two0bitsi
sus
edasatempor
ary
s
our
ceaddres
satstar
tupbeforeahos
tlear
nsi
tsI
Paddres
s.
92 I
nte
rne
tAddr
ess
ing Chap.5

5.
21.
6IPv
4Mul
ti
cas
tAddr
ess
es

Ina ddi
tiont o unicastdelivery,i nwhi chap acketisde l
i
veredt oas i
ngle
computer,andb r
oadcastdelivery,inwhi c
hap ac
ketisde l
iv
eredt oallcomputers
on ag iven net-work,t heI Pv4a ddressi
ngs chemes uppor
tsas peci
alform of
multi
pointde li
veryk nowna smul ticast
ing,i nwhichap ac
keti sdeli
veredtoa
spec
ifi
cs ubs
e tofhos ts.Cha pte
r1 5di scuss
esmul ti
cas
ta ddre
ssi
nga ndde l
iv
eryi n
detai
l.Fornow,i tiss uffic
ientt ounde r-standthatanyI Pv4addressthatbegins
withthree1b i
tsisusedf ormul tic
asting.

5.
21.
7IPv
4Loop
bac
kAddr
ess

Thene tworkp r
e fi
x127.0.0.0/8( aval
uefrom theorigi
nalcl
assArange)is
rese
rvedf orloopback,andi sint e
nde
df oruseintes
t i
ngTCP/ I
Pa ndforinter
-
proces
sc ommunicationont hel oc
alcomput
er.Byconvention,progr
ammersuse
127.
0.0.1f ortesti
ng ,buta nyhos tval
uecanbeus e
db e
causeTCP/IPsoft
wa r
e
doesnote xami
net hehos tportion.
Whena napplic
ations endsap ackettoa1 27a ddre
ss,theprot
oc ols
oft
wa rein
thecomp ute
ra cc
e ptst heout g
oingp ack
eta ndimme di
atel
yf e
edst hepack
etb ack
tot hemodul et hatha ndle
si ncoming pac
ke t
s,a sift hepacketj ustarriv
ed.
Loopbac
ki sre-s
tr i
ctedt oal ocaloperati
ngs yst
em;nop ac
ketwitha1 27a ddre
ss
shoul
de verapp
eari nt heI nter
net .

IPv
4r es
erv
es 127.0.
0.0 /8 for l
oopbacktes
ting;a pac
ket
des
tinedtoanyhos twithpr
efi
x127s tayswi
thi
nt hec
omputer
anddoesnottr
av elac
ros
sanetwor
k.

5.
21.
8Summa
ryOfI
Pv4S
pec
ialAddr
essConv
ent
ions

Fi
gur
e5. 15s ummarizesthespe
cialaddres
sesusedi
nI Pv
4.Asthenotesinthe
fi
guremention,t hea l0sa
l ddr
essisneveruseda sadest
inati
on,andcanonl
yb e
useda sasour c
ea ddre
ssdur i
nginiti
als t
artup.Onceac ompute
rl e
arnsitsIP
addr
e s
s,t
hema chinemus tnotuseall0sasas ource
.

5.
21.
9IPv
6Mul
ti
cas
tAndAnyc
astAddr
ess
es

Intheory,thec hoi
ceb etweenmul t
icastandbr oa
dcastisirr
elev
antb ecause
onec anbes i
mulate
dwi t
ht heot he r
.Tha tis,broadcas
tingandmul ti
casti
nga re
dual
sofonea nothert hatp r
ovidet hes amef unct
ionali
ty.Tounde rsta
ndwhy,
consi
derhow tos i
mu- l
ateonewi tht heother.Ifbr oa
dcastisavai
lab
le,ap acket
canb edeli
veredtoag r
oupb yb r oadca
stingtoa l
lma c
hine
sa nda rr
ang i
ngf or
soft
wa reone ac
hma chi
net ode cidewhe thert oacceptordi s
cardthei ncoming
packet
.I fmultic
asti sa va
il
able
,ap acketc a
nb ede li
veredtoa llmachinesb y
a
rra
ngi
ngf
ora
llma
chi
nest
oli
ste
nt hea
ot llnodesmul
-ti
cas
tgr
oup
.
S
ec.5.
21 S
pec
ialAdd
res
ses 93

a
ll0s S
tar
tups
our
cea
ddr
ess

a
ll1
s Li
mit
edb
roa
dca
st(
loc
alne
t)

ne
t al
l1s Di
rec
tedb
roa
dca
stf
orne
t
Networkaddre
ss
ne
t al
l0s Nonst
anda
r ddi
rec
tedbr
oadc
ast

ne
t s
ubne
t a
ll1
s S
ubne
tbr
oadc
ast

1
27 a
nyt
hing(
oft
en1
) Loop
bac
k

1
4 mul
ti
cas
tgr
oupI
D Mul
ti
cas
taddr
ess

Fi
gur
e5.
15S
umma
ryofI
Pv4s
pec
iala
ddr
ess
es.

Knowing t hatb roadcas


ting a nd multicasting aret heoreti
caldua l
sofone
anotherdoe snothe lpc hooseb et weent he m.I Pv6 desig
ne rsde c
idedt oav oi
d
broadcas
ta ndus eonlymul tic
a s
t.The r
efore,I Pv 6definesse ve
ralr e
servedset
sof
multic
astg roups.Fore xamp l
e,ifa nIPv6hos twa ntstob roadcastap acketthat
willreachr outersont heloc a
lne twork,t hehos ts endst hep ackettot hea ll
routersmult i
castgroup.IPv6a lsode fi
nesa na llhos t
smul ticas
tg roup(thepack e
t
i
sde li
veredt oa llhostsont hel oc alnetwor k)a nda na l
lnodesmul t
icastgroup
(thepacketisde l
ivere
dt oa l
lhos tsa ndallrout ers).
Tounde rsta ndwhyt hede s
igner
sofI Pv6c hosemul ti
ca stinga st hec ent ra
l
abst
r a
c-tioni nst eadofb r
oadcast
ing,considera ppl
icati
onsi nste a
dofl ooki
nga t
theunde r l
ying ha rdwa r
e.An a ppli
cati
on e i
therne edst oc ommuni c
at ewi tha
si
nglea p
plicationo rwi thag roupofa ppl
icati
ons.Dir e
ctc ommuni cati
oni sha ndled
bestv i
auni cast;g r oupc om-municati
onc anb eha ndle
de ithe rb ymul t
icastor
broadcas
t.I na nI nte r
net,g r
oupme mb ers
hipisnotr el
atedto( orr es
tric t
edt o)a
si
ngle net wor k g roup me mbersc anr es
ide ata rbit
ra ryl ocat
ions . Using
broadcas
tf ora llg roupc ommunicati
ondoe snots cal
ea crosst heg l
obalI nternet,
somul ti
casti st heonl yop ti
on.Ironic
a l
l
y,e vene ff
or tstoimp leme ntmul ti
caston
theg l
obalI nte r
ne tha v
ef ail
edsof ar.Thus,littl
eha sb eena ccomp li
shedb yI Pv6
multic
ast.
I
naddi
ti
ont
omul
ti
cas
t,I
Pv6i
ntr
oduc
esane
wtyp
eofa
ddr
essk
nowna
san
any-
cas
taddr
ess
.Anyc
asta
ddr
ess
ingi
sde
sig
nedt
oha
ndl
ese
rve
rre
pli
cat
ion.A
p
rovi
de rc an de
ploy a set of identi
calserve
rsa ta rb
itr
arylocat
ionsinthe
I
nternet.Allser
versi nthese tmus toffe
re xactl
yt hes
ameservi
ce,andalla
re
a
ssi
gnedt hesamea nycastad-dre
ss.Forwardi
ngi ssetupsotha
tap ackets
entto
t
hea nycastaddr
essg oestothene a
r es
tserve
r.
Anyca
staddr
ess
eswe
reor
igi
nal
l
yk sc
nowna l
ust
er
addr
esse
s.
94 I
nte
rne
tAddr
ess
ing Chap.5

5.
21.
10I
Pv6Li
nk-
Loc
alAddr
ess
es

I
Pv6de f
inesas e
tofp re
fix
e sforunicasta ddr
essestha
ta r
enotg lob
all
y
v
a l
i
d.I n-s
tead,thepref
ixesares ai
dt ob elocal
lyscopedort ohael
v i
nk-l
ocal
s
cope.Tha ti
s ,pac
ket
ss enttot hea ddr
esse
sa rer es
trict
edtotrav
elacrossa
s
ingl
ene twor
k .Thest
an-darddefine
sa nyIPv6a ddres
st hatb
egi
nswiththe10-
b
itb i
naryprefi
x:

1
1111
1101
0

t
ob ealink-l
ocaladdre
ss.Forexamp
le,whenac ompute
rboot
s,thecomput
er
f
ormsanI Pv
6a ddressbycombi
ningthel
ink
-loc
alpre
fixwit
haninte
rfac
eMAC
a
ddre
ssasdescri
bedabove.
Rout
e r
shonorl i
nk-l
ocalscopingrul
es.Aroutercanresp
ondt oali
nk-
loc
al
packetsentacros
sal ocalnet
wor k ,b
utar outernev
erforwardsapack
etthat
contai
nsal i
nk-
localaddr
essout s
idethespec
ifi
edscop
e(i.
e.,neverof
ftheloc
al
network)
.
Li
nk-l
ocaladdre
ssesprovi
deawa yforac omputertot al
kt oit snei
ghbor
s
(e.
g.,atstart
up)withoutdangerofpacketsb
eingfor
wa r
deda cr
osstheI nte
rnet
.
Wewi l
lsee,forexample,t
hatanI Pv6nodeusesali
nk-l
ocaladdres
sa tstar
tupto
di
scoverit
sne i
ghbor
s,incl
udi
ngt headdres
sofar out
er.Comp uter
sc onnec
tedto
anisol
atednetwork(i.
e.,anetworkthatdoesnothaveroute
r sattac
he d
)canuse
l
ink-l
ocaladdr
esse
stoc ommuni-c
a t
e.

5.
22We
akne
sse
sInI
nte
rne
tAddr
ess
ing

Embedding ne
tworkinfo
rmati
on ina ninte
rneta d
dressdoe
sha v
es ome
dis
advan-ta
g es
.Themostobvi
ousdi
sadvant
agei
sthataddres
sesr
efert
one t
work
connec
t i
ons,nottothehos
tcomputer:

I
fahostcomputermov
esfromonenet
wor
ktoanot
her
,it
s
i
nter
netad-
dres
smustchange.

IPv6tri
est
oa l
lev
iatetheprob
lembymaki
ngite
asie
rt ocha
ngeana ddr
es s
.
How-ev
er,thebas
icp r
oble
mr emains
.Cha
pte
r1 8di
scus
seshow theaddres
sing
sc
hemema k
esmobi
li
tydiffi
cul
t.
Awe a
knessoft heIPv 4schemea ri
sesfrom earl
yb indi
ng onc eap refi
xsize
ischosen,thema x
imum numb erofhos tsont henetwor kisfixed.Ifthene twork
growsb eyondt heorigi
nalb ound,ane wp refi
xmus tb es el
ect
e danda llhos
tson
thene t
wor kmus tb er enumb ere
d.Whi lerenumbering may s eeml i
keami nor
problem, changing net
wor ka ddres
sesc anb ei ncredibl
yt i
me -consuming and
diffi
culttode bug.IPv6s olvesthep robl
em ofne tworkg rowthb ya l
locati
nga n
absurdnumb erofb i
ts(64)t oas uffi
xt hatident
ifi
esahos t(ortob ep rec
ise
,a
ne
twor
kint
erf
ace
).
S
ec.5.
22 We
akne
sse
sInI
nte
rne
tAddr
ess
ing 95

The mos ti mp ortantf l


awi nt he int
e r
neta ddr e
ssing sche
me wil
lb ecome
apparentwhe nwee xamineforwa r
ding .Howe v
er,itsimp ortanc
ewa r
rantsab ri
ef
intr
oduc tion he re. We ha ves ug g
e ste
dt hatf orwa rding wil
lb eb as
ed on
desti
nationI nterneta d-dress
e s
.S pecifi
cal
ly,ar oute rwi llus
eap refi
xoft he
addres
st hati d
ent ifi
esade sti
na-tionne twork.Now c onsiderahostthathast wo
networ kc onnections.Wek nowt hats uchahos tmus tha vet woIPaddre
sses,one
foreac hint e
r f
ace .Thef ol
lowingistr ue:

Becaus
ef orwardi
ngus
est henetworkpor
tionoft
heIPaddres
s,
thepatht akenbypacket
st r
aveli
ngt oahostwi
thmul
tipl
eI P
addres
sesdependsont
headdressused.

Theimpl
ic
ati
onsaresurpr
isi
ng.Humansthinko feac
hhosta sasingl
eenti
tyand
wanttouseasingl
ename.Theya r
eoftens urp
ris
edt of
indthattheymustle
arn
morethanonena meande venmor esurp
r i
sedtof i
ndt ha
tp ac
k e
tssentusi
ng
mult
ipl
enamescanbeha
vediffer
entl
y.
Anot
hersurpri
si
ngc onsequenceoft heinte r
neta ddr
ess
ingsche
mei sthat
merelyknowi
ngoneI Pa ddr
e s
sf orade st
inationma ynotb es
uffi
cie
nt.Ifa
networkisdown,itma yb eimp os
sibl
etor ea
c ht hedest
inat
ionusi
ngas pe
cif
ic
addres
s.
Tounder
stand,cons
iderthee xa
mp l
einFigure5.16.

NETWORK1

I I I
1 2 3

R Hos
tA Hos
tB

I4 I
5
NETWORK2

Fi
gur
e5.
16Ane
x ampl
eoft wonet
workswi
thc
onnect
ionst
oarout
er,
R,conve
ntiona
lhos
t,A,a
ndamulti
-homedhos
t,B.

Int hefigure,hostsA a nd B b otha tt


a c
ht one two rk1 .Thus ,wewoul d
normall
ye xpetAt
c os e
ndt oBsa ddressonne t
wor k1 .S uppose,howe ver
,that
Bsconnecti
ont onetwork1b r
e ak
s( i
.e.,interf
a eI
c 3b e
c ome sdis
connected).IfA
tri
est ous eBsne t-
wor k1a ddress( i
.e.
,t hea ddr essf ori nterf
a eI
c 3,A will
concl
udet tBi
ha sdownb e caus
enop acketsgot hroug h.S ur pris
ingl
y,ifAs e
ndsto
theaddressforinterf
aceI 5,packetswillbeforwa r dedt hroug hr outerR,a ndwill
reahB.Tha
c tis,ana l
ternatep athe xi
stsfrom At oB,b utt hep a
t hwillnotbe
usedunlessthea l
ter
natea ddressissp e
cifi
ed.Wewi l
ldis cus sthep robl
emi nlate
r
chapter
swhe nwec onsi
derf orwardinga ndnameb ind-ing.
96 I
nte
rne
tAddr
ess
ing Chap.5

5.
23I
nte
rne
tAddr
essAs
signme
ntAndDe
lega
tionOfAut
hor
ity

Eac hnetwor kp re
f i
xus edint heg l
ob alInt e
r ne tmus tb euni que.Toe nsure
unique-ness,a l
lp r
efi
x esar ea ssi
g nedb y ac ent rala uthori
t y.Or igi
nall
y,t he
InternetAs s
ignedNumber sAut hority( IANA)hadc ontrolov ernumb ersassi
gned,
ands ett hep oli
cy.Fr om thet imet heI nternetb e ganunt ilthef al
lof1 998,a
si
ng l
eindivi
dua l
,t helateJonPos tel,rant heI ANAa nda ss
igneda ddres
ses.Inlate
1998,a f
terJon sunt i
mely death,ane w or gani za ti
on wa sc r
e ate
dt o handle
addressa ss
ignme nt.Na medt he I nternetCor -por ationf orAs si
gnedNamesand
Number s( I
CANN) ,t heor ga
nizations etsp oli
cya nda ssi
gnsv aluesf orna mesa nd
otherc onst
ant susedinp rotocol
sa swe lla saddres ses.
Mos ts i
test hatne e
da nInternetp refi
xne ve
ri nteractwi t
ht hec entral
authority direc
tly. Instead, an or g
a nizati
on usuall
yc ontract
s wi thal ocal
Internet Servic
e Pr ovid-er (I
SP).I na dditi
ont op rovi
ding physic
alne twork
connecti
ons,I SPsob t
ain av ali
da d-dr esspr e
fixfore ach oft hei
rc ust
ome rs
networ k
s.Ma nyl ocalISPsa re,inf act ,custo-mersofl argerI S
Ps whe na
customerr equestsa naddr e
ssprefi
x,t hel ocalISPmerelyobtai
nsap r
efixfrom a
lar
g erISP.Thus ,onl yt helarges
tI SPsne edt oc ontac
toneoft her egional
addressregistri
est hatI CANN hasa uthor i
zedt oadminis
terb l
ocksofa d-dresse
s
(ARIN,RI PE,APNI C,LACNI C,orAFRI NI C).
Not ehow de l
egationa ut horityp as
se sdownt heISPhi e ra
rchya saddr e
sses
area s-sig
ned.By g i
ving a b l
ock ofa ddress
est oar egi
ona lregis
try,I CANN
delegatesauthori-
tyf ort he ira ssi
gnment .Whe nitgivesas ubbl
ockt oama jor
ISP,ar egi
str
yde leg
a t
e saut horityf ora ss
ignment.Att helowe stl
evel,whe na n
ISPg iv
esp ar
t of i tsa l
l
oc a t
ion t oa n organi
zati
on, t he ISPg r
ant st he
organizati
ona uthori
tyt os ub di
videt hea ll
ocati
onwithint heor gani
zation.The
pointi sthatwhe n ab lockofa ddress
e sisa ll
oca
teddo wn t hehierarchy,t he
recip
ientr ec
eivesauthorityt os ubdivi
det heb l
ockfurt
her .

5.
24AnExa
mpl
eIPv
4Addr
essAs
signme
nt

Tocla
rifytheIPv
4a ddr
e s
singsche
me ,c
onside
ra nex
amp
leoft
wonetworks
a
tasi
te.Fig
ure5.1
7s howst hec onc
eptua
larchi
tectur
e:t
wonet
wor
ksc
onnect
ed
t
oanIS
P.
Thee x
amp l
es howsthreenetworksandt hecla
ssl
essnetworknumbersthe
y
haveb e
ena ssi
gned.TheI nter
netS er
vic
ePr ovi
der
sne tworkhasbeenassi
gne
d
9.0.
0.0/ 8.AnEt hernetatthesi
teha sbee
na ss
igned128.1
0.0.
0/16,a ndaWi -
Finetworka tthesitehasbe
ena s
sig
ned128.210.
0.0/16.
Fi
gure5. 18showst hesamene t
wor kswithhostcompute
r sattache
dt othe
networksa nd anI nt
er ne
ta ddr
essa ss
igne
dt oe ach ne
tworkc onnecti
on.The
fi
gureshowst hr
eehostswhi c
ha r
el a
beledMe r
li
n,Lancel
ot,andGue nevere.The
fi
gurealsos howstwor outer
s:R1connectstheEthe
rnetandWi -Finetworks,and
R2 c
onnectst hesi
tetoa nISP.
S
ec.5.
24 AnEx
amp
leI
Pv4Addr
essAs
sig
nme
nt 97

WI
-FI ETHERNET
I
SP
NETWORK R1 1
28.
10.
0.0/1
6 R2 9.
0.0.
0/8
1
28.
210.
0.0/16

r
out
ers

Fi
gur
e5.
17Ex
amplear
chi
tec
tureofasi
tewi
thI
Pv4a
ddr
essp
ref
ixe
sas
-
si
gne
dt otwonetwor
ks.

tMe
Hos rli
nhasc onne
ctionst oboththeEt hernetandt heWi -
Finetwork,so
i
tc anreachde sti
nationsone i
thernetworkdi rec
t l
y.Thedi st
incti
onbetweena
router(e.g., R1) and a mul t
i-homed hos
t( e.g., Merl
in) ari
sesf r
om t he
confi
gurat
ion:a r out e
ri sc onfi
g-ure
dt of or wardp ac
k e
t sbetweent he two
network
s;ahos tcanus eei
therne twor
k,butd oesnotf orwardp a
ckets
.

1
28.
210.
0.3
Me
rli
n La
nce
lot Gue
nev
ere

1
28.
10.
0.3 1
28.
10.
0.26 1
28.
10.
0.8

WI
-FI ETHERNET
NETWORK 1
28.
10.
0.0/1
6 I
SP
1
28.21
0.0.
0/16 R1 R2 9.
0.0.0/8

1
28.
10.
0.6 1
28.
10.
0.250

1
28.
210.
0.50 9.
0.0.
76

Fi
gur
e5.
18Theexampl
enet
workfr
omFi g
ure5.
17wi
thI
Pv4a
ddr
ess
es
as-s
igne
dtohostsa
ndrout
ers.

Ast
hef
igur
eshows
,anI
Paddr
essi
sas
sig
nedt
oea
chne
twor
kint
erf
ace
.
Lanc
elot
,whichc
onnec
tsonl
ytotheEt
herne
t,ha
sbeena
ssi
gne
d128.1
0.0.
26a s
i
tsonlyI Pa
d-dr
ess
.Be c
aus
eiti
sadual-
homedhos
t,Me
rli
nhasbeenass
igne
d
addres
s1 28.10.
0.3f ori t
sc onnecti
ont ot heEther
neta nd1 28.210.0.3fori ts
connecti
ont otheWi -Finetwork.Whoe vermadetheaddressa s
s i
gnme ntchosethe
samev al
uef orthehos tnumberine achaddress
.RouterR1alsoha stwoa ddres
ses:
128.1
0.0.6and1 28.21 0.0.
50.Notet hatthehostporti
onoft het woa ddress
esa r
e
unrel
ated.I Pp rotocolsdonotc arewhe th-eranyoft heb ytesint hedot t
ed
deci
ma lform ofac omputer
sa ddres
sesa rethesameordi ffere
nt .Howe ver,
networkt e
chnici
a ns,ma nager
s,anda dminis
trat
orsneedtoe nter
98 I
nte
rne
tAddr
ess
ing Chap.5

addre
sse
sf ormaintenance,test
ing
,a ndde bugg
ing
.Choos
ingt omak
ea l
lofa
machi
nesaddr
ess
e se nd withthes ame val
ue makesiteas
ierforhumanst
o
rememberorgues
st hea ddr
essofap a
r t
icul
arint
erfa
ce.

5.
25S
umma
ry

Eachc ompute rinaTCP/ IPi nterneti sassi


gnedauni queb i
na ryaddres
sc all
ed
anInter netProtoc oladdressorI Pa ddr es
s.IPv4us es32-bita ddress
eswhicha re
part
i-ti
one dintot woma i
np ieces:ap r ef
ixidenti
fiesthene twor kt owhicht he
computera t
-taches,andt hes uf fi
xp r
ov i
desauni queidentifi
e rforac omp uter
ont hatne t
work .Theor i
gi
nalI Pv4a ddress
ingschemei sk nowna sc l
ass
ful;a
pref
ixb elongstoo neoft hreep rimaryc l
asse
s.Laterv a
riati
onse xtendedtheI Pv4
addres
singme c
ha nism withs ub neta ddressi
nga ndc l
assl
essa ddressi
ng.Classle
ss
IPv4addr ess
ingus esab itma skt os peci-fyhowma nyb itscorrespondt oaprefix.
Toma kea ddres
sese a
sierf orhumanstounde rs
tand,syntact
icformshave
beenin-vente
d.I Pv4a ddr
essesa r
ewr it
tenindottedde c
imalnotati
oninwhic
h
eachoctetiswr i
ttenindecima l
,withtheval
uessep
aratedbydecimalpoi
nts
.IPv
6
addres
sesa re wr i
tteni nc ol
on hex notati
on, wit
h oc t
etsr epres
ent
edin
hexadec
imalseparat
edb ycolons.
IPaddr
essesref
erto ne
tworkconnect
ionsrat
hert hanindi
vi
dua
lhos
ts.
The
ref
ore
,ar oute
rormul
ti
homedhos
tha smulti
pl
eIPaddr
e s
ses
.
BothI Pv
4a ndIPv6incl
udespec
ialaddres
ses
.I Pv
4p ermi
tsnetwork
-speci
fi
c,
s
ubnet-s
pecif
ic,and loc
albroadc
asta swe llasmul ti
cas
t.IPv6 haslink-
loca
l
a
ddress
esa nd anyc
asta swellasmul t
icas
t.A s e
tofI Pv4pref
ixesha sbeen
r
eser
vedf oruseonp r
ivat
eintr
anets
.

EXERCI
SES

5.
1 How manyclasA,B,a
s ndCnetwor
k sc
ane xi
st?How ma
nyhost
scananet
workin
eac
hc l
assha
ve?Beca
refult
oal
l
owf orbroa
dcasta
swella
scl
assDandEa
ddres
ses
.
5.
2 I
fyoursi
teuse
sI Pv
4,f
indoutwha
tsi
zea
ddr
essma
ski
sus
ed.Howma
nyhos
tsd
oes
i
tper
mityoursi
tetoha
ve?
5.
3 Doesyoursi
tep
ermi
tIPv
4di
rec
tedb
roa
dca
stp
ack
ets
?(Thi
nkofawa
ytot
estb
y
usi
ngping
.)
5.
4 Ifyoursi
teus esIPv6,trysendi
ngap i
ngt
othea l
l
-nodesmul
ti
cas
taddr
ess
.How
manyres
ponse
sa rerecei
ved?
5.
5 Ifyours
iteusesIPv6,fi
ndoutwhe nI
Pv6wa
sfi
rstdepl
oye
d.
5.
6 Whatisthechi
efdi
ffe
renc
ebe
twe
ent
heI
Paddr
ess
ings
che
mea
ndt
heU.
S.t
ele
phone
numbe
ringsc
heme?
Ex
erc
ise
s 99

5.
7 Thea ddr
essreg
ist
rie
sa roundt
heworl
dcooper
atetohandoutbl
ock
sofIPaddres
ses
.
Findouthow theye ns
ur enoISPi
sgi
venaddres
sest
hatover
lapwit
hthos
eg i
vento
anotherISP.
5.
8 How ma
nyI Pv
6a ddr
ess
eswoul
db enee
dedtoass
ignauni
quea ddr
esst
oev
eryhous
e
i
nyourcountry?Theworl
d?IstheIPv
6addre
ssspac
esuf
fic
ient?
5.
9 Suppos
ee ac
hp ers
onont hep
lanetha
das mar
tphone
,laptopcomput
er,andt en
otherde-
vicest
hateachhada
nI Pv6addr
ess
.Whatper
cent
ag eoftheIPv
6a ddr
ess
spac
ewouldb ere
quir
ed?
Chapt
erCont
ent
s
6.
1 Introduc tion,1 01
6.
2 TheAddr e ssRes olutionProblem,1 01
6.
3 TwoTyp esOfHa rdwa reAddr e
s s
e s
,1 02
6.
4 ResolutionThr oug hDi rectMa pping,1 02
6.
5 ResolutionI nADi re ct
-Ma pp
e dNe twor k,1
03
6.
6 IPv4 Addr e s
sRe soluti
on Thr ough Dyna mic Bi
ndi
ng,
104
6.
7 TheARPCa che,1 05
6.
8 ARPCa cheTi meout ,106
6.
9 ARPRe fine ment s,1 06
6.
10 RelationshipOfARPToOt herPr otocols
,108
6.
11 ARPI mp le menta tion,1 08
6.
12 ARPEnc ap sulat
ionAndI dentif
ica t
ion,110
6.
13 ARPMe s
sa geFor ma t,110
6.
14 Automa ti
cARPCa cheRe vali
dation,1 12
6.
15 Revers eAddr e s
sRe soluti
on( RARP) ,112
6.
16 ARPCa che sInLa ye r3S witches,1 13
6.
17 ProxyARP,1 14
6.
18 IPv6Ne i
g hborDi s
c overy,115
6.
19 Summa ry,1 16
6

Mappi
ngInternetAddr
ess
es
ToPhysi
calAddres
ses(
ARP)

6.
1Int
roduc
tion

Thep r
eviousc hapterde s
cri
best heI Pv 4a ndI Pv6a ddress
ings chemesa nd
state
st hata ni nt e
rnetb ehav
esl i
keav ir
tua lnetwor k
,us i
ngonl ythea ss
igned
addresseswhe ns endi
nga ndr e
cei
v i
ngp ackets.Chapter2r evi
ewss everalnet
wor k
hardwa r
et echnol-ogie
s,andnot esthatt woma chi
nesonag ivenp hys
icalnet
wor k
canc ommuni ca
t eonlyi ftheyknow eac hot hersphysic
alnet workaddr es
s.Wha t
weha venotme nt i
onedi show ahos torar outerma psa nI Pa ddresstot he
correctphysicaladdresswhe nitneedst osendap acketacrossap hysi
calnetwork.
Thisc ha
p t
erc onsidersthema ppi
ng,s how-inghow i tisi mpl
e mentedinI Pv4a nd
IPv6.

6.
2TheAddr
essRe
sol
uti
onPr
obl
em

Considert woma chinesAa ndBt hatconnecttot hesamep hysi


calnetwork.
Eachma chineha sana s
signedIPa ddres
s,IAandIB,andaha rdwa r
e( MAC)a ddres
s,
HA and HB.Ul timatel
y,c ommuni c
ati
on mus tbec arr
iedo utb ys e
ndingf rames
acrosstheunde rl
yingne tworkus i
ngt heha r
dwar eaddress
est hatt hene twork
equipmentr ecog-ni
zes.Ourg oal
,howe ver,i
stoa l
lowa ppl
i
cationsandhi g
her-lev
el
protocol
st o work only withI nter
neta ddres
ses.Tha tis,wewa ntt o devi
se
softwaret hathidesthe

1
01
1
02 Ma
ppi
ngI
nte
rne
tAddr
ess
esToPhys
ica
lAddr
ess
es(
ARP) Chap.6

har
dwa r
ea ddre
ssesa tal ow leve
loft hep rotoc
olstack.Fore xampl
e,a ss
ume
machineAne edst ose ndanI Pp ackettoma c
hineBa cros
st henetworktowhi ch
the
yb othat-t
ach,b utAonl yk nowsBsI nternetaddr
ess,IB.Theques
tiona r
ises
:
how doesAma pBsI nter
ne taddresstoB sha r
dwareaddress,HB?The
rea ret wo
ans
we rs,IPv4us ual
l
yus esonea ndI Pv
6us ual
lyusestheot her
.Wewi llconsi
der
eac
h.
Itisimp ortantt onot ethata ddressma ppi
ngmus tb eperfor meda te achs t
ep
alongap athf rom t heor igi
nalsourcet ot heult i
ma tede st
ination.Inp art
icular,
twoc as
esa rise.Fir
s t,att helaststepofde l
i
veringa nI Pp ack
e t,thep acketmus t
bes enta crossa p hysic
a lnetwor kt ot he ultima te desti
nat i
on.The ma chi
ne
sending t he da t
a g
r am ( usual
-lyar oute
r )mus t ma pt he f ina
lde s ti
nations
Interneta ddresst ot hede s
tinati
onsha rdwarea ddressb eforet ransmissi
on i s
possibl
e.S econd,a ta nyp ointa l
ongt hep athfrom t hes ourcet ot hede sti
na ti
on
othert hant hef inalstep,t hepacketmus tb esentt oa ninterme di
ater outer.We
wi l
lseet hatt hep rotocolsoftwarea l
wa ysusesa nI Pa ddresstoi dent
ifyt hene xt
route ralongt hep ath.Thus ,as endermus tma pt her out er
sI nterne
ta ddressto
aha rdwa rea ddress
.
Thep roblem ofma ppinghi gh- l
eveladdre s
sest ophysi
caladdress
esisk nowna s
he a
t ddressr esoluti
on pr oblem,and hasbeen s ol
vedi ns ev
e r
alwa ys.S ome
p
rotocolsuitesk eepta b
lesine a
c hma chinet hatc ont
a i
np ai
rsofhi gh-leveland
p
hysic
a lad-dres
ses.Ot herp rot ocol
ss ol
v et hep robl
emb ye mbeddingaha rdware
a
ddressinhi g
h-leveladdre s
ses.Us i
nge i
the ra pp
roa chexcl
usi
velyma keshigh- l
evel
a
ddressi
nga wk -warda tb est.Thi sc hapterdi sc
us s
est wot e
chniquesf ora ddres
s
r
eso
lutionus edbyTCP/ I
Pp rot ocols,ands howswhe neachisappropri
ate.

6.
3TwoTyp
esOfHa
rdwa
reAddr
ess
es

Therea retwob as
ictypesofhardwarea ddres
ses
:t hosethata relar
g e
rt ha
n
thehostp orti
ono fanIPa ddre
ssandthoset hataresma ll
er.Becauseitdedic
ates
64 b i
tstot he hostporti
on ofa na ddres
s,I Pv6a c
c ommodatesa l
lt ypesof
hardwarea ddres
ses.There-
fore,thedisti
nctionisonlyi mporta
ntf orI Pv4.We
wil
ls tartb yc onsi
deri
ng the te
ch-ni
que us edf or I
Pv 6a nd for IPv4 when
address
esa resma l
lenough.Wewi l
lthenc on-si
derat echni
quet hatIPv4us es
whe naddress
esa r
elarge.

6.
4Re
sol
uti
onThr
oughDi
rec
tMa
ppi
ng

IPv6 usesa t ec
hnique k nown a s direct mappi
ng. The bas
ici de
ai s
s
tra
ightforwar
d:useac omput e
r
sha r
dwa r
ea ddre
ssasthehostporti
onoft he
c
omputersInter
netad-dres
s.I Pv4c anusedi r
ectmappi
ngwhe naddres
sesare
s
uffi
cie
nt l
ysmall
.Fi
gure6.1il
lustrat
est heconc e
pt.
S
ec.6.
4 Re
sol
uti
onThr
oug
hDi
rec
tMa
ppi
ng 1
03

MACa
ddr
ess

I
Paddr
ess

ne
twor
kpr
efi
x hos
tsuf
fix

Fi
gur
e 6.
1 An il
l
ustra
tion of a di
rec
t mapp
ing scheme i
n whic
ha
computer
shardwar
ea ddr
essise
mb edde
di nthecomputer
s
IPaddres
s.

Tos eehow di rectma ppi


ngwor kswi thI Pv4,itisimp ortantt oknow t hat
someha rdwareus ess mal
l,confi
gurableintegersa shardwarea ddress
es.Whe never
ane wc ompute risa dde
dt os uchane twor k,t hesys
te ma dminis
tratorchoosesa
hardwarea d-dre s
sa ndc onfi
gurest hec omp uter
sne tworki nterfa
cec ard.The
onlyimportantr uleisthatnot woc omp utersc anhav
et hes amea ddres
s.Toma k
e
assi
gnment e a s
y a nd s af
e, a n a dministrator typica
lly a ss
igns a ddre
sses
sequenti
all
y:t hef i
rstcomp uterconne c
t e
dt ot henetworki sassi
gneda ddress1,
thesecondc omp uterisassi
gnedaddre s
s2,a nds oon.

Aslonga sama na
g e
rha sthef r
ee dom toc hoosebotha nIPaddres
sa nda
hardwareaddress
,t hep ai
rofa ddres
sesc anb es e
lect
eds uchthatthehardware
addres
sa ndthehos tportionoft heI Pa ddres
sa reidenti
cal.I
Pv6ma k
essucha n
assi
gnmentt ri
via
l t he hardwa r
ea ddr es
sa lwaysf it
si ntothe ar
ea oft he
addres
sus e
df orani nt
e r
fa c
eI D.ForI Pv4,considerane xampl
ewhereane twork
hasbeena s
sig
nedt heIPv4p refix
:

1
92.
5.48.
0/24

Thene t
wor kp r
e f
ixoccup
iesthefi
rstthreeoctets,l
eav
ingoneoc tetforthehost
ID.Thef i
rstc omput
eront henetworki sas
signedhardwa readdress1a ndIP
addres
s1 92.5.
48. 1
,thes ec
ondcomp uterisas
signedhard wareaddres
s2a ndIP
addres
s1 92.5.
48.2,ands oon.Thati s
,t henet
wor kisc onfi
gur
eds uchthatthe
l
ow- or
deroc t
etofe achI Paddre
ssi st hesamea st hec omputer
sha r
dware
addres
s.Ofc our s
e,the ex-ampl
e only work
si ft he ha r
dwarea ddre
ssesare
between1a nd254.

6.
5Re
sol
uti
onI
nADi
rec
t-Ma
ppe
dNe
twor
k

Ifacompute
rsIPa ddr
essi
ncludesthecomputer
shardwa
rea ddre
s s
,a ddres
s
r
eso
-lut
ionistri
vi
al.Givena nIPa ddre
ss,thecomputer
shardwarea ddresscan
b
ee x
tract
edfrom thehostport
ion.Int hee
x a
mp l
eabove,ifp
r ot
ocolsoftwa r
eis
giv
e ntheI Pa d-
dressofac omp ute
ron t hene t
work(e.g.
,192.
5.48.
3),the
corres
pondi
ngha r
dwaread-dre
s scanbecomp ut
edme re
lybyextr
act
ingthelow-
orderoctet
,3.Ast henamedirectmappi
ngimp l
i
es,themap
pingcanbeper
formed
withoutrefer
encetoexter
nalda t
a.In
1
04 Ma
ppi
ngI
nte
rne
tAddr
ess
esToPhys
ica
lAddr
ess
es(
ARP) Chap.6

f
act,themappi
ngise xt
remel
ye ffi
ci
entb ecaus
ei tonl
yrequire
saf ew mac
hine
i
nstr
uc-ti
ons
.Di
rectma pp
inghasthea dv
antaget ha
tnewcomp ute
rscanbeadded
t
oane tworkwi
thoutchangi
nge xi
sti
nga s
sig
nme ntsandwi
thoutp r
opa
gati
ngne w
i
nformat
iontoex-
ist
ingcomput
e r
s.
Mat
hemati
cal
ly,di
rectmap
pingmea
nssel
ecti
ngafunct
ionfthatmapsI
Pad-
dr
ess
estophys
ica
laddres
ses
.Resol
vi
nganI
Pa ddre
ssI
A me
anscomputi
ng

HA =f(I
A)

Alt
houghitisp os
sib
let ochoos
ema p
pingsot herthantheonede sc
rib
edi nthe
exampl
ea b
ove,wewa ntthecomputat
ion offt ob eeff
ici
ent,andwewa nt
choi
cestobee asyf orahuma ntounde r
stand.Thus,as c
hemei sprefe
rredin
whichtherel
ati
onshi
pb et
weentheIPaddressa ndhar
dwareaddre
ssisobvi
ous.

6.
6IPv
4Addr
essRe
sol
uti
onThr
oughDyna
micBi
ndi
ng

Althoughi tise ffi


ci
ent,dire
ct ma pp
ing cannot be used withI Pv4i fa
hardwar ead-dres
sesislar
gerthananI Pv4address.Spe
cif
ical
ly,anEt he
r netMAC
addressc a
nnotb edirec
tlymappedintoanI Pv4addressbecauseaMACa ddre
ssi
s
48b it
sl onga ndanI Pv4addr
e s
sisonly32b itslong.Furthermore,becauseiti
s
assi
gnedwhe n ade v
iceisma nufa
ctured,a n Et
he r
netMAC a ddr
e s
sc annotbe
changed.
De s
ignersof TCP/ I
Pp r
otocolsf ound a c reativ
es olution tot he addres
s
resol
utionp roblemf orne tworkslikeEt her
ne tthatha vebr oadcastcapabi
li
ty.The
sol
ut i
on a l
lows ne w hos ts or r outerst ob ea dde dt o a ne twork wi t
hout
recomp i
li
ngc ode,a nddoe sno trequirema intenanceofac entr a
li
zedda t
abase.To
avoidma intaini
ngac entrali
zedda ta-
ba se
,t hede si
g nerschoset ouseal ow- l
evel
protocolt hatr esolvesa ddresse
sdyna mical
-ly.Na medt he Addr es
sRes oluti
on
Protocol(ARP) ,thep rot
oc olprovi
desame chanis
mt hatisre a
sona b
lyeffic
ientand
doesnotr equir
ea na dminist
ratort oconfigureta b
lesma nua l
l
y.
Thei
de abehinddyna micr es
olution withARP iss traightfor
ward:whe nit
wa ntstoresol
veIPa ddressI B,ah ostb roa
dcast
sa nARPr equestpack
ett hata s
ks
thehos twithI Pa ddr esI
s B tor espondwi thitshardwa rea ddresHB.Al
s lhosts
,
incl ngB,r
udi ece
ivet her e
que s
t,b utonl yhostB re c
og ni
ze sitsIPa ddressand
sendsar eplythatc ont ai
nsi tsha rdwa r
ea ddre
ss.ARPi sonl yus edwhe nahos t
nee dstosendanI Pp acket.The re-fore,whe nitrecei
ve sar ep
lytoit srequest
,
thehos tthatma det her eque stwi l
lus etheinformationt os endanI Pp ac
ket
directl
ytoB.Wec ans umma rize:

TheAddr es
sRes ol
uti
onPr ot
ocol
,ARP,all
owsahostt of i
ndthe
phy-s
icaladdres
sofat argethostonthesamephys
icalnetwor
k,
giv
enonlyt hetarget
sIPaddres
s.
S
ec.6.
6 I
Pv4Addr
essRe
sol
uti
onThr
oug
hDyna
micBi
ndi
ng 1
05

Fi
gur
e6.2il
l
ust
rate
st heARPpr
otocolb
ys howi tAb
nghos roa
dcas
tinga
r
eques
tforB,a
ndBr e
sponding
.Not
et hata
lthoughthereque
stisbr
oadcas
t;t
he
r
epl
yisnot.

A X B Y

(
a)

A X B Y

(
b)

Fi
gur
e6.
2I ll
ust
rati
on ofARP whe r
e( a tA b
)hos roadc
ast
san ARP
r
equestcontai
ningIB,and( b
)hostBr e
spondswitha
nARP
r
epl
yt ha
ts p
ecifie
sitshar
dwa rea
ddr
essHB.

6.
7TheARPCa
che

Itma ys eems il
lyt ha tbeforeA c ans enda nI nternetpackett oB i tmus t
sendab roa dcastthatc onsumest i
meone v
e r
yhos t.Ori tma ys eeme v
ens i
ll
ier
thatA b r oad-cas
tst he question, how c an Ir each you?,i nste
a d of just
broadcas
tingt hep a
cke titwa ntst ode l
iv
er.Butt he
r eisanimp ortantr eas
onf or
the excha ng e.Broadca s
ting isf art oo exp e
nsivet ob e usede veryt i
me one
ma c
hinene edst ot ransmitap ackett oa nother,be c
ausee ve
ryma chineont he
networkmus tr ec
eivea ndp roce s
st heb r
oa dcas
tp acket.So,ARPs oftwareinA
usesa n op t
imizati
on:i tr ec
or dst hea nswe ra nd reusesthei nfor-mation for
succes
sivet ra
nsmissi
ons .
Thes tandardspeci
fi
est hatARPs of twaremustma i
nt a
inac acheofr ecent l
y
ac-quiredIP- t
o-hardwarea ddressbindings.Tha ti
s,whe neve
rac omp uterse nds
an ARP r equesta nd recei
vesa n ARP r epl
y, i
ts avest he IPa ddressa nd
correspondi
ngha rdwarea ddressinforma t
ionini t
sc ac
het empora r
il
y.Doi ngs o
reducesov eral
lcommunicati
onc ost
sdr a mati
cal
ly.Whent ransmi
ttingap acket,a
comp uteralwayslooksinitsc a
c hebe f
or esendinganARPr eques
t .Ifitf indst he
desi
re db i
ndingini tsARPc ache,t hec ompute rdoe
snotne edt ob roa
dc a
sta
r
eque
st.Thus,whe
ntwoc omput
ersonanet-
workc
ommuni
cat
e,t
heyb
egi
nwi
th
a
nARPr eque
standre
sponse
,andthenr
epe
atedl
y
1
06 Ma
ppi
ngI
nte
rne
tAddr
ess
esToPhys
ica
lAddr
ess
es(
ARP) Chap.6

t
ransf
erp a
cketswit
houtus i
ng ARP f
ore ac
hp a
cke
t.Exp
eri
enceshowsthat
b
ecausemostnetworkcommunic
ationi
nvol
vesmoretha
nonep a
cke
tt ra
nsf
er,
e
venas ma
llca
cheisworthwhi
l
e.

6.
8ARPCa
cheTi
meout

AnARPc achep rovidesa ne xampleofs ofts tate,at echni


quec ommonl yus ed
i
nne tworkp rotocols
.Thena mede scri
besas ituationi nwhi chi nf ormationc an
becomes ta
lewi thoutwa r
ning.I nthec aseofARP,c onsi
dert woc omp uter,Aa
s nd
B,bot hcon-ne ct
edt oa nEt hernet.AssumeAha sse nta nARPr eque st,andBha s
repli
ed.Fur t
he ra s
sumet hata fte
rt hee xchangeBc rashes.Comp ut erAwi l
lnot
recei
vea nynot i
fic
ationoft hec rash.Mor eover,b e ca
us eita lr
e adyha sa ddres
s
bi
ndingi nforma t
ionf orB i ni tsARPc ache ,comp ut rA wi
e llcont inuet os end
packetstoB.TheEt herne thardwa r
ep ro-videsnoi ndica t
iont hatBi snotonl i
ne
becauseEt hernetdoe snotha veg uaranteedde l
iv
e ry.Thus ,A ha snowa y of
knowingwhe ni nforma t
ioni nitsARPc acheha sbe -c
omei ncorrect.
Inas ys te
mt ha tus ess ofts tat e,responsibi
li
tyf orc or rectne s
sl i
e switht he
owne roft hec ache .Typ icall
y,p rot ocolsthati mpleme nts ofts ta teus etime r
s.A
time ri ssetwhe ni nforma ti
oni sa dde dt othec ache ;whe nt het imere xpi
res,t he
infor ma t
ion i sde l
e ted.Fore xa mp le,whe neve ra ddressb inding i nformation is
placedi na nARPc ache ,t hep rotoc olr equi
resat i
me rtob es e t,wi that ypica
l
time outb eing20 mi nute s.Whe nt het imere xpi
re s
,t hei nfor mation mus tb e
remov ed.Af terre mov alt herea ret wop ossi
bil
i
t i
e s
.I fnof urtherp acketsares ent
tot hede stinati
on,not hingoc curs.I fap ack-etmus tb es entt ot hede s
tination
andt he r
ei snob indingp resenti nt hec ache,t hec om- puterf oll
owst henor mal
proc edureofb roa dca s
ting a n ARP r e
que s
ta nd ob tai
ning t heb inding.Ift he
destina ti
oni ssti
l
lr eachab l
e,t hene wb i
ndingwi l
lb ep l
acedi nt heARPc ache .If
not ,t hes e
nde rwi lldiscov ertha tt hede sti
nationi snotr ea c
ha ble.
Theus eofs ofts tateinARPha sa dvantagesa nddi sadva
ntages.Thec hi
ef
advan- ta
gea risesf rom a utonomy. Fi r
s t,a c omp ute rc an determine whe n
inf
or ma t
ion ini ts ARP c ache shouldb er eva
lidatedi ndependent of ot her
comp uters.Second,as enderdoesnotne eds uccessfulcommuni cati
onwi tht he
receiverorat hirdp artytode terminet hatab indingha sbecomei nval
id;ifa
targe tdoesnotr espondt oanARPr equest ,thesende rwi l
ldeclar
et het a
r getto
bedown.Thi r
d,t hes c
he medoesnotr e
lyonne twor khar d
wa retop rovi
der eli
abl
e
transferori nform ac omputerwhe t
hera notherc omp uterisonline.Thec hi
ef
dis
adv antageofs of
ts tatearise
sf rom delay i fthet i
me rinter
valisNmi nutes
,
ase nderma ynotde tectt ha
tar e
ce i
verha scrashedunt ilNmi nuteselap
se.

6.
9ARPRe
fine
ment
s

Sev
era
lref
ine
me nt
sofARPhav
ebeeni
ncl
udedi
ntheprot
ocoltha
tre
duc
e
t
hea
mountofnetworktr
aff
ica
ndaut
omaterec
ove
ryaft
eraha r
dwarea
ddr
ess
c
hang
es:
S
ec.6.
9 ARPRe
fine
ment
s 1
07

Firs
t,ob servet hathos tAonl yb roadcastsanARPr equestforBwhe n
i
tha sanI nternetp acketrea dyt os endt oB.Be c
a usemos tI nternet
protocol
si n- v
olveat wo-waye xc
ha nge,thereisahi ghp r
obab i
li
tyt hat
hostBwi l
ls enda nI nte
rnetp ac
ke tba c
kt oAi nt hene arf uture.To
anti
c i
pateB sne eda nda voi
de xt
rane twor ktraf
fic
,ARPr e
quiresAt o
i
nc l
udei tsI P-to-hardwarea d- dr
es sbi
ndingwhe nse ndingBar eque s
t.
Bext ractsA sb i
ndingf rom t her e-questa ndsave
st heb i
ndingi nits
ARPc a
che.Thus ,whe nsendinga nI nt e
r-netpackett oA,Bwi llfind
theb i
ndingi sa l
readyi nitscac he
.
Second,not i
cet hatb eca
us er eque stsa reb roadcast,a l
lma chi
ne son
thene t -
wor kr e ce
iveac op yoft her e que st.Thep rotoc olspeci
f i
es
thate achma c hinee xtr
actt hes ende rsIP- to-ha r
dwa readdr essbinding
from ther e-que st,andus et hei nf ormat iont oup dat etheb i
ndingi n
theirca c
he .Fore x-
ample,ifAb r oadcastsar equest,ma chinesont he
networ kwi llup datetheiri nforma tionf orA.Ma chinest hatdonot
alrea
dyha vea ne ntryforAi nthe irc ac
hedonota ddA si nformation;
thes tandardonl ys pec
ifi
esup dat i
ngt heha rdwa rea ddre
s sone x
isting
entrie
s.Thei de ai sthatifama chineha sb eenc ommuni catingwi thA,
i
tsc aches houl dha vethel atestinf ormat ion,b uti fama chineha snot
beenc ommuni cat i
ngwi th A,i tsc a ches houldnotb eclogg e
dwi t
ha
useles
se ntry.
Third,whe nac omp uterha sitshos ti nterfac
er eplaced,( e.g.
,b ecause
theha rdwareha sfail
ed),it sp hys icala ddresschange s
.Ot hercomp uters
ont hene tt hatha vestor edab indingi nt heirARPc a chene edt ob e
informe ds ot heyc a
nc ha nget hee nt ry.Thec omp ut erc an notify
othe rsofane wa ddres sb yb roa dcastingag ratuitousARPr equest.
Cha ngingaMACa ddressr e -quire sr ep la
c i
ngaNI C,whi c
hoc curswhe n
ac omp ute
ri sdown.Be c auseac omp ut erdoe snotk now whe the rits
MACa ddresshaschanged,mos tc om- put ersbroadcastag ratui
tousARP
dur i
ngs ys
t eminit
iali
zation.Gr a tui t
ousARPha sas e condaryp urpose:
tos e eifa nyotherma chinei sus ingt hes ameI Pa ddre ss.Theb ooting
ma chines endsanARPr e que stf ori tsownI Pa d-dress;i fitr ecei
vesa
reply,t heremus tb eami sconf i
g ur ationoras e c
urityp robl
em whe rea
comp ut erisint
entionall
ys p oofing .

Thef
oll
owi
ngs
umma
rize
sthek
eyi
deaofa
utoma
ticc
acheup
dat
es.

Thes ender
sIP-to- hardwareaddres
sbindingi
si nc
ludedin
every ARP broadcas t;receiv
ersus ethei nf
ormat i
on to
updatet hei
raddr essbinding i
nformati
on.Thei ntended
reci
pient usesthe i nformation tocreate a new c ac
he
entryinant i
ci
pationofar eply.
1
08 Ma
ppi
ngI
nte
rne
tAddr
ess
esToPhys
ica
lAddr
ess
es(
ARP) Chap.6

6.
10Re
lat
ions
hipOfARPToOt
herPr
otoc
ols

Asweha ves een,b ecausei tus esdir e


ctma pp
ing,IPv6doe snotne ed
ARP.Thus ,ARP me rel
yp rovidesonep ossi
bleme chani
smt o ma pa nI P
addresst o a hardwa rea ddr ess.I nterestingl
y,ARP a nd othera ddress
bindi
ngme cha
nismswoul db ec omp let
e l
yunne ce
ssaryifwec oul
dr edesign
allnetworkha rdwa retor e cognizeI Pa ddre s
ses
.Thus ,from ourp ointof
view,a ddressb i
nding isonl y neededt o hide the underl
ying hardwa re
address
e s
.Conc eptuall
y,wei mposeourne wI Pa ddress
ingschemeont op
ofwha t e
verl ow-l
e veladdr essme c hani
smt heha rdwareuse s.Therefore,
wev iew ARPa sal ow-levelp rotocola s
sociatedwi ththeha rdwarer ather
thanak eyp artoft heTCP/ IPp rotocolswhi chruna bovet hehardwa re.
Theideac anb esumma r
ized:

ARP isa l ow-l


evelprotoc
olt hat hidest he underlyi
ng
addres
s-i
ngus edbynet workhardwar e,permitti
ngust o
assi
gn an ar-bi
trar
yI P addr
esst o ev er
y mac hine.We
thi
nk ofARP asas -s
oci
ated witht hephys i
calnet work
syst
emr atherthanaspartoftheI nternetprotocols.

6.
11ARPI
mpl
eme
nta
tion

Funct i
onal
ly,ARPs oftwareisdivi
dedint otwop arts
.Thef i
rstp a
rt
pro-vi
desa ddressr es
oluti
onf oroutgoi
ngp ackets
:g i
ventheI Paddressof
ac omp ut-er on t he netwo rk
,i tf i
ndst he hardwarea ddre
ssof t he
compute r.Ifana ddressisnoti nthecache
,i tsendsarequest.Thes e
cond
parthandl e
sincomi ngARPp a
ckets
.Itup da
te sthecache,answersrequest
s
from ot herc omp uterson t he network,a nd checkswhe therar epl
y
ma t
chesa nout st
andingr equest
.
Add re
ssr e
soluti
onf oro utgoingp a cketss e
emss trai
ght for ward,b ut
sma l
lde tai
lsc omp l
icatea ni mpleme ntat i
on.Gi vent he IPa ddr essofa
comp utert owhi chap acke
tmus tb ese nt,t hesoftwa rec onsul tsitsARP
cachet oseei fthec achea l
readyc ont ai
nst hema pp
ingf r
om t heI Paddress
toaha rdwa readdr e
ss.Ift hea nswe risf ound ,thes oftwa ree x trac
tst he
hardwa rea ddress
,f il
lsint hede stinati
ona ddressont heout g oingf ra
me ,
ands e
ndst hef r
a me.I ft hema ppingi snoti nc ac
he ,t wot hingsmus t
happen.Fir st,thehos tmus tstoret heout goingpack ets oitc anb es ent
oncet hea ddressha sb e
enr es
olved.S econd,ARPs oftwa remus tb r
oadcast
anARPr eque st
.
Coor
dinationb etweent hepartofARPt hatsendsrequest
sa ndt he
partthatr e
ceivesr e
p l
iescanbecomec ompl
ic
ated.Ifat arge
tma chineis
downort oob usyt oa ccep
tt herequest,nor epl
ywi l
lberecei
ved(ort he
repl
yma yb ede -layed).Further
mor e,b ec
auseEthernetisab est-
ef f
ort
del
iverysystem,t hei ni
-ti
alARPb roadcas
tr eques
tort her epl
yc anb e
l
ost.The
re f
ore,asendershoul
dr etr
ans
mitther eques
tatle
astonc
e,
whic
hme ansat i
mermus tbeus e
da ndtheinp
uts i
demus
tc a
nce
lthe
ti
merifar epl
yar
riv
es.Moreimpor
tant,t
heques
tion
S
ec.6.
11 ARPI
mpl
eme
nta
tion 1
09

ari
ses:whileARPi sresol
v i
ngag ive
nI Pa ddress,wha tha p
p ensifa nother
ap-pl
icat
iona ttemp t
st os e ndt othes amea ddress
?ARPma yc hooset o
crea
t eaque ueofout goi
ng p ackets
,ors imp l
y ma yc hooset o discard
succ
e s
siv
ep ackets.Ina nyc ase,thek eydesig
nde c
isi
onsinvolvec oncurrent
acce
ss:c anothe ra p
pli
- c
ationsp rocee
dwhi leARPr esol
vesa na ddr es
s?I f
anothera ppl
ica
t i
ona t
t e
mp t stos end tot hes amea ddre s
s,s houldt he
appl
icati
onb eb lockedors houldARPme relyc reateaque ueofout going
packets
? How c an ARP s oftwareb e desig
ne dt op reve nt itf rom
unnecess
aril
yb roadcasti
ngas econdrequesttoac omputer?
Onef i
naldeta i
ldistingui
shesARPc ac
hema nage
me ntfrom thema nage
-me nt of a t ypi
c alc ache.I n at ypi
calc ac
he ,timeoutsa re usedt o
eli
mi nateinac-
t i
vee ntries.Thus,thet i
mestampona ne ntr
yi srese
te ach
timet hee ntryisus ed.Whe nspac
emus tb erec l
ai
med,t heentrywitht he
oldestt i
me s
tampi sr e-mov edfrom t
hec ache.Fora nARPc ache,however,
thet i
mea twhi cha ne ntrywa slas
tr efere
nce disirrel
evant ARPc an
continuet ous et hee ntr yevenift hedesti
na ti
onc omputerhasc ras
hed.
Thus ,itisimp ortantt ot imeoutane ntryev e
ni fthee ntryisstil
lbeing
used.
We s a
idt hatt he se
cond p a
rt of the ARP software ha ndl
esARP
packet
st hatar r
ivefrom thene twork.Whena nARPp a
cketa rriv
es,the
softwaref i
rste x-
tract
st hes ender
sI Paddressa ndha rdwarea ddress
pair,andexaminesthelocalca
chet oseeifitalre
a dyhasa nentr yforthe
sender
.I fac achee nt
rye xi
stsf ort hegivenI Pa ddres
s,t heha ndl
er
updatesthate ntryb yoverwri
tingthep hys
icaladdresswitht hep hysi
cal
addres
sob tai
nedf rom thep ac
ke t
.Af terupdati
ngt hec ache,ar ec
eiv
er
proces
sesther es
toft heARPp acket.
To p roces
st he rest of a n ARP p a
ck e
t ,t he r ec
eiverc hec
kst he
operation.Ifthei ncomingp acketisanARPr equest,t herec ei
vingma chine
checkst os eewhe theri tist het argetoft her eque st(i.
e .,someot her
machineha sbroadc a
star e
que stand Iamt het argetoft her equest
).I f
so,theARPs oftwarea ddst hes ender
saddre s
sp a
irt oi t
sc a
c he(ift he
pai
ri snota l
readyp res
e nt),formsar e-p
ly,a nds endst her ep l
ydirectly
backt ot herequester.Ift heI Pa ddr
essme n-ti
one dinar equestdoe snot
matcht heloc
alIPa ddress( i
.e.
,t herequestisf ora notherc omp ute
r),t he
inc
omi ngARPp a
c ketisdisc
a rded.
Ift heincomingp ac
keti sanARPr e
p l
y,t her ecei
vert riestoma tch
t
her e
-p l
ywi t
hap revi
ousl
yissuedr equest.I ft her e
p l
ydoe snotma tcha
r
equest,thep ack
e tisdis
carded.Ot herwi
se ,t hea ddressbindingisknown
(
theent ryint hec a
chewi l
la l
readyha veb e enup datedi nt hef i
rststep
a
bove)
.The refore,theARPs oftwaree xamine st heque ueofout goi
ngI P
p
ackets(packetsthatha v
eb eenwa i
tingfort her esponse)
.ARPs oftware
p
lac
ese achI Pp acketinaf rame,us est hea ddressb i
ndi
ngi nf
orma t
ion
f
rom thec ac
het of i
lli
nt hede sti
nationad- dressint hef rame ,andsends
t
hep a
cke t
.
1
10 Ma
ppi
ngI
nte
rne
tAddr
ess
esToPhys
ica
lAddr
ess
es(
ARP) Chap.6

6.
12ARPEnc
aps
ula
tionAndI
dent
ifi
cat
ion

WhenARPmessa
gestrav
elfrom onecomputertoanother
,the
ymust
b
ecarri
edi
nane t
workframe.AsFigure6.3il
l
ustra
tes
,a nARPmessa
gei
s
c
arr
iedint
hepayl
oadare
aofaf rame( i
.e.
,istre
atedasdata
).

ARPMES
SAGE

FRAME
FRAMEPAYLOADAREA
HEADER

Fi
gur
e6.
3AnARPme
ssa
gee
nca
psul
ate
dinap
hys
ica
lne
twor
kfr
ame
.

Toi de ntifyt hef ramea sc a


rr yinga n ARP me s
sage ,thes enderassi
gnsa
speci
a lvaluet ot het yp ef i
el
di nt hef ramehe ader.Whe naf ramea rri
vesa ta
comp uter,t hene tworks oftwa reuse st hef ramet ypetode t
ermineitscontents.
Inmos tte c
hnologies,as ingl
et ypev aluei susedf orallframe sthatcarr
ya nARP
mes s
a ge ne twor ks oftwa r
ei nt her e
c e
ivermus tf ur there x
aminet heARP
mes s
a getodi sti
nguishb etwe e
nARPr e-questsa ndARPr ep l
ies
.Fore xampl
e,ona n
Etherne t
,f r a
me sc ar
ryingARPme s
s agesha veat ypef i
eldof0x 0806,whe rethe
prefix 0x i ndic
ate sa he x
adecimalv a l
ue .The f rame t ypef or ARP hasb een
standardizedb yI EEE (whi c
hownst heEt herne ts tan-dards).Thus,whe n ARP
travels ov era ny Et hernet,t he t yp ei sa lwa ys 0x 0806. Other hardwa r
e
technologiesma yus eot herv al
ues.

6.
13ARPMe
ssa
geFor
mat

Unli
kemos toft heTCP/ IPp rot
ocols
,a nARPme ss
a g
edoe snotha veaf i
xed-
formathe ade r.Instead,t oa ll
ow ARP t ob e used on a v ari
ety ofne twork
technol
ogies
,t hedesignerschoset oma ket helengthofha rdwarea ddres
sf iel
ds
dependont hea d-dr
e s
sesusedb yt heunde rl
yingnetwork.I nf act,thede sig
ners
didnotr es
t r
ictARPt oIPv4a ddre
sses.Instead,thes izeofp rotocoladdr es
s
fiel
dsina nARPme s
sagede p
e ndsont het ypeofhigh-levelprotocoladdressb ei
ng
used.Ironic
a l
ly,withonl yaf ewe x-cep
tionssucha sresearche x
p e
riments,ARPi s
alwaysus e
dwi th32- bitIPv4p rotocoladdresse
sa nd48- b
itEt hernetha rdware
address
es.Thep oi
ntis:

Thedes
ignal
l
owsARPt
omapanar
bit
rar
yhi
gh-
lev
elpr
otoc
olad-
dres
st oanar
bit
rar
ynet
workhar
dwar eaddres
s.I
npract
ice,ARP
isonlyusedtomap32-bi
tIPv4 addres
sesto48-bi
tEt her
net
addres
ses
.
S
ec.6.
13 ARPMe
ssa
geFor
mat 1
11

Theexampl
einFig
ure6.4s
howstheformatofa28-oct
etARPme ss
agewhen
used wit
ha nI Pv
4p rot
ocola
ddres
sand an Ethe
rne
tha rdwar
ea ddres
s.The
prot
ocolad-dr
essis32bit
s(4oct
ets)l
ong,andthehardwarea
ddre
ssis48-bi
ts
(6octets
)long
.

0 8 1
6 24 31
HARDWARETYPE PROTOCOLTYPE
HLEN PLEN OPERATI
ON
S
ENDERHARD(
oct
ets0-
3)
S
ENDERHARD(
oct
ets4-
5) S
ENDERI
Pv4(
oct
ets0-
1)
S
ENDERI
Pv4(
oct
ets2-
3) TARGETHARD(
oct
ets0-
1)
TARGETHARD(
oct
ets2-
5)
TARGETI
Pv4(
oct
ets0-
3)

Fi
gur
e6.
4TheARPmess
agef or
ma twhe
nus
edt
oma
panI
Pv4a
ddr
ess
t
oanEthe
rnetaddress
.

Thef i
gures howsanARPme ssa
g ewi t
h4oc t e
tsp erli
ne,af orma tthatis
standardthroughoutthi
stextandtheTCP/ I
Psta
nda r
ds.Unfortunately,the48-
bitEthernetad-dressmea
nsthatfi
eldsint heARPme ss
a g
edonota llali
gnne a
tly
on32- bitboundaries
.Thus,thedi
ag r
amc anbediffi
culttor e
a d.Fore x
a mpl
e,
the sender
sha rdwareaddres
s,label
edS ENDER HARD,oc c
upies6 c onti
guous
octets
,s oitspa
nst woli
nesinthedi
- agr
am,t hethi
rdlineandha l
foft hefourth
l
ine.
Field HARDWARE TYPE s p ec
ifi
esaha rdwa rei nter
facet ypef orwhi chthe
senders eeksa na nswe r;itc ontai
nst hev alue1t os peci
fyt hatt heha r
dware
addressisa nEt her-
ne tMACa ddres
s.S imil
arly,f ieldPROTOCOLTYPEs pe
cifi
esthe
typeofhi gh-le
v e
lp rotocoladdresst hes ende rha ss upp
li
ed;itc ontai
ns0x 0800
(
he xadeci
ma l)tos peci
fyt hatt hep rotocola ddressi sIPv4.TheARP me ss
age
forma tma kesitp ossibl
ef orac omp ut ert oi nte r
pr e
ta nyARPme s
sage,evenif
thec omp uterdoe snotr ecognizethep rotocola ddresstypeorha rdwa r
ea ddres
s
type.I nterpret
a t
ioni spossi
bleb ecauset hef ixedf iel
dsne a
rt heb egi
nningofa
me s
sagel abel
edHLENa ndPLENs pe
cifyt hel eng thofaha rdwa r
ea ddres
sa ndthe
l
e ngt
hofap rotocoladdress.
Fi
eldOPERATION s
peci
fie
sa nARPr eque
st(1)
,ARPr es
p ons
e( 2)
,RARPr e-
quest(3),orRARPrespons
e( 4)
.Whens endi
nganARPp ac
ke t,asenderpla
cesi
ts
hardwarea ddr
essinfiedsS
l ENDER HARD and i
tsIPv
4a ddres
s,ifk nown,in
SENDERI Pv4.
Fi
eds TARGET HARD a
l nd TARGET IPv4 giv
et he hardwareaddres
sa nd
p
rot
ocoladdr
essofthetar
ge tmachi
ne,ifknown.Forar e
sponsemes
sage(i.
e.,a
r
epl
y),thetar
-geti
nforma
tioncanbee x
tracte
dfromt hereques
tmessag
e.Whe n
s
endi
nga nARPre-
que
st,as
ende
rknowst
het
arg
et
sIPv
4addr
ess
,butdoe
snot
k
nowt hetar
get
s

Alat
ers
ect
ionde
scr
ibe
sRARP,ap
rot
ocolt
hatus
est
hes
ameme
ssa
gef
orma
tas
ARP.
1
12 Ma
ppi
ngI
nte
rne
tAddr
ess
esToPhys
ica
lAddr
ess
es(
ARP) Chap.6

hardwarea
ddr
ess
.There
for
e,inar
eque
st,t
het
arg
etha
rdwa
rea
ddr
essf
iel
d
contai
nsze
roe
s.Tosummar
ize
:

AnARPr epl
yc arriestheIPv 4addres
sandhardwareaddr
essof
theorigi
nalreques teraswellast heIPv
4addres
sandhar dwar
e
addres
soft hes ender.Inar eques
t,thetar
gethardwar
eaddress
issettozerobec auseitisunknown.

6.
14Aut
oma
ticARPCa
cheRe
val
ida
tion

Itispossib
letous eat echniquethatavoi
dsintroduc ngj
i i
tter(i.e
.,v ar
ianc
e
inp ac
k ettransfe
rt imes).Tounde rs
tandhow j i
tte rc a
n occur,t hi
nkofone
computers end-i
ngas teadys tream ofp ac
ketstoa nothercomp uter.Whe neve
r
the sender
sARP t i
mere xpi
re s
,ARP wi llremovet he cac
he e nt
ry.The ne x
t
outgoi
ngp acketwilltri
gge rARP.Thep acke
twi l
lbede l
ayeduntilARPc ans enda
reques
ta ndr ecei
vear esp ons
e .Thede l
aylast
sa pprox i
matel
yt wicea slonga si
t
takest otransmitap a
cke t.Althoughs uc
hde l
aysma ys eem negli
gi
b l
e,t heydo
intr
oducejitter,es
p e
cial
lyf orr e
a l
-ti
meda tas
ucha sav oi
cephonec all
.
The k eyt oa v oi
ding jit
te ra ri
sesf rom earlyr evali
dation.That i s
,t he
i
mp l
e menta-ti
ona ssoci
a te
st woc ount e r
swi the a
c he ntryi nt heARPc ache:the
tra
ditionalt i
mera ndar evali
dation t i
me r.Ther e val
idation timeri ss ett oa
sl
ig
ht lys mal
lerv al
uet hant het r adi
t i
onaltimer.Whe nt her ev
alidat
ion timer
expi
re s
,t hes oft
wa ree xaminest hee ntr
y.I fdat a
g ramsha v
er ecentl
yus e
dt he
entry,t hesoftwares endsanARPr equesta ndcon-t i
nue stous et hee ntry.Whe n
i
tr e cei
vesar epl
y,b otht i
me rsa r er ese
t.Ofc ourse,i fnor epl
ya rrives,the
tra
ditionaltimerwi l
le xpi
re,a ndARP wi l
la gai
nt ryt oob ta i
n ar es
p onse.In
norma lc as
es,ho we ver,r e
v al
idation wi l
lr es
ett he c ache time r without in-
ter
rup ti
ngt hef l
owofp ackets.

6.
15Re
ver
seAddr
essRe
sol
uti
on(
RARP)

Wes a
wa bov
ethattheope
rati
onfiel
dina
nARPpac
ketcanspec
ifyaRever
se
Ad-
dres
sResol
uti
on(RARP)mess
age.RARPwasonc
eaness
ent
ialp
rotocolus
edto
bootstrapsystemst hatdi dnotha v estables t
orage( i.e.,diskl
essde vi
ces).The
paradigmisstraightforwa r
d:a ts tartup,as yste
mb roa dcastsaRARPr equestt o
obtaina nI Pad- dr
e ss
.Ther eque s
tc ont a
inst hes ender
sEt herneta ddress
.A
serv
e ront hene twor kre -
c e
ivest her equest,looksupt heEt herneta ddres
sina
database,extr
actst hec orrespond-ingI Pv4a ddressfrom t heda tabase
,a nds e
nds
aRARPr e
plywi tht hei nformation.Onc et her eplya rrives
,t hedi sk
lesssystem
continuest o b oot,a nd us e
st he I Pv4 a ddre
ssf or a l
lc ommuni c
ation.
Interest
ingl
y,RARPus est hes amep ack
e tfor matasARP.Theonl ydi ffere
ncei s
thatRARPus esEt hernett ype0x 8035.
TheARPp
ack
etf
orma
tca
nbef
oundonp
age
11
1.
S
ec.6.
15 Re
ver
seAddr
essRe
sol
uti
on(
RARP) 1
13

RARPi snol ongerimportantf ordiskle


ssde vi
ces,b utha sa nint er
estingus e
inc l
oudda tacente r
s.Inada tac enter,whe naVi rtua lMa chinemi gr
a te
sf rom
onePCt oanother,theVM r et
ainst hesameEt herneta ddressitwa sus i
ngb efore.
Tol ettheund er
lyingEthernets wi tchknow t hatt hemov eha soc c
ur re
d,t heVM
mus tsendaf rame( thesourcea ddr e
ssint hef ramewi llca usethes witcht o
updateitstables
).Whi chframes houldaVM s end?Ap p are
ntly,RARPwa sc hosen
becauseitha sthea d-vant
a g
eofup dati
ngt heMACa ddresst abl
ei nt hes witch
withoutc a
usingf urtherpro-cessing.I nfact,a fte
rup dati
ngt hea ddresst ab
le,
thes wi
tchwillsi
mp lydroptheRARPp a
cket.

6.
16ARPCa
che
sInLa
yer3S
wit
che
s

AnEthernetswitchiscla
ssif
iedasaLa yer3s witc
hi ftheswi
tchunde
rstands
I
Ppa c
ketsandc ane xamineIPhe ader
swhe nde ci
dingho wt opr
oces
sap acket.
S
ome Layer3 s witc
hesha vea n unusualimple
me ntati
on ofARP thatc a
nb e
c
onf
usingtos omeonewhoi stryi
ngt ounderst
andt hep r
otocol
.
Thei mpleme nt
at i
ona ris
e sfrom ade s
iretoreduceARPt raffic.Toseewhy
opti
m- i
zationi she l
p f
ul,t hi
nka boutt het ra
ffi
cg enera
tedb yARP.S uppos
ea
swit
c hha s192p ortst ha
tc onnectt oc omputer
s.Ife achcomp uterimple
me nts
ARPc achet i
me outs,thec omp ute
rwi l
lperi
odic
all
ytimeoutcachee ntri
esandthe n
broadca
s tanARPr equest
.Ev enift hecomp ut
erusesa ut
omaticr eval
i
dati
on,t he
swit
c hwillreceiveperiodi
cb roadcaststhatmus tbesenttoal
lc omp uter
s.
How c anas witchreduceb r
oadca s
tt raffi
ct oc omp uter
s?Weob ser
vet hree
things.First,as witchc an wa tch ARP t raf
fica nd k eepar ecord ofb indings
betwe enI Pad-dress
esa ndEt he r
neta ddress
es.S econd,i fitha sthene cessary
information,as witc
hc anr espondt oa nARPr eques twithoutb roadcast
ingt he
request.Third,anEt herneta d-dressc anonl ycha ngeifac omput e
ri sp owe red
down,a nd a switchc ant ellwhe t herac omp uter ha sb ee
np owe r
ed down.
The r
e f
ore,as witchcanc r
eatei tsownc acheofARPi nformati
ona ndc ana ns wer
requests.Fore xampl
e,ifc omp uterAs endsanARPr equestforc omp uterB,t he
switchc aninte
rceptt herequest,looki ni t
sc ac
he ,a ndc r
eatea nARPr epya
l sif
ther epl
yc amef r
omB.
Forap roduc ti
one nv i
ronme nt,theop ti
mizati
onde scri
beda bovewor kswe ll
.
Com- puterAa ppearstob roa dcastanARPr eq ues
tf orB,a ndAr ece
ivesav al
id
repl
y.I tr educe sextrat raf
f ic
,a nddoe snotr equireanymodi fic
ationstot he
soft
wa rer unni ng on t he c omp ute
rs.For a nyone test
ing networkp rotocol
s,
howeve r
,i tc a
nb ec onf usi
ng .A c omputerb roadcas
tsa r equestt hatisnot
rece
ivedb ya nyo t
herc omput eront henet-work !Furt
hermor e,thec omp uter
thats entt her eques
tr eceivesap hantom replyt ha
twa sne v
e rsentb yt he
source!
1
14 Ma
ppi
ngI
nte
rne
tAddr
ess
esToPhys
ica
lAddr
ess
es(
ARP) Chap.6

6.
17Pr
oxyARP

I
ntr
ane
tssomet
ime
sus eatechniqueknownasproxyARP t
oimpl
eme
nta
for
m ofsec
uri
ty.Wewillf
irs
tex
ami nep r
oxyARP,a
ndt he
nseehow i
tcanb
e
use
d.
Ea rl
yinthehi s
toryoft heInte
rnetatechniquewa sdevel
op e
dthatall
oweda
si
ngl
eI Pv4prefi
xt obeus edacr
osstwone t
wor k
s .Origina
llycall
edTheARPHa ck,
thet ech-ni
queb ecamek nownb ythemor eforma lter mp roxyARP.Pr oxyARP
rel
ie
sonac om-puterthatha st
wone tworkconne c
tionsa ndr unssp
eci
al-p
urpose
ARPs oftware.Fi
g ure6.5showsa nexa
mp l
econfigurationinwhi chprox
yARPc an
beuse d.

t
orestof
R
I
nte
rnet
Ne
twor
k1

H1 P H2
c
omput
err
unni
ngpr
oxyARP

Ne
twor
k2
H H
3 4

Fi
gur
e6.
5Il
l
ust
rat
ionoft
wone
twor
ksus
ingp
rox
yARP.

Int hef i
g ure,t hec omp ute rlabeledPr unsp roxyARPs of tware.Comp uterP
ha sada tabas
et hatc ont a
inst heI Pv4a ddre ssa ndt heEt hernetMACa ddres
sof
ea c
hot herma chineonne twor k1a ndne twor k2.Ther outera nda lltheot her
host sruns tandar dARP;t he ya reuna waret hatp roxyARPi sbeingus ed.Mor e
imp ortant,a l
lt heot he rhos tsa ndt her oute ra rec onf i
gur e
da siftheya reona
sing l
ene twork .
Tounde r
s tandp rox yARPi nteracti
on,c ons i
de rwha tha ppenswhe nr outerR
re -
c ei
vesap acketf rom t heI nt ernett hatisde stinedf ort heI Pv4a ddressbeing
us ed.Be -forei tc ande l
ivert hei ncomingp acket,R mus tus eARPt of i
ndt he
ha rdwarea ddr essoft hec omp ut er.Rb r
oadc astsa nARPr eque st
.The rea retwo
ca s
e stoc onsider:t hede sti-na ti
on ison ne twor k 1ort hede sti
na t
ion ison
ne twork2.Cons idert hef irstc a
se( e.g.
,s up poset hede sti
nationishos tH1).All
ma chinesonne twor k1r eceiveac opyofR sr eque st.Comp ut erP look sinits
da tabas
e ,disc
ov erst hatH1i sonne twork1 ,a ndi g-nor esther equest.Hos tH1a l
so
re c
e i
vesac op
yoft her equesta ndr esp
ondsnor ma lly( i
.e.
,s endsa nARPr epl
y).
Nowcons
iderthesecondcasewheeRb
r r
oadcastsar e
questforama c
hineon
net
-work2 (e.
g.,host H4).ARP wasonlyi ntendedt ob e used on a si
ngl
e
net
work,sob r
oadcas
ting for a c
ompute
ro na nother net
works e e
msl ik
ea
vi
ol
ati
onofthep rot
ocol.However,R i
sbehavingc orr
ectl
yb eca
usei tdoesnot
know ther
ea retwone twor
ks.Allcomp
ut ersonnet
work1willrec
eiv
eacopyof
thebroadcas
t,inc
l ngP.Comp
udi uterPc onsul
tsi
tsdat
aba
se,dis
cover
st tH4 i
ha s
onnetwork2,a ndsendsanARPr ep
lytha t
S
ec.6.
17 Pr
oxyARP 1
15

speci
fiesRsEt herneta ddressa stheha rdwarea ddres
s.R willrecei
vet her epl
y,
plac
ei tintheARPc ac
he ,ands enda nI PpackettoP( beca ePha
us simper s
onated
H4).Whe ni tr e c
e iv
esa nI nternetp acke,Pe
t xa
mi nesthede s
tinat
iona ddressin
thep acke
t,a ndf or-wardst hep ack
e ttoH4.
ProxyARPa lsohandlesi mpersonati
ona ndf orwardi
ngwhe nac omp uteron
net-work2s e ndst oac omp uteronne twork1.Fore xa
mp l
e,whe nH4 f ormsa n
Internetp a
ck eta ndnee dst os e
ndt hepack
e ttor outerR,H4 wi l
lbroa dcas
ta n
ARPr equestf orR.Pwi llreceiveac opyoft here que
st,consul
ti t
sda t
ab ase,and
senda nARPr ep l
yt hatimp ersonatesR.
How canp roxyARP b eus edf orsec
urity? ProxyARP c anb eus edf ora
fir
ewa lloronaVPNc onne c
tion.Thei deaist hatbecauseap roxyARPma c
hine
i
mp er s
onatesma chi
nesont hes econdnetwork,a l
lpacke
t smustt r
avelthought he
proxyARPma chinewhe retheyc anb echeck
ed.I nFigure6.4,fore xample
,as i
te
couldp lac
ea llhostson ne twor k2 a nd putf ire
wa l
ls of
twarei n machine P.
Whe neverap acketa r
rive
sf rom theI nte
rne t,thep acketwillg othroug hP
(
whe rethep acketcanb ee x
ami neda ndfi
rewa l
lcanb er ul
esappli
ed)oni tswa y
tot hede s
tina
tionhost.

6.
18I
Pv6Ne
ighb
orDi
scov
ery

IPv6 usest het em ne


r ighbor t o describea not
herc omp uteron t hes ame
network .IPv
6sNe i
ghborDi s
cover yPr otocol(NDP)r e
place
sARPa nda l
lowsahos t
toma pb etweena nI Pv6a ddressa ndaha rdwa readdr
ess.Howe v
e r
,NDPi ncludes
ma nyot herfuncti
ons .Ita ll
owsahos tt ofindt hesetofr out er
sonane t work,
determinewhe therag ivenne ighb oriss ti
llr eac
habl
e,learnt hene t workp r
efix
being us e
d,d etermine c harac-ter i
sti
cs of t he network ha rdware( e.g
. ,t he
ma xi
mum p acke
ts i
ze ),configurea na ddressf oreachinterf
a c
ea ndv e ri
fyt hatno
otherhos tont hene twor kisus ingt hea ddre s
s,andf i
ndt heb estr outert ous e
forag ivendesti
nation.
I
nsteadofcreati
ngaprotoc
olana
log
oustoARPt oha
ndlenei
ghbordis
cov
ery,
thede si
gnersofIPv6chos
et ouseI
CMPv6.Thus,I
CMPv6incl
udesmessag
esthat
ac omp ut
erus e
st of i
nditsnei
ghb
orsatstart
upa ndtocheckthes t
atusofa
nei
g hborperi
odi
call
y.
Ak eydi f
ferenc ebe t
we enARPa ndNDPa ri
s esfrom t hewa yea chha ndlesthe
statusofne i
ghbors.ARPus e sal ate-bi
ndinga pproac hwi thsofts tate.Tha ti s
,
ARPwa itsunt i
lada tagram mus tb esentt oane i
ghb orb efor
et akinganya cti
on.
Afteritp e
r-formsa ne xcha nge,ARPs torest heb indingi nitsca che,a ndt hen
sendsIPp acketstot hene i
g hborwi thoutc hecki
ngt hene ig
hbor
ss tatusunt ilthe
ARPc achet i
me rexp i
r e
s.Thede l
ayc anlastma nymi nut es.NDPus e searlyb i
nding
andt akesap roactivea p-proa cht ostatema intenance .Insteadofwa i
tingunt ila
datagra
m mus tbes ent ,anI Pv6nodeus esNDPt odi scoverneighborsa ts ta
rtup.
Furthermor e,anI Pv6 nodec onti
nuall
yc heck
st hes ta
tusofne i
ghbors.Thus ,
transmi
ssionofa nI Pv6da t agr amt oane ig
hborc a
np roceedwi t
houtde l
aya nd
doesnoti nvolv
eb roadc as
t.
SeeChapt
er22foradis
cus
sionof
NDP.SeeCha
pte
r9f oradi
sc us
sionof
ICMPv6.
1
16 Ma
ppi
ngI
nte
rne
tAddr
ess
esToPhys
ica
lAddr
ess
es(
ARP) Chap.6

6.
19S
umma
ry

Internetp rotoc
ols oft wareus e
sI Pa ddress
es.Tos endap a cketa c
r ossa
network , however, ha r dwa r
ea ddresses mus tb e used. The r
ef ore,p rot oc
ol
softwaremus tma pt heI nterneta ddressofac omputert oaha rdwa readdre ss.If
hardwar ea ddres
sesa r es mall
ert hanI Pa ddress
es,a di rect ma ppi
ng c anb e
establ
is
he db yhavingt hema c
hinesha rdwarea ddressemb eddedini tsIPa ddr ess
.
BecauseI Pv6 ha slargea ddr ess
es,i ta l-waysus esdi rectma pping.I Pv4 us es
dynamicma ppi
ngwhe nt heha rdwa rea ddressislar
gert hant hehostp ortionofa n
IPv4a ddress.TheAddr essRe sol
ut i
onPr otocol(ARP)p erformsdyna mica ddr e
ss
resol
ution,us i
ngo nl
yt hel ow-levelne tworkc ommun- i
cationsystem.ARPp ermits
ac omputert or es
olv
ea ddr ess
eswi thoutus ingada tabaseofb indi
ng sandwi t hout
requir
ingama nagert oc onf i
gures oftwa re.
Tofindt heha r
dwarea ddre
s sofa not
he rcomp ute
ro nthes amene t
work,a
machinebroa
dc as
tsa nARPr equest.Ther e
que s
tc ontai
nstheI Pv4a ddres
softhe
ta
rge tmachi
ne .Allmachine
sonane t
wor kr ec
eivea nARPr e
que st,andonlythe
ta
rge tmachi
ner esponds.TheARPr eplyc ontai
nst hesender
sI Pv4a ddres
sand
har
dwa read-dress
.Re pl
i
esa resentunicast
;t heya r
enotb roadca
s t
.
Tomak eARPe f
fic
ient
,eachmachineca
chesI
P-t
o-har
dwa r
eaddre
ssbi
ndi
ngs.
Usi
ngac acheavoi
dsunne c
ess
arybr
oa dca
sttra
ffi
c;e
arl
yr ev
ali
dat
ioncanb
eus e
d
toeli
mina
tej i
tter
.
AnolderprotocolrelatedtoARP,RARP,i sbei
ngus e
di nc l
oudda tac
enters
.
Thep roxyARPt echniquec anb eusedins e
curi
tys ys
tems,s ucha saVPN ora
fi
rewalltha
ti stransparentt oroutersandhosts
.IPv6ha sre pl
acedARPwi t
ha
Neighb
orDiscover
yPr otocol(NDP).Unli
keARP,NDPc ont i
nuall
yc hec
ksneig
hbor
sta
tust odete
rminewhe therane i
ghborhasrema
inedreachabl
e.

EXERCI
SES

6.
1 Give
nas ma l
lsetofhardwareaddre
sse
s(posi
ti
veinte
g er
s),canyouf i
ndaf unct
ionf
andana s
signmentofIPa ddr
e s
sess
uchthatfma pstheIPa ddr
ess
es1 -t
o-1ontothe
phys
ica
la d-dres
sesandc omputng fi
i seff
ici
ent
?( Hint:lookatt helite
ratur
eon
perf
ecthashing
.)
6.
2 I
nwhatsp
eci
alca
sesdoesahostconne
cte
dt oanEthe
r ne
tnotneedtouseARPor
a
nARPca
chebef
oretrans
mit
tinga
nI Pdatag
ram?(
Hint:whata
boutmult
ica
st?)
6.
3 Onec ommona l
gori
thm forma na
gingt
heARPcacherep
lac
esthelea
strece
ntlyuse
d
entr
ywhe naddi
ngane w one.Underwha
tci
rcumsta
ncescanthi
sal
gor
ithm p
roduc
e
unneces-
sarynetworktr
a f
fic
?
6.
4 S
houldARPsoftwaremodi
fytheca
cheevenwhe
nitr
ece
ive
sinf
orma
tionwi
thout
s
peci
fi
-ca
ll
yreques
tingi
t?Whyorwhynot
?
6.
5 Anyimpl
ementati
onofARPt hatus e
saf ix
ed-si
zecacheca
nfailwhe
nus
edona
net
workthathasma nyhost
sa ndheavyARPtra
ffi
c.Expl
ai
nhow.
6.
6 ARPisof
tencit
eda sasecuri
tywe a
kness
.Expl
ainwhy.
Ex
erc
ise
s 1
17

6.
7 Supposemac
hineC r
ece
ive
sa nARPr e
que
stsentfrom A l
ook
ingforta
rgtB,a
e nd
sup
pos eChasthebi
ndi
ngf om I
r oHB i
B t nit
sc ac
he.S dCa
houl ns
we rt
hereque
st?
Expl
ain.
6.
8 ARPcanpre
b ui
ldacac
hef orallpos
sib
lehos
tsona nEthe
rne
tb yit
era
tingthr
ough
these
tofp oss
ibl
eIPaddr
e s
sesandsendi
nga nARPreque
stforea
ch.Isdoi
ngs oa
goodi
dea
?Whyorwhynot ?
6.
9 Shoul
de arl
yr ev
ali
dati
on s
end areque
stforal
lposs
ibl
eI Paddr
esson thel oc
al
network
,a l
lentr
iesintheARPcac
he,oronl
yforde
sti
nati
onst
hathaveex
pe r
ienced
traff
icrec
entl
y?Ex p
lai
n.
6.
10 How c
anacomputeruseARPa
tb oott
imet
of i
ndoutifa
nyothe
rma c
hineont
he
net
worki
simpe
rsonat
ingi
t?Whataret
hedi
sadv
ant
age
softhes
cheme
?
6.
11 Expl
ai
nhowsendi
ngIPv
4p ac
ket
stonone
xis
tenta
ddr
ess
esonar
emot
eEt
her
netc
an
ge
n-erat
ebr
oadcas
ttra
ffi
conthatne
twork
.
6.
12Suppos
eag iv
enEthe
rne
tswitc
hc onnec
ts4095hostsandar out
er.I
f99% ofa
ll
tra
fficiss
entbe
tweeni
ndi
vi
dualhost
sandtherout
er,doesARPorNDPinc
urmor
e
over
head?
6.
13 Answe
rt hepre
viousquest
ionfort
hec
asewhe
ret
raf
fici
suni
for
mlydi
str
ibut
ed
amongra
n-domp ai
rsofhosts
.
Chapt
erCont
ent
s
7.
1 Intr oduc ti
on,1 19
7.
2 AVi r tualNe twor k,1 19
7.
3 Inte rnetAr chit
e ctur eAndPhi l
osophy,1 20
7.
4 Princ i
p l
esBe hindTheS tructure,120
7.
5 Conne ctionl
e ssDe li
ve rySystemCha ract eri
st i
cs,121
7.
6 Pur pos eAndI mp orta nceOfTheI nterne tPr otocol
,122
7.
7 TheI PDa tagram,1 22
7.
8 Dat agr am Typ eOfS ervi
ceAndDi ffer entiatedS er
v i
ces
,
127
7.
9 Dat agr amEnc apsulat i
on,129
7.
10 Dat agr amS ize,Ne twor kMTU,a ndFr a gme ntation,130
7.
11 Dat agr amRe assemb ly,134
7.
12 Hea derFi el
dsUs edForDa t
ag r
amRe assemb ly,135
7.
13 TimeToLi v
e( IPv 4)AndHopLi mi t(IPv 6),136
7.
14 Opt i
ona lI PI tems ,137
7.
15 Opt i
onsPr oce ss
ingDur ingFragme ntation,1 41
7.
16 Net wor kByt eOr de r,143
7.
17 Summa ry,144
7

InternetPr otocol:
ConnectionlessDatagram
Del
ivery( IPv4,I Pv6)

7.
1Int
roduc
tion

Pr e
v i
ousc hapte rsreviewp ie
c esofne twor khardwar eands oftwa rethatma k e
i
nt er-
ne tc ommuni ca ti
onp os
sib
le,e xp
lainingt heunde r
lyingne tworkt e
chnologi
e s
and a d-dressr es
olut i
on.Thi sc hapte
re xpl
ains the fundame ntalp r
incipl
e of
connectionles
sde li
v ery,a nddi s
cusseshow i tisp rovi
dedb yt heI nternetPr otocol
(IP),whi c
hi soneoft het woma jorprot ocol
sus edinint er
net working(TCPb ei
ng
theot her).Wewi lls t
udyt heforma tofp ack
et susedforb othI Pv4a ndI Pv6,and
willseeho ws uchp a cketsf ormt hebasisf ora l
linterne
tc ommuni cation.Thene x t
twoc ha ptersc ontinueoure xamina-ti
onoft heI nternetPr otocolb ydi s
cussi
ng
packetf orwardinga nde rrorhandling.

7.
2AVi
rtua
lNe
twor
k

Chapter3di sc
ussesi nt
ernetarchi
tectureinwhichrout
ersc onnec
tmul t
ipl
e
p
hysi
calne t
wor k
s.Look inga tthear c
hit
e ct
urema ybemi s
lea
ding,b ec
ausethe
f
ocusofi nter
nett echnologyisont heab s
trac
tionthataninternetprovi
desto
a
ppli
cat
ionsandus ers
,notont heunderl
yinginterc
onne
cti
ontechnolog
y.
1
19
1
20 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

Internettec
hnologypr esent
st heabstract
ionofas ingl
ev i
rtual
net-workt hat interconnects al
l hosts, and thr
ough whi c
h
communicati
on ispossibl
e.Theunder l
yingar c
hit
ectureisboth
hiddenandirrel
evant.

I
nas e
nse,a nint
ernetisa na bs
tracti
onofal argep hysic
alnetwork.Att he
l
owes
tl evel
,inter
nett echnol
ogyp rovi
desthe same b a
sicf uncti
ona
lit
ya sa
p
hysi
calnetwork
:ita c
-ce
pt spacke
tsa nddel
i
ver
st hem.Hi gherlev
elsofinter
net
s
oft
wa reandnetworkappl
i-cat
ionsaddmostoft heric
hf unc ti
onal
it
yt hatuser
s
p
erce
ive.

7.
3Int
erne
tAr
chi
tec
tur
eAndPhi
los
ophy

Conc
e p
tual
l
y,aTCP/IPi
nte
rnetprov
idesthr
eeset
sofserv
ice
s.Fi
gur
e7.
1
l
i
ststhethreec
ate
gor
iesa
ndi
ll
ustr
ate
sdepende
nci
esa
mongthe
m.

APPLI
CATI
ONS
ERVI
CES

RELI
ABLETRANS
PORTS
ERVI
CE

CONNECTI
ONLES
SPACKETDELI
VERYS
ERVI
CE

Fi
gur
e7.
1Thet
hre
econc
ept
uall
eve
lsofi
nte
rne
tse
rvi
ces
.

Att helowe s
tl evel
,ac onnect
ionl
essde l
i
veryservi
ceprovi
de safounda t
ionon
whiche ver
yt hi
ngr es
ts.Att hene xtlev
e l
,ar el
iabl
et r
anspor
ts ervi
cepr ovi
desa
hig
her -
levelp l
atform onwhi cha ppl
ic
ationsdepend.Wewi llexplor
ee ac
hoft he
ser-
vices,unde rs
t andt hefuncti
onali
tyt heyprovide,theme chani
smst heyus e
,
andt hespecifi
cp rotocolsa
ssoci
atedwitht hem.

7.
4Pr
inc
ipl
esBe
hindTheS
truc
tur
e

Althoughwec ana ss
ociateprotocolsoftwa rewitheachoft heleve
lsinFi gure
7.1
,t her easonf o
ri denti
fyingt hema sconceptualpartsoft heTCP/ IPI nternet
technologyist hatt heyc l
earl
yp ointoutt wop hi
l
osophi
ca lunderpi
nningsoft he
desig
n.Fi rs
t,t hefi
g -ureshowst hatt hedesignb ui
ldsrel
iableserv
iceont opofa n
unreli
ab l
e,c onnec
tionles
sb ase.S econd,i ts howswhy t hede si
gn hasb ee
ns o
widelya cc
epted:thel owestlevelservi
c eexactlyma tc
hest hefacil
it
iesprovidedb y
underlying hardwarene twor ksa nd thes econd levelprovidesthes ervicet hat
a
ppl
i
cat
ionse
xpe
ct.
S
ec.7.
4 Pr
inc
ipl
esBe
hindTheS
truc
tur
e 1
21

Thethree-
levelconceptaccountsf ormuc hoft heInt
ernet
ssucces
s;a sa
conse-
quenc
eoft heb as
icdesi
gn,t heI nte
rnettechnol
ogyhasb e
ens ur
pris
ingl
y
robustand adaptab
le.Thec onne c
tionl
essservi
cer unsove
ra rbi
tra
ry network
hardware
,a nd ther e-l
ia
bletra ns
por tservi
cehasb eensuffi
ci
entf orawi de
vari
etyofappli
cati
ons.Wec ansumma ri
ze:

Internetprotocol
saredesignedar oundt
hreec onc
eptuall
evel
sof
ser
- v
ice.A c onnect
ionl
esss er
viceatt hel owestlevelmatches
underlyi
nghar dwarewel l
,ar eli
abletr
ansportservi
c eprov
ides
ser
v i
cet oappli
-cati
ons,andav ar
ietyofappli
cati
onsprovi
det he
ser
v i
cesusersex-pect.

The de s
ignin Figure 7.1issignifi
cant beca useitr epresentsa drama ti
c
depart
ur ef rom pre
vioust hink
ing a
b out dat ac ommuni c
ati
on.Ea rl
y networ k
s
fol
lowedt hea p
-proa
chofb ui
ldi
ngreli
a b
ili
tya tea chleve
l.TheI nternetprotocol
s
are organizedt ostart wi t
hab asicp a c
ke t de l
iv
erys ervic
ea nd t
hena dd
rel
i
a bi
li
ty.Whe nthede s
ignwa sfi
rstp roposed,ma nyprofes
sionalsdoub
tedt hat
itcoul
dwor k.
Ana dva
ntageoft heconceptualse
parat
ionistha titenable
sones ervi
cetob e
enhancedorr epl
acedwi t
houtdi s
turbi
ngot he
r s
.Int heea r
lyInt
ernet,r es
earch
andde vel
opmentproceededconcurrent
lyona l
lthreel ev
els.Thesep
ar a
tionwillbe
espe-c
ial
lyimportantduringt hetransi
ti
onf rom IPv4t oI Pv6becauseita l
lows
hig
herl a
yerp r
otocol
sa ndappl
icati
onstoremainunc hanged.

7.
5Conne
cti
onl
essDe
li
ver
ySys
tem Cha
rac
ter
ist
ics

Themos tf undame ntalInt e


rnets e
rvicec onsistsofap acketde li
verys ystem.
Techni call
y,t hes ervi
cei sde fi
neda sa nunr el
iable,b es
t-effort,c onne cti
onless
packe tde li
v er
ys yste
m.Thes e
rviceisa na l
og oust ot hes e
r vi
cep rovi
dedb ymos t
networ k ha rdwa reb ecausep acket-switc hing t e
chnologiess ucha s Et herne t
opera teonab est-e
ffor tde l
iveryp aradi
g m.Weus et het echni
calt erm unr el
iable
to me ant hatde l
iveryi sno tg uarantee d.A p acketma yb el ost,dup l
icated,
delaye d,orde li
veredoutofo rder.Thec onne cti
onlesss e
rvicewillnotde tectsuc h
condit i
ons,norwi l
liti nformt hes enderorr ec ei
ver.Theb asi
cserv i
ceisc lass
ifi
e d
asc onnec tionlessbecaus ee ac
hp ack
e tist re ate dindep e
ndent l
yf rom allot hers.A
seque nc e of p a c
ketss ent from one c omp ut ert oa nother ma yt ra v
elov er
differe ntp aths ,ors omema yb el ostwhi leot hersa rede li
vered.Fi nall
y,t he
servicei ssa i
dt ous eb est-effortdeliverybec auset heI nternetsof twarema kesa n
earne sta ttemp tt ode liverpa c
kets.Tha ti s ,t heI nternetdoe snotdi sca rdpa c
k -
etsc a pri
ciously; unre li
abil
i
tya rises only whe nr esourcesa ree xha usted or
unde rlyingne twor ksfa il
.
1
22 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

7.
6Pur
pos
eAndI
mpor
tanc
eOfTheI
nte
rne
tPr
otoc
ol

Theprot
ocolthatdefine
st heunr el
i
a b
le,connectionl
essdel
ive
ryme chani
smis
cal
le
dt heInter
netProtocol(IP).Wewi llfol
lowt hec onve
ntionusedinstandar
ds
doc-ument
sb yus i
ngthet emsI
r nter
netPr otoc
olandI Pwhens tate
me nt
sa ppl
y
broadl
y,andonlyus ngI
i Pv4 orI Pv6whenapar t
iculardetai
lisappli
edt oone
vers
ionbutnott heothe
r.
The I nternet Protoc olp rovidest hreei mp ortant spe c
ificati
ons .Fi rst,I P
definest heb asicunitofda tat ransferus e
dt hr oughoutaTCP/ IPint e rne t
.Thus ,
itsp eci
fi
e sthee x-ac
tp ack e
tf orma tus edbya l
lda taast heda tapa sse sa c
ros sa n
int
e rnet.S econd,I Psoftwa rep erformst hef orwar dingfunc tion,c hoos ingap a th
over whi chap ack
et wi l
lb es ent.The s tandardss pecify how f or wa r
ding i s
performe d.Thi rd,ina dditi
on t ot he pre -
c i
se,f orma ls pe ci
fi
ca tion of da ta
forma tsa ndf orwarding,I Pi ncludesas etofr ul
est ha te mb odyt heb asisof
unre l
iabl
ede l
ivery.Ther ulesc haracteri
zehow hos tsa ndr out erss houl dp rocess
packe t
s,how a ndwhe ne rrorme ssag
e sshouldb eg enerated,a ndt hec on-ditions
unde rwhi c hp acketsc a
nb edi scarded.TheI nt e
rnetPr o tocoli ss uc haf unda -
ment alp artoft hede si
g nt ha tt heI nterneti ss ome t
ime sc al
l
eda nI P-bas ed
technology.
Web egi
nourc ons
idera
t i
onofI Pbylooki
ngatthepack
etforma
ti tspe
cif
ies
.
The chapte
rf ir
ste xaminest he I
Pv4p ack
etf or
mat,and the
nc onsi
dersthe
for
ma t used wi
thI Pv6.We l e
ave unt
illaterchap
ter
st he t
opi
csof p ac
ket
for
wa rdi
nga nderr
orha ndl
ing.

7.
7TheI
PDa
tagr
am

Onap hysi
calne twork,theunitoft ransf
eri
saf r
a methatcontainsahe ader
anddata,whe ret hehe aderg i
vesinfor mati
onsucha st he(physi
cal
)s ourcea nd
des
tinati
on addresses.The I nte
rnetc all
si t
sba s
ict rans
fer uni
ta nI nter
net
dat
agram,us ual
lya bbre
-via
t edIP dat agram.Inf act,TCP/ I
Pt echnology has
bec
omes osuccess
f ulthatwhe ns ome oneus esthet erm dat
agram wi thouta ny
qual
ifi
cati
on,itisg eneral
lyaccepte
dt ome anIPdatagram.
Theanalogybe
tweenada tagrama ndane tworkp acketi sstrong.AsFi g
ur e
7.2il
-lus
trates
,adatagramisdi v
idedintoahe ade
ra ndp ayloadjustlik
eat ypi
cal
networkframe.Al
solik
eaf r ame,theda ta
gram headerconta i
nsme tadatasucha s
thesourceanddesti
nati
ona ddress
esandat ypefi
eldt hatidenti
fiesthec ontents
oftheda t
agram.Thediffe
re nce
,ofc ourse,istha
tt heda tagram headercontains
IPaddress
es,wher
easthef ramehe ade
rc ontai
nshardwa r
ea ddresses.

DATAGRAM HEADER DATAGRAM PAYLOAD

Fi
gur
e7.
2Ge nera
lf or
mofa nI
Pda
tag
ram,t
heI
nte
rne
tana
log
yofa
ne
t -
wor kframe
.
Net
work
ingprof
e s
siona
lssometi
mesref
ert o
Inter
netpac
ket
storefe
rtoadatagrama
sit
t
rav
elsove
ranetwork;thedist
inct
ionwil
lbecomecl
earwhenwetal
kaboutenc
aps
ula
tion.
S
ec.7.
7 TheI
PDa
tag
ram 1
23

7.
7.1I
Pv4Da
tagr
amFor
mat

Now tha
tweha vedes
cri
bedt heg e
nerall
ayoutofa nIPda ta
gra
m,wec a
n
l
ookatthecontent
sinmoredetail
.Figure7.3showst hearrang
ementoffiel
dsi
n
a
nI Pv4da-t
agram.Thenextp a
rag r
aphsdi
scus
ss omeoft heheaderf
iel
ds;l
ater
s
ecti
onsonfrag
-me nt
ati
onandop t
ionscoverre
ma ini
ngf i
el
ds.

0 4 8 1
6 1
9 24 31
VERS HLEN S
ERVI
CETYPE TOTALLENGTH
I
DENTI
FICATI
ON FLAGS FRAGMENTOFFS
ET
TI
METOLI
VE PROTOCOL HEADERCHECKS
UM
S
OURCEI
PADDRES
S
DES
TINATI
ONI
PADDRES
S
I
POPTI
ONS(
IFANY) PADDI
NG
PAYLOAD
...

Fi
gur
e7.
3FormatofanIPv4da
tag
ram,t
heb
asi
cuni
toft
rans
feri
na
TCP/
IPint
erne
t.

Beca usea nint erneti sv irtua l


,t hec onte ntsa ndf ormata r
enotc onstrained
byne t-wor kha rdwa re.Fore x
a mp l
e,t hef irst4- bitfiel
di nada t
a gram( VERS)
cont ai
nst hev ersionoft heI Pp rotocolt hatwa sus e
dt ocre atet heda tagra m.
Thus ,forI Pv4,t hev er-si
onf i
eldc ontainst hev alue4.Thef i
eldisus edt ov er i
fy
thatt hes ender,r eceive
r ,a nda nyr oute rsinb e
t weent hema greeont hef orma t
oft heda tagr
am.Al lIPs oft war eisr e-quire dt oc heckt hev e
rsionf iel
db e
f ore
proce s
singada tag ramt oe nsurei tma tchest hef or matt hesof twaree x pe
cts.We
wills e
et ha talt
houg ht heI Pv6da tagram he aderdi ff
ersf rom t heI Pv4he ader,
IPv6a l
sous esthef i
r s
tf ourb i
tsf orav er
s i
onnumb er,ma kingi tp ossi
blefora
rout erorhos tc omp utert od i
stinguishb etwe ent het wov e
r -si
ons.I ng enera l
,a
comp ute rwi llreje c
ta nyda tagr ami ft hec omp uterdoe snotha ves oftwaret o
handlet hev ersi
ons peci
f i
e di nt heda tagram.Doi ngs op reventsc omp utersf rom
misinterp reti
ngda tagramc ont e
nt sora pp l
yinga nout datedfor ma t.
Theheaderlengt
hf ie
ld(HLEN),als
o4b i
ts,giv
est hedata
gram hea
derleng
th
measuredin32-bi
twor ds.Aswewi l
lsee,allfi
e l
dsi
nt heheaderhavefi
xedleng
th
ex-
ce p
tf ortheIPOPTI ONSandc orr
esp ngPADDI
ondi NG fi
elds
.Themos tcommon
da-t
a gra
m header
,whi c
hc ontai
nsnoop ti
onsa ndnop addi
ng,measure
s20oc tets
andha saheaderleng
thf i
eldequalto5.
TheTOTALLENGTH fi
eldgiv
estheleng
thoft heI
Pda ta
gra m meas
ure
din
oct
et s
,inc
ludi
ngoct
etsintheheade
ra ndpayl
oad.Thesizeoft hepayl
oadare
a
ca
nb ecom-pute
db ysubt
ract
ingthelengt
hoft heheader(thir
tyt wotimes
HLEN)f
r heTOTALLENGTH.Be
om t caus
etheTOTALLENGTHf
iel
dis1
6bi
tsl
ong
,
t
hema
ximump
oss
ibl
e
1
24 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

1
6
sizeofa nI Pda ta gr
ami s2 or65, 535oc te
ts.Formos tappli
cati
onst hel i
mit
doesnotp res
e ntap roblem.I nf a
ct,mos tunde r
lyingne t
wor ktechnologie
sus e
muc hsma l
lerfr a
mes i
zes ;wewi lldis
c us
st herel
ations
hipb et
we enda t
a gra
ms i
ze
andf rames i
zel a
te r
.
FiedPROTOCOLi
l sa nalog
oust ot het yp efi
el
di nane tworkf rame;t hev a
lue
speci
fie
swhi chhi gh-l
ev e
lp rotocolwasus e dt ocreatetheme ssagecarriedint he
PAY-LOADar e
aoft heda ta
gram.I ne sse
nc e,thev a
lueofPROTOCOLs peci
fiesthe
formatoft hePAYLOADa rea.Thema ppi
ngb etweenahi gh-l
evelprotocolandt he
integ
erv a
lueus edi nt he PROTOCOL f i
eldmus tb eadminist
eredb y ac entra
l
authori
t ytog uaranteea greementa crosst heentir
eI nter
ne t
.
Fi
eldHEADERCHECKS UM ensuresi
ntegr i
tyofhe a
de rval
ues.TheIPchec
ksum
i
sformedb ytreati
ngthehe ade rasas equenceof1 6- b
itinteger
s(innet
wor k
b
yteord-er
),addingthe
mt og etherusi
ngone scomplementa r
ithmeti
c,a
ndt hen
t
aki
ng the one
sc ompl
ement of t he re
s ult
.For p urpose
sof c omput
ing the
c
hecks
um,fiedHEADERCHECKS
l UM isas
sume dt oconta
inze r
o.
Itisi mportantt onot et hatt hec heck
sum onlya p
p l
iestov aluesintheI P
headera ndnott ot hep ayload.S epa
r a
tingthec hecks
umsf orheade r
sa ndpayl
oads
hasa dvan-tagesa nddi sadvanta g
es.Be causet hehe aderus uall
yoc c
upiesfewer
octetsthant hep ayload,ha vingas eparateche c
ksum r e
duc esprocessi
ngt i
mea t
routerswhi c
honl yne e
dt oc omp utehe aderchecksums.Thes ep
ar a
tionalsoall
ows
higher-
levelprotocolst
oc hooset heirownc hecksums chemef ort heme ss
agesthey
send.Thec hi
e fdisadvan-t a
g ei sthathi gher-
levelpr otocol
sa ref orce
dt oa dd
theirownc hecksumorr iskha vingac orruptedp a
yloadg ounde tect
ed.
Fi
eldsSOURCEI PADDRESSandDESTI NATIONI PADDRESSc ontai
nt he32- bi
t
IPa ddresse
sof t he datag
ramsse nde
ra nd intendedreci
pi
ent .Althought he
datagra
m ma yb eforwardedthroughma nyintermedia
terouter
s ,thes our
cea nd
dest
ination fi
el
dsneverc hange;the yspeci
fyt heI Paddr
essesoft heor i
gi
nal
sourcea ndultima
tede st
ina-t
ion.Not ethatintermedi
aterout e
ra ddress
esdo
nota p
pe ari
nt hedat
a gr
am.Thei deaisfundamentaltotheover
a l
ldesi
g n:

Thes our
c eaddr
essf i
el
din adatagram al
waysref
erstot
he
ori
ginalsour
ceandt hedes
tinat
ionaddres
sf i
el
drefer
stot
he
ul
timatedesti
na-
tion.

Thefieldlabe
ledPAYLOADi nFig
ure7.3onlys howsthebeg i
nni
ngoft hea r
ea
oft heda ta
g ra
mt hatc arr
iestheda t
a.Thel engthoft hep ayl
oadde pends,of
course,onwha tisb eingsentintheda ta
gram.TheI POPTI ONSf i
eld,discuss
ed
below,isv aria
blel ength.Thef i
eldlabel
ed PADDING,dependson t heop ti
ons
sele
cted.Itr epres
e ntsb i
tsconta
ini
ngze rotha tma ybene ededtoe ns
ur ethe
datagram headerex tendstoa nexactmulti
pl
eof32b i
ts(re
ca l
lthatt hehe a
der
l
e ngthfi
eldisspeci
f i
edi nunit
sof32- bi
twords).
Anexce
pti
oni
sma
dewhe
ntheda
tag
rami
ncl
ude
sthes
our
cer
out
eop
tionsl
i
ste
d
bel
ow.
S
ec.7.
7 TheI
PDa
tag
ram 1
25

7.
7.2I
Pv6Da
tagr
amFor
mat

IPv6completel
yr evi
sesthedatag
ramformatb yrepla
cingt heIPv 4dat
agram
header.Inst
eadoft ryi
ngt ospeci
fya l
ldeta
il
sinas i
ngl
ehe ader
,I Pv6usesan
extensi
on capa
bili
tyt hata l
lowsthe IETF toa da
ptt he pr otoc
ol.Figure 7.
4
i
llus
tratesthec oncep
t :anI Pv6datagr
amb egi
nswi t
haf ix
e d-szeb
i as
eheader
foll
owedb yzeroormor eext
en-si
onheader
s,fol
lowedb yap ayload.

opt
ional

Bas
e Ext
ensi
on Ext
e ns
ion
Hea
der Heade
r1 ... HeaderN PAYLOAD...

Fi
gur
e7.
4Thegene
ralf
ormofanIPv6da
ta g
ramwi
thab
asehe
ade
rfol
-
lowe
dbyopti
ona
lex
tensi
onheaders
.

How c a
nar ecei
verknow whi c
he xte
nsionhe a
dershavebeeni
ncl
udedina
g
ivenda t
agram?Ea chIPv6he adercontansaNEXTHEADER f
i i
el
dthatspec
ifi
es
t
het ypeoft heheade
rt ha
tf oll
ows.Thefina
lhe a
derusestheNEXTHEADERfie
ld
t
os p
e c
ifythet yp
eoft hepayload.Fi
gure7.5il
lustr
ate
st eofNEXTHEADER
heus
f
iel
ds.

Ba
seHe
ade
r
NEXT=TCP TCPS
egme
nt

(
a)

BaseHeader Rout
eHe ade
r
TCPS
egme
nt
NEXT=ROUTE NEXT=TCP
(
b)

BaseHeader RouteHeader AuthHeader


TCPS
egme
nt
NEXT=ROUTE NEXT=AUTH NEXT=TCP
(
c)

Fi
gure7.
5I l
l
ustra
tionoftheNEXTHEADERf i
eldsi
nIPv6dat
agra
ms
wi
th
(a)onl
yab as
ehe ade
r,(b
)ab as
ehe a
derandoneexte
nsi
on,and
(c)abasehea
dera ndtwoext
ensionhea
ders
.
1
26 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

Thep ara
di gm ofaf i
xedb a s
ehe aderf ol
lowe db yas etofop tiona le x
tensi
on
headerswa sc hosena sac omp romi seb etweeng enerali
tya nde ff i
c i
enc y.Tob e
totall
yg ene
ra l,IPv6ne edst oi ncludeme chanismst osupportf unc tionss ucha s
fragmentati
on,s ourcer outing,a nda uthent i
cation.Howe ver,choos ingt oa ll
oca
te
fix
e dfiel
dsint heda -ta
g r
a mhe aderf ora llme chanis
msi sineff
ici
e ntb e causemost
datagramsdonotus eallme chanisms;t hel argeI Pv6a ddres
ssizee x acerb a
testhe
ineffi
ci
ency.Fore x a
mp le
,whe ns endingada tagrama c
rossas ing l
el ocala r
ea
networ k
,ahe adert hatc ontainsunus eda ddressf i
e l
dsc a
noc cup yas ubstant
ial
fracti
onofe a chf rame.Mor eimp ortant,t hede si
gnersreali
zedt ha tnoonec an
predic
t whichf aci
lit
ieswi llb e ne eded.The re-fore,t he desi
g ne rsop tedfor
extensi
onhe adersa sawa yt oprov i
deg e
ne ral
it
ywi thoutforci
nga llda tagramsto
havelargehea ders
.
Someoft hee xtensi
onhe adersa reint e
ndedforp roces
singb yt heulti
ma te
de s
tina-tiona nds omeoft hee xt
ens i
onhe adersar
eus edb yintermediaterouters
alongt hep ath.Ob s
ervethatt heus eofNEXTHEADERf i
eldsme ansext e
nsi
onsa re
proce ss
eds eque n-ti
all
y.Tos peedp rocess
ing,IPv6requi
rese xtensi
onhe ade
rstha t
areus e
db yinte rmedi-
ater outer
st op recedeexte
nsionheader susedb ythefinal
de s
tination.Weus ethet e
r m hop-by-hopheadert orefertoa ne xtensi
onhe a
de r
thata ni nterme diat
er outermus tp ro-
c e
ss.Thus,hop- b
y-hophe a
de rsprec
e de
end-t o-endhe ade rs
.

7.
7.3I
Pv6Ba
seHe
ade
rFor
mat

EachI Pv6 da
tagra
m b egi
nswi th a 40-oct
etb ase headera sFi gure 7.6
il
lus
trates
.Althoughitistwiceasl a
rgeasat ypi
calI
Pv4da ta g
ram he a
der,t he
IPv6b a
sehe a
dercontai
nsles
sinformati
onb ec
ausefragmentat
ioni nformati
onha s
beenmov edtoe xt
en-si
onheaders.Inaddi
tion,IPv6changest hea l
i
g nmentfrom
32-bitto64-bitmult
ipl
es.

0 4 1
2 1
6 24 31
VERS TRAFFI
CCLAS
S FLOW LABEL
PAYLOADLENGTH NEXTHEADER HOPLI
MIT

S
OURCEADDRES
S

DES
TINATI
ONADDRES
S
Fi
gur
e7.6TheI
Pv6b
asehe
ade
rfor
mat
;thes
izei
sfi
xeda
t40
oc
tet
s.
S
ec.7.
7 TheI
PDa
tag
ram 1
27

Asi nI Pv4,t hei nitia


l4- bitVERSf ields pecifi
est hev e rsi
onoft hep rotoc ;6
ol
speci
f i
e sa nI Pv 6da tagram.Asde scri
bedb elow,t heTRAFFI CCLASSf ieldisi nter-
pretede xact l
yt hes amea sI Pv 4sTYPEOFS ERVI CEf ield.FieldFLOW LABELi sin-
tende dt oa llow I Pv6t ob e us ed wi t ht echnol
og i
est hats upportr esource
reserva ti
on.Theunde r
lyinga bstracton,af
i l
ow,c ons istsofap atht hr oug ha n
interne t.I nte rmediater out er sa l
ongt hep athg ua r a
nte eas peci
ficqua lityof
servi
c ef orp a
c ketsont hef ow.TheFLOW LABELhol
l dsa nI Dt ha tallowsar outer
toi de ntifyt hef low,whi chi sus edi ns tead oft hede st i
nation a ddr esswhe n
forwa rdingada t
agr am.Cha p ter1 6e xplainst hep ote ntialus esofaf low la belin
mor ede tail
.I Pv 6us esaPAYLOADLENGTH f i
eldr at hert hanada ta g
r aml ength
fie
ld;t hedi ffe re
ncei st ha tt hePAYLOADLENGTHr e f
e r
sonl yt ot heda tab eing
carri
e da nddoe snoti nc l
udet hes i
zeoft heb asehe a dero re xt en-si
onhe a
de r(s)
.
1
6
Toa llow ap ayloadt oe xce e
d2 oc tets,I Pv6de fi
ne sane xtens i
onhe a
de rt hat
speci
f i
e sada t a
gramt ob ea j umbogr am.A NEXT HEADER f iel
da ppe arsi na l
l
heade rs( theb asehe adera ss howna nde a che xtensi
onhe ader);t hef ields pecifi
es
thet yp eoft hene xte xte nsionhe ader,a ndi nt hef i
na lhe ade r,g i
vest het ypeof
thep ay- load.TheHOPLI MI Tf i
eldspecifiest hema ximumnumb e rofne twor kst he
datagr amc ant raverseb ef oreb ei
ngdi scar ded.Finally,t heS OURCEADDRESSand
DESTI NA- TI ONADDRESSf iel
d ss pecifyt heI Pv6a ddr essesoft heor iginals ender
andul t i
ma tede sti
nation.

7.
8Da
tagr
am Typ
eOfS
erv
iceAndDi
ffe
rent
iat
edS
erv
ice
s

Informa l
l
yc al
ledTypeOfSer vice( TOS),t he8- btS
i ERVI CETYPEf i
el
di na n
IPv4 headera ndt he TRAFFIC CLASSf ie
ldi na nI Pv6he a
de rs p
e c
ifyhow the
datagra
ms houldb ehandled.InIPv4,t hef iel
dwa sor i
gi
nall
ydi vi
dedintosubfi
elds
thats p
e c
ifiedt heda tagram
sp recedenc ea ndde s
iredp athc haract
eri
sti
cs( l
ow
dela
yorhi ght hroughput)
.I nthelat e1990s ,t heI ETFr e
def i
nedt hemeaningof
thef i
el
dt oa c
c om-modateas etofdi f ferenti
at eds er
vic
es( Diff
Serv).Fi
gure7. 7
il
lus
tratest her es
ulti
ngde fi
nit
ionwhi cha ppli
est oIPv 6aswe llasIPv4.

0 1 2 3 4 5 6 7
CODEPOI
NT UNUS
ED

Fi
gur
e7.
7Thedi ff
erent
iat
edserv
ice
s(Di
ffSe
rv)i
nterp
ret
ati
onofb i
ts
i
nt heIPv4SERVICETYPEandIPv6TRAFFI
CCLASSheader
f
iel
ds.

UnderDi
ffS
erv,thefirsts
ixbi
tsofthefie
ldcons
tit
uteac odepoi
nt,whichis
s
ome-ti
mesabbrev
iat
edDS CP,andthel
asttwob i
tsareleftunused.Ac odep
oint
v
aluemap st
oa n under
lyingser
vic
edefini
ti
on,typi
call
yt hr
oug hana r
ray of
poi
nters.Althoughiti sposs
ibl
et odefi
ne64 se
pa r
ateserv
ices
,t hedes
igners
sugge
stt hatag i
venrouterwillonl
yneedafewservi
ces
,andmultipl
ecode
points
wil
lma pt oeachserv
ice.Forexam-pl
e,arout
ermightbeconfi
guredwihav
t oic
e
ser
vic,av
e i
deoserv
ice,anetwork
1
28 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

management s
erv
ice
,and a nor
mal dat
ase
rvi
ce. To ma
int
ain b
ack
war
d
comp a t
ibi
li
tywi tht heor iginaldefi
niti
on,t hestandar
ddi s
tinguis
he sbet weenthe
fir
s tt hreeb i
tso ft hec ode p
oint(bitsthatwe r
ef or
me rl
yus edf orp re c
edenc
e)
andt helastthreeb i
t s
.Whe nt helas
tt hreeb i
tsconta
inzero,t hep rec
e dencebi
ts
definee i
ghtb roadc la
ssesofs ervi
cet hata dheretot hesa meg uidel
ine sasthe
originaldefini
tion:da tag
r amswi thahi ghernumb erint hei
rp recedencef iel
dare
givenp r
eferentialtreatme ntov erdatagramswi thal owernumb er.Tha ti s
,the
eightor deredclasse
sa rede f i
nedbyc odepoi
ntv al
uesoft heform:

x
xx000

wherexde note se it
heraze r
ooraone .
The differe nti
ateds erv
ices de si
gna ls
oa cc
ommod at
esa not he
re xi
sti
ng
prac
tice t hewi despreaduseofp r
e c
edence6or7t og iv
ehi ghestp riori
tyt o
routi
ngt r
affic.Thes tandardincludesas p
e c
ialcaset ohandlet het wop re ce
dence
val
ues.Ar oute ri sre-quire
dt oimp lementatl easttwop r i
ori
tys che mes:onef or
normaltraffi
ca ndonef orhigh-p r
iorit
yt ra
ffic.Whe nt helastt hre ebitsoft he
CODEPOINTf ielda reze ro,therout ermustma pac odepointwit hpre ce
de nce6or
7intothehi gher -pri
orityclas
sa ndot hercodepointv a
luesintot hel ower- pr
iori
ty
cl
ass.Thus,ifada tag
r ama rri
vest hatwass entus i
ngt heor ig
inalTOSs cheme ,a
routerusi
ngt hedi fferenti
ateds ervi
cesschemewi l
lhonorp recedenc e6a nd7a s
thedatagrams ende rex pect
s.
Figure7.8il
lus
trat
eshow t
he64 c
ode
poi
ntv
alue
sar
edi
vi
dedi
ntot
hre
e
a
dmi
nis
- t
rat
ivep
ools.

Pool Code
point Assi
gne
dBy
1 xxxxx0 Sta
nda r
dsorganizat
ion
2 xxxx11 Localorexperi
me nt
al
3 xxxx01 Localorexperi
me nt
al

Fi
gur
e7.
8Thet
hre
eadmi
nis
tra
tiv
epool
sofDi
ffS
ervc
ode
poi
ntv
alue
s.

Ast hefig
urei ndic
ates,hal
foft hev alue
s(i.e
.,t he32v alue
sinp ool1
)mus t
b
ea s-s
ignedinterpretati
onsbyt heI ETF.Cur r
ently,a l
lv a
luesinp ools2 and3
a
rea vai
lab
lefore xperi
me nta
lorl oc
alus e.However,p ool3i stent
at i
ve ift he
s
tandardsbodi
ese xhaustallval
uesinp ool1,theywi l
lleavepool2a l
one ,butma y
a
lsochoosetoa s
sig
nv a
luesinpool3.
Thediv i
si
onintop ool
sma ys eem unusualbeca
useitreli
esont hel ow-
order
b
itsoft hev al
uet odi sti
ngui
shp ool
s.Thus ,ratherthan aconti
g uoussetof
v
alue
s,p ool1c on-tai
nse very otherc odep
ointv al
ue(i.
e.,thee ven numbers
b
etween2a nd 64).The di v
i-s
ion wasc hosent ok e
ept he e
ight codepoi
nts
c
orres
pondingtov al
uesx x
x000i nthesamep ool.
Whet
hertheor
igina
lTOSint
erpre
tat
ionortherevi
seddi
ffe
rent
iat
edse
rvi
ces
i
n-t
erp
retat
ioni
sused,iti
simport
anttoreal
izetha
tf orwa
rdi
ngsoft
war
emus t
cho
osef r
om amongtheunde
rlyi
ngp
hys
ica
lne
twor
kte
chnol
ogi
esa
tha
nda
nd
mustadheret
oloca
l
S
ec.7.
8 Da
tag
ramTyp
eOfS
erv
iceAndDi
ffe
rent
iat
edS
erv
ice
s 1
29

p
oli
ci
es.Thus
,spec
ifyi
ngale
velofse
rvicei
nadatag
ramdoe
snotgua
rant
eet
hat
r
outer
sa l
ongthepathwi
l
lagreetohonorther
eques
t.Tos
ummar
ize
:

We regardt he servi
cet ype specifi
cation as a hi
nt tot he
for
wardingalgori
t hm t
hathel psi
tc hooseamongv ari
ouspathsto
adestinati
on basedon localpol i
ci
esandi tsknowledgeoft he
har
dwar etechnol
-ogiesav
ailableont hosepaths.Aninter
netdoes
notguaranteetopr ovi
deanypar tic
ulart ypeofservi
ce.

7.
9Da
tagr
am Enc
aps
ula
tion

Before we c an under
stand t he otherf iel
dsina nI Pv4 datagram,i tis
importanttoc onsiderhowda tagramsr elat
et op hys
icalnetworkframe s.Wes t
art
withaque st
ion:how l a
rgec anada tagramb e?Unl i
kep hysi
calne t
wor kframes
thatmus tb er e
c ognizedbyha rdwa r
e,da tagr
a msareha ndle
db ys oftware.They
canb eofa nyl engtht heproto-coldesigner
sc hoose
.Weha veseent hatt heIPv4
datagramfor mata l
lots16bit
st ot het ota
lleng t
hf i
el
d,limiti
ngt heda ta
g r
amt o
atmos t65,535oc t
et s
.
Moref undamentall
imitsonda t
agrams izea r
iseinp ra
c ti
ce.Wek nowt hatas
da-ta
gramsmov efrom onema chi
net oanothe r
,t heymus tb etrans
portedb ythe
underl
ying network hardwa r
e.To ma kei nternett ransportat
ion eff
ici
ent,we
wouldli
k etog uar
an-teet hateachdata
g r
amt ravel
sinad ist
inctnetworkframe.
Thatis,wewa ntoura bs
t r
ac-ti
onofane t workp ac
ke tt oma pdir
e c
tlyontoa
realpac
k etifposs
ibl
e.
The i
dea of c
arr
ying one da
tag
ram i
n one ne
twor
kfr
ame i
sca
ll
ed
enc
aps
ulat
ion,andi
sus
edwi
thb
othI
Pv4a
ndI
Pv6.Tot
heunde
rlyi
ngne
twor
k,a
datagramisl i
kea nyotherme ss
ages e ntf rom onema chinet oa nother the
network hardwa r
e does not recognize t he data gr
a m f ormat
, nor doe sit
understa
ndt heI Pdest
inat
ionaddress.I n-s
t ead,thene twor ktreatsada t
agra
m
asb ytesofda tat obet rans
ferred.Fi gure7. 9i l
lus-t
rate sthei dea:whenit
travel
sa cr
ossane t
wor kfrom onema chi
net oa nother,t heent ir
eda t
agra
m
travel
sinthep ayl
oadareaofthene twor kfr ame.

DATAGRAM
DATAGRAM PAYLOADAREA
HEADER

FRAME
FRAMEPAYLOADAREA
HEADER

Fi
gur
e7.
9Thee nca
psul
ati
onofa
nI Pdata
graminaframe
.The
unde
rlyi
ngnetwor
ktre
atstheent
ireda
tag
ram,inc
ludi
ngt
he
he
ade
r,a
sda
ta.
1
30 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

Howdoesar e
ceive
rk nowthatthepayl
oada re
ainaframecontai
nsa nI Pda
-
tagra
m?Thet ypefie
ldint hef
rameheaderi
de nt
ifi
est
hedatabeingc
a r
ried.For
e
xam-ple
,Et he
rnetusest he t
ypev al
ue 0x0800 tospe
cif
yt hatthe p ayl
oad
c
ontai
nsa nenc
ap-s
ulat
edI Pv4dat
agramand0x 86DDtospec
ifythatthep ayl
oad
c
ontai
nsa nI
Pv6da-tagra
m.

7.
10Da
tagr
amS
ize
,Ne
twor
kMTU,a
ndFr
agme
nta
tion

I
nt heidealcase,anentireIPda tagramf i
tsintoonep hysi
calfr
ame,ma king
tra
nsmis
sion acrosst he unde rl
ying ne t
wor ke ffici
ent. To guarant
e es uch
eff
ici
enc
y,t hede s
igner
sofI Pmi ghtha v
es el
ectedama xi
mum datag
rams izesuch
thatada ta
gram woulda l
waysf i
tint oonef r
ame .Butwhi chfra
mes i
zes houl
db e
chos
en?Af tera l
l
,ada tagra
m ma yt ravelacros
sma nyt ype
sofne twork sa
si t
movesacrossaninternetfromitss ourc
et oitsfinaldest
inati
on.
Tounde rs
tandt hep robl
e m,wene edaf acta boutne twor kha rdware:each
packet-switc
hingt echnol
ogyp l
acesaf i
x e
dup p
erb oundont hea mountofda ta
thatc anb etrans f
erredinonef rame .Fore xample,Ethernetl imitst r
ansfersto
1500 octetsofd at
a.Wer efert othes izelimita sthene twor ksmaximum
trans
f erunit,ma ximum transmis-sionunitorMTU.MTUs i
ze sc anb elarg
ert han
1500ors mall
er:t echnol
ogieslikeI EEE802. 15.4limitat rans f
ert o1 28oc tets.
Limit
ing da ta
g r
a mst of i
tt he sma ll
estp os-s
ibl
e MTU i nt he internet ma k
es
trans
f ersineffi
cient.Thei neffi
ciencyi sespeci
all
ys ever
eb ecausemos tp athsin
theI nternetc anc arrymuc hl argerda tagrams.Howe ver,c hoosi
ngal arges i
ze
causesanotherp roblem.Becauset heha rdwarewi l
lnotp ermitp acketslarge
rt han
theMTU,wewi llnotb eabletos endl ar
geda tagramsinas inglene tworkframe .

Twoov
era
rchi
ngi
nte
rne
tde
sig
npr
inc
ipl
eshe
lpusunde
rst
andt
hedi
l
emma
:

Theinter
nettec
hnol
ogys
houldaccommodat
ethegr
eat
est
pos
sibl
evari
etyofnet
workhardware.

Theinter
nettec
hnol
ogys
houldaccommodat
ethegr
eat
est
pos
sibl
evari
etyofnet
workappl
ic
at i
ons
.

Thef i
rstp r
inci
pl
ei mp
li
esthatweshoul
dnotruleoutane t
workt ec
hnol
ogy
merelybecausethet ec
hnol
ogyhasasmal
lMTU.Thesecondp
rinci
ples
uggestst
hat
app
li
c a-t
ion progra
mme rsshoul
db eal
l
owe dtochoosewhatev
erda ta
grams i
ze
the
yf indap-propri
ate.

Tos ati
sfybot hprinci
ple
s ,TCP/I
Pp rotocol
sus eac ompromise.Inste
a dof
re
strict
-ingdatagramsizeap r i
ori
,thestandardsall
oweachapp l
i
c at
iontoc hoose
adat a
grams izethatisb estsuite
dtot hea pp
lic
ati
on.Thenwhe nt ransf
erringa
dat
ag r
am,c heckt hesi
zet os eeiftheda tag
r a
mi sles
st ha
nt heMTU.I ft he
dat
ag r
am doesnotf iti
nt oaf rame,div
idetheda ta
gramintosma ll
erpiec
esc al
led
fr
agment s.Choos
et hefr a
gme nt
Thel
i
mitof1500oc
tet
sha
sbe
comei
mpor
tantb
eca
usema
nyne
twor
ksi
ntheg
lob
alI
nte
rne
tus
e
Et
her-
nettec
hnol
ogy.
S
ec.7.
10 Da
tag
ramS
ize
,Ne
twor
kMTU,a
ndFr
agme
nta
tion 1
31

si
zes uc
hthateac
hf r
a gme
ntcanbes e
ntinane
twor
kfr
ame
.Thep
roc
essof
di
vidi
ngadat
agr
ami sknownasf
ragment
ati
on.
To unde
rst
and f
rag
mentat
ion,cons
ide
rthr
eene
twor
ksi
nte
rconne
cte
dby
t
worout
ersasFi
gur
e7.10i
ll
ust
rates
.

Hos
t Hos
t
A B

Net1 Net3
MTU=1
500 MTU=1500
Net2
R1 MTU=620 R2

Fi
gure7.
10Anil
lus
t r
ati
onofIPv
4
fr
agment
ati
on. Eachrout
ermayne
edt
o
f
ragmentdata
gra
msb e
for
ese
ndi
nga
cros
snetwor
k2.

Int hefi
gur e,eachhosta t
tachesdirect
lyt oanEt hernet
,whi chha sanMTU
of1 500oc te
ts .Thes ta
ndardr equiresrouterst oacceptda tagr
amsupt ot he
ma x
imum oft heMTUsofne tworkst owhicht heya t
ta c
h.Thus ,eit
herhos tc an
createa nd send a da-tagr
a m up t o1500 oc t
ets,t he MTU oft he dir
ectly-
connected network.I fa na ppl
ica
tion runni
ng on hos tA s endsa 1 500-octet
datagramt o B,t heda t
agramc a
nt r
avelacrossnet-wor k1i nas i
nglef ra
me .
Howe ve
r,b ec
aus enetwork2ha sanMTUof620,f r
agme nta
-tionisr e
quiredf or
theda t
ag r
amt ot ra
velacrossnetwork2.
I
na ddi
ti
on to defini
ng t
he MTU of e
achi ndi
vi
dualnetwor
k,i t wi
llbe
import
antt oconsi
dertheMTUa longapat
hthroug
ha nint
erne.Thep
t athMTUis
defi
nedt ob et heminimum oft heMTUsonne t
wor ksal
ongthep a
t h.Inthe
fig
ure,thep a
thf rom AtoBhasap athMTUof620.
Al
thought heye a
chp r
ov i
deda tagr
amf r
agmentati
on,I Pv4a ndI Pv6t ake
comple
te-l
y diff e
rent app roache
s.I Pv4a ll
ows any rout era l
ong a p at
ht o
frag
me ntada t
a gram.Inf act,ifal aterr outera l
ongt hep a
thf i
ndst hata
frag
me ntistool arge,ther outercandiv i
det hef r
agmenti ntof ragme nt
st hat
aree v
ens mal
ler.I Pv6r e
qui restheor i
ginalsourcet olea rnt hep athMTUa nd
perf
ormf ragme ntati
on;r outersa r
ef orbiddenf r
om p e
rf ormingf ra
gme ntati
on.
Thene xtsec
tionsc onsi
dert het woa ppr
oa chesandg i
vet hede t ai
lsforI Pv4a nd
IPv6

7.
10.
1IPv
4Da
tag
ramFr
agme
nta
tion

InIPv
4,f r
agment
ati
on i
sde l
aye
da nd onl
yperf
ormed whe
n nec
ess
a r
y.
Whe
theradat
agram wi
l
lbefragme
ntedde
p e
ndsonthepathadatagr
amfol
lows
thr
oughani
nter
-net.Thatis,as
our
ceonl
yinsur
esthatada
tagr
amc a
nf i
tint
o
aframeonthefi
rstnet-
workitmus
ttrav
ers
e.Eachrout
eral
ongthepat
hlooks
attheMTUofnextnetwork
1
32 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

overwhichtheda t agra
m mus tpass
,a ndf r
agme ntst heda ta g
rami fnecessar
y.I n
Figur
e7. 1
0,f orex ample,r outerR1wi llf r
agme nta1 500- octetda t
agramb efore
sendi
ngitove rnetwor k2.
Wes ai
dt hatahos tmus tinsureada t agra
mc anf i
ti ntoaf ra
meont hef i
rst
net-work.Appli
cationsoft e
nt r
yt oc hooseame ssages izet hatiscomp a
tibl
ewi th
the underl
ying net work.Howe ver
,i fa na pplic
ation c hoosest os end a large
datagra
m,I Ps oft
wa r
eont hehosts oftwa reca npe rformf ragmentati
onb efore
sendi
ngi t
.I nFi g
ur e7. 10,f ore xamp l
e,i fa na ppli
cat i
ononhos tA c r
eatesa
datagra
ml argert han1 500o c-t
ets,I Ps oftwareont hehos twillfragmentt he
datagra
mb eforese ndi
ngi t.Thep oi
nti s:

IPv4fragmentat
ionoc cursaut
omati
cal
lyatanypointalongthe
pathwhenadat agr am i
st ool
argeforanetwor
kov erwhichit
mustpass;thes ourceonlyneedstoinsur
ethatdatagr
amsc an
trav
eloverthefirsthop.

How largeshouldeac
hf ra
gme ntbe?Wes a
idthateachf ragmentmustb e
smal
le nought of i
tinas ing
lef r
ame .Int heexampl
e,af ragmentmus tbe620
oct
ets or s mall
-er.A routerc ould di
vide the da
tagram intof r
a g
ments of
appr
ox i
ma te
lye qualsi
ze. Mos tI Pv4s oftwares i
mplye xtrac
tsa s er
ies of
fra
gme ntst ha
te achfi
l
lt heMTU,a ndthe nse
ndsaf ina
lf r
ag mentofwhatever
si
zer emains
.
Youma yb es urprise
dt ol earnt hata nI Pv 4f ragme ntus esthes amef orma t
asac omp l
eteI Pv4da t agram.TheFLAGSf i
e l
di nt heda t a
g ram headerc ontainsa
bi
tt ha ts peci
fieswhe t hert heda tagrami sac omp leteda t agra
m oraf ragme nt.
Anothe rb itint he FLAGS f i
eldspe ci
fieswhe t hermor ef ragment soc c ur( i.
e .
,
whe t
he rap articularf rag-mentoc cupiest het aile ndoft heor i
gi
na lda t agr
a m).
Fi
na l
ly,t heOFFS ET fieldint heda ta gr
a m he ade rs pecif
ieswhe reint heor i
g i
nal
datagr a
mt heda tai nt hef ragmentb e
-longs.Ani nterest i
ngf ragme ntationde tai
l
ari
sesb ecaus
et heOFFS ET f i
el
ds toresap o-sitioni nmul t i
pl
esofe ightoc tet s
.
Thati s,a noc t
e tof fs
e tisc omputedb ymul tipl
yi ngt heOFFS ETf iel
db ye i
ght.As
ac ons e
que nce,t hes izeofe achf ragme ntmus tb ec hose nt ob eamul t
ipl
eof
ei
ght.The refore,whe np erformingf ragme nt a
t i
on,I Pc ho osesthef r
ag me nts ize
tob et hel argestmul t i
pleofe i
ghtt hati sl es
st ha nore qua ltot hes izeoft he
MTU.Fi gure7.11i l
lust
r atesIPv4f ragme ntation.
Fragme
nt a
tionstar
t sbyrepli
cati
ngtheor i
ginaldat
ag r
am he adera ndt hen
modify-i
ngt heFLAGSa ndOFFSETf i
el
ds.Thehe a
dersinfr a
gme nts1a nd2ha ve
themor efragment sbi
ts eti
ntheFLAGSf ie
ld;theheaderinf r
ag ment3ha szero
inthemor ef r
agmentsbit.Not
e :i
nt hefig
ure,da t
aoffsetsares howna soctet
offs
etsinde c i
ma l
;the
ymus tb edivi
dedbye i
ghtt ogett hevalues t
or e
di nt he
fra
gme nthea ders.
Ea
c hf rag
me ntcontai
nsa dat
agra
m he a
dertha
tdup l
ica
tesmos toft he
ori
gi
nalda -tagra
m he ade
r( e
xce
ptf or b
itsinthe FLAGS f
iel
dt hatspeci
fy
fr
agme nta
tion),fol
l
owedb yasmuchdat
aa scanb
ecarri
edinthefra
g mentwhil
e
k
eepi
ngthetot
alle
ngt
hs ma
ll
ert
hantheMTUoft henet
wor
kov
erwhi
chi
tmus
t
t
rav
elandthesi
zeoftheda
taamul
ti
-pleofe
ightoct
ets
.
S
ec.7.
10Da
tag
ramS
ize
,Ne
twor
kMTU,a
ndFr
agme
nta
tion 1
33

. .
. .

dat
a1 dat
a2 dat
a3
. .
DATAGRAM .
.
.
.

. .
HEADER 600oc
tet
s .
.
600oc
tet
s .
.
200oc
tet
s
. .

(
a)

FRAGMENT1
dat
a1 Fr
agme
nt1(
off
set0)
HEADER

FRAGMENT2
dat
a2 Fr
agme
nt2(
off
set600)
HEADER

FRAGMENT3
da
ta3 Fr
agme
nt3(
off
set1
200)
HEADER

(
b)
(
a)Anori
gi
nalI
Pv4da
tag
ramc
arr
ying1
400oc
tet
sofdata
Fi
gur
e7.
11 a
nd
(
b)thr
eefr
agment
sfora
nMTUof620.

7.
10.
2IPv
6Fr
agme
nta
tionAndPa
thMTUDi
scov
ery(
PMTUD)

Inst
eadofde layedf r
agmenta
tion,IPv6us esaf orm ofe ar
lyb i
nding
:t he
ori
ginalsourcehosti sr equir
edtof i
ndt heminimum MTUa l
ongthep athtot he
dest
inati
ona ndf r
ag mente achdatagra
ma cc
ordingt othep a
thi twil
lt ake.IP
routersa l
ongt hep atha renotp ermitte
dt of r
agmentI Pv
6 datagrams;ifa
datagram doe snotf itintot heMTUofane twor k,theroutersendsa nerror
messagetot heor i
ginalsourceanddropstheda -
ta g
ram.
Inma nywa ys,theI Pv6ap p
roacht of ra
gme ntati
onist heop posi
teoft he
IPv4a p-pr
oa c
h,whi chi sp uzzl
ing.Whyc hange?Whe nI Pv6wa sbeingde fi
ned,
phonec om-panie
swe rep us hi
ngAs ynchronousTransferMode( ATM)t ec
hnologi
es,
and the IPv6 de si
gnersa ss
ume d ATM woul db ecome wide l
y used.ATM i sa
connecti
on-ori
ent edtechnology,me aningthatas endermustp re-
establ
is
hap ath
tot hede s
tinati
ona ndt hens e
nda l
ongt hep ath.Thus,t hede si
gnersa s
sume d
thatas ourcecomp uterwoul dlearnp athcharact
e r
ist
ics(i
ncludingthep at
hMTU)
whent hepathwa sest
ab l
ishedandt hep athwouldnotc hange.
Becausenetworkingt e
chnol
ogiesusedint heI nter
netdonoti nfor m ahos t
aboutt hep a
th MTU,ahos tmus te ngagein at ri
al
-and-
errorme cha ni
smt o
determi
net hepat hMTU.Knowna sPa thMTUDi scovery(PMTUD),theme chani
sm
consi
stsofs ending anI Pv6 da
tag ramt ha
tf it
si nt heMTU oft hedi rec
tly-
connect
e dnetwork.Ifane t
worka longthepathha sas mal
le
rMTU,ar outerwi l
l
senda nI CMPe rrorme s
s agetot heor i
-gi
nalsour c
et hatspeci
fi
est hes mal
ler
MTU.Thehos tfr ag
me nt
sda tagr
amsa c
cordi
ngt ot hene wp a
thMTUa ndt r
ies
a
gai
n.I
fal
ate
rne
twor
kal
ongt
hep
athha
sanMTU
1
34 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

t
hatiseve
ns ma
ll
e r
,a notherr
out
erwil
lsendanerrormess
age.Byr
epe
ate
dly
p
robi
ng,ahos
twilleve
nt ual
l
yfi
ndthes
mall
estMTUa
longthepat
h.
Whatha ppe
nsift hep at
hc ha ngesandt hene wp at
hMTU i slarger
?The
sourcewi l
lnotlear
na b
outt hei ncreas
eb ecauserouter
sdonots tor
es t a
te.
Therefor
e ,PMTUD sp
ecifi
esthatahos ts houl
dp robeperiodi
cal
l
yb ysendinga
l
a r
gerda tagr
am.Becausewedonote xpec
tr outestoc hangef r
equentl
ya nd
becaus
et hepathMTUc hangesles
sf requentl
yt hanrout
es,mos timple
me nta
t i
ons
ofIPv6c hoos
ealongtimep e
riodbe for
ep robi
ngagain(e
.g.,tenminutes)
.
Reca
llt hatt he IPv6b ase he
ader doe
s not i
ncl
ude f
iel
ds tos pe
cify
f
ra gmentat
ion.Theref
ore,whe nitfr
agmentsanIPv
6datagr
am,as our
ceins
erts
a FragmentExt ens
ion Header i
ntoeac
hf rag
ment.Fi
gure7.1
2i l
lust
rat
est he
f
or mat.

0 8 1
6 29 31
NEXTHEADER RES
ERVED FRAGMENTOFFS
ET RES M
I
DENTI
FICATI
ON

Fi
gur
e7.
12Thef
orma
tofa
nI 6Fr
Pv agment
ati
onExt
ens
ionHeader
.

Asthe fi
gur
es hows
,t he e
xte
ns i
on he
aderi
ncl
udest
he re
qui
red NEXT
HEADER f
iel
d.Itals
oincl
ude
st wofi
eldsthatar
erese
rve
dforfut
ureuse.The
r
emaining t
hreefiel
dsha vethesameme ani
ng asI Pv4f ragmenta
tion c
ontrol
f
iel
ds.A1 3-b
itFRAG-MENTOFFSETf i
eldsp
eci
fieswhereint heorig
inaldata
gram
t
hisfragmentbel
ongs,theM b i
t samor
si efragmentsbi
tt hatspeci
fieswhether
afragmentisthefinal(ri
ght-
most
)f r
agmentoft heori
ginaldatagram,andt he
I
DENTIFICATION fi
el
dc ontai
nsauniquedatagra
mI Dt hati sshare
db yal
lt he
f
ragmentsofada ta
gram.

7.
11Da
tagr
am Re
ass
emb
ly

Eventual
ly,fragmentsmustb er eassembl
edt op roduceac ompletecop yof
the ori-gi
nal datagram. The que st
ion a r
ise
s: whe res houl
df ragment sb e
reass
emb l
ed? Thati s,shoul
d a da tagram ber eass
e mble
d whe ni tr e
ac hesa
networkwi thal ar
g erMTU,ors houldt hedatagr
a mr emainfra
g menteda ndt he
fra
g mentsb et ra
ns p
orte
dt ot heul timated es
tinat
ion? Wewi l
ls e
et ha tt he
answerr e
v e
alsanotherdes
ignde
c is
ion.
InaTCP/ IPi nternet,onceada t
agram ha sbeenf r
ag mented,t hefrag
me nts
tr
av e
la ssepar
at eda t
a gr
a msallthewa yt ot heulti
ma tede s
tinati
onwhe ret hey
ar
er ea
sse
mb le
d.Pr es
e r
vingf ragme ntsallt hewa yt ot heul ti
ma tedesti
nation
mays eem oddb ecaus
et hea p
p r
oac hha st wodi s
advantag e
s.Fi rs
t,i fonl
yone
networkalongt hep athha sas mallMTU,s endingsmallfragment sov e
rtheot her
networksisineffi
c i
ent,be ca
uset ranspor
t-ings mal
lp acketsme ansmor eoverhead
t
hant r
ansport
inglarg
ep ac
k e
t s
.Thus,evenifnetwor
k senc
ount
ere
da ft
ert he
p
ointoffragmentat
ionhaveve r
ylar
geMTUs ,IPwil
lsendsmal
lfr
agment
sa c
ross
t
hem.Second,ifanyfrag
me ntsarel
ost,t
hedatag
ramc an-
S
ec.7.
11 Da
tag
ramRe
ass
emb
ly 1
35

notb er easse
mb le
d.Theme chani
sm us e
dt oha ndlef ragme ntl ossconsi
stsofa
reass
embl yt i
mer .The ulti
ma te de
stinati
on s t
artsa t ime r whe n af ragme nt
arri
vesf orag i
v e
nda tagr
am.I fthetime rexpir
esb e
f oreallf r
a g
me ntsarri
ve,t he
recei
vingma chinedi s
car
dsthes urvi
vingf ragments.Thes ourcemus tr etransmit
thee nt i
reda tagram;therei sno wa yf ort her ec e
ivert or eque
s tindi
v i
dual
fragme nts
.Thus ,thep r
obabi
lit
yofda -tag
ra mlossincreaseswhe nfragmentation
occursb ecauset he los
sof a s ingl
ef ragment resultsi nl ossof t he entire
datagram.
Desp
itet he mi
nor di
sadvantages,p erfor
mi ng rea
ssembl
ya tt he ul
timate
dest
inati
onwor kswell
.Itallowse achf ra
g mentt ob eforwardedindependentl
y.
Moreimp orta
nt,itdoesnotr equir
ei nt
erme di
ater outer
st ostoreorr eass
emble
fr
a g
me nts.Thedeci
si
ontor eassembleatt heultimatedesti
nat
ioni sderi
vedf r
om
ani mportant pr
inc
ipl
ei nI nternet desi
g n:t he stateinr out
e r
ss houldb e
mini
mized.

IntheInter
net,theult
imatedes
tinati
onr
eas
sembl
esfragment
s.
Thedes
ignmeansthatrouter
sdonotneedtostor
efragmentsor
keepot
h-erinf
ormati
onaboutpackets
.

7.
12He
ade
rFi
el
dsUs
edForDa
tagr
am Re
ass
emb
ly

Thre ef i
e l
dsi na nI Pv 4 dat a
gr am he a
de rora nI Pv6 Fragme ntEx tension
He aderc ontr olreassemblyofda tagrams :IDENTI FICATI ON,FLAGS( Mi nI Pv6),
andFRAG- MENTOFFSET.Fi e dI
l DENTI FICATI ON c ontainsauni quei nt e
gert hat
identifi
est heda tagram.Tha ti s,e achda tagr ams entb yag iv
ens ourceha sa
uniqueI D.At ypica
limp l
eme nt ati
onus e sas eque ncenumb er ac omp uters ends
ada tagram wi thidentifi
-ca t
ionS ,t hene xtda tagram wi llhaveide nt i
f i
catonS+
i
1.As si
gning a uni que ident if
i-cati
on t oe ach da tagra m isi mp ort ant b e
c ause
frag ment at
ions t
artsb yc opyingt hei den-tifi
c ati
onnumb erint oe ac hf ragme nt.
Thus ,e achf ragmentha se xactl
yt he same I DEN- TIFICATION numberast he
originalda tag r
am.A de sti
na ti
onus est heI DENTI FICA- TION f i
el
di nf ragme nts
alongwi tht heda tagrams ourcea ddr e
s stog r oupa llt hef rag-me nt sofag i
v en
da t
a gram.Thev al
uei nt heFRAGMENTOFFS ET f iel
ds p eci
fie
st heof fsetint he
originalda t
ag ram oft hepa yloadb ei
ngc arr
iedi nt hef ra gment,me asur edinuni ts
of 8 oc t
ets, s tarti
ng a t offset ze ro. To r eassemb let he da ta gr
am, t he
de s
t i
nationmus tob tai
na l
lf ragme ntss tarti
ngwi tht hef r a
gme ntt ha tha sof fset
0t hr ought hef rag-mentwi tht hehi ghestof fset.Fr ag mentsdonotne ces
s a
r il
y
arrivei n or de r,a nd the rei s no c ommuni cation b e t
we ent he s ys t
em t hat
frag ment edt heda tagr
am( ar outeri nI Pv4 ort hes enderi nI Pv 6)a nd t he
de s
t i
nationt ryingtor eassemb l
ei t.
In IPv4, the low-ordert wo b i
ts of the 3-bt FLAGS f
i i
eldc ontr
ol
f
rag
me ntati
on. Usua l
l
y, a ppl
ic
ati
ons us ing TCP/
IP do not c ar
e a bout
f
rag
me ntati
on becauseb othf rag-
me ntat
ion and reas
sembl
ya r
ea ut
oma ti
c
p
roce
dur esthat occur atl owerl ev
e l
s of the p
rotocolstac
k,i nvi
si
blet o
a
ppl
ica
tions.Howev
er ,totestnetworksoftwareordebugoper
ati
onalprobl
ems,it
maybeimp
ortanttodete
rminethes
izeofda t
ag r
amsforwhi c
hf r
agme ntat
ion
oc
cur
s.The f
irstcont
rolbitai
dsins uchtes
ting byspec
ifyi
ng whethert he
da
tag
rammayb efr
agmente
d.Iti
scal
l
e dthedonotf r
agmentbitbe
causes e
tting

Offs
etsa
res
pec
ifi
edi
nmul
ti
pl
esof8oc
tet
stos
aves
pac
eint
he
hea
der.
1
36 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

t
hebi o1s
tt pe
cif
iesthatthedat
agramshoul
dnotb efr
agme nt
e d.Whene
vera
r
out
erneedstof ra
gmentada t
agramthathasthedonotfragmentbitset,t
he
r
out
erdi
scardsthedat
a g
ramandsendsanerro
rme s
sag
ebacktot hesour
ce.
Thel ow or de rb i
tint heFLAGSf iel
di nI Pv4ort heM b itinI Pv 6s peci
f i
es
whet h-ert hep ayloa dint hef rag
me ntb el
ongss ome wher
ei nt hemi ddl eoft he
ori
ginalda -
t agram ora tt het ai
le nd.I ti sk nown a sa mor efragment sbi t
becauset hev alue1me anst hep ayloadi nt hef ragmentisnott het ailoft he
datagram.Be caus ef ragme nt smaya rri
veout -of -order,thede sti
nationne edst o
know whe na llf rag mentsf orada -tagram hav ea rrive
d.Ag i
venf rag me ntdoe s
nots peci
fyt hes i
zeoft heor igi
na lda -ta
gr a
m,s oar ecei
vermus tc omp utet he
datagrams ize.The mor ef ragment sbi ts ol
ve st hep robl
e m:onc eaf ragme nt
arri
ve swit ht he mor ef ragment sbi tt urned of f,t hed esti
-nati
on k nowst he
frag
me nt c arri
e s da taf rom t he t a
ilof t he or igi
nalda tagra
m. Fr om t he
FRAGMENT OFFSET f i
el
da nd the s i
ze oft he f ragment,t he destina t
ion c an
comp utet hel eng t
hoft heor i
gi
na lda tagr
am.Thus ,oncet hetailoft heor ig
inal
datagrama rri
ve s,t hede sti
na ti
onc ant ellwhena llot herfragmentsha vea r r
ived.

7.
13Ti
meToLi
ve(
IPv
4)AndHopLi
mit(
IPv
6)

Ori
gi
nal
ly,theI Pv4TIMETOLI VE( TTL)headerfi
el
ds p
eci
fi
edhow long,in
se
conds,ada tagram wa sal
l
owe dtor ema i
ni na nint
ernet as enderseta
maximum ti
met hate ac
hdatagr
ams houldsurvive
,androute
rsthatproce
ssedthe
data
g r
am decr
e-me ntedtheTTLa st i
mep as
sed.WhenaTTLr eache
dze ro,the
data
g r
amwa sdisc
ar d
-ed.

Unfor t
una t
e l
y,c omp ut inga nex ac
tt imei simposs
ibl
eb ecauseroutersdonot
know t het ransitt imef orunde rlyi
ng ne t
works.Fur the r
mor e,thenot i
on of
datagramss pend- i
ngma nys econdsi nt ransitbecameout date
d( currentr outers
andne twor ksar edesigne dt of orwa r
de achda t
agram withinaf ew mill
is
econds )
.
Howe v
er ,ame chanis
m wa ss ti
llne ededt oha ndl
eac a
sewhe rea ninternetha sa
forwardingp roblem whe nr out e r
sf or-wa rdda tagr
amsi nac ircl
e.Top reventa
datagramf rom t ravel
inga roundac ir
clef orev-er
,ar ulewa saddeda saf ail
-safe
mechanism.The r uler e qui r
ese achr outera l
ong the p athf r
om s ourcet o
desti
nationt ode crementt heTTLb y1 .I ne s
sence,eachne twor kthatada tag ra
m
traver
se scountsa sonene twor khop.Thus ,inpracti
ce,theTTLf i
el
di snowus ed
tos p
ecifyhow ma nyhop sada tagr
a m ma yt rav
ersebefor eb ei
ngdi s
carded.I Pv6
inc
ludest hee xa
c tsamec onc ept .Toc lar
ifyt heme ani
ng,I Pv6us esthena me
HOPLI MI Tinp l
aceofTI ME- TO- LIVE.

IPs oft
warein each machi
ne al
ong a pathfr om s our
cet o
dest
inat
iondec
rementsthefiel
dknownasTI ME-TO- LI
VE( IPv4)
orHOPLI MIT(IPv
6).Whent hefi
el
dreacheszer
ot hedatagram
isdi
scar
ded.

Ar
out
erdoe
smor
etha
nme
rel
ydi
sca
rdada
tag
ram whe
ntheTTLr
eac
hes
zer
o ther
out
ers
endsa
ner
rorme
ssa
geb
ackt
othes
our
ce.Cha
pte
r9de
scr
ibe
s
er
rorha
nd-l
i
ng.

Mos
tnetwor
kingp
rof
ess
iona
lsus
ethet
erm hopc
ounti
nst
eadof
hopl
i
mit
.
S
ec.7.
14 Op
tiona
lIPI
tems 1
37

7.
14Op
tiona
lIPI
tems

BothIPv4a ndIPv6defi
neopt
ionalit
emst ha
tcanb ei
ncl
udedinadat
agr
am.
InIPv4,theI POPTIONSfiel
dtha
tf ol
lowsthedesti
nat
ionaddr
essisus
edtos
end
opt
ionalit
e ms.InI Pv6,e
achoft hee xt
ensi
onhe a
dersisopt
iona
l,andagiv
en
dat
ag ra
mma yin-c
ludemult
ipl
eextens
ions
.
Inp r
acti
ce,f ew data
gramsint heg
lobalI nt
ernetincl
udeopti
onalite
ms.
Manyoft heop ti
onsint hes t
andardsar
ei ntendedf orspec
ialc
ontrolorfor
net
workt e
sti
nga ndde b
ug gi
ng.Opti
onsproc
e s
singisa nint
egralp
artoft heIP
pr
otoc
ol;al
lstandardi
mp l
e-mentat
ionsmusti
nc l
udei t
.
Thene
xts e
cti
onsdi
scussopti
onsi
nIPv4a ndIPv
6.Bec
aus
eourp urp
osei
sto
pr
o-vi
deac onc
eptua
lovervie
wr athe
rt ha
n ac ata
logofal
ldetai
l
s ,thetex
t
hi
ghl
i
ghtse
xam-ple
sanddisc
usseshoweac
he xa
mp l
emightb
eused.

7.
14.
1IPv
4Op
tions

IfanI Pv
4datag
ramcont
ainsopt
ions
,theopti
onsf
oll heDES
ow t TINATION
I
PADDRESSfi
eldi
ntheda
tagr
am hea
der.Thel
eng
thoftheopti
onsf
iel
dde p
ends
onwhi chop ti
onsha veb ee nincl
uded.S omeop ti
onsa r
eoneoc tetlonga ndother
op t
ionsa r
ev ari
ableleng th.Ea chop ti
ons tart
swi thas ing
leoc t
etop t
ioncode
thati denti
fi
est heop tion.An op ti
on codema yb ef oll
owe db yas ingl
eoc t
et
l
e ngtha ndas e
tofda taoc -t
e t
sf ort hato pt
ion.Whe n multi
pl
eop ti
onsare
present,theyappearc ont ig
uously,withnos peci
alsepara torsbetweent hem.That
is
,t heop ti
onsa re
aoft hehe aderist re
a t
eda sana rr ayofoc t
ets,a ndopti
ons
arep lac
edi nthea rrayonea f
tera nother.Thehigh-or derb i
tofa nop ti
oncode
octets pec
ifi
eswhe thert heo pti
ons houl
db ec opi
edi nt oa l
lfrag-me ntsoronly
thef i
rstfragment;al aters ecti
on thatdiscussesop tion process
ing ex-p
lai
ns
copying.
Figure7.13li
stse
xampl
esofop t
ionsthatc
ana ccompanyanIPv4datagra
m.
Asthel i
stshows,mostopti
onsareus edforcontrolpurpos
es.Theroutea nd
ti
mesta
mp op -ti
onsarethe mostintere
sti
ng be
causet heyprovi
de a wa
yt o
moni
tororc ontr
olhowrout
ersforwarddata
gra
ms .
Rec ordRout eOpt ion.Ther ecordr outeopti
ona l
lowst hesourcet ocreatea n
emp -
tyl i
stofI Pv4a ddr ess
e sandr equestthate achr outera l
ongthep atha ddits
IPv4a ddr es
st ot hel i
st.Thel i
stb egi
nswi thahe adert hatspeci
fi
est het ypeof
theop tion,al e
ng thf i
e ld,andap ointer.Theleng t
hf ieldspeci
fi
esthenumb erof
octetsint helis
t ,andt hep ointerspeci
f i
estheof fsetoft hene x
tf r
eei tem.Ea ch
routert hatforwa rdst heda tagramc omp a
rest hep ointertot heleng t
h.I ft he
pointere qual
sore xceedst hel ength,thel i
stisf ul
l.Ot herwi
se,ther outerp l
aces
itsIPa ddres
sint hene xtf ouroc tet
soft heop ti
on,i ncrementsthep ointerb y
four,a ndf orwardst heda t
a gra
m.
1
38 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

Numb
er Le
ngt
h De
scr
ipt
ion
0 1 Endofop tionl i
st ,us edifop ti
onsdonote nda te nd
ofhe a der( seehe a derp addingf i
eld)
1 1 Noop er ation.Us edt oa l
ignoc tetsinal is t
2 1
1 Securitya ndha ndl ingr estr i
cti
onsf ormi l
itarya pps.
3 varLoos
es ourcer out e.Us edt or eque s
tr outingt hrough
as etofs p eci
fiedr out ers
4 v
ar Interne tt i
me sta mp .Us e
dt orecordat i
me stampa t
eachhopa l
ongt hep atha crossa ninter net
7 v
ar Recordr out e.Ca us e seachr outera longt hep at
ht o
recordi t
sI Pa ddr es sint heop t
ionsoft heda t
agr am
9 v
ar Stri
cts our c erout e.Us edt os peci
fya ne xactp ath
throughas etofr outers
1
1 4 MTUPr ob e.Us edb yahos tdur i
ngI Pv 4Pa t
hMTU
Discove ry
1
2 4 MTURe p l
y.Re tur ne db yr outerdur ingI Pv 4Pa t
hMTU
Discove ry
1
8 v
ar Tracerout e .Use db yt het raceroutep rogr amt of ind
ther out er salongap ath
20 4 Route rAl ert.Ca use se achr outera l
ongap atht o
exami net heda t agr am,e v e
ni far out e
ri snott he
ulti
ma tede stina tion

Fi
gur
e7.
13Exampl
esofI
Pv4opti
onsa
longwi
tht
hei
rle
ngt
handab
rie
f
de
scri
pti
onofea
ch.

Sour
ceRouteOpt
ions
.Twoopt
ions,Stri
ctSourc
eRouteandLooseSour
ce
Rout
e,prov
ideawayforase
nde
rtoc ont
rolfor
wardi
nga
longapat
ht hr
oughan
i
nternet
.Fore x
ampl
e,t ote
s tap a
rtic
ula
rnetwor
k,asys
temadmi
nis
tra
torcoul
d
usesourcerouteop
-tionstof or
ceI Pdata
gra
mstotra
vers
ethene
twork,ev
enif
normalforwardi
ngusesanotherpath.
Thea bil
i
tyt os our c
er outep ack
etsisespeci
al
lyi mpor
tanta sat oolf or
t
esti
nginap roduct
ione nv
ironme nt.Itgi
vesthene tworkma na
gerf re
e dom t o
t
estane we xperi
-me ntalnet workwhiles
imul
taneousl
ya ll
owi
ngus e
rstraff i
ct o
p
roceeda l
ongap atht hatonl yincl
udespr
oducti
onne tworks
.Ofc ourse,s ource
r
outi
ngi sonlyus efult os ome onewhounde r
standst henetworkt op
ology;a n
a
verage user hasne it
her a mot i
vati
on t
oc on-si
ders ourc
er outi
ng nor t he
k
nowledgerequire
dt ous eit.
St
ric
tSour ceRoute.Str
ictsourcerout
ingspeci
fi
esac omp l
etep a
tht hrough
anin-ter
ne t(i.
e.,thepaththeda t
agra
m mus tfol
low tor ea
chi tsdesti
nation).
Thep a
thc on-si
stsofIPv4addres
sestha
te achcorr
espondt oar oute
r( ortot he
ul
timatede s
tinat
ion)
.Thewor dstri
ctmeanst ha
te ac
hp airofr oute
rsa l
ongt he
pat
hmus tb edirect
lyconnect
-edb yane twork;a ne r
rorr es
ultsifar out e
r
c
annotr
eac
hthene
xtr
out
ers
pec
ifi
edi
nthel
i
st.
S
ec.7.
14 Op
tiona
lIPI
tems 1
39

Loose Sour c
e Rout e.Looses ourcer out
ing s
p ec
ifi
esa patht hrougha n
inte
r ne
t ,andt heoptioninc
ludesas equenceofIPa ddres
ses
.Unli
kestri
cts ource
routing,al oos
es ourc
er out
es p
e c
ifi
est hatthedata
g ra
m mus tv
isi
tthes equence
ofI Pa ddresse
s,b uta l
-l
owsmultipl
ene tworkhopsb etweensuc
cessi
veaddr es
ses
ont helist
.
Bothsourcerout
eop ti
onsrequir
er oute
rsalongthep a
tht ooverwri
teitems
i
nthea ddr
e s
slis
twitht hei
rlocalnetworkaddress
es.Thus,whe nthedatagr
a m
a
rri
vesatitsdesti
nat
ion,itcont
ainsal i
stofal
laddress
esvisi
ted,ex
actl
ylik
et he
l
i
stproducedbytherecordrouteoption.
I
nternetTi mestamp Option.The t imest
amp op ti
on wor ksl i
ket he r ecord
routeop -tion:theop t
ionfie
lds ta
rtswi thaniniti
all
yemp tyl i
st,andeac hr outer
alongt hep a t
hf rom s our
cet ode sti
nationfil
lsinonee nt
r y.Unlikether ecord
routeop t
ion,e ache ntryinat imestampl i
stcontai
nst wo32- bi
tv a
lue
st hata re
sett ot heI Pv4a ddressofther outert hatfil
ledthee ntrya nda32- biti nteger
timestamp .Ti mestampsg i
vet het imea ndda tea twhi c
har outerha ndlest he
da t
agram,e xpre
sseda smil
li
secondssincemid-night
,UniversalTime.

7.
14.
2IPv
6Op
tiona
lExt
ens
ions

IPv
6 us
esthemechani
sm ofextens
ion header
sinp l
aceofIPv4 opt
ions
.
Fi
gur
e7.14l
is
tsex
amp
lesofIPv6op
tionsheader
sa ndex
pla
insthe
irp
urpos
e.

Ne
xtHdr Le
ngt
h De
scr
ipt
ion
0 v
ar Hop-b y- HopOp tions .As etofop ti
onst ha tmust
bee xa mine da te achhop
60 v
ar Desti
na tionOp ti
ons .As etofop tionsp a ssedto
thef irsthopr out e
ra nde achi nt e
rme dia
ter oute
r
43 v
ar RouteHe ader .Ahe adert hata l
lowsv arious
typ esofr outingi nforma ti
ont ob ee nc l
osed
44 8 Fragme ntHe ader.Pr es
enti naf ragme ntt ospeci
fy
thef ieldsus edf orr e
assemb l
y
51 v
ar Authe nt i
c ati
onHe ader.Spec i
fi
est het yp eof
aut he nt i
cat i
onus eda ndda taf ort her ecei
ver
50 v
ar Encaps ula ti
onS e cur i
tyPa yloadHe a der.S pecif
ies
thee nc ryp t
ionus ed
60 v
ar Desti
na tionOp ti
ons .As etofop tionsp a ssed
tot heul tima tede st
ination
1
35 v
ar Mob i
li
t yHe ade r.Us edt os p
e ci
fyf or wa rding
i
nf or ma tionf oramob il
ehos t

Fi
gur
e7.
14Ex
ampleop
tionsheade
rsus
edwit
hIPv
6a heNEXT
ndt
HEADERval
uea s
sig
nedtoeac
h.
Uni
versa
lTi
mewa
sfor
mer
lyc
all
edGr
eenwi
chMe
anTi
me;i
tist
het
imeofda
yatt
hep
rime
meri
dia
n.
1
40 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

Some IPv 6 options useaf ixe


d- si
ze extensi
on header. For exa
mp l
e,a
f
r a
gme nthe aderc ont ai
nse x
actl
ye ightoc te
t s
.Howe ver,ma ny oftheI Pv6
e
x te
ns i
onhe a
de rs
,s uc hase xampl
esli
s t
e dinFigure7.14,arev ari
abl
es i
ze;the
s
izede pendsont hec on-te
nts.Forexa mple
,t heAuthenti
cationHeaderspeci
fi
es
t
hef orm ofa uthenti
c ati
onb e
-inguseda ndcontainsanauthenti
cati
onme ss
agein
t
hes pecif
iedform.
Thef or
ma tofv a
riab
le-l
eng
t he xtens
ionhe adersi
snotf i
xed.Ahe adermay
con-tai
nas ingl
eitem(e.g.
,theAut hentic
ationHeaderc ont
ainsana ut
hentic
ati
on
me s
sage)oras etofitems.Asa ne x
amp l
e,c onsi
dert heHop-By-Hopextensi
on
header.Thes t
andardspe
cifi
esag eneralformatt hatal
lowsmul t
ipl
eop t
ionstobe
encl
osed.Figure7.1
5il
lust
ratesthef ormat.

0 8 1
6 31
NEXTHEADER HDREXTLEN

.
..OPTI
ONS
...

Fi
gur
e7.
15TheIPv
6Hop
-By-
Hope
xte
nsi
onhe
ade
rtha
tenc
los
esmul
ti
pl
e
opti
ons.

Asthefig
ureindi
cate
s,onlyt hefi
rsttwo oc
tetsa r
especi
fi
ed:a NEXT
HEADER fi
el
da ndaHeaderExtens
ionLengthfi
el
d( HDR EXTLEN).Thel
ength
fie
lds pec
ifi
est hel engthoft hee xtensi
onhe ade rinoctets
.Theb odyoft he
extensi
onhe aderf ol
lowsaTyp e-Length-Val
ue( TLV)approac
h.Theb odycons
ist
s
ofop ti
onst hate achb eg
inwi t
ha2- octethe a
der .Thefir
stoctetspeci
fi
esthe
typeoft heop tion,t hesec
ondoc tets p
e c
i-fi
est heleng
th,andt henextoctet
s
contai
nt he value. As inI Pv4, the op t
ions int he ex-t
ens
ion headerare
contig
uous.
IPv6r e
quir
esdatagram headerstob ea l
igne
dt oamul t
ipl
eofeig
htoc te
t s
.
Varia
b l
e-s
izeopti
onsme anthatt heHop -By-Hopheadermaynotali
gnc or
rectl
y.
Insuc hcase
s,IPv6defi
nestwop a
ddingop t
ionsthatasend
erc a
nusetoa l
ig
nt he
headers.Oneoft hetwoconsis
tsofas i
ngleoctetofp a
ddi
ng;theot
herusestwo
oct
e tstospeci
fyap a
ddinglength.
I
nitia
ll
y,I Pv6i nclude dma nyoft hes ameop ti
onsa sIPv4.Fore xample,one
oft heI Pv6e xtensionhe a
de rsisdesignate dt ob eaRout eHeader ,andt heiniti
al
defini
tion provide ds tricts ourcer outea nd looses ourcer outev a ri
ants.The
gene r
alf ormatoft he r oute he a
derwa sa lsot ak enf rom I Pv4 al istof
addresses,af i
e l
dt hats peci
fiedt heleng thoft hel i
s tinoc tets,andaf ie
ldt hat
pointedt othene xta ddr ess
.Howe ver
,a na s-sessmentofs ecurityconc l
udedt hat
giv
ingus er
st hea bil
i
t yt os p e
cifyas our cer out et hrougha na rb
itrarylistof
addresseswoul da l
l
ow a na ttackert os endada tagrama roundas etofr outers
manyt imes,cons umingb andwidth.The ref ore,t hes our c
er outeop tionsarenow
deprecated( i
.e.,t heI ETFd is
couragest he i
rus e).The yha vei nst
ea db eenr e-
pla
c edb yas our cer out et hati ncl
udesonei nt erme di
ates iteb ecauseas i
ngl
e
intermedi-atesiteisne e dedf orMob il
eI Pv6.
Fi
gur
e7.1
2onp a
ge134il
lus
tra
tesfi
el
dsi
nthef
rag
ment
hea
der
.Chap
ter18des
cri
besmobi
l
eIP.
S
ec.7.
15 Op
tionsPr
oce
ssi
ngDur
ingFr
agme
nta
tion 1
41

7.
15Op
tionsPr
oce
ssi
ngDur
ingFr
agme
nta
tion

BothI Pv 4andI Pv 6 uset hes amec onceptuala p


pr oacht oha ndl eop ti
ons
duringf rag
me ntati
on.Whe nc re a
tingf ra
gme nts,theI Pc odee xaminese achof
the op ti
ons int he or i
ginalda tagr
am.I fa n option mus tb ep r ocess
edb y
inte
r medi
ater outers
,t heop -t
ioni scopiedintoe a
c hfra gme nt.Howe ver,ift he
opti
oni sonl yus edatt heul timatede sti
nation,theop tioni scopiedi ntot he
headeroft hef i
rstfragme ntb utnott herest
.Omi tti
ngunne cessar
yop ti
onsf r
om
l
a t
erf r
agme ntsreducest het otalnumb erofb i
tst rans mitte
d.I nt er
estingl
y,
omittingoptionsmaya lsor educet henumb eroff ragment sne eded(i.
e .,as mall
er
headerme ansaf ragmentc anhol dmor eda tafromt hep ayload).
Al
thoughtheyusethesameconc
ept
,IPv4a ndIPv
6di
ffe
rinmos
tde
tai
l
s.
Thene
xts e
cti
onsde
scri
behoweac
hhandl
esop
tions.

7.
15.
1IPv
4Pr
oce
ssi
ngOp
tionsDur
ingFr
agme
nta
tion

Recal
lthati nI Pv4,e achop tionb egi
nswi t
hac odeoc tet.Eachc odeoc tet
conta nsac
i opybi tt hats p
e ci
fieswhe thert heop tions houldb erep l
ic
a t
edi na l
l
fragme ntsori nonl yonef rag ment.Asa ne x
amp le,c onsi
dert her ecordr oute
option.Be c
ausee ac
hf rag
me nti streateda sani ndepe ndentdatagram,t hereisno
guar ante
et hata l
lfr agmentsf oll
ow thes amep atht ot hede s
tinat
ion.I tma yb e
interesti
ngt ol e
arnas etofp athst hate achoft hef ragmentst ook,b utt he
desi
g nersdeci
dedt ha tade sti
na ti
onwi llhavenowa yt oa r
bitrateamongmul ti
p l
e
paths.The ref
ore,t heI Ps tandards pecif
iest hatt her ecordr outeop ti
ons hould
onlyb ecopiedintooneoft hef ragme nts.
Sourcer outeop t
ionsp rovideane xampl
eofop tionstha tmus tb ec opie
di nto
e
achf ragment.Whe nas enders pe
cifi
esas ourcer oute,t hes enderi ntendsf or
t
heda tag
r a
mt ofoll
owt hesp e
c i
fi
edp a
ththr oughani nternet.Ift heda ta
grami s
f
ragmenteda ts ome p oint along the pat
h,a l
lf r ag
me ntss houldf oll
ow t he
r
emainderoft hep aththa tt hesenderspeci
fied,whic hmea nsthats ourc erouting
i
nfor
ma ti
onmus tb erep l
icatedina l
lfragmenthe ade rs
.The refore,t hes tandard
s
peci
fiesthatas ourcerout eop ti
onmus tbec opie
dint oa l
lf r
agme nts.

7.
15.
2IPv
6Pr
oce
ssi
ngOp
tionsDur
ingFr
agme
nta
tion

IPv6di vi
de sada tagrami nt
ot woc oncept
ualp i
eces
:a ni niti
alp i
ecet hatis
cl
a s
si-
fied a s unf ragment abl
e and t he r emainde r
, whi ch i sc lass
ifi
ed a s
fragmentable.Thebas ehe aderliesintheunf ragme ntablep i
e cea ndt hep ayl
oad
l
iesint hefr a
g mentablep i
ece.Therefore,t heonlyque sti
oni sa b
outt hee xtensi
on
headers:how s houl
de ac hbec las
sifi
ed?Aswi thIPv 4,e x
t ensionhe ade rstha tare
onlyp roc
e s
sedb ytheul t
ima tedes-ti
nat i
ondonotne edt ob ep res e
nti ne ach
fragment.TheI Pv
6s tanda r
dss peci
fy whe th-erahe aderi sf r
a gme ntabl
e .In
parti
cular,theHop -By- HopHeaderandRout eHeaderar enotf ragme ntable;other
extensi
onhe adersar ef ragmentable
.The ref
ore,t hef rag- me ntablep artoft he
datagramb e gi
nsa ftert henon- fr
agment abl
ee xtens i
onhe ade rs
.Toc la
rifyt he
i
dea
,cons
ide
rthee
xamp
lei
nFi
gur
e7.
16,whi
chi
l
lus
tra
test
hef
rag
ment
ati
on
1
42 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

ofanIPv
6datagramt
hatha
sab
asehe
ade
r,f
oure
xte
nsi
onhe
ade
rs,a
nd1
400
oc
tet
sofpayl
oad.

unf
ragme
nta
ble f
ragme
nta
ble
. .
. .
. .
b
ase hop
. r
te. a
uth. de
st. da
ta . da
ta . da
ta
1
. 2 . 3
. .
. .
hdr
. hdr
. hdr
. hdr
. hdr
. 300oc
tet
s. 600oc
tet
s . 500oc
tet
s

. .

(
a)

bas
e hop. rte
.Fauth.dest. dat
a1 Fr
agme
nt1(
off
set0)
hdr. hdr
. hdr. hdr. hdr
.

bas
e hop. rte
.F dat
a2 Fr
agme
nt2(
off
set600)
hdr. hdr
. hdr.

bas
e hop. rte
.F da
ta3 Fr
agme
nt3(
off
set1
200)
hdr. hdr
. hdr.

(
b)
fra
gment
ation
Fi
gur
e7.
16I
Pv6 with(a)a
nI Pv
6data
gramwi t
he xt
ensi
on
heade
r i
ntofr
agment
ableand
s di
vi
ded unfr
agmentabl
ep i
eces
,
and(b)as
etoffragments
.

As the fig
urei ndicat
es,e achf r
agme nt s
tarts withac opy of t he
unfrag
me ntab
lepie
ceoft heo r
igi
nalda
tagram.Inthef i
gure,theunfra
gmentab l
e
pi
ecei ncl
udes a Base Header,a Hop-By-Hop Header
,a nd a Route Header.
Fol
lowingtheunfragmentabl
ep i
ece,afragmenthasaFr agmentHeaderla
beledF
i
nt hef i
gure
.
I
Pv 6treatsthef r
agmentablepieceoft heda tagr
ama sa narr
ayofoc tetsto
be divid-edint of ra
gme nt
s.I nt he example,t he fi
rstf ra
gment carri
esa n
Authent i
cati
onHeader ,aDe sti
nationHeader ,a nd300oc tetsofda tafrom the
orig
ina lpayl
oad.Thes ec
ondf ragme ntc a
r r
iest hene xt600 octet
sofp ayl
oad
from t heori
ginaldatagra
m,a ndt het hi
rdf ragmentc ar
rie
st heremai
nderoft he
payload.Wec anc oncl
udef rom thef i
guret hati nthisparti
cul
arinst
ancet he
Authent i
cati
onHeaderandDes t
inati
onHeaderoc cupyex-act
ly300oc t
ets
.
S
ec.7.
16 Ne
twor
kByt
eOr
der 1
43

7.
16Ne
twor
kByt
eOr
der

Ourdi scussio
n ofhe aderf i
e l
dsomi t saf unda menta lidea:p rotocolsmus t
speci
fye noug hde ta
iltoi nsuret hatb oths i
de sinterpretda tat hes amewa y.In
parti
cular,t ok eepi nternetwor ki
ng inde pendent of a ny p art i
cularv endors
ma c
hine a rchitec
ture or ne t work ha rdwa re, we mus ts pecifyas tanda r
d
representat
ionf orda ta.Cons iderwha tha ppens,fore xamp le,whe ns oft war eon
onec omputers endsa32- bitb i
na ryint e
ge rtoa not hercomp uter.Wec ana ssume
thatt heunde r
lyi
ngne twor kha rdwa rewi l
lmov et hes e
que nceofb it
sf r om the
fir
st ma chi
ne t ot he se c
ond wi thout c hanging the or de r.How- ever,not a ll
comput er
ss tore3 2-bi
ti ntegersi nt hes amewa y.Ons ome( cal
l
e dl i
ttleen- dian),
thelowe stme mor yaddressc ont a
inst helow- orderb yteoft hei nt e
ge r
.Onot hers
(cal
ledb i
gendi an),thel owe stme morya ddres sholdst hehi gh-or derb yteoft he
integ
e r.Stil
lot hersstor eint egersi ng roupsof1 6- b
itwor ds,wi tht hel owe st
addresseshol di
ng the low- orde rwor d,b utwi t
hb ytess wapp ed.Thus ,di rect
copyi
ngofb ytesf rom onema chi
net oa notherma yc hang et hev al
ueoft he
integ
e r.
S
tandardi
zi
ngb yte-or
derf orint
eg e
rsi sespec
ial
l
yimp ort
antf orp r
otocol
headersb e
causeahe ade
rus ual
lycont
ainsbinar
yv al
uestha
ts peci
fyinformati
on
sucha sthep ack
etlengthorat yp
ef i
eldthatspeci
fie
sthet ypeofda tainthe
payloada rea.Such quanti
tie
smus tb e underst
ood byb otht he se
ndera nd
receive
r.
TheTCP/I
Pp rot
ocol
ss ol
vet hebyte
-orderprob
lembydefi
ninganetwor
k
s
tandar
dbyteordertha
ta l
lma c
hinesmustuseforbi
naryf
iel
dsi
nhe a
der
s.Eac
h
hostorr oute rconv er
tsb inaryi te msf rom thel oc a
lr ep
r ese
nt ationtone twor k
standardb yt
eor derb e- f
ores endi
ngap ac
ke t,a ndc onvertsf rom ne t
wor kb yte
ordert ot hehos t
-s p
ecifi
cor derwhe nap ack eta rri
ves.Na turally,thep ayload
fie
ldi nap acketise xemp tf rom t heb yt
e-or ders tandardb e causet heTCP/ IP
protocol
sdonotk now wha tda taisb e
ingcar- ried a ppl
icati
onp rogra
mme rsa re
freet of ormatt he i
rown da tar epres
entation a nd transl
ation.Whe ns ending
intege
rv al
ues,ma nya pp l
ic
a t
ionp rogramme rsc hooset ofo l
-l
ow t heTCP/ IPb yte-
orders t
a ndards,butt hec hoic eisof tenma deme relya sac onveni- e
nce( i
.e.
,us e
ane xi
stings tandardr athert hanc hoos eonej ustf ora nap pl
icati
on) .Ina nyca s
e,
theissueofb yteor derisonlyr ele
v antt oapplicati
onp rogramme r
s ;userssel
-dom
dealwithb yteorderp roblemsdi rectly.
TheI nte
rnets t
andardf orbyteor ders pec
if i
esthatinteg
er saresentwith
t
he mosts ig
nifi
cantb ytef i
rst(i.
e.,b ige ndi
a ns t
yle)
.I fone c ons
ider
st he
s
ucces
siv
eb ytesinap acketa si
tt r
avelsf r
om onema chi
net oa not
her,ab i
nary
i
nte
gerint hatpacketha si
tsmos tsig
ni f
icantb yteneares
tt heb eg
inni
ngoft he
p
acketanditslea
sts i
gnif
ica
ntb ytenearestt hee ndofthep a
cket.

The Inter
netpr ot
ocol
sdef i
ne networkbyte or
derto be big
endi
an.As endermustconv
ertallint
egerf
iel
dsinpac
ketheaders
tonet wor
kbyt eorderbeforesendi
ngapacket,andareceiver
mustconvertallin-tegerf
iel
dsinpac
ketheader
stol
ocalbyt
e
or
derbeforeprocess
ingapacket.
1
44 I
nte
rne
tPr
otoc
ol:Conne
cti
onl
essDa
tag
ramDe
li
ver
y(I
Pv4,I
Pv6)Chap.7

Ma nyargume ntshaveb e
e noff
er eda b
outwhichdatar e
presentat
ionshould
b
eus ed,andtheI nterne
ts tandardsti
llcomesunderatta
ckfromt imet oti
me.I n
p
artic
ular
,p roponentsofc hangearguet hatal
thoughmostc omputerswereb ig
e
ndian whent hes tandardwa sdefi
ned,mos ta r
enow l i
ttl
ee ndia
n.Howe ver,
e
veryonea gr
e e
st hatha v-
ingas ta
nda rdiscruci
al,andthee xac
tf orm oft he
s
tandardisfarlessimportant.

7.
17S
umma
ry

Thef undamentalservic
ep r
ovidedb yTCP/IPI nternetsoftwarecons
ist
sofa
con-necti
onless
,unr eli
able
,b est
- ef
fortp acket deli
verys ys
tem.The I nternet
Protocol(IP)formal
lys peci
fiesthef or
ma tofi nternetpackets
,c al
l
eddatagrams,
and informa l
l
ye m-bodi
est he ideas of connecti
onless del
i
ve r
y.Thisc hapter
concentra
t edonda t
ag ra
mf or-mats;la
t e
rcha pte
rswi l
ldiscus
sI Pforwar
dinga nd
errorhandling.
Anal
ogoustoap hysi
calframe,theI Pdat a
grami sdi
videdi nt
ohe a
derand
dat
aa r
eas.Amongotherinfor
ma ti
on,theda t
a gra
m heade
rc ontai
nst hesourc
e
andde st
ina-
tionInt
ernetaddress
esandt hetyp eoft heitemt ha
tf oll
owsthe
hea
de r.Versi
on6oft heInternetProtoc
olc hangesthefor matf rom as i
ngl
e
hea
de rwithsever
alfi
el
dstoab aseheade
rp l
usas erie
sofext e
ns i
onhe a
de r
s.
Al a
rgeda t
a gr
amc anb edi v
idedintof r
agmentsfort ransmi
ssi
ona c
rossa
networkt hat hasa s mallMTU.Ea chf ragment trave
lsa sa ni ndependent
datagr
am;t heul ti
ma tede s
tinati
on reass
emblesfragments.InI Pv4,ar outer
perfor
msf rag
me ntati
onwhe nada -tagr
am mustb esentov e
rane twor kandt he
datagr
am doesnotf iti nt
ot hene t
wor kframe.InI Pv6,t heoriginalsource
perfor
msa llfragmentati
on;ahos tmus tp r
obet ofindt hep a
thMTU.Op ti
ons
thatmus tbep roces
sedb yint er
me di
ateroutersarecopiedintoeachf ragment;
opti
onst hata r
e ha ndl
e db yt he ulti
mated est
inat
ion ares ent i
nt he fi
rst
fra
g ment.

EXERCI
SES

7.
1 Whatisthesi
ngl
egrea
testa
dva
nta
geofhavingac heck
sum c
ove
ronl
ytheda
tag
ram
he
aderandnotthep
ayloa
d?Whati
sthedi
sadvant
ag e
?
7.
2 Isi
tneces
saryt
ous
ea nIPche
cksum whe
ns e
ndi
ngp a
cke
tsov e
ranEt
her
net
?Why
orwhynot?
7.
3 Whati
stheMTUofan802.
11net
work?Fibr
eChanne
l?802.1
5.4?
7.
4 Doyouexpe
ctahi gh-
speedloc
ala
reane
twor
ktohavel
arg
erors
mal
l
erMTUt
hana
wi
deareanetwork
?Why?
7.
5 Ar
guethataf r
agments dnotr
houl es
embl
eadat
agr
am.
7.
6 Ethe
rnetassi
gnsanewtyp
ev al
ueforI
Pv6,whi
chme a
nst hefr
ametypec
anbeuse
d
todis-
ting
uis
hb et
weenarri
vi
ngIPv6andIPv4 da
tagra
ms .Whyisitne
ces
sar
yto
ha
veav
ers
ionnumb
eri
nthef
irs
tfourb
itsofe
achda
tag
ram?
Ex
erc
ise
s 1
45

7.
7 Inthepre
viousexe
rci
se,es
timatehow manytotalb
itsar
etr
ans
mit
teda
roundt
he
wor
ldea
chye arj
usttocar
ryt he4-bi
tver
sionnumber.
7.
8 Whatistheadva
ntag
eofus
ingaone
sc
omp
leme
ntc
hec
ksum f
orI
Pins
tea
dofa
Cyc
li
cRedunda
ncyCheck
?
7.
9 SupposetheInt
erne
tdes
ignwasc
hangedt
oa l
lowrout
ersa
longap
atht
ore
ass
emb
le
da-
ta g
rams.Howwouldt
hecha
ngeaff
ectsec
urit
y?
7.
10 Whati
sthemi
nimum ne
tworkMTUre
qui
redt
ose
nda
nIPv
4da
tag
ramt
hatc
ont
ains
atl
eas
toneoc
tetofdata?AnI
Pv6da
tag
ram?
7.
11S
upposeyouarehi
redtoimp
lementIPda
tag
r a
mp roce
ssi
ngi
nhardwa
r e
.I st
her
ea ny
r
ear
- r
angeme
nt of fi
eldsi
nt he he
ade
rt hat woul
d mak
e your hardwa
re more
e
ffi
cie
nt?Easi
ertobui
ld?
7.
12 When amini
mum-s
izeI
P da
tag
ramt
rav
elsa
cros
san Et
her
net
,how l
arg
eist
he
fr
ame?Ex-
p l
ai
n.
7.
13 Thed i
ffe
renti
ate
ds ervi
cesi
nte
r p
ret
ationoftheSERVI
CETYPEfiel
dall
owsupto64
sep
arateservi
celevel
s.Arguethatfewerlev
elsa
r eneede
d(i
.e.
,ma k
eal i
stofal
l
poss
ibl
eservi
cestha
taus ermightac
cess)
.
Chapt
erCont
ent
s
8.
1 Introduc ti
on,1 47
8.
2 Forwa rdingI nAnI nterne t,1 47
8.
3 DirectAndI ndirectDe livery,1 49
8.
4 Transmi ssi
onAc rossAS ingleNe twork,150
8.
5 Indi
r ectDe livery,1 51
8.
6 Table-Dr i
venI PFor wa rding ,152
8.
7 Next-HopFor wa rdi
ng ,1 53
8.
8 DefaultRout esAndAHos tEx amp l
e,155
8.
9 Host-Sp eci
ficRout es,1 56
8.
10 TheI PFor wa rdingAlg or i
thm,1 57
8.
11 Longes t-Pref i
xMa tchPa radigm,1 58
8.
12 Forwa rdingTa blesAndI PAddr esses
,1 60
8.
13 HandlingI nc omingDa tag r
a ms,1 61
8.
14 Forwa rdingI nThePr e se
nc eOfBr oa
dcastAndMul
ti
cas
t,
162
8.
15 Softwa reRout er sAndS eque ntialLookup,163
8.
16 Establ
ishingFor wa rdi
ngTa bles,163
8.
17 Summa ry,1 63
8

Int
ernetProt
ocol
:
Forwardi
ngIPDatagr
ams

8.
1Int
roduc
tion

Weha ves e ent hata l


linternets e
r vi
cesus ea n underlying,connecti
onless
pack
e tdeli
verys ystema ndtheb asi
cunitoft ra
ns ferinaTCP/ IPinternetist he
IPda tag
ram.Thi sc haptera ddst othede scri
ptionofc onnec ti
onl
essservi
ceb y
des
cribi
nghow r out ersf orwardI P datagramsa ndde li
vert hemt ot hei
rf i
nal
des
tinati
ons.Wet hinkoft heda -
tagramf ormatf rom Chapter7a scharac
t e
rizi
ng
thestati
ca s
p ec
t soft heI nternetProto-col
.Thede s
cri
p t
ionoff orwardi
ngint his
chaptercharacterizest heop erati
onala spe
cts.Thene xtc hap tercompletesour
bas
icp res
ent a
tionofI Pb yde scri
bi
nghow e rrorsa reha ndled.Laterc hapters
showhowot herp rotocolsuseI Ptop r
ovidehigher-le
velser-vices.

8.
2For
war
dingI
nAnI
nte
rne
t

Traditional
ly,t hetermr outi
ngwasus edwithp a
ck e
ts witchings ystemssuch
a
st heI nternett or efe
rt ot hep roc
es sofc hoosi
ngap athov e rwhi cht osend
p
ackets,a ndt het ermr outerwasus edt ode sc
ribethep ac k
e ts witchi
ngde vic
e
t
hatma k e
ss uchac hoi
ce.Ap pr
oximatel
yt wentyye a
rsa ftert heinc e
p ti
onoft he
I
nternet,ne tworkingprofessi
onalssta
rt edus i
ngthet ermf orwar dingt oreferto
t
hep rocessofc hoosi
ngt hep athforap ac
ket.Interesti
ngly,t heyr e t
aine
dt he
t
ermr out ert or efertot hes yste
mt ha tperformsf orwarding.Wewi llfol
low
p
opularusa ge,andus ethet ermf or
war ding.
1
47
1
48 I
nte
rne
tPr
otoc
ol:For
war
dingI
PDa
tag
ramsChap.8

For wardi
ngoc cursats everallevel
s.Forex ample
,wi thinas wit
chedEt her net
thats pansmul t
iplephysicalcha ss
is,theswitchesa r
er esponsi
bleforf orwar ding
Etherne tframesa mongc omp ut e
rs.Thef ra
mee ntersthes witchthroughap ort
thatc onnectstot hes e
ndingc omputer,andt hes wi
t c
ht ransmitsthef r
ameout
the p ortt hatl eads tot he de sti
nati
on hos t.S uchi nter
nalf orwarding i s
complet e
lys el
f-contai
nedi nside a singl
e Ethe r
net ne t
wor k.Ma chi
neson t he
outsi
dedonotp arti
ci
patei nEt hernetforwarding;theyme r
elyviewt hene twor k
asane nti
tythata ccept
sa ndde l
iv
ersp a
cket
s.
Rememb ert hatt he goalof I Pi st op rovi
de a v i
rtualne twor kt hat
encompassesmul ti
plep hysi
calnetwor ks,and off e
rsac onne cti
onle
ssda t
agram
del
iveryservicethatisa nabstrac
tv ersi
onoft hes erv
icepr ovi
dedb ya nEt hernet
swi
t c
h.Tha ti s
,wewa nttheI nternett oaccepta nInternetp acketa ndde l
iver
thep ac
kett ot heintendedre c
ipi
ent( i.
e.,operat
ea siftheI nternetwor kedlike
agiantEt hernetswitch).Thema jordi f
fer-ence
sa rethati np la
ceoff ramest he
Int
e rneta c
ceptsandde l
iv
ersI Pda tagrams,andi nplac
eofEt herneta ddres
ses,
the Internetus esIPa ddress
es.The refore,throughoutt he chapter,we wi l
l
res
t r
ictthedi s
cuss
iont oIPf orwarding.
Thei
nfor
mat
ionI
Psof
twa
reus
est
oma
kef
orwa
rdi
ngde
cis
ionsi
sknowna
sa
For
-war
dingI
nfor
mat
ionBas
e(FI
B).Ea
chI
Pmodul
eha
sit
sownFI
B,a
nde
ach
hast o ma k
ef orwardi
ng deci
sions.Theb asi
cideai ss tra
ightforward:g i
vena
datag
ra m,IPc hoo s
eshowt osendt heda
tagram ontowa rditsde s
tinati
on.Unli
ke
forwardingwithi nas i
ngl
ene twor k
,howe v
er,theI Pf orwardinga lg
orit
hm does
notsimp l
ychoos eamongal oc
als etofdesti
nati
onc omputers.Instead,IPmus tbe
confi
gure dtose ndada t
agrama crossmul
tipl
ephysi
c a
lne t
wor ks.
Forwardingina ninter
ne tca nb ediffic
ult,e s
pecia
ll
ya mongc omputerst hat
havemul ti
plep hysicalnet
wor kc onne c
tions.Youmi ghtima gi
net hatf orwarding
soft
wa rewoul dc hooseap athacc ordi
ngt ot hec urr
entl oa
dona l
lthene twork s
,
theda t
agrams ize ,thetypeofda t
ab ei
ngc a r
ried,thet ypeofs ervi
cer equested
i
nt heda t
agr amhe a
der,and( pe
rha ps)thee conomiccostofv a
riouspaths.Wewi l
l
seethatmos tint ernetfor-wardings oftwarei smuchl es
ss ophi
stic
ated,howe ver,
andselect
sr outesb asedonf i
xeda s
sump ti
onsa boutshortes
tp aths.
To unde rst
and IP f orwardi
ng c ompl
etel
y, we mus tthink about the
architectureofaTCP/ I
Pinte r
net.Fi r
st,rec
alltha
ta ninte
rne
ti scompos
edof
mul t
iplep hysi
calnetworksinterconnectedbyr outer
s .Eachrouterha sdi
rect
connectionst ot woormor ene twor ks
.By contras
t,ahos tcomputerusual
ly
connectsdi rec
tlytoonep hysic
alne twork.Wek now thatitispos
sib
letohavea
mul t
i-home dhos tdi
rectl
yc onnectedt omultipl
enet- work
s,butwewi l
ldefer
thinki
nga boutmulti
-homedhostsf ornow.
Both hos t
sa nd routersp ar
tici
patei nfor wardi
ng anI P datagra
mt oi t
s
desti
nation.Whe na na pp l
ic
a t
ionprogram onahos tc ommunicateswithar emote
appli
cati
on,p roto -c
ols oftwareon t hehos tbe gi
nst og enera
teI P data
gra ms
.
Whe nitr e
ceivesa nout goingdatagram,t heIPs of t
wa reont hehostma ke sa
forwardingde ci
si
on:i tc hooseswheret osendt heda tag
ram.Ev enifahos tonly
connectst o as inglene twork,thehos tma y needt o ma k
er outi
ngde ci
sions
.
Figure 8.1s howsa ne xamplearchite
cture whe re a host with one network
c
onne
cti
onmus
tma
kef
orwa
rdi
ngde
cis
ions
.
S
ec.8.
2 For
war
dingI
nAnI
nte
rne
t 1
49

pa
thtosome pa
tht oother
de
sti
nat
ions dest
inat
ions
R1 R2

Hos
t

Fi
gur
e8.
1Anexampl
eofasing
ly-home
dhostthatmustma
keachoi
ce
b
etwe
e nrout
erR1androut
erR2 whe
nsendi
ngada
tagra
m.

I nt hef i
gure,t wor oute rsc onne ctt ot hesamene tworka st hehos t.S ome
internetde sti
nat i
onslieb eyo ndr outerR1 a ndot herde sti
na ti
onsl i
eb eyondR2.
Thehos tmus tde c
idewhi chrout ert ous ef orag i
ve ndatagram.
Ar out erp erformst rans i
tf orwar ding,whi chme anst her out e
rwi llac cept
incomingda tagramsf rom a nyoft hene t wor kstowhi cht her out era ttache s
,a nd
willforwa r
de ac
hda t
ag r a
m ont owa rdit sde sti
nation.Aque s
t i
ona ri
sesf ormul t
i
-home dhos ts.S uppose,f ore xamp le,t hatac omp uterha sb ot hWi -Fia nd4G
cell
ularne tworkc onne ct i
ons.S houldt hec omp utera ctli
k ear out era ndp rovide
transitf orwa r
ding b etwe ent he ne t-wor ks? We wi llseet hata ny c omp uter
running TCP/ IP ha sa l
lt hes oftwa rene ede dt of orwar d data grams.Thus ,i n
theory,a nyc omput erwi thmul tiplene twor kc onne cti
onsc ana cta sar out er.
Howe ver,t heTCP/ IPst anda r
dsdr a was harpdi sti
nc ti
onb etwee nt hef unc ti
onsof
ahos ta ndt hoseofar oute r
.Anyonewhot riestomi xhos ta ndr out erf unc tions
onas i
ng lema c
hineb yc onfiguringahos tt op rovi
det ransitfor war di
ngdi s-
cov ers
thatt hema chinema ynotp er forma sex pect ed.Fornow,wewi l
ldi sti
ng uishhos ts
from r out ers,a nda ssumet ha thos tsdonotp erformt her out ersfunc t
ionof
transferringp a
ck etsfromonene t
wor kt oa nother.

The I nt
ernetdesi
gn di
sti
nguishesbetween host
sand r outers
.
Although a hos
t with multipl
e networkc onnect
ions can be
configuredtoactasar outer,t heresul
ti
ngs yst
em may not
performasexpect
ed.

8.
3Di
rec
tAndI
ndi
rec
tDe
li
ver
y

Loosel
ys pe
aking,wec andiv i
deforwardingintot wof orms:directdeli
very
andin-directdelivery.Direc
tde li
v e
ry,thet r
a ns
mi s
sionofada tagra
mf rom one
machinea cr
os sasinglephysi
calne twor
kdirectlytoa nother,istheb asi
sonwhi ch
al
linternetc ommuni cati
onr e
sts.Twoma c
hinescane ng ag
ei ndir
e c
tde l
iveryonly
i
ft heyb otha t-ta
c hdirect
lyt ot hesa
meunde rl
yingp hysi
caltra
nsmissi
ons yste
m
(
e .
g.,as i
ngleEt her -
net).Indirectdeli
very occurswhe nt hedesti
na t
ion ofa
da
tagra
m is not on a di
rec
tlya t-
tache
d ne t
wor
k. Be
caus
ethe ul
ti
mat
e
de
sti
nati
onc
annotberea
cheddi
rect
ly,thesende
r
1
50 I
nte
rne
tPr
otoc
ol:For
war
dingI
PDa
tag
ramsChap.8

mustc
hoosear outer
,t r
ans
fert
hedat
agr
ama cr
ossadi
rec
tly-c
onne
cte
dnetwork
totherouter,anda ll
ow t
herout
ertof or
wardthedatagr
am ontowa
rdt he
ul
ti
matedest
inatio
n.

8.
4Tr
ans
mis
sionAc
ros
sAS
ingl
eNe
twor
k

Wek now thatonema chineonag i


ve nphys i
calnetwor kc ansendaf rame
dir
ec tl
yt oa notherma c
hineont hes amene twork.Weha vea ls
os eenhow I P
softwa r
eus esthehardware.Tot r
a nsfera nIPda tagram,t hes e
ndere nca ps
ulat
es
theda tagrami nap hys
i-calframea sde scri
bedinCha pter7,ma p
st hene xt
-hop
IPa ddresstoaha rdwaread- d
r es
s,p lace
st heha rdwarea ddressinthef ra me,and
usest hene t
wor khardwaret ot rans f
ert hef r
a me.AsCha pter6de scribes,IPv4
typi
c al
lyusesARPt omapa nI Pa d- dres
si ntoaha r
dwa rea ddres
s,andI Pv6uses
Neighbor Discoveryt olearnt he ha rdwa rea ddress
e s of ne i
ghboring node s.
Therefore,p re
viouschapt
er se x
ami nea l
lt hep i
ec e
sne ededt ounde rstanddi re
ct
del
ivery.Tos umma ri
ze:

Transmiss
ionofanI Pdatagr
ambetweent womachi
nesonas i
ngle
physi
cal network does not i nvolv
e r out
ers
. The s ender
encapsul
atesthedatagram i
naphys icalframe,bindst
henext -
hop addresst o a physi
calhar
dwar e addres
s,and sends the
resul
tingframedir
ectlytothedest
ination.

Theideaofs endi
ngda tagr
amsdi rectl
ya crossas ingl
ene t workma ys eem
obvious,butor igi
nall
yi twa snot.Be foreTCP/ I
Pwa sinvented,s e
veralnetwork
technologi
esre -
quiredthee quival
entofar oute
rt ob eattachedt oeachnetwork.
Whe nt wo comp uter
son t he networ k neededt oc ommuni cate,they dids o
throug hthel ocalrouter.Pro-ponentsa rguedthatha vinga l
lc ommunicat
iong o
throug har outerme anta l
lc ommuni-cati
onus edt hesamep ara
digma nda l
lowed
sec
ur ityt ob ei mple
me nt
e de asil
y. The TCP/ IP designs howe dt hat dir
ect
communi cat
ionr educedthene tworkt r
a f
ficb yaf a
c -
toroft wo.

S upposet heIPs oftwa r


eonama chi
neisg i
vena nIPda ta g
ram.Howdoe sthe
softwa rek nowwhe t
hert hede st
inati
onl i
esonadi rectl
yconne ctedne twor
k ?The
testi ss t
r ai
ghtforwarda ndhe l
pse x
p l
aintheI Pa ddres
sings cheme .Recal
lthat
eachI Pa ddr essisdivi
dedi ntoap refixthatidentifi
esthene tworka ndas uffi
x
thati dentifi
esahos t.Tode te
rminei fade sti
nati
onl i
esononeoft hedirectl
y
conne ctedne tworks,IPs oftwareextractsthene t
wor kportionoft hedest
inat
ion
IPa ddr essa nd comp arest hene tworkI Dt ot hene twor kI D ofi tsown I P
addres s
(es).Ama tchme anst hedestinati
onliesonadi rectly-connectednetwork
and t he da tagra
mc anb ed el
iver
ed directl
yt ot he destina-ti
on.The t estis
comp utational
lye f
fici
ent,whi ch highli
ghtswhy t he Int e
r neta ddressscheme
work swe ll
:
S
ec.8.
4 Tr
ans
mis
sio
nAc
ros
sAS
ing
leNe
twor
k 1
51

Becauset he inter
net addres
ses of al
lmac hi
nes on a si
ngle
networki n-
cludeac ommonnet workprefi
xandext rac
tingthat
prefi
xr equi
resonlyaf ew machi
neinstr
ucti
ons,tes
tingwhether
adestinati
onc anbereacheddi
rect
lyiseffi
ci
ent.

Froma ninternetp ers


pe cti
ve,iti seasi
e sttot hi
nkofdi r
ec tdel
iveryast he
finals t
e pi na nyda tagr
amt r ansmiss
ion.Ada tagram ma yt rav
ersema nyne twor ks
andi nter- mediater outersa si tt r
a vel
sf rom s our c
et ode stinat
ion.Thef inal
route ra longt hep a
thwi l
lc onne c
tdi rectl
yt ot hes amep hysi
calnetwor kast he
de s
tination.Thus ,thef i
nalr outerwi l
ldeli
ve rtheda tagr
am usingdire c
tde l
i
v ery.
Ine ssence ,ap atht hrougha ni n-terneti nvol
v esze ro ormor ei nter
me diate
route rsp lusones te
pofdi rec tdeli
very.Thes pec
ia lcasearis
eswhe nt herear eno
route rsint hep ath thes endinghos tmus tp er-
f ormt hedirectde l
iv
e rystep.

8.
5Indi
rec
tDe
li
ver
y

I
ndi
rec
tdeli
ver
yi smoredi f
fic
ultthandirec
tde l
i
veryb e
caus
et hesendi
ng
machi
nemusti
denti
fya nini
ti
alroutertohandlethedata
gram.Theroute
rmus t
the
nf or
wardt
heda t
agramont owardthedest
inati
onnetwor
k .
Tov isuali
zehow i ndir
ectf orwa rdi
ngwor ks,i magineal argei nternetwi th
manyne tworksi nterconnectedb yr outers,b utwi thonl yt wohos tsa tt hef ar
ends.Whe nahos tha sada tagramt os end,thehos te ncapsulatest heda tagrami n
af ramea nds endst hef ramet ot hene arestr out e
r.Wek now tha tt hehos tc an
reachar outerb ecausea llphysi
calnetwor ksa reint er
conne cted,s ot heremus tb e
ar outera t
tache dt oe ach net-wor k.Thus ,t heor ig
inatinghos tc a nr eac
ha
routerus ing a s i
nglep hysicalne t
wor k.Onc et he f rame r eachest he router,
soft
wa ree xtractst hee ncapsula
te dda tag
ram,a ndt heI Ps of t
wa res el
ectst he
nextr outera l
ongt hep athtowa r
dt hede stination.Thed atag r
ami sa gainplaced
inaf r a
mea nds entov ert hene xtp hysi
calne twor kt oas econdr outer,a nds o
on,unt i
litc anbede l
i
v ereddirec
tly.Thec onc eptc anb esumma ri
ze d:

RoutersinaTCP/ IPi
nter
netform acooper
ati
ve,i
nterc
onnec
ted
struct
ure.Datagramspassfrom routertor out
erunt i
lthey
reachar out
erthatcandel
iv
erthedatagramdi
rect
ly.

The i
nter
ne t desi
gnconce
ntrat
esf orwardi
ng knowl
edg
ei nr out
ersa nd
i
nsur
esthatar outercanforwar
da narbi
trar
yda ta
gram.Hostsr
elyonr out
ers
f
oralli
ndi
rec
tde li
very.Wecansummari
ze:
Ahostonlyknowsab
outdire
ctl
y-c
onne
ctednet
wor k
s;ahos
t
re
li
esonr oute
rstotra
nsf
erdatag
ramstoremote
des
tina
tions
.
Ea
chr
out
erk
nowshowt
ore
acha
llp
oss
ibl
ede
sti
nat
ionsi
nthe
i
n-t
ernet;gi
venada
tag
ram,ar
out
erc
anf
orwa
rdi
t
c
orrec
tly.
1
52 I
nte
rne
tPr
otoc
ol:For
war
dingI
PDa
tag
ramsChap.8

How canar outerknow how tor eac


har e
motede st
inat
ion?How c anahos t
know whichroutert ouseforag i
v endesti
nati
on?Thet woque st
ionsa r
er el
ated
becausetheyb othinvol
veI Pforwa r
ding.Wewi llanswertheque sti
onsi ntwo
stag
e sbyconsi
deringabasi
ct a
ble
-dr i
venforwardi
nga l
gori
thmi nthischapt
era nd
postponi
ngadi s
cussi
on ofhow r outerslear
na boutr emotede s
tina
t i
onsunt i
l
Chapters121
4.

8.
6Ta
ble
-Dr
ive
nIPFor
war
ding

IPp erf
ormsdata
gr a
mf orwardi
ng.TheI Pf or
wardinga l
gori
thm e mploysa
datastructuretha
ts toresinfor
ma ti
ona b
outp oss
ibl
ede s
tinati
onsa ndhow t o
reacht hem.The dat
as tr
uc t
urei sk nown formall
ya sa nI nternet Protocol
forwardingtabl
eorIPf or-wardi
ngt able,andinformal
lyass i
mp yaf
l orwardi
ng
tabl
e.
Becausetheye achmus tforwa r
dda tagr
ams,b othhostsa ndr outershavea
for
wa rd-ingtabl
e.Wewi llseethatthef or
wa rdi
ngt abl
eonat yp i
calhos ti
smuc h
small
ert hanthef or
wardingtabl
eonar outer,butt headvant
a geofus ingat a
ble
isthatas i
ngl
ef or-war
dingme chani
sm handl
esb othcases
.Whe nev
e ritneedst o
tra
nsmi tada tagram,IPf orwardi
ngs oftwarec ons
ultsthef orwar di
ngt abl
et o
deci
dewhe r
et osendtheda t
agram.
Whati nformat
ionshoul
db ekeptinaf orwardi
ngt ab
le?I fev
eryforwardi
ng
tab
lec ontainedinfor
ma t
ionaboute v
eryp oss
ibl
ede s
tinati
oni naninterne
t,it
wouldb ei m- p
ossi
bletok eept he tab
lescurrent.Furthermore,beca
us ethe
numberofp oss
ibl
ede s
ti-
nati
onsislar
ge,sma l
lspec
ial
-purposesys
temscouldnot
runI Pb ecausetheywoul dnotha v
es uffi
ci
ents pac
et os toretheforwardi
ng
i
nforma t
ion.
Conc eptua ll
y,iti sde s
irab l
et ous et hep rincipl
eofi nf orma tionhi dinga nd
all
ow ma chi
ne st o ma kef or warding de cis
ionswi th mi nima li nfor mation.For
examp le,wewoul dl i
ket oi solatei nf orma ti
ona bouts p ecifichos tst ot hel ocal
environme nti nwhi cht heye xist,anda rrangef orma chine st hata ref a
ra wayt o
forwa rdp ack etst ot he m wi thoutk nowing s uc h details.For t una tel
y,t he IP
addre s
ss chemehe lpsa chi
evet heg oa l
.Re callt hatI Pa ddr ess
esa r eas s
ignedt o
ma kea llma c hinesconne ctedt oag iv enp hysicalne twor ks hareac ommonp refi
x
(the ne twor kp or
tion of t he a ddr ess).We ha vea l
re adys eent hats ucha n
assig
nme nt ma kest he t es
tf or dir e ct deli
verye ffici
e nt.I ta l
so me anst hat
routingt abl
e sonl yne edt oc ontainne t
wor kp re fi
xesa ndnotf ullI Pa d-dresses
.
Thedi s
tinc t
ioni sc ri
ti
c al
:t heg l
oba lI nte r
ne tha sov e
r800, 000, 000 indivi
dua l
comp uter s,b ut only 400, 000 uni que I Pv4p refix
e s
. Thus ,t he f orwa r
ding
i
nf orma tionne e
dedf orp refixesi st hreeor der sofma gnit udes ma l
lert hant he
forwa rdingi nf orma-ti
onf ori ndivi
dua lcomp uters .Thep oi nti s:

Becaus
eitall
owsforwar
dingtobebas
edonnetworkpref
ixes
,
theIPaddres
sings
chemecont
rol
sthesizeoff
orwardi
ngtabl
es.

Whe
n wedi
scus
srout
epr
opa
gat
ion,wewi
l
lse
etha
ttheI
Pfor
war
ding
s
cheme a l
so hasa nothera dv
ant
age: we a
re onl
y requi
redt op
rop
aga
te
i
nforma
tion a
b outnet-work
s,nota b
outindi
vi
dua
lhost
s.I nfac
t,ahos
tcan
a
ttachtoane twork(e.
g .
,Wi-Fi

Ori
ginal
ly,thetab
lewa
sk sa r
nown a out
ingt
abl
e;s
omene
twor
kingp
rof
ess
iona
lsus
ethe
or
igi
nalt
er -
minol
ogy.
S
ec.8.
6 Ta
ble
-Dr
ive
nIPFor
war
ding 1
53

hotspot)andbegi
nus
ingt
hene
twor
kwi
tho
uta
nyc
hang
esi
nthef
orwa
rdi
ng
tab
lesinrout
ers
.

8.
7Ne
xt-
HopFor
war
ding

Wes ai
dt hatus ingt hene t
wor kport i
onofade sti
na ti
onI Paddres
sinsteadof
thec omp le
t ea ddressk eepsf orwardingt able
ss ma l
l.I ta lsoma kesf orwardi
ng
effi
ci
e nt.Mor ei mp ortant,i t hel
pshi de informa t
ion,k eeping t
he de ta
il
sof
spec
ifichos tsc onf i
ne dt ot hel ocalenv i
ronmenti n whi cht hehostsop erat
e.
Conceptua l
ly,af orwa r
dingt abl
ec ontainsas etofp a i
rs( N,R) ,whereN i sthe
networ kpr efixf orane t
wor kint hei nterneta nd R ist heI Paddressoft he
nextr outera longt hep athtone twor kN.Rout e rRi sc alle
dt henexthop,and
theide aofus i
ngaf orwardi
ngt ab
let ostoreane xthopf ore a
chde s
t i
nati
onis
cal
led ne xt-hop f orwarding.Thus ,t he forwa r
ding t abl
ei n ar outer R only
spec
ifiesones te pa l
ongt hep athf rom R t oe achde s
tina t
ion net
wor k t he
routerdoe snotk nowt hec omp l
etep athtoade s
tination.
I
tisi mportanttounderstandt hateachentryinaf orwardi
ngt a
blepoint
st o
ar outert hatcanb ereachedacrossas i
nglenetwork.Thatis,allroutersli
stedin
mac neM
hi sforwardi
ngt ab
lemus tl i
eonne tworkstowhichM c onnect
sdirectl
y.
Whe nada ta
g r
ami sr e
adyt ol eaveM,I Psoftwarelocate
st hede st
inat
ionI P
addr e
ssa nde xtra
ctsthene t-
wor kp ort
ion.M thenlooksupt hene tworkp or
tion
i
ni t sforwa rdi
ngt ab
le,sel
ectingoneoft hee ntr
ies.These l
ectede ntryint he
tablewillspecif
yane xt-hoproutert hatcanber ea
cheddirectl
y.
Inp ract
ice
,wea p
plythepr
inci
pl
eofinformat
ionhidi
ngtohost
sa swe
ll
.We
i
n-si
stt hatalthoughhost
shaveI Pfor
wardingtable
s,theymustkeepmini
mal
i
nformationint he
irtab
les
.Theide
aistoforcehoststorel
yonrouter
sformost
f
orwa r
ding.
Fi
gure8.2showsac oncret
ee xa
mpl
et ha
the lpsexpla
infor
wa r
dingtables
.
Thee x
-amplei
nte
rnetconsi
stsoff ourne
tworksconnecte
db ythr
eer out
ers.The
tabl
eint hefi
gurecor
r e
spondstot heforwar
dingta b
leforrouterR.Although
theexampleus
esIPv4addres
ses
,t heconc
eptappl
iesequal
lytoIPv
6.
Int hef igure,eac hnetwor kha sb e
ena s
sig
ne das l
ash-8prefi
xa nde ach
networki n-t e
r f
ace ha sbeena ssi
gned a 32-bi
tI Pv4a ddre
ss.The ne twork
admini
stratorwhoa s
-signe
dI Pa ddres
seshaschosent hes amehos tsuffi
xf or
bothinte r
f a
c esofa r outer.Fore xampl
e,the interfac
eson r outer Q have
addres
ses1 0.0.0.5and20. 0.0.5.AlthoughIPall
owsa r b
itrarysuf
f i
xes
,c hoos
ing
the same v al
ue f orb othinte r
facesma kesaddress
-ing easi
erf orhuma nst o
rememb e
r .
BecauserouterR conne ctsdirec
tlyt one t
works20. 0.0.0a nd30.0.
0. 0,it
canus edire
ctdel
iverytos endt oahos tone i
theroft hosene t
wor k
s.Ther outer
usesARP ( IPv
4)ordi r
e c
tma p
ping (I
Pv6)t of i
nd t he physi
caladdres
sofa
comp ut
e ronthosenet-wor ks.Givenada tagra
m desti
ne dforahos tonne t work
40.0.0.0,howeve
r,R c a
nnotde li
verdirec
tly.Inst
ead,R f orwardsthedata gr
am
tor outerS( a
ddress30.0.0.7).Swi l
lthende li
vertheda tagram dir
ect
ly.R c an
r
eac
haddr
ess30.
0.0.
7be
caus
eb hRa
ot ndSa
tta
chdi
rec
tlyt
one
twor
k30.
0.0.
0.
1
54 I
nte
rne
tPr
otoc
ol:For
war
dingI
PDa
tag
ramsChap.8

20.
0.0.
5 30.
0.0.
6 40.
0.0.
7

Net
work Net
work Net
work Network
Q R S
1
0.0.
0.0/8 20.0.
0.0/8 30.0.
0.0/8 40.
0.0.0/8

1
0.0.
0.5 20.
0.0.
6 30.
0.0.
7

(
a)

TOREACHHOSTS FORWARDTO
ONTHISNETWORK THI
SADDRES
S

20.
0.0.
0/8 DELI
VERDI
RECTLY
30.
0.0.
0/8 DELI
VERDI
RECTLY
1
0.0.
0.0/8 20.
0.0.
5
40.
0.0.
0/8 30.
0.0.
7

(
b)

Fi
gur
e8.
2(a)Anexamp
leinte
rnetwith4ne
twor
ksa
nd3r
out
ers
,and
(
b)thef
orwardi
ngt a
bl nR.
ei

AsFigure8.2demonstr
a te
s,thesizeoft heforwa r
dingtabl
edepe
ndsont he
numb erofnetwork
sint heinterne
t;thetableonlyg r
owswhe nnewnetwor
ksa re
added.Tha tis
,thet a
blesizea ndcontentsa r
ei ndepende
ntoft henumberof
i
ndividualhos
tsconnect
e dt othenet work
s.Wec ansumma r
izetheunderl
ying
pri
nciple
:

To hide i
nf or
mat i
on,keep f orwardi
ng tabl
ess mall
,and make
forward-i
ng decisi
ons eff
ici
ent ,IPf or
warding soft
ware only
keeps inf
ormat i
on about des t
inat
ion network address
es, not
aboutindi
vidualhostad-dr
esses.

Choosingr outesbasedont hede stinati


onne twor kp re f
ixa l
oneha ss e
ve ra
l
conse-
que nces
.Fi r
st,inmos timplementa ti
ons,itme anst ha talltra
f fi
cde s
tined
forag ivenne tworkt ake
st hesamep a t
h.Asar e
sult,e v
e nwhe nmul ti
plepaths
exis
t,the yma ynotb eusedc oncurrently.Also,i
nt hes imp les
tc as
e ,alltraffi
c
fol
lowst hes amep a
thwi thoutre ga
rdt ot hede l
ayort hroughputofp hysica
l
networks.S econd,b ec
auseonl yt hef i
na lroutera l
ong t hep atha ttemptst o
communica tewiththede s
tinati
onhost,onl yt hefi
nalr outerc andetermineift he
hoste xi
stsori soperati
onal.Thus,wene edt oa r
-r angeawa yf ort hef i
nal
r
out
ert
ose
ndr
epor
tsofde
li
ver
ypr
obl
emsb
ackt
otheor
igi
nal
S
ec.8.
7 Ne
xt-
HopFor
war
ding 1
55

source.Third,becaus
ee achr oute
rf or
wardst raff
icindependent
ly,datagr
a ms
travel
ingfrom hos tA tohos t B mayfol
l
ow a nentirel
y dif
ferentpatht han
datagramst ra
vel
ingf rom hostB backtoho stA.Mor eover
,t hep at
hi n one
dire
ctioncanb edown( e.
g.,ifane t
workorr outerfai
ls)evenifthep a
thint he
otherdirec
tionre mai
nsa va
il
able.Weneedt oe ns
uret hatrouterscooper
atet o
guaranteethattwo-wayc ommunicat
ioni
sal
- wayspossi
ble.

8.
8De
faul
tRout
esAndAHos
tExa
mpl
e

The I P de
s i
gni ncludesa ninterest
ing op t
imiza t
iont hatf urther hides
i
nfor
ma tiona ndr educ esthes i
zeoff orwardingta bl
es:consol
ida t
ionofmul ti
p l
e
e
ntri
esi ntoas inglede faultcase
.Conceptuall
y,ade faul
tc as
ei ntroducesat wo-
s
tepalgorithm.I nt hef i
r s
tstep,IPforwardingsof t
wa relooksint hef orwarding
t
abletof i
nd ane x t-hop.Ifno e n-tr
yi nt het abl
ema tc
hest hede s
t i
nation
a
ddress
,t heforwa rdings oft
wa r
et ak
esas econds t
e pofc heckingf orade fault
r
oute.Wes aytha tt hene xthopspeci
fi
edinade faultrouteisade faul
trouter .
Inp racti
ce,wewi l
lseet hatdefaultroutingdoesnotrequi
ret wos epa
ra t
e
s
teps.In-st
e a
d ,adefaultroutec anbeincorporatedi
ntoaforwar
dingt a
ble.That
i
s,ane x
trae n-trycanb ea ddedt oaf orwa r
dingtabl
ethatspeci
fiesade faul
t
r
outera st hene xthop.Thel ookupalgori
thm c a
nb earr
angedtoma tc
hot her
t
ablee ntri
esf ir
standonl ye xam-i
net hede faultent
ryifnoneoft heot her
e
ntri
e s ma tc
h. A l aters e c
t i
on explai
ns t he for-
wardi
ng algori
thm t hat
a
ccommoda tesdefaul
tr out
e s
.
Ade faultrouteise speci
al
lyusef ulwhenma nydesti
nati
onslieb e
yondas i
ngl
e
router
.Fore xample,cons i
derac omp anythatus esaroutertoc onnecttwosmall
depart
me ntne tworkst ot hec ompa nyintra
ne t.Therouterha sac onnect
ionto
eachde p
a r
t mentne twor kandac onne cti
ont otherestoft hecomp anyintr
anet
.
Forwardingi sstra
ightforwardb ecauset herouteronlyneedsthr eeentr
iesinit
s
forwardi
ngt abl
e:onef oreachoft het wode p
a r
tmentalnetworksa ndade f
aul
t
routefora llotherdestinati
ons.
Def
aultr outi
ngwor ksespec
ial
lywe l
lf ort ypi
calhostcomputersthatob tai
n
servi
cefrom anI SP.Fore xample
,whe naus era c
quire
sservi
ceov eraDS Llineor
cabl
emode m,t heha rdwareconnectsthec omp utertoane tworka ttheI S
P.The
hostusesar outeront heISPsnetworktor eachana rb
itr
a r
yde sti
nati
oni nthe
glob
alInternet.Ins uchc as
es,thef or
wa r
di ngt ab
leinthehos ttableonl
yne e
ds
twoe nt
ries:onef ort helo-c
alneta ttheI S Pandade faul
te ntr
yt hatpointsto
theISP
sr outer.Figure8.3ill
us-tr
atesthei dea.

Althought heexampleinthefigureusesIPv4a ddress


es,thesa mep ri
ncip
le
worksf orI Pv6:ahostonlyneedstok now aboutthel oca
lne t
workp lushavea
defa
ul troutet hati
sus e
dt oreac
ht herestoft heInternet.Ofcourse,anI Pv6
addressisfourt i
mesaslargeasanIPv4a ddr
ess,whichme ansthate ac
he ntr
yi n
thef orwardingtabl
ei sfourtimeslar
ger.Thec onsequenceforlookupt imesis
mores i
gnif
icant:on mode r
nc omput-er
s,a nI Pv4a ddressfitsintoas i
ngle
i
nte
ger,whichmeansac
omp
ute
rc anus
easingl
eintege
rc omp
ari
sontoc
omp are
t
woI Pv4addre
sse
s.Whenc
ompar
ingtwoI
Pv 6ad-dr
esses
,multi
plec
ompar
isons
a
reneeded.
1
56 I
nte
rne
tPr
otoc
ol:For
war
dingI
PDa
tagr
ams
Cha
p.8

p
athtoInterne
t
IS
Pne twor
k de
sti
nat
ions
20.0.
0.0/8 R
20.
0.0.
17
20.
0.0.
1

Hos
t
(
a)

TOREACHHOSTS FORWARDTO
ONTHISNETWORK THI
SADDRESS

20.
0.0.
0/8 DELI
VERDI
RECTLY
DEFAULT 20.
0.0.
17

(
b)

Fi
gur
e8.
3(a)Anex
ampl
eInte
rne
tconnec
tionusi
ngIPv
4addr
ess
es,a
nd
(
b)thef
orwa
rdi
ngtab
leuse
dint hehos
t.

8.
9Hos
t-S
pec
ifi
cRout
es

Although we sai
dt hata llforwardi
ng isba s
ed on networksa nd noton
i
ndi
vidualhost
s,mos tIPf orwardi
ngs oft
warea l
lowsaho s
t -
speci
fi
cr outetob e
s
peci
fieda sa s pe
-cia
lc ase. Havi
ng host-sp
ec i
fi
cr outesg iv
es a ne twork
a
dministra
tormor econtrol
.Thea bi
li
tyt osp
ecifyar out
ef orindi
vidualmachi
nes
t
urnsoutt oha v
es ev
eralposs
ibl
euses:

Controloverne tworkus e
.Ana dminis
tratorcansendt r
affi
c
forc er
t ai
n hostsalongonep atha ndt raf
ficforremaini
ng
host
sa longa not
herp ath.Forexamp l
e,a nadmini
str
atorcan
sepa
ratet raffi
cde s
t i
nedt othecomp any
swe bserverfrom
othertraffi
c.
Tes
ting a ne
w networ
k.A ne w,p a
r a
ll
elnet
workc anbe
i
nstal
le
da ndtes
tedbysendi
ngt ra
ffi
cf orsp
eci
fichos
tsove
r
thenew net-
workwhil
el ea
vingallothertr
aff
icont heol
d
net
wor k.
Sec
ur i
ty.An admini
stra
tor can us
e host-s
pe c
ifi
cr oute
st o
di
rectt r
affi
cthroughsecuri
tysystems.Fore xampl
e,t r
aff
ic
des
tinedt othecompanysfi
nanci
aldepart
me ntma yne edto
tr
averseas e
curenet
wor kthathasspec
ialf
il
tersinplace
.

Al
thoughc
once
ptsli
kedefa
ultroutesandhost-s
pec
ifi
cr out
ess e
emtobe
s
pec
ialcase
sthatrequi
resp
ecialhandi
ng,the ne
xts ect
ion exp
lai
nshow a
ll
f
orwardi
nginforma-t
ioncanb ec
omb
ine
dint
oas
ing
let
abl
eandha
ndl
edb
ya
s
ing
le,uni
for
ml ook
upa l
go-
rit
hm.
S
ec.8.
10 TheI
PFor
war
dingAl
gor
ithm 1
57

8.
10TheI
PFor
war
dingAl
gor
ithm

Taki
nga l
lthes
pec
ialc
asesdesc
rib
eda bov
eint
oa cc
ount
,itmaysee
mtha
tIP
sof
twa reshoul
dtak
ethefoll
owingstepswhendec
idi
nghowt of
orwa
rda
datagr
am:

1
.Ex
tra
ctt
hede
sti
nat
ionI
Paddr
ess
,D,f
romt
heda
tag
ram
2.I
fthe f
orwa
rdi
ng t
abl
econt
ains a hos
t-s
pec
ifi
cent
ryf
or
de
sti
nat
ion D, For
war
dthe da
tag
ram t
othe ne
xt hop
s
pec
ifi
edi
nthee
ntr
y
3
.Ift
hene
twor
kpr
efi
xofDma
tche
sthep
ref
ixofa
nydi
rec
tlyc
onne
cte
d
ne
twor
k,S
endt
heda
tag
ramdi
rec
tlyov
ert
hene
twor
ktoD
4.I
fthef
orwa
rdi
ngt
abl
econt
ainsa
nent
ryt
hatma
tche
sthene
twor
k
p
ref
ixofD,For
war
dtheda
tag
ramt
othene
xthops
pec
ifi
edi
nthe
e
ntr
y
5.I
fthef
orwa
rdi
ngt
abl
econt
ainsade
faul
trout
e,
For
war
dtheda
tag
ramt
othene
xthops
pec
ifi
edi
nthede
faul
trout
e
6.I
fnoneoft
hea
bov
eca
sesha
sfor
war
dedt
heda
tag
ram,
De
cla
reaf
orwa
rdi
nge
rror

Thinkingoft hes i
xs tepsindividuall
yhe l
psusunde r
standa l
lt hec as
est ob e
con-side
re d.Int e r
msofi mp leme ntati
on,howe ver,p rogra
mmi ng s i
xs eparate
stepsma kesthec odeclumsya ndf il
ledwi thspec
ialcases(e.
g.,check i
ngwhe thera
defaultrout ehasb eenspeci
fied).Ea rlyinthehi s
toryoft heI nternet,de s
igners
foundawa yt ouni f
ya llthec as esintoas ingl
el ookupme chani
smt hatisnow
usedi nmos tc omme rc
ialIPs oftwa re.Wewi l
le xp
lainthec onceptuala l
gorit
hm,
examineas traig
ht f
orwardi mp l
e- mentationusingat abl
e,a ndt henc onsidera
vers
ion t hats ca
lest o handlef or wardi
ng inr out e
rsne art he c e
nteroft he
Internett hathavelargeforwa rdingt abl
es.
Theuni
fi
edlo
okupsche
mer
equi
resf
ouri
temst
obes
pec
ifi
edf
ore
ache
ntr
y
i
ntheforwa
rdi
ngtabl
e:

TheIPaddr
ess,A,tha
tg i
vesthedest
inati
onfortheent
ry
Anaddre
ssmask,M,thatspec
ifi
eshowma nybitsofAtoe xa
mine
TheIPaddr
essofane xt
-hoproute
r,R,or del
i
verdi
rect
Anetworki
nterfa
ce,I,tousewhens endi
ng

Thefourite
msdefi
nearout
eunambi
guous
ly.I
tshoul
db ecle
art hateach
e
ntr
yi naf or
wardi
ngt
abl
ene
edsthet
hir
ditem,anext
-hoprout
era ddre
ss.The
fourthitemisne ede
db ecausear outerthata tt
a c
hestomulti
pl
ene t
wor kshas
multi
pleinterna
lne tworki nterf
aces.Whe ni tf orwar
dsada ta
gr a
m,I P must
speci
fywhichinter
nalinte
rf acetous ewhe nsendi
ngt heda
tagr
am.Thef i
rstt wo
i
t e
msde fi
neane tworkp r
ef ix thema s
ks p
e c
ifi
eswhichbi
tsoft hede s
tinat
ion
addresst
ous eduri
ngc omparisonandt heIPa d-
1
58 I
nte
rne
tPr
otoc
ol:For
war
dingI
PDa
tag
ramsChap.8

dres
s,A,g
ive
sav a
lueag
ains
twhi c
ht oc
ompar
e.Thati
s,thea l
gori
thm c
omputes
thebit
-wi
selogi
calandoft hema s
k,M,wit
ht hedes
tina
tionaddres
sa ndthe
n
compar
est
her es
ulttoA,thefir
stitemi
ntheentr
y.
Wede finet hel engthofanaddr essma skt obet henumb erof1b itsint he
mask.Ins l
ashnot a t
ion,thelengt hofama s
ki sgive
ne xpli
citl
y( e.g.,/28de notes
ama skwi t
hl eng th28) .Theleng thofa na ddressmaski simp ortantb ec a
uset he
unif
iedforwa rdinga lg
orithmincludesmor ethant radi
ti
ona lnetwor kp refixes
.The
mask,whichde te rmineshowma nyb i
tstoe xaminedur i
ngc omp aris
ons ,a l
soa l
lows
ust o handle hos t-spec
ifi
ca nd de f
aultc ases.Fore x
amp le,c onsidera nI Pv6
dest
inati
on.A/64ma skme anst hatac omp ar
isonwillconsidert hef i
rst64b i
ts
ofthea ddress(i.e.,thene tworkp ref
ix).A/1 28ma s
kme anst hata ll128b i
tsof
addresA i
s nt hee ntry wil
lb ec omparedt ot hede s
tination (i.e.
,t hee ntry
spec
ifi
esahos t-s p
e c
ificroute)
.
Asanothere xampleofhow t hefouri t
e mss uffi
cefora r
b it
raryforwardi
ng,
consi
d-erade faultroute .Tocreateane ntryf orade faul
tr oute,thema s
k,M,
i
ss ettoze ro(allzerob its
),andthea ddressfield,A,issett oze r
o.Noma t
ter
whatde st
inati
ona ddressisinada tag
ra m,usingama skofa l
lze roe
sresul
tsina
val
ueofze r
o,whi chise qualtothevalueofAi nt heentry.Inot herwords,the
entryalwaysma tches(i
.e .
,itprovi
desade faultroute).Alg
ori
t hm 8.1s
umma ri
zes
step
st a
k e
nt ofor wardada t
agram.
Ine ssence,t hea l
gori
thm i teratest hroug he ntri
e sint hef orwardi
ngt abl
e
untilitf i
ndsama tch.Thea l
g or
ithm a ssume se ntriesarea rrang e
di nlong es
t-
prefi
xor de r(i.e
.,t hee nt
rieswi tht hel ongestma s
koc c
urf i
rst
).The refore,as
soona sthede sti
na tionma tchesa ne ntry,t hea lgorithmc anse ndt hedatagramt o
thes peci
fi
e dne xthop .The r
ea ret woc a ses
:di rectori ndi
rectde l
ivery.Fordi r
ect
deli
very,t heda tagra m des
tinationisus eda st hene x thop.Fori ndirectde l
ive
ry,
thef orwardingt ablec ontai
nst hea ddressofar out e
r ,R,t ous ea sthenex thop.
Onceane xthopha sb eende t
er mi
ne d,t hea lgo-rithm ma pst hene xt-hopa ddres
s
toaha r
dwa rea ddr ess,createsaf r
ame ,f i
l
lsi nt heha rdwa rea ddres
si nt he
frame ,ands endst hef ramec arryi
ngt heda tagr a
mt ot hene x
thop .

Thea l
gor i
thm as
sumest hattheforwardi
ngtabl
ec ontainsade fa
ultr oute
.
Thus,e v
eni fnoot herentriesmatc
hag i
vendest
inati
on,thede faul
te ntrywill
match.Ofc our s
e,ama nagercoul
dma keami s
takeandinadve r
tentl
yremov ethe
defaul
tr oute.Insuchc as
es,oura l
gori
thm wi
lli
teratethrought heentir
et abl
e
withoutf i
ndingama tc
h,a ndwil
lt he
nr eachthep oi
nta twhi chitde c
laresa
forwardi
nge rrorhasoccurr
e d.

8.
11Longe
st-
Pre
fixMa
tchPa
radi
gm

Toma k
et heal
gorit
hm workcorre
ctl
y,e nt
rie
sint het abl
emustb eexamined
i
na norderthatguarantee
sentri
eswithalongerma s
ka rec he
ckedbe
f or
ee ntri
es
withas hort-
e rmask.Forexample,sup
poset het a
blec ontai
nsahos t-s
pecif
ic
rout
ef orahos tXa nda l
socontai
nsane twork-s
peci
ficr outeforthene twork
p
orti
onofX.Bothent
rie
swi l
lma t
chX,b utf
orwa
rdi
ngs
houl
dchoos
ethemos
t
s
pec
ifi
cmat
ch(i
.e.
,thehost
-spec
ifi
crout
e).
S
ec.8.
11 Long
est
-Pr
efi
xMa
tchPa
radi
gm 1
59

Al
gor
ithm8.
1

For
war
dIPDa
tagr
am(Da
tagr
am,For
war
dingTa
ble){I
nsur
e
f
orwa
rdi
ngt
abl
eisor
der
edwi
thl
onge
st-
pre
fixf
irs
tExt
rac
t
t
hede
sti
nat
ion,D,f
romt
heda
tagr
am
Fore
acht
abl
eent
ry{
Comp
ut hel
et ogi
calandofDwi
thma
skt
oob
tai
nap
ref
ix,P
I
fpr
efi
xPma
tche
sA,t
hea
ddr
essi
nent
ry{
/
*Foundama
tchi
nge
ntr
y--f
orwa
rda
ssp
eci
fi
ed*/
i
f(ne
xthopi
nent
ryi
s"de
li
verdi
rec
t"){
S
etNe
xtHopt
othede
sti
nat
iona
ddr
ess
,D}
ot
her
wis
e{
S
etNe
xtHopt
other
out
era
ddr
essi
nthee
ntr
y,R
}
Re
sol
vea
ddr
essNe
xtHopt
oaha
rdwa
rea
ddr
ess
,H
Enc
aps
ula
tet
heda
tagr
ami
naf
rameus
inga
ddr
essH
S
endt
heda
tagr
amov
erne
twor
kus
ingi
nte
rfa
ceI
S
topb
eca
uset
heda
tagr
amha
sbe
ens
ents
ucc
ess
ful
ly
}
}
S
topa
ndde
cla
ret
hataf
orwa
rdi
nge
rrorha
soc
cur
red
}

Al
gor
ithm 8.
1Unif
iedI PFor
wardingAlgor
ithm i
nwhi
che a
c hta
b l
eentr
y
c
onta i
nsanaddress,A,ama sk,M,anext-hoproute
r,R
(
or di
rectde
li
very),andanetworki
nte
rface,I.

Weus et heterml onges


t-prefi
xmatchtodesc
rib
etheide
aofexami
ningthe
most
-spe
c i
fi
cr out
esf i
rst.Ifwei magi
nethefor
wardi
ngta
bletobea
na r
ray,the
l
onges
t-prefi
xma tchruleme ansentri
esi
nthearra
ymustbesort
edi
ndescendi
ng
or
deraccord-i
ngtot helengthoft hei
rmask.
1
60 I
nte
rne
tPr
otoc
ol:For
war
dingI
PDa
tag
ramsChap.8

8.
12For
war
dingTa
ble
sAndI
PAddr
ess
es

Itisimp ortanttounderstandt hatexceptf orde c


r e
me nti
ngt hehopl imit
(TTLi nIPv4)a ndr ec
omputi
ngt hec heck
sum,I Pf orwardingdoe snota lte
rt he
ori
g i
nalda-tag
r am.Inp a
rti
cular
,t heda t
agrams ourcea ndde s
tinati
ona ddresses
remainuna l
tered;theyspeci
fyt heI Paddressoft heor i
ginalsourcea ndtheI P
address of the ul t
imat
e de s
-tinati
on. Whe ni te xecutest he f or
wa rding
algor
ithm,IPc omp utesanewa ddr es
s,theI Paddr es
soft hema chi
net owhi ch
theda ta
grams houldbesentnext.Thene wa ddre
ssi smostl i
kel
yt headdressofa
router.Iftheda tagramcanbede li
vereddir
ectl
y,t henewa ddressi
st hesamea s
thea ddr
essoft heulti
matedesti
na t
ion.
Int hea l
gori
thm,t heIPa ddres
ss elec
tedbyt heIPf or wardi
ngalgori
thm is
cal
l
edane xt-hopaddressbecauseitt el
l
swhe retheda t
agram mus tbese ntnext.
Wheredoe sI Ps torethene xt-hopa ddress?Noti ntheda tagra
m;nop la
cei s
res
erv e
df orit.Inf act,IPdoe snots torethenext-hopa ddressatall
.Af terit
exec
ut esthef orwardi
nga lgo
rithm,t heI Pmodulepassest heda t
agra
ma ndt he
next-hopa ddres
st ot hene tworki nterfac
er e
sponsi
blef ort hene t
wor k over
whicht hedatagram mustb esent.Ine sse
nce,IPre-questst ha
tt hedatagra
mb e
se
ntt ot hespeci
fiednext-hopaddres
s .
Whe ni trece
ivesada tag
r amandane x t
-hopa ddres
sf r
om I P,thene t
wor k
inter
fa c
emus tma pt henext-hopaddres
st oaha r
dwa r
ea ddre
ss,c re
ateaf rame,
pla
c et he hardwarea ddre
ssi nt he destinati
on addressfiel
d of t he frame,
encapsula
t etheda tagr
ami nt hep a
yloada reaoft heframe,a ndt rans
mitt he
resul
t.Onc eithasob tai
nedaha rdwarea ddress
,t henetworkinte r
facesoft
wa re
dis
cardst henext-hopaddre
ss.
Itma ys eem oddt hataf orwa rdingt a b
lestorest heI Pa ddressofe ac
hne xt
hopi n-ste
adoft heha rdwa rea ddr essoft hene x thop .AnI Pa ddres
smus tb e
transl
atedi nt oac or resp
ondi ngha r dwarea ddressb eforet heda ta
gramc anb e
sent,soa ne x tras t
e pisr e-quiredt oma pane xt-hopI Pa ddresst oanequival
ent
hardwa r
ea ddr ess.Ifwei ma gineahos ts endingas equenceofma nyda ta
gramst o
as i
ng l
ede s
t ination,t heus eofI Pa d-dr
e ssesforf orwa rdi
ngc a nseemincredi
bly
ineff
icie
nt.Ea c
ht i
me a na p
p l
ic
at i
on g e n-erate
sa da tagra
m,I Pe xtrac
tst he
desti
nation a ddressa nds earchest hef or wardi
ngt a
blet op roduc eane xt-hop
address.IPt henp assest he data gr a
ma nd next-hop a ddresst ot he network
inter
f a
ce,whi chr ecomp utest heb indingt oaha rdwa rea ddress.Ift heforward-
ing tabl
es t or e
d ha rdwa rea ddres ses,t he b i
nding b etweent he nexthop
sI P
addressa nd ha rdwa rea ddr e
s sc oul db ep erf
or me d once,s a v
ing unneces
sary
comput ati
on.
WhydoesIPsoftwarea voidusingha r
dwa readdre
ssesinaforwa r
dingt a
ble?
Fi
g-ure8.4hel
psil
lustr
a t
e sthet woimp orta
ntr eas
ons.Firs
t,aforwa r
dingt abl
e
pr
ovidesa nespe
cial
lyc leani nterfac
eb etweenI Ps oftwar
et hatf orwards
dat
agramsandmana g
eme ntt ool
sa ndhigh-l
evelsoftwarethatmanipul
aterout es
.
Sec
ond,t he g
oalof i nternetwork-i
ng ist o hi
de the deta
il
s of unde rl
ying
net
wor k
s.Usi
ngonlyI Pa ddress
esi nforwa r
dingtable
sa l
lowsnetworkma nagers
to worka tahigherle velo fab s
trac
tion.A ma nagerc anexamineorc hange
forwar
dingr ul
esa nddebugforwa
rdi
ngprob
lemswhi
leonlyusi
ngI Paddres
ses
.
Thus,ama na g
erdoe snotne
e dtoworr
ya boutorunde
rsta
ndt heunder
ly-i
ng
hardwar
ea ddress
es.

Theonlye
xce
pti
onoc
cur
swhe
nada
tag
ramc
ont
ainsas
our
cer
out
e
opt
ion.
S
ec.8.
12For
war
dingTa
ble
sAndI
PAddr
ess
es 1
61

EXAMINATI
ONANDUPDATES DATAGRAM
OFFORWARDINGINFORMATI
ON TOBEFORWARDED

FORWARDI
NG FORWARDI
NG
TABLE ALGORI
THM

I
Paddr
ess
esus
ed
Phys
icaladdr
ess
esus
ed
DATAGRAM TOBES
ENT
PLUSADDRES
SOFNEXTHOP

Fi
gur
e8.
4Ill
ustr
ati
onofthefor
wardi
ngal
gori
thmusi
ngafor
war
ding
t
ablewhi
leent
rie
sarebe
ingex
aminedorc
hang
ed.

Thefi
gureil
lustr
atesaninteresti
ngi dea:concurrenta c
cesst of orwardi
ng
i
nfor
ma-ti
on.Dat
a g
ramf or
wa r
ding
,whi chha ppe
nsmi ll
is
e c
ond-to-mill
is
econd,can
c
onti
nuetousethef orwar
dingtabl
ewhi leama nagerexaminese ntri
esorma k
es
c
hanges
.A chang
et a
keseffectimme di
ate l
yb eca
uset hef orwar di
ngc onti
nues
c
oncurr
ent
ly(unl
essthemanagerma nual
lydisabl
esne t
wor kinterf
a ce
s).
Figure8.4a ls
oi ll
ustr
atest he addressboundar y,an importa
ntc onceptual
div
isi
on b et
we e
nl ow-leve
ls oft
wa ret hatunde rstandsha rdwareaddressesand
inte
r ne
ts oftwaretha tonlyus e
shi gh-lev
ela ddres
se s
.Ab ovetheb oundary,a l
l
softwarec anb e writtent o usei nterneta ddre
sse s
;k nowle
dge of ha r
dwa re
address
e sisr el
egatedt oaf ew s ma l
l,low- l
evelf uncti
ons thatt rans
mita
datagram.Wewi l
ls e
et hatob se
r v
ingt hea ddres
sb oundarya l
sohe l
psk eept he
impl
e mentati
onofhi gher-
levelprotocol
s,sucha sTCP,e a
syt ounderstand,test,
andmodi fy.

8.
13Ha
ndl
ingI
ncomi
ngDa
tagr
ams

S
of ar,we ha
ve dis
cuss
e dIPf or
wa r
ding b
y de s
cri
bi
ng how f
orwar
ding
dec
isi
onsarema
dea boutoutgoi
ngdatagr
ams.Its houl
db ecl
ear
,howeve
r,that
IPsoftwa
remus
tp r
ocessi
ncomingda
tagramsaswell.
Fi
rstc ons
iderhos tsoftware.Whe na nIPda tagrama rrivesa tahos t,t he
networki nterfaces oftware del
iver
st he da ta
gram t ot he IP modul ef or
proces
sing
.I ft heda ta
gramsdesti
nationaddressma tchesthehos tsI Pa ddress
(oroneoft heho s
tsad-dres
ses)
,I Psoftwareont hehos tac c
eptst heda t
agram
and passesitt othe a pp
ropri
ate higher
-leve
lp rotocolsoftwa r
ef or f urther
proces
sing
.I fthede sti
nati
onI Paddressdoesnotma tc
honeofhos tsa ddres
ses,
thehos tisr equir
edt odi sc
ardt heda tagr
am( i.e.
,hos tsa ref orbiddenf rom
at
tempti
ngt
ofor
war
dda
tag
ramst
hata
rea
cci
dent
all
yfo
rwa
rd-
edt
othewr
ong
machi
ne)
.
1
62 I
nte
rne
tPr
otoc
ol:For
war
dingI
PDa
tag
ramsChap.8

Now c onside
rr outers oftware.Unl ike a hos t,a r outer mus tp er
form
forwa r
ding.Howe ver,ar outerc ana lsor un app s(e.
g.,ne twor kma nagement
apps).Whe nanI Pda -tagra
ma r
rive
sa tar outer
,t hedatag r
ami sde li
ver
e dtothe
IPs oftware,andt woc as
esa ri
se:theda t
a gr
am ha sreachedi tsfinaldesti
nati
on
(i
.e.,itisintendedf orana ppont her outer)
,ori tmustt ravelfarther.Aswith
hosts,iftheda tagra
m de sti
nati
onI Pa ddressma tchesanyoft her outer
sownI P
addresses
,I Psoftwar epassestheda t
ag ramt ohig her
-lev
e lprotocolsoftwarefor
processi
ng.Ift hedat ag
ram hasnotr ea cheditsfinaldest
ination,IPf orwa r
dsthe
datagram us i
ng t he s ta
nda r
da l
gori
t hm a nd t he informa ti
on i nt he local
forwa r
dingtable.
Wes aidt hatahos ts houl dnotf orwa r dda tagra ms( i.
e.,ahos tmus tdi s
c a
rd
da-tagramst hata r
ei ncor rect l
yde l
iver
e d).The rea ref ourr e asonswhyahos t
shouldr e-frainf rom p erfor minga nyf or wa rding .Fi rs t,whe nahos tr eceiv
e sa
datagrami ntendedf ors ome ot herma chi ne,s ome t hing ha sg one wr ong with
int
e r
ne ta ddressi
ng ,forwa rd-ing,orde l
iver y.Thep rob lem ma ynotb er e veal
edif
thehos tt akesc orrectiv
ea ctionb yf orwa r dingt heda tag ram.S e cond,f orwa rdi
ng
wil
lc auseunne cessaryne t wor kt raffic(a ndma ys t ea lCPUt imef rom l egit
ima t
e
usesoft hehos t)
.Thi rd,s i
mp lee rrorsc a nc a usec ha os.S uppos et hathos tsa r
e
permittedt of orwa rdt ra ffic,a nd i ma g i
ne wha t ha p-p
ens i fac omput e
r
acci
denta l
lyb roadc a
s t
sada tag ramt hati sde stinedf orahos t,H.Be causei tha s
beenb roadc ast,ac opyoft heda tagram wi llb ede l
iv ere dtoe ve r
yhos tont he
networ k.Ea chhos te xamine st heda tagrama ndf or wa rdst hec opyt oH,whi ch
wil
lb eb omb a
rde dwi thma nyc opies.Four t h,a sl ate rc hapterss how,r out er
sdo
mor etha nme rel
yf orwardt ra ff
ic.Thene xtc ha p
te re xp l
ai
nst hatr out ersus ea
speci
alp rot ocolt or epor te rrors,whi lehos t sdo not( agai
n,t oa void ha vi
ng
multipl
ee r rorr eportsb omb a
r das our ce).Rout ersa lsop ropaga tei nforma ti
ont o
ensuret ha tthe i
rf orwa rdingt abl
esa rec ons istenta ndc orrec
t.I fhos tsf orward
datagrams wi thout p a
r tici
pa ti
ng f ullyi n a llr out erp r
ot ocols, une xp
ec t
ed
anoma l
iesc ana ri
se.

8.
14For
war
dingI
nThePr
ese
nceOfBr
oadc
astAndMul
ti
cas
t

De t
erminingwhe thera nI Pda ta
g ram hasr eache
di tsfinaldesti
na t
ionisnot
quitea strivi
ala sde scri
beda bove .Wes ai
dt hatwhe nada tagrama r
rives
,t he
receivingma chinemus tc ompa ret hede stinati
ona ddres
sint heda tagra
mt otheI P
addr essofe a chne twor kinte r
f ace.Ofc ourse,ifthede stinat
ionma tches
,t he
ma chinek eepst heda -tagrama ndp rocessesit.Howe ver,ama c
hinemus ta lso
handleda t
agra mst hata reb roadc ast( IPv4)ormul t
icas
t( IPv4a ndI Pv6)a c
r oss
one of t he ne twor kst o whi cht he ma chi
ne a t
taches
.I ft he ma chi
ne i s
participati
ngi nt hemul t i
castg roup ora nI Pv4da -t
agram ha sbeenb roa
dc ast
acrossal ocalne twor k,ac opy oft heda t
a gr
am mus tbep assedt ot hel oc a
l
protoc olstackf orp rocess
ing.Ar outerma ya l
sone edtof orwardac opyonone
ormor eoft heo therne t
wor ks.ForI Pv4,di r
ectedb r
oadcastintroducess ever a
l
possibil
iti
es.Ifadi r
e ct
e db roadca stisa ddress
edt oane t workN a ndt heda -
tagramarr
ivesov
ernet
workN,arouteronl
yne edstokee
pac opyf
ort hel
ocal
protoc
olstac
k.Howeve
r ,i
fadirec
tedb r
oa d
cas
tf ornetworkN a rr
ivesov
er
anotherne
twork,therout
ermus
tk ee
pac opyanda l
sobroa
dc a
stac opyov
er
networkN.

Chapt
er15de
scr
ibe
sIP
mult
ica
st.
S
ec.8.
15 S
oft
war
eRout
ersAndS
eque
nti
alLook
up 1
63

8.
15S
oft
war
eRout
ersAndS
eque
nti
alLookup

Our des
cri
pt i
on of t he forwardi
ng algorit
hm i mpli
est hatIPs earc
hesa
forwardi
ngt ab
les equenti
a l
l
y.Forl ow- endr outer
s ,sequent
ialsearc
hi sinde ed
used.Low-endr outersareof tencallds
e oftwarer outerstoe mphas
izet hatt he
routerdoesnotha vespeci
a l
-purpos
eha rdwaret oas s
istinforwardi
ng.Instead,a
softwarerouterc onsi
sts of a gene r
al-p
ur pos
ec omputer withap r
ocessor,
memor y,andne twor kinterfacecards.Allt heI Pf orwardi
ngisp erformedb y
software
.
S
of twarer oute
rsc anusesequenti
altabl
es ea
rchbe c
auset het a
blesaresmall
.
Forex ample,consi
derat ypi
calhost.Wee xpecttheforwa r
dingt abletoc onta
in
twoe ntri
esa sFigure8.3i l
l
ustrate
s.Ins uc
has i
tuati
on,seque nti
alsear
chwor ks
fi
ne.I nf a
ct,mor es op
histi
catedsearc
ht ec
hniquesonlypayof ff orlarge
rt abl
es
t heov erheado fstarti
ngas earchme a
nst hatsequenti
allook upwinsfors mall
tab
les
.
Despi
teb eingus ef
uli nsoftwarerouters,se quentia
lsearchdoe snots uf f
ice
fora l
lc ase
s .A hi gh-end routerne a
rt he c enteroft he I Pv4I nt
ernetha s
appr
oximately400, 000e ntri
esinitsforwardingt ab
le.Ins uchc ase
s,seque ntia
l
tabl
ese ar
cht a
k e
st oolong .Themos tcommonda tastruct
ur eus edforhigh- end
for
wa rdi
ngt ablesconsi
stsofat ri
e.Itisnoti mp ortanttok nowt hedetai
lsofa
tri
edat astructurea ndt helook
upa l
gorit
hm us edt os ea
rchat ri
e,butwes hould
beawar ethathi gh-endr oute
rsusemor esophist
ic at
-edme chanismsthantheone s
des
crib
e dint hi
sc hapter
.

8.
16Es
tab
lis
hingFor
war
dingTa
ble
s

Weha vediscussedtheI Pforwardi


nga l
gorit
hm a ndde sc
ribedhowf orwarding
usesat abl
e.Howe ve
r,weha venots peci
fie
dhow hos tsorr out e
r sini
ti
a l
izethe i
r
forwa rdi
ngt able
s ,norhavewede sc
r i
bedhow thec onte nt
soff orwardingtab l
es
areup d a
teda st hene t
wor kchanges
.La terchaptersdea lwiththeque sti
onsa nd
dis
cus sp r
otocolst hatal-
low routerst okeepf or
wa rdingt abl
esc onsi
stent.For
now,i ti simp ortantt ound e
rstandt hatIPs oftwa r
eus esaf or
wa rdi
ngt ab l
e
whe neveri t decideshow t of orward a da-tagr
a m.The c onsequencei st hat
chang i
ngt hev al
ue sinaf orwardingta b
lewillchanget hep athst hatda tag
ra ms
fol
low.

8.
17S
umma
ry

IPs of
twa r
ef or
wa rdsdatag
rams;t he comp utati
on consi
stsofus i
ng the
des
tinati
onI Pa ddres
sa ndf or
wardingi
nf ormati
on.Di rec
tde li
ver
yispos s
ibl
eif
thedesti
nationma chi
neliesonane tworkt owhicht hesendingmachi
nea tt
aches
.
Ifthes e
nderc annotreachthedesti
nati
ondi rec
tly,t hesendermustfor
wa rdthe
data
g r
amt oar outer.Theg enera
lp a
radigmi st ha thostssendani ndi
rectl
y
f
orwar
dedda t
ag ra
mt otheneare
str outer;theda t
agramtr
ave
lsthr
oughthe
i
nte
rnetfrom routertor
oute
runt ilthelas
tr out
era l
ongt
hepathcandel
i
ver
t
hedatag
ramdir e
ctlyt
otheul
timatedesti
nati
on.

Pronounc
ed
t
ry.
1
64 I
nte
rne
tPr
otoc
ol:For
war
dingI
PDa
tag
ramsChap.8

IPkeep
si nforma t
ionne ede
df orf orwardi
nginat a
bleknowna saf orwa r
ding
tabl
e.Whe nI Pf orwardsada t
agram,t hef orwardi
nga lgor
ithm producest heI P
addres
soft hene xtma c
hine( i
.e.
,t hea ddressoft hene xthop )towhi cht he
datag
ram shouldb es ent.I Pp asse
st he datag
r am and ne x
t-hop a ddresst o
networkinterfacesof t
wa re.Theinter -
facesoftwa r
ee ncapsul
atestheda t agram
inane twor
kf r
a me,ma pst henext-hopi nter
neta ddres
st oaha rdwa r
ea ddress
,
usesthehardwa rea ddressasthef ramede sti
nati
on,a nds endsthef ramea cr
oss
theunderl
yingha rdwarene twork.
Inte
rnetf or
wa rdi
ng only usesIPaddres
ses
;t he bi
nding be
twe ena nI P
addressand a hardwarea ddres
si snotpartoft he IPf orwar
ding functi
on.
Becauseeachforwa r
dingt abl
ee nt
ryinc
ludesana ddres
sma sk
,as ingl
euni f
ied
forwardi
nga l
gori
thm c an handl
ene t
work-s
pec
ifi
cr outes,host-s
pecif
icr out
es,
andade faul
troute.

EXERCI
SES

8.
1 Cr
eatef
orwardi
ngtab
lesfora
lltheroute
rsinFi
gur
e8.
2.Whi
chr
out
erorr
out
ers
wi
llb
ene
fitmostfr
omus i
ngadef
a ul
trout
e?
8.
2 Examine the forwardi
ng al
gori
thm us e
d on yourl oc
alop era
ting syst
em.Ar ea l
l
for
wa rdingca
se smenti
onedinthec hapterc
overed?Doest healg
or i
thm al
low e
ntri
es
tha
ta renotde scri
bedinthechapt
er ?
8.
3 Whe n doesar out
ermodi f
yt he hopl i
mit(or time-to-
liv
e)f ie
ldi n adatagr
am
header?
8.
4 Consi
derama chinewi t
ht wop hysi
calnetworkconnect
ionsa ndtwoI Paddres
sesI1
andI2.Isitposs
ibl
ef orthatma chi
net orece
iveadatagram des
tinedforI
2o verthe
networkwithaddresI
s ?Ex
1 p
lai
n.
8.
5 Inthea b
oveexerci
se,whatisthea ppropr
iat
er es
pons
eifs uc
has ituat
ionar
ise
s?
8.
6 Consi
dertwohost
s,A andB,tha
tb ot
hat
tac
htoac ommonp
hysic
alnet
wor
k,N.
Whatha ppe
nsifanot
herhoston t
henet
works
endsA adatag
ramt ha
thasIP
dest
inat
ionB?
8.
7 Modi
fyAlgor
ithm 8.
1toa
ccommoda
tet
heI
Pv4s
our
cer
out
eop
tionsdi
scus
sedi
n
Chap
ter7.

8.
8 Whenitf orwar
dsada ta
gram,ar out
erpe
rformsacomput
at i
onthattake
sti
me
pr
opor
tionaltothel
eng
tho ftheda
tagra
mheade
r.Ex
pla
int
hec omput
ati
on.
8.
9 I
ntheab
oveques
tion,canyouf
inda
nop
timi
zat
iont
hatp
erf
ormst
hec
omp
uta
tion
i
nafewmac
hinei
nstruc
tions
?
8.
10 A networkadmini
str
atorwantstomonitortr
affi
cde s
tinedforhost H,andha s
purc
hasedar outrR wi
e thmoni
tor
ingsoft
ware.Thema nageronlywantstraf
f i
c
des
tinedforHt opassthr
oughR.Expl
ai
nhow toarra
ngef orwar
dingt
os at
isf
yt he
manager.
8.
11 DoesAl
gor
ithm 8.
1al
l
owama
nag
ert
osp
eci
fyf
orwa
rdi
ngf
oramul
ti
cas
taddr
ess
?Ex
-pl
ai
n.

8.
12 Doe
sAl
gor
ithm8.
1ap
plyt
ofr
agme
ntsoronl
ytoc
omp
let
eda
tag
rams
?Ex
pla
in.
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
Chapt
erCont
ent
s
9.
1 Introduc tion,1 67
9.
2 TheI nte rnetCont r
olMe s s
ag eProtocol,1 67
9.
3 ErrorRe portingVs .ErrorCor recti
on,1 69
9.
4 ICMPMe ssageDe li
very,1 70
9.
5 Conce ptua lLaye ring,171
9.
6 ICMPMe ssageFor ma t
,1 71
9.
7 Examp leI CMPMe ss
ageTyp esUs e
dWi thI Pv4AndI Pv6,1
72
9.
8 TestingDe sti
na tionRe achabilit
yAndS t a
t us(Ping),173
9.
9 EchoRe que stAndRe p
lyMe ssageFor ma t,174
9.
10 Che c
k s
umComp ut ati
onAndTheI Pv6Ps eudo- Header,175
9.
11 Re p
or tsOfUnr eachableDe stinati
ons,1 76
9.
12 ICMPEr rorRe p ortsRe gardingFr agment ation,178
9.
13 Rout eCha ngeRe questsFr omRout ers,178
9.
14 De t
ec t
ingCi rcularOrEx cessivel
yLongRout es,180
9.
15 Re p
or ti
ngOt he rPr obl
ems ,1 81
9.
16 OlderI CMPMe ss agesUsedAtS ta
rtup,1 82
9.
17 Summa ry,1 82
9

Inter
netProtocol
:ErrorAnd
ControlMes
sages(ICMP)

9.
1Int
roduc
tion

Thep r evi
ousc ha pterdescribesIPa sab est-
e f
f ortme chani
s mt hatma kesa n
at-temptt o deliverda t
agramsb utdoe snotg uar ant
eede l
iv
e ry.Thec hapte r
showshow t heI nte rne tProtocola r
rang esf ore achr outert oforwa rdda t
a g
ra ms
towardt he i
rde stina ti
on.Ada tagramt rav
e l
st hroug ha ninternetf rom routert o
routerunt ilitre ache sar outert hatca nde livertheda t
agram directlytoitsf i
na l
desti
nation.Be ste ff ortme anst hatIPdoe snotdi s
c ardda t
agramsc ap ri
ci
ousl
y.I f
ar outer doe snot k now how t of or ward a da - tagram,c annot c ontactt he
desti
nationhos twhe nde l
iveri
ngada t agram,ort her outerde te c
tsa nunus ua l
condi
t i
on t hata ffe ctsi tsa bil
i
tyt ot r
a nsfert he da tagram ( e.g.,net-wor k
fai
lure),ther oute ri nformst heor igi
na lsour cea boutt hep roble
m.Thi schapte r
dis
cussest heme cha nismt hatr outersa ndhos tsuset oc ommuni cates uchcontr ol
ore r-rori nforma t i
on.Wewi lls eet hatr outersus et heme chanismt or epor t
probl
emsa ndhos tsus et heme chanis
mt of indne ig
hborsa ndt ot estwhe the r
desti
nationsa rer ea ch-able.

9.
2TheI
nte
rne
tCont
rolMe
ssa
gePr
otoc
ol

I
ntheconne
cti
onl
esssyste
m weha vedes
cri
bedsofar
,e achrout
erop er
ates
aut
ono-mous
ly.When a dat
agr a
ma rr
ives
,a route
rf or
wa r
dsorde l
ive
rst he
dat
agramandthengoe
sont ot hene
xtda t
agr
am;therouterdoesnotcoordi
nate
withtheori
gi
nals
ende
rofadat
agr
am.S
uchas
yst
em wor
kswe
lli
fal
lhos
tsa
nd
route
rshav
eb e
enconf
igur
ed

1
67
1
68 I
nte
rne
tPr
otoc
ol:Er
rorAndCont
rolMe
ssa
ges(
ICMP) Chap.9

correctlyb e c
a us et heya gr eeonr out e
st oe achde s
t i
nati
on.Unf ortuna te
ly,no
l
a rgec ommuni cation system wor ksc orr ec
t l
ya l
lt het i
me.Be s
ide sf ail
uresof
networ ka ndp roc essorha rdwa re,I Pc annotde l
iverada tagrami ft hede sti
na tion
ma chi
nei st em- p orari
lyorp erma ne nt l
ydi sconne ctedf rom t hene twor k,ift he
hopl i
mi tex piresb eforeada tagra mr eac hesitsde sti
na ti
on,ori fa ni nterme diate
rout e
rb ecome ss oov e r
loade dt hati tmus td i
sc a
rdada ta
g ram.Thei mpor tant
differenceb et we en ha vi
ng a s ingle ne twor ki mp l
eme nted wi th homog ene ous,
dedicated ha rd wa rea nd a ni nte rne ti mpleme nted wi th mul tipl
e ,i ndepende nt
systemsi st ha ti nt hef or mer,t hede s
ignerc ana rrangef ort heunde rlying
hardwa ret oi nf orma ttac
he dhos tswhe np r
oblemsa ri
se.Ina nint ernet,whi ch
hasnos uchha rdwa reme cha ni
sm,as ende rc annott ellwhe therade l
iveryf ailure
resultedf r om a ma lfunction oft he l ocalne t work ora f ai
lure ofa s yste m
some wherea longt hep atht oade st i
nat i
on.De buggingi ns ucha ne nvir
onme nt
become se xt r
e me l
ydi ffi
cult.TheI Pp rot ocolitselfcont ai
nsnot hingt ohe l
pt he
sendert e
stc onne ctiv
ity orl ea rna b outf ai
lures.Al thoughwes aidt hatI Pi s
unre l
iabl
e,wewa ntouri nt ernett ode tecta ndr e
cov erfr om e rrorswhe ne ver
possibl
e.The r
e for e,a naddit i
onalme c hanismi sne eded.

To al
low routersina ni nternettor e
porte rror
sorp rov
ideinfor
ma t
ion
ab
out une x
-pected c i
rcumstances,the de s
igners a dde
d a s pe
cia
l-pur
pose
mechanis
mt ot he TCP/IPp rotoc
ols
.Known a st he InternetControlMessage
Protoc
ol(ICMP),t heme chani
smi scons
ide
redar equire
dp artofI Pandmustb e
i
ncludedinever
yI Pi mpl
eme ntati
on.
ICMPi sp ri
mari
lyi nt endedt oinform as ourcewhe nada tagr a
ms entb yt he
sourcee xperi
encesp rob le
ms .Howe ver,t he ulti
mate destination of a nI CMP
me s
sageisnota na pp l
icationp rogramr unningont hes ourcec omputerort he
userwhol a
unchedt hea ppli
-ca
tion.I nst
ead,I CMPme s
sagesa res enttoI nterne t
Protocolsoftwareont hes ourcec omp ut
er.Tha tis,whena nI CMPe r
rorme s
sag e
arri
vesonac omputer,t heI CMPs oftwaremo dul
eont hec omp uterha ndl
est he
me s
sage.Ofc o
urse,I CMPma yt akef urthera cti
oninr esponset othei ncoming
me s
sage.Fore xampl
e ,I CMPmi ghti nforma na ppli
cat
ionorahi ghe r
-leve
lp r
ot ocol
abouta nincomingme ssa g
e.Wec ans umma r-i
ze :

TheI nternetCont rolMessagePr otoc


olall
owsr outerst os end
errororc ontrolmessagesbackt othesourc
eofadat agram t hat
causedapr obl
em.I CMPmes sagesarenotus ual
lydel i
veredt o
appli
cat
ions. We t hink of ICMP as pr ovi
ding c ommunic ation
betweenanI CMPmodul eononemac hi
neandanI CMPmodul eon
another.

ICMPwa sini
ti
a l
l
yde si
gnedtoal
l
ow routerst orepor
tt hec auseofde l
iv
ery
e
rrorsto hos
ts,b utICMP i snotres
tric
tede xcl
usi
velyt or outers
.Al t
hough
g
uidel
ine
sspeci
fyt hatsomeI CMPmessa
gesshouldonlyb es e
ntb yr outers,an
a
rbit
rarymachi
nec ansenda nICMPmessagetoa nyotherma chine.Thus ,ahost
c
anus eICMPtoc orres
pondwi t
harouterora notherhost.Thec hiefa dvant
age
ofall
owi
nghostst
ous eI
CMPisthati
tpr
ovi
desas
ing
leme
cha
nis
m us
edf
ora
ll
cont
rola
ndinf
ormati
onmes-
sag
es.

Whe
nre
fer
ring s
pec
ifi
cal
l
ytot
he v
ers
ion ofI
CMP t
hata
ccomp
ani
esI
Pv4,we wi
l
lwr
ite
I
CMPv
4,andwhenr
efe
rri
ngt
othev
ers
iont
hata
ccomp
ani
esI
Pv6,wewi
l
lwr
iteI
CMPv
6.
S
ec.9.
3 Er
rorRe
por
tingVs
.Er
rorCor
rec
tio
n 1
69

9.
3Er
rorRe
por
tingVs
.Er
rorCor
rec
tion

Technical
ly,I CMPi sa ne rrorr eport i
ngmec hani
sm.I tp r
ovidesawa yfor
routerst hate ncountera ne rrort or eportt hee rrort ot heorigi
nalsourc e,but
ICMPd oesnoti n-teractwi tht hehos tnordoe sI CMPa tte
mp tt ocorre ctthe
error.Thei de aofr eport
ingp r
oblemsr athert hanwor ki
ngt oc orrec
tp r obl
ems
ari
sesf rom thef undament a
lde sig
np ri
nciplediscussede arl
ier:routersaret obe
ass t
ate l
essa sp ossi
ble
.Wenot et hatt hei deaofe rrorr eporti
ngr athert han
errorcor rec
tionhe lpsimproves ecur i
ty.Ifar oute rtri
e dt oma i
ntai
ns tatewhe n
ane rroroc cur red,a na ttackerc oulds imp l
yf l
ood t her outerwi thinc orre
ct
packetsa nd e i
the rnotr es
pond orr e
sp ond verys l
owly whe nt her oute rat-
temptedt ocor r
ec tthep robl
e m.S ucha na t
tackc oulde xhaustrouterr esources.
Thus,thei deaofonl yreportinge rrorscanp reventc ertainsecuri
tya ttac
ks .
Alt
houg ht he protocolspe
cif
ication outl
i
nesintended usesof ICMP and
s
uggest
sp oss
ibl
ea ct
ionstot a
keinr esponsetoerr
orr e
ports
,I CMPdoesnotfull
y
s
peci
fyt he a c
- t
ion tob etakenf or e ac
hp os
sib
lee rr
or.Thus ,hostshave
f
lex
ibi
li
tyi nhowt heyre l
ateerr
orr e
p ortstoappl
i
cati
ons.Inshort:

When adat agr


am causesan error
,I CMP c an onlyreportthe
errorc onditi
onbackt otheorigi
nalsourceoft hedatagram;the
sourcemus trel
atetheer r
ortoani ndiv
idualappli
cati
onprogr
am
ort akeot heracti
ontoc orr
ecttheproblem.

Moste rrorsstemf rom t heor i


gina
ls ource ,buts omedonot .Bec auseICMP
re-p
ortsp roble
ms t ot he or iginals ource,i tc annot be use dt oi nform
i
ntermediater oute
r saboutp r oble
ms .Fore x a
mp l
e,s up p
oseada tagr
amf ol
lowsa
paththroug has equenceofr outers,R1,R2,. .,Rk.I
. fRk hasincorr
e ctrout i
ng
i
nformationa ndmi stakenlyf orwa rdstheda t
a gramt or outrRE,RE c
e annotus e
ICMPt or eportthee rr
orb a ckt or outrRk;I
e CMPc anonl ysendar eportb ac
kt o
theorigi
na lsource.Unfor tuna t
e l
y,t heor i
g i
na lsour ceha snor e
sponsibi
li
tyf or
theprobl
e ma ndc annotc ontrolt hemi sbehavi
ngr oute r.Infact,thes ourcema y
notbea bletode te
r mi
newhi chr outerca usedt hep roblem.
Whyr est
rictICMPt oc ommuni cat
ionwi tht heor iginalsource?Thea ns wer
shouldbec learfrom ourdi s
cus si
onofda t
a gr
amf orma tsa ndf orwa r
dingi nt he
previ
ousc hapters
.Ada ta
g r
a m onlyc ontainsf i
el
dst hats p ec
ifytheor i
gina
ls our c
e
andt heul t
i-matede sti
nation;i tdoe snotc ontainac omp let
er ecordofi tst ri
p
throught heinternet( exce
p tf orunus ua lcaseswhe nt her ecordr outeop tioni s
used).Furthermor e,becauser outer scane stabli
sha ndc hanget hei
rownr outing
table
s,the r
ei snog l
obalknowl edgeofr outes.Thus ,whe nada tagramr eachesa
givenrout er
,i tisi mpossi
blet ok now t hep athi tha st a
kent oa rri
ve.I ft he
routerde te
ctsap r
oblem,I Pca nnotk nowt hese tofi n-te r
me di
atema chi
nest hat
process
edt heda tagram,s oi tc annoti nformt hem oft hep rob-lem.I nsteadof
sil
entl
ydi scar
dingt heda tagram,t her out erus esI CMPt oinformt heor iginal
sourcet hatap roblem hasoc c urred,a ndt rus t
st ha thos ta dministratorswi ll
c
oop
era
tewi
thne
twor
kadmi
nis
tra
tor
stol
oca
tea
ndr
epa
irt
hep
rob
lem.
1
70 I
nte
rne
tPr
otoc
ol:Er
rorAndCont
rolMe
ssa
ges(
ICMP) Chap.9

9.
4ICMPMe
ssa
geDe
li
ver
y

Thede si
g nersofI CMPt ookanov elapproa
chtoe rrorr e
porti
ng :instea
dofus ing
al owe r-levelcommuni cat
ionss yst
emt ohandl
ee rrors,theyc hoset ouseI Pt o
carr yICMPme ssages.Thati s
,likeallothertr
affic
,I CMPme ssag
e strave
la c
ross
the i nter-neti nt he payloada r
ea of IP datagrams.The c hoicer efl
ectsa n
imp ortanta ssumption:e r
r orsarer a
r e
.I npart
icul
a r
,wea ssumet ha
tda tagr
a m
forwa rding wi l
lr ema i
ni ntac
ta t mostt i
mes( i.e.
,e r
ror me ssages wi
llb e
delivered).Inp r
actice,thea ssumpti
onha sturnedoutt ob ev al
id e rror
sa re
inde e
dr ar e
.
Beca
useeachICMP messa
get r
avel
sina nIP da
tagra
m,t
wo l
eve
ls of
e
nca
p s
ulati
ona
rere
qui
red.Fi
gure9.
1il
lus
tra
test
hec
oncept
.

I
CMP
I
CMPPAYLOAD
HEADER

DATAGRAM
DATAGRAM PAYLOADAREA
HEADER

FRAME
FRAMEPAYLOADAREA
HEADER

Fi
gur
e9.
1Thetwole
vel
sofenc
aps
ula
tionus
edwhe
nanI
CMPme
ssa
gei
s
s
entac
ros
sanetwor
k.

Ast hef i
gures hows,e achI CMPme s
saget rave
lsa crossani nt e
rnetint he
payloadp ort
ion ofa nI P datagra
m,whi c hitsel
ft ravel
sa crossa n underlyi
ng
networ ki nthep a y-l
oadp orti
onofaf r
a me.Althoughb othI Pv4a ndI Pv6us ea
datag ra
mt oc a
rrya nICMPme ssag
e ,thede tail
sdiffer
.I Pv4us est hePROTOCOL
fie
ldi nt heda ta
gr am headerasat ypefield.Whe nanI CMPme ssagei scar
riedin
thep a
yloada reaofa nIPv4da tagram,t hePROTOCOLf ieldissett o1 .IPv6us e
s
theNEXTHEADER f iel
dt os peci
fyt het ypeoft heitemb e
ingc arrie
d.Whe na n
ICMP me ssageisc a
rrie
di nt hep a yl
oada r
eaofa nI Pv6da t
agra m,t he NEXT
HEADERf i
el
doft hehe a
de rthatisp re
vi-oust otheICMPme s
sagec ontai
ns58.
Int erms of proc
essi
ng, a da t
ag r
am t ha
tc a
rr i
esa nI CMP me s
sagei s
forwardedex-actl
yli
keada ta
gr a
mt hatc arrie
sinforma t
ionf orusers;thereisno
addit
ionalrel
ia
b i
l
ityorp ri
ori
ty.Thus ,e rrorme ssagest hemsel
v e
sma yb elost,
dupli
cate
d,ordi s
car
ded.Fur thermore,ina na lr
eady c onges
te d net
wor k,t he
errorme ssa
ge ma yincr
easec onges-
tion.An e xc
eption isma de t ot he error
handli
ngp r
oceduresi
fanI Pdat a
gramc arryinganI CMPme s
sagecausesa nerror.
Thee x
cepti
on,est
abl
ishedtoavoi
dtheprobl
em ofhav
ingerr
ormess
agesab
out
err
orme ss
ages
,speci
fi
e stha
tICMPmessag
esarenotgen-e
rat
edforerr
orstha
t
res
ultfromdatag
ramsc ar
ryi
ngICMPerr
orme s
sage
s.
S
ec.9.
5 Conc
ept
ualLa
yer
ing 1
71

9.
5Conc
ept
ualLa
yer
ing

Usual
ly,enca
psulat
ionandlayer
inggoha nd-i
n-hand.Forexampl
e,consi
derI P
andEther
ne t
.Whe nitt r
ave
lsacros
sanEt herne
t,a nIPda t
agramisencaps
ulat
e d
i
na nEthernetframe.Theencapsul
ati
onfoll
owst helayeri
ngschemeprese
ntedi n
Chapt
er4b e
caus
eI PisaLa ye
r3p rotoc
olandEt hernetisaLayer2t ec
hnology.
The Ethernettyp ef i
elda l
l
ows a v ari
ety of hi ghe
r-l
aye
rp ac
ketst ob e
enc
apsul
atedinEthernetfra
me swit
hnoa mb i
guit
y.
ICMP r epres
entsa ni mpor ta
nte xce
p t
ion.Al thoug he achI CMP me s
s a
g eis
encap -s ula
tedi nanI Pda ta
gr am,I CMPi snotc ons ide
r edahi gher-l
evelprotocol
.
Instea d,I CMPi sar equir
edp a r
tofI P,whi chme ansI CMPi sclassi
fi
eda saLa yer
3p rot ocol.Wec ant hi
nkoft hee ncapsul
a t
ion a sus ingt hee xi
sti
ngI P-based
forwa r ding scheme rathert hanc reating a p a
r a
llelf orwardi
ng me chani
smf or
ICMPme ssag
es.ICMPmus tse nde rrorr eportstot heor ig
inalsource,soanI CMP
me ssage mus tt rav
ela crossmul ti-ple unde rl
ying ne twor k
st or eac
hi tsf i
nal
de s
tina tion.Thus ,ICMPme ssagesc a nnotb ede l
i
v eredb yaLa yer2 transport
alone.

9.
6ICMPMe
ssa
geFor
mat

Thes t
anda
r dsdef
inetwosetsofICMPmessage
s:asetf orIPv4andalarg
er
setforIPv6.Inb othversi
onsofIP,eachICMPme ss
a g
eha sit sownformat.
However,allICMP me ss
agesbegi
n withthe same threef i
elds.Fi
gur
e 9.2
i
ll
ust
r a
testhegenera
lfor-matofanICMPmessag
e.

8bi
ts 8bi
ts 1
6bi
ts
TYPE CODE CHECKS
UM

MES
SAGEBODY
...

Fi
gur
e9.
2Thef
irs
tthr
eef
iel
dsi
nea
chI
CMPme
ssa
ge.

Asthef igures hows,a nICMPme ss


ageb eg
inswi than8- bi
tintegerI
CMP
message TYPE fie
ld.The TYPE f i
el
didenti
fi
e sthes pec
ifi
cI CMP mess
agethat
fol
lows.Be -c
auset hef ormatofame ss
agei sdefine
db yt heme s
sagetyp
e,a
rec
e i
verusest hevalueint heTYPEfie
ldtok now how toparsetheremai
nderof
theme s
sage.
An8- btCODEf
i ie
ldinanI CMPme s
sageprovi
desfurt
herinformat
ionab
out
t
heme s
sagetype.Forexampl
e,anICMPTI MEEXCEEDEDmes s
agec anhaveac
ode
v
aluetoindi
catethatthehopcount(TTL)oftheda t
agra
mr eachedzeroortha
t
r
eass
em-blytimedoutbefor
ea l
lfra
gmentsarr
ived.
1
72 I
nte
rne
tPr
otoc
ol:Er
rorAndCont
rolMe
ssa
ges(
ICMP) Chap.9

Thethirdf
iel
dine a
chICMPmessa
gecons
ist
sofa16-btCHECKS
i UM tha
ti s
comput
edovertheent
ireICMPme
ssa
ge.ICMPusest
hes
a me16-
bitone
scomple
-
mentchec
ksumasIP.
Themessag
eb odyinanI CMPme s
sagedep
endsent
ire
lyont heICMPt yp
e.
How- e
ver
,f orICMPme ss
agest hatr
eportane r
ror,t
heme ss
agebodya l
ways
i
nc l
udestheheaderplusaddi
tiona
locte
tsfrom theda
tagra
mt hatcaus
edt he
probl
em.
Ther eas
onI CMPr e
turnsmorethant hedatagr
a m headeraloneistoa l
low
t
her e
- c
eiv
ert odeter
minemoreprec
isel
ywhi c
hp rot
ocol(s
)a ndwhi c
happl
icat
ion
p
rogram werer esp
onsi
bl
ef orthedatagra
m.Aswewi llseel at
e r
,highe
r-leve
l
p
rotocol
sint heTCP/IPsuit
earedes
ignedsot ha
tc ruci
alinformati
onisencoded
i
nthef i
rstfewoc t
etsbeyondt
heIPhe a
der.

9.
7Ex
amp
leI
CMPMe
ssa
geTyp
esUs
edWi
thI
Pv4AndI
Pv6

Fi
gur
e9.3l
istsex
amp
leICMPme ss
agetype
susedwi
thIPv4.Late
rs e
cti
ons
de
scr
ibet
hemea
ningsi
nmoredet
aila
ndg i
veex
ampl
esofmes
sag
ef or
ma t
s.

Type Me a
ning Type Meaning
0 EchoRe ply 17 AddressMa skRe quest
3 Desti
nationUnr eac
ha b
le 18 AddressMa skRe ply
4 SourceQue nc h 30 Traceroute
5 Redirec
t( changear oute
) 31 Datagram Conver si
onEr ror
6 Alter
nateHos tAddre s
s 32 MobileHos tRedirect
8 EchoRe ques t 33 Whe re-Are-You( forIPv 6)
9 RouterAdv e rti
sement 34 I-Am-He re(forI Pv6)
10 RouterDi scovery 35 Mobil
eRe gistra
tionRe que s
t
11 TimeExc eede d 36 MobileRe gi
strati
onRe ply
12 ParameterPr obl
em 37 Doma i
nNa meRe que s
t
13 TimestampRe quest 38 Doma i
nNa meRe ply
14 TimestampRe pl
y 39 SKIP( Si
mp l
eKe yMgmt )
15 InformationRe que s
t 40 Photuris
16 InformationRe ply 41 ExperimentalMob ili
ty

Fi
gur
e9.
3ExampleI
CMPv 4 mes
sag
et ype
sand the me
ani
ng o
fea
ch.
Va
lue
snotli
ste
da r
eunassi
gnedorr
ese
rv e
d.

Asthef i
g ureshows,ma nyoft heor i
ginalICMPme ss
ageswe rede s
ignedto
c
arryinfor
ma t i
on rat
he rtha nerr orme ss
a ges(e.
g.,a hostus e
st yp e17t o
r
eques
tt hea ddres
sma skb einguse donane t
worka ndar oute
rr espondswith
t
ype18t ore portthea ddressmask ).IPv6di sti
ngui
shesbetwee
ne rrorme s
sag
es
a
ndinformati
o nalmessagesbydi-vidingt het ypeval
uesintotwos ets
:t ypesles
s
t
han128a reus edfore rrorme ss
ag es,andt ype
sb e
tween128a nd255a reused
f
orinfor
mationme ssage.Fig
ur e9.4l is
tse x
-

I
CMPonl
yre
tur
nsp
artoft
heda
tag
ramt
hatc
aus
edt
hep
rob
lemt
oav
oidha
vingI
CMPme
ssa
ges
f
rag
-me nt
ed.
BothTCPa
ndUDPs
tor
epr
otoc
olp
ortnumb
ersi
nthef
irs
t32b
its
.
S
ec.9.
7 Ex
amp
leI
CMPMe
ssa
geTyp
esUs
edWi
thI
Pv4AndI
Pv6 1
73

a
mp l
eICMPmess
agetypesuse
dwi thIPv
6a ndshowst ha
ta l
thoug
honlyf our
e
rrormes
sag
esha
vebe
e ndef
ined,I
Pv6def
ine
smanyi nf
ormati
onalmess
age
s.

Type Me aning Type Meaning


1De stinati
onUnr eac
hable 138 RouterRenumb e
r i
ng
2 PacketTooBi g 139 ICMPNodeI nfo.Que ry
3 Ti
meExc eeded 140 ICMPNodeI nfo.Re s
ponse
4 Parame te
rPr ob l
em 141 Inve
rseNe ighborSoli
citati
on
1
28 Ec hoRe que s
t 1
42 I nve
rseNe ighborAdv e
r ti
se.
1
29 Ec hoRe ply 143 Multi
cas
tLi s
tenerRe ports
1
30 Mul ticas
tLi stenerQue ry 1
44 HomeAge ntRe quest
131Mul ticas
tLi stenerRe p
ort 145 HomeAge ntRe ply
1
32 Mul ticas
tLi stenerDone 146 Mobil
ePre fixSoli
cita
tion
133 Route rSoli
citati
on( NDP) 147 Mobil
ePre fixAdvertis
e ment
1
34 Rout e rAdv e
rtise.(NDP) 148 Certi
fi
cationPa thSoli
citati
on
135 NeighborS ol
ici
t a
tion(NDP) 149 Certi
fi
cationPa thAdv erti
se.
1
36 Ne ighborAdv ertis
e.(NDP) 151 Multi
cas
tRout erAdv erti
se.
137 RedirectMe ssage

Fi
gur
e9.
4Ex
amp
leI
CMPv
6me
ssa
get
ype
sandt
heme
ani
ngofe
ach.

Ast hef i
gureshows,I Pv6i ncorporat
est hreemajorsub s
yste
msi ntoICMP:
the Ne i
ghbor Dis
covery Protocolment i
onedi n Cha
pt e
r 6,Mul ti
cas
ts upport
descri
bedinCha pter15,andI Pmob il
ityde sc
rib
edinCha pter18.ICMPme s
sages
haveb ee
nde -fi
nedf oreacho fthes ubsystems.Forexa
mp le
,whe nus i
ngNe i
ghbor
Disc
overy,a nIPv6nodec anb roadcastaNe i
ghborSol
ic
itati
onMes sage(type135)
todi s
coverdirectl
y-rea
chab l
ene i
ghborsoraRout erSolic
itati
onMes sage(type
133)todi s
coverdi
rectl
y-reachabl
er out e
rs.

9.
8Te
sti
ngDe
sti
nat
ionRe
acha
bil
it
yAndS
tat
us(
Ping
)

Thep i
ngpr ogramisp e
rhapsthemos twidelyusedinterne tdi
a gnosti
ctool.
Ori-gi
nal
lyc r
e a
tedf orIPv4,pingha sb e
ene xtendedtoa ccommoda teIPv6.I n
eithe
rc ase,pingsendsa nICMPEc hoRequestmessagetoar emot ec omp ute
r.Any
computert hatrecei
vesa nICMPEc hoRe ques
tc reatesanI CMPEc hoRepl yand
returnst her epl
yt otheor i
gi
nalsender.Thus,thep i
ngp r
og ramr eceivesant he
EchoRe plyf rom there-motema chi
ne.Ther equestme s
sag
ec ontai
nsa nop ti
onal
secti
onf orda ta,andt herepl
yc onta
insac op
yoft hedatat hatwa ssentint he
request.
How canas i
mpleme s
sagee x
changehelpdiagnoseint
ernetpr
oblems?Whe n
sendi
nga nechoreques
t,aus ermus tspec
ifyade sti
nat
ion.Thestr
aightforward
answeristhatanechoreques
ta ndassoc
iat
edr ep
lyc a
nb eusedtotes
twhe t
hera
desti
nat
ionisreac
habl
ea ndresp
onding.Becaus
eb oththereques
tandre p
lyt ra
vel
i
nIPda
tag
rams
,

DaveMil
l
sonc
esug
ges
tedt
hatPI
NGi
sana
cronymf
orPa
cketI
nter
Net
Groper
.
1
74 I
nte
rne
tPr
otoc
ol:Er
rorAndCont
rolMe
ssa
ges(
ICMP) Chap.9

recei
v i
ngar epl
yf rom ar emot ema c
hinev erifi
est hatma jorp i
e c
esoft heI P
transports yst
em a re working c orrec
tly.Fi rst,IPs oft war
e on t he sour ce
comp utermus tha vea nentryini tsforwa r
dingt abl
ef ort hede sti
na t
ion.S ec ond,
thes ourc ecomputerha screat-edac orrectda tagra
m.Thi r d,thes our cewa sa b l
e
tor e a
c h ar outer,whi ch me ansARP ( IPv4)orNe ighb
orDi scovery( I
Pv 6)i s
wor ki
ng .Third,intermedi
ater outersbetwe ent hesourcea ndde stinationmus tb e
operating,a ndmus tf or
wardda t a
g r
amsc orrec t
lyinb othdi rec
tionsb etweent he
sourcea ndde sti
nati
on.Finall
y,t hede sti
nation machinemus tb er unning,t he
devic
edr ive
rmus tb eabletor ecei
vea nds endp ackets,a ndb othI CMPa ndI P
softwar emodul esmustb ewor ki
ng.
Sev
er alversi
onsofp i
nge xi
st.Mos tinc l
udeop t i
onst hata l
low aus ert o
speci
fywhe thertosendar equestandwa i
tf orar eply,sends e
veralreque stsand
then waitf orar e
ply,ors endr equestsp eri
odical
ly( e
.g.,e ve
rys e
c ond)a nd
disp
layallre p
li
es.Ifp i
ngs endsas e r
iesofr e
que st
s,i tdis
p l
aysst a
tis
t ic
sa bout
me s
sageloss.Thea dvantageofs endingac ontinuouss eri
esofr equestsa ris
es
from ana bil
ityto discoveri nter
mit t
ent p rob
lems.For e xample,c onsidera
wirel
essne tworkwhe ree l
ectrica
linterferencec auseslossb utthei nte r
fe r
ence
occursrandomly(e.g.
,whe nap ri
nterstarts).
Mostve r
sionsofpinga lsoa l
l
ow aus e
rt ospec
ifytheamountofdatabei
ng
se
nt ine achr e
ques
t.S ending a larg
ep i
ng packe
ti s use
fulfor te
sti
ng
fra
gme ntat
iona ndreassembly.La rg
ep acke
tsa l
soforc
eI Pv
6t oenga
geinp a
th
MTUdis c
overy.Thus,as e
e minglytri
via
lappli
cat
ionhassev
eralus
es.

9.
9Ec
hoRe
que
stAndRe
plyMe
ssa
geFor
mat

Bot
hIPv4a ndIPv
6useasi
ngl
eforma
tforallICMPEchoRe
que
sta
ndEc
ho
Re
-pl
yme s
sag
es.Fig
ure9.
5il
l
ust
rat
esthemes
sag
ef orma
t.

0 8 1
6 31
TYPE CODE(
0) CHECKS
UM
I
DENTI
FIER S
EQUENCENUMBER
OPTI
ONALDATA
...

Fi
gur
e9.
5ICMPe
chor
eque
storr
epl
yme
ssa
gef
orma
t.

Alt
hought hes
ameme ss
ageformatisusedforechorequestsandr
eplie
s,the
val
ueoft heTYPEdif
fers
.ForIPv4,theTYPEi s8inar eques
ta nd0inar epl
y.
ForI Pv
6,t heTYPEis128inar eque
sta nd129inar ep
ly.Fora nyval
uei nthe
TYPEf i
eld,theCODEiszero(i
.e.
,e c
hor eque
stsandrepl
iesdonotuset hecode
fi
eld)
.
Fi
edsI
l DENTI
FIERandSEQUENCENUMBERar
eus
edb
ythes
ende
rtoma
tch
re
pli
estoreque
sts
.Ar e
cei
vi
ngICMPdoesnoti
nter
pretthetwofi
el
ds,butdoe
s
re
turnthesameval
uesi
nthere
p l
ytha
twe r
efoundinthere
ques
t.Ther
efor
e,a
machi
netha
t
S
ec.9.
9 Ec
hoRe
que
stAndRe
plyMe
ssa
geFor
mat 1
75

s
endsa r e
que stcansett he IDENTIFIER fi
el
dt oav al
ue thatidenti
fi
esa n
a
ppli
cati
on,a nd c
an uset he S EQUENCE NUMBER fiel
dt o numbers ucce
ssi
ve
r
equestssentb ythea ppl
ica
tion.Fore x
ample
,t he I
DENTIFIER mightbet he
p
rocessID oft hesendi
nga p-plic
ati
on,whicha l
lowsICMP soft
wa r
et oma t
ch
i
ncomingrepl
i
e swi
ththea p
p l
i
cationthatsentar e
quest
.
Thef i
eldlabel
edOPTI ONALDATAi sav a
riab
leleng
thf ie
ldthatc ontai
nsda ta
tob ereturnedt othes ender.Ane chorep
lyalwaysret
urnse xac
tlyt hes ameda ta
aswa sreceivedint her equest .Al
thoug
ha rbi
trarydatacanb esent,t ypi
calping
programsst oreseque nt
ialva luesinoctetsoft hedataa r
ea,ma kingi teasyt o
verif
yt hatt heda tar e-tur nedise xa
ctlythes amea stheda tas e ntwi thout
needingtos torecopiesofp a ckets
.Asme nti
oneda b
ove,thev a
riabl
es i
zea l
lowsa
ma nage
rt ot es
tf r
ag mentation.

9.
10Che
cks
um Comp
uta
tionAndTheI
Pv6Ps
eudo-
Hea
der

BothI Pv4a ndI Pv6us etheCHECKS UM f i


el
dina nI CMPme s
sage,andb othr e
-quireas endert oc omp utea1 6-bi
tone
sc omple
me ntc hecksum oft hec omplete
me s
-sage.Fur t
he rmore,b othversi
onsrequirear ecei
vert ov ali
dat ethechecksum
and to dis-cardI CMP me ss
agest hatha vea ninv a
li
dc hecksum.Howe v er,t he
detai
lsoft he c heck-
sum c omp ut
a t
ion dif
ferb ecauseI Pv6a ddsa na ddit
ional
require
me nt:t hec hecksum usedwi thIPv 6a l
soc over
sf i
el
dsf rom theI Pb ase
header.Conc eptuall
y,t hede si
gnatedhe aderfiel
dsa rea rrangedi ntoap s
eudo-
headerasFi gure9. 6il
lustrat
es.

0 4 1
2 1
6 24 31

S
OURCEADDRES
S

DES
TINATI
ONADDRES
S

I
CMPv
6LENGTH
UNUS
ED(
MUS
TBEZERO) NEXTHEADER

Fi
gur
e9.
6TheIPv6ps
eudo-
hea
derus
edf
ort
hec
hec
ksumc
omp
uta
tion
wi
thICMPv
6.
1
76 I
nte
rne
tPr
otoc
ol:Er
rorAndCont
rolMe
ssa
ges(
ICMP) Chap.9

Thetermp seudo-headerandt heus eofda shedl i


nesi nt hefigureindi
cate
t
hatt he ar r
ang ement of e xtraf i
elds i
s me rel
y us edf or the check
sum
c
omputati
ona ndi sne verp l
ace
di nap acket
.Wec ani magine,f ore x
ample,that
t
hechecks
um c odec reatesap s
eudo-hea
derinme moryb yc opyingfiel
dsfrom the
b
aseheader
,a ppendsac op yoft heICMPme ssa
get ot hep s
e udo-hea
de r,a
ndt hen
c
omputesac hecksuma crossboththepseudo-headerandt heme ss
age.
Whydi dI Pv6incl
udeap seudo- hea
deri nthec hecksum?Thede si
gnersofIPv6
werec ons c
iousofp os
sib
les e
c uri
ty we aknesses
,a nd wa ntedtoi nsurethata
comp ut
erwoul dnotmi s
takenl
yp rocessanI CMPme ssagethatwa snoti nt
ended
fort hec omputer.Incl
udingap s
eudo- he
a derint hec heck
sum addsa naddi
tiona
l
veri
ficat
iont hattheme s-sa
gewa sde li
veredp r
operly.Thep se
udo-headerdoesnot
guaranteec orrec
tness i fstronge rsecurit
yi sne eded,theda t
agram mus tbe
encrypted.

9.
11Re
por
tsOfUnr
eac
hab
leDe
sti
nat
ions

Al
t hough IP i mpl
eme ntsa b es
t-effor
t de l
ive
ry me c hani
sm, discardi
ng
dat
a gr
a mss houl
dnotb et a
k e
nl i
ght
ly.Whe neverane r
rorp r
e ventsar out
e rfrom
for
wa rding or deli
veri
ng a datagram,t he routersendsa nI CMP de s
t i
nati
on
unreachable messa
g ebackt ot he sourcea nd then drops (i.
e.,discards)t he
dat
a gr
a m.Ne tworkunr ea
chableerrorsimplyforwardi
ngf ai
lur e
sa tintermediate
poi
nts;hos tunreachab
leerrorsimpl
yde li
veryfail
uresacr
osst hef i
nalhop.
BothIPv4a nd I
Pv6 usethe s
ame f
orma
tfor de
sti
nat
ion unr
eac
hab
le
me
ssage
s.Fi
gure9.7i
ll
ust
rate
sthefor
mat
.

0 8 1
6 31
TYPE CODE CHECKS
UM
UNUS
ED(
MUS
TBEZERO)
PREFI
XOFDATAGRAM THATCAUSEDTHEPROBLEM
...

Fi
gur
e9.
7ICMPde
sti
nat
ionunr
eac
hab
leme
ssa
gef
orma
t.

Al
thoug
ht hey usethe s
a me me s
sagef ormat,t he wayI Pv4a nd IPv6
i
nterpretfi
el
dsinthemess
agediffe
rss l
i
ghtl
y.I Pv4setstheTYPEt o3,a ndIPv6
set
st heTYPEt o1.Aswit
hEc hoRe ques
ta ndRe pl
yme ssa
ges,IPv4comp ute
sa
CHECKSUM ove
rt heICMPmess
a geonlyandI Pv6incl
udesap s
eudo-hea
deri nthe
chec
k s
um.
TheCODEfi
eldc
onta
insanint
ege
rt hatf
urtherde
scr
ibe
stheprob
lem;c
ode
s
f
orI
Pv4andIPv
6dif
fer
.Figur
e9.8li
ststhemea
ningofCODEval
ues
.
Inpracti
ce,itisposs
ibl
etocomp ut
eac hecks
umov e
rt heps
eudo-
hea
derf
iel
dswithoutcop
ying
the
m.TheI ETFrecommendsonlyreport
inghostunrea
chab
lemess
age
stotheori
gi
na ls
ource,
andusingrout-
i
ngp
rotoc
olstoha ndl
eotherforwar
dingp r
obl
e ms
.
S
ec.9.
11Re
por
tsOfUnr
eac
hab
leDe
sti
nat
ions 1
77

I
Pv4i
nte
rpr
eta
tion

Code Me a
ning Code Me aning
0 Networ kunr eac
hab l
e 8 Sourcehostisolat
e d
1 Hostunr eachabl
e 9 Comm.wi thne tp rohib
ited
2 Protocolunr e
achable 1
0 Comm.wi thhos tp rohi
bit
ed
3 Portunr eachabl
e 11 Netunreacha b
leforTOS
4 Fragme ntati
onne eded 1
2 Hostunreachablef orTOS
5 Sourcer outefail
ed 13 Communicationp rohibi
ted
6 Dest.ne tunknown 1
4 Hostprece
de ncev i
olati
on
7 Dest.hos tunknown 15 Prece
dencec utoff

I
Pv6i
nte
rpr
eta
tion

Code Meani
ng Code Me a
ning
0 Nor outetode st
. 4 Portunrea
chable
1 Comm.p rohi
bited 5 Sourcea
ddr.f ai
ledpol
ic
y
2 Beyondsrc.scope 6 Rejec
troutet odest.
3 Addressunre
ac habl
e 7 Sourcer
outee rror

Fi
gur
e9.
8TheCODEv
alue
sfora
nICMPde
sti
nat
ionunr
eac
hab
leme
ssa
ge.

Thet wov ersi


onsofI Palsodifferint hewa ytheysele
ctap r
efi
xoft he
data
g ra
mt hatcausedthep robl
em.I Pv
4s endsthedatag
ram headerp l
ust hefi
rst
64b it
soft heda tagramp ayl
oad.I Pv
6a ll
owst hedatagr
amc ar r
yingt heICMP
messaget ob eupt o1280oc tetslong(theI Pv6mini
mum MTU) ,a ndc hoos
esa
maximum p refi
xs izeac-cordi
ngly.Becauset heICMPe rr
orme ss
agec ontai
nsa
sho
rtp r
efixo ft heda ta
g r
a mt hatcausedt hep r
obl
em,t hes ourcewi l
lknow
exac
t l
ywhi chaddre s
sisunreacha
b l
e.
Destinationsma yb eunr eachab l
eb ec a
useha rdwarei st emp or a
ril
y outof
servi
ce,be causet hes e
nde rspeci
fie danone xi
stentde st
inationa ddre s
s,or( i
nrare
cir-
cumst ances)b ecauset her out erdoe snotha v
ear out et ot hede sti
nat
ion
network.Not et hata lthoughr out ersr eportfa i
luresthe ye ncount er,theyma y
notde te
c ta llde l
iv
eryf a
il
ures.Fore xa
mp le,ift hede s
tinationma chi
nec onne
cts
to a n Et hernet ne twork, t he ne twork ha rdware doe s not p rovi
de
acknowledge ment s
.The refore,a r outerc anc ontin-
ue t os e nd p ack
etst oa
desti
nati
on a ftert he de st
inati
on i sp owe r
ed down wi thout r eceiv-
ing any
indi
cati
ont hatt hep ack
e tsarenotb eingde l
ivered.Tos umma ri
ze :

Al
thoughar out
ersendsades t
inati
onunr
eachablemess
agewhen
i
tencounter
sadatagram thatcannotbefor
war dedordel
i
ver
ed,
arouterc
annotdet
ec tal
lsucher r
ors.

Theme
ani
ngofp
ortunr
eac
hab
leme
ssa
geswi
l
lbe
comec
lea
rwhe
nwes
tudy
howhig
her-l
eve
lpr
otoc
olsus
eab
str
actde
sti
nat
ionp
oint
sca
ll
edp
ort
s.Ma
nyof
ther
ema i
n-
1
78 I
nte
rne
tPr
otoc
ol:Er
rorAndCont
rolMe
ssa
ges(
ICMP) Chap.9

i
ngcodesaresel
fe xpl
ana
tory.Fore xamp l
e,as i
tema yc hoosetor es
tric
tc e r
tai
n
i
n-c
oming or outgoi
ng datagr
a msf or adminis
trati
ver eas
ons.I nI Pv6,s ome
a
ddres
sesareclas
sifi
edassit
e-local
,me ani
ngt hatthea ddresscannotb euse don
t
heg l
obalInt
ernet.Atte
mp ti
ngt os endada tagra
mt hatha sas i
te-l
ocals ource
a
ddres
swi l
ltri
ggera nerrortha ttheda tag
ram hasb eens entb e
yondt hev al
i
d
s
copeofthesourceaddre
ss.

9.
12I
CMPEr
rorRe
por
tsRe
gar
dingFr
agme
nta
tion

BothIPv4a ndI Pv6all


owar outert oreporta ne r r
orwhe nada tagramistoo
l
a r
gef or a ne twork over whichi t mustt ravela nd cannot b ef ragmented.
Howe v
er,thede tai
lsdif
fer.IPv4s endsade s
tinationunr eac hablemessagewi th
theCODE f i
elds ett o4 andI Pv6s endsap ackett oobi gmes sage,whichha sa
TYPEf i
eldof2.I tma yseemtha tnof rag
me ntationr e
portsa rene ededforIPv 4
becausear outerc anf r
agmenta nI Pv4da -
t agram.Re cal
lt hata nI Pv4he a
de r
incl
udesadonotf ragmentbit.Whe nthebiti ss e
t ,ar outeri sprohibi
tedfrom
perfor
ming f r
a gmentati
on, whi c
h c ause
st he r out ert os end an I CMPv 4
desti
nati
onunr eachabl
emes s
agewi thCODE4.
Thereas
onI Pv6de fi
nesas eparateI CMPme ss
ag etor eportfrag
me ntat
ion
p
rob-l
emsari
sesfromt hede s
ign.Rout ersa r
ea lwaysp rohibi
tedfromf r
agme nt
ing
a
nIPv6datagram,whichme ansas our c
emus tp er
f ormp athMTUdi sc
overy.Ak ey
p
artofp ath MTU discover
yi nvol
ve sr ecei
vingi nforma t
ion abouttheMTU of
r
emotenetworks.Therefore,thep ackett oobi gmes s a
gec ontai
nsaf i
eldthata
r
outerus
est oinfor
mt hesourceab outt heMTUoft hene t
wor ktha
tc ause
dt he
p
robl
em.Fig
ure9. 9il
lustra
test heme ss
ag efor mat.

0 8 1
6 31
TYPE CODE CHECKS
UM
MTU
PREFI
XOFDATAGRAM THATCAUSEDTHEPROBLEM
...

Fi
gur
e9.
9Thef
orma
tofa
nI 6p
CMPv ac
kett
oobi
gmes
sag
e.

9.
13Rout
eCha
ngeRe
que
stsFr
omRout
ers

Hostfor
wa rdingtabl
esusual
lyre
ma i
ns tati
cove rlongp er
iodsoft i
me.Ahos t
i
ni-t i
ali
zesitsf orwardi
ngt abl
ea tsyste
ms tart
up ,a nd systema dmini
str
ators
sel
d om chang
et het ab
leduringnormalopera
tion.Aswewi l
lseeinlaterchapte
rs,
rout ersaremor edyna mic theyex c
hanger outi
ngi nformati
onp eri
odi
cal
lyt o
accommoda te networkc hangesand keept heirf orwa r
ding tabl
esup -to-
date.
Thus ,asag ener
a lrul
e:
S
ec.9.
13 Rout
eCha
ngeRe
que
stsFr
omRout
ers 1
79

Router
sareass
umedt oknowcor
r ec
troutes
;hostsbegi
nwith
mini
malrout
inginf
ormati
onandlearnnewroutesfromrout
ers.

To f oll
ow the r ulea nd toa voids ending forwa rdi
ng infor
ma tion whe n
confi
guringahos t,t heiniti
alhos tconfigurationusuallys pec
ifi
est hemi nimum
possi
bl
ef or wardi
ngi nformationne ededt oc ommuni c
a t
e( e.
g.,thea ddr es
sofa
si
ngledef aultrouter).Thus ,ahos tma yb egi
nwi thinc omplet
ei nf
or ma t
iona nd
rel
yonr outerstoup da t
eitsf orward-ingt ab
lea sneeded.Whe nar out erde t
ects
ahos tusinganonop t imalfirsthop,t her outersendst hehos tanI CMPr edi
rect
me s
saget hatinstr
uct sthehos tt ocha ngeitsf or-
wardingt abl
e.Ther outera l
so
forwardst heorigi
nalda tag
ramont oi tsdesti
na ti
on.
The adv a
ntage of t
he ICMP r edi
rec
ts c heme iss impli
ci
ty:a hos
tb oots
without a ny needt o downloadaf or
wa rding t abl
ea nd can i
mmedi
ately
communi c
at ewit
ha nydesti
-nati
on.Ar out
e ronl ysendsar edi
rectmes
sag
eift he
hosts e
ndsada tag
rama l
onganon- p
r e
ferredr oute.Thus ,thehostfor
warding
tabl
er emainssmall
,butwillha
veop -
timalroute sfora l
ldesti
nati
onsi
nuse.
Becausetheyarelimit
edt ointe
racti
onsb e
twe e
nar out
era ndahostona
di
rec
tlyc onne
cted net
wor k,redi
rect mess
agesdo not sol
vet he pr
obl
em of
pr
opaga
tingr o
utinginf
orma t
ioninag enera
lwa y.Toundersta
ndwhy,c ons
ide
r
Fi
gure9.10whichil
l
us-tra
tesas e
tofne tworksconnect
edbyrouter
s.

R2 R
R1 3 R5
S D
R
4

Fi
gur
e9.
10Exa
mpl
etopol
ogyshowi
ngwhyICMPr
edi
rec
tmes
sag
esdo
notha
ndl
ea l
lrout
ingp
rob
lems
.

Int he f i
g ure,hos tS s endsa da tagramt o desti
nat on D.I
i fr outer R1
i
ncor re
ctl
yf or
- wa r
dst heda ta
g ramt hroughr outerR2 instea dofthroughr outer
R4 (i
.e.,R1i ncorrectl
yc hoosesal ong erp a
tht hanne ces
sary),theda ta
g ra
m wi l
l
arriv
ea tr oute rR5.Howe ver,R5 c annots enda nI CMPr e di
rectme s
saget oR1
becauseR5 doe snotk now R1 sa d-dr e
ss.La t
e rcha pter
se x pl
orethep robl
e m of
howt op ropagat eroutingi nforma t
iona crossmultipl
ene twor ks.
Aswi ths e veralot herI CMP me s
saget ypes,I Pv4a nd I Pv6 usethes ame
generalfor matf or redirect mes sages.Theme ssageb egi
nswi tht her equisi
te
TYPE,CODE,andCHECKSUM f i
elds.Theme ssagef urtherc ontai
nst wop i
ec e
sof
i
nf ormati
on:t heI Pa d-dr essofar outert ousea saf i
rsthopa ndt hedesti
na t
ion
addressthatc a usedthep rob-lem.Theme ss
agef orma tsdiffer.AnI Pv4r edi
rect
mes s
agec ontai
nst he32- bi
tI Pv4a ddres
sofar oute rfol
lowe dbyt hep refi
xof
t
heda
tag
ramt
hatwa
sinc
orr
ect
lyf
orwa
rd-
1
80 I
nte
rne
tPr
otoc
ol:Er
rorAndCont
rolMe
ssa
ges(
ICMP) Chap.9

ed.AnI Pv6redir
ectmess
ageconta
instheIPv
6addres
sofarouterandtheI
Pv6
desti
-na
t i
ona ddr
esstha
ts ho
uldbef orwa
rdedt
hroughtherout
er.Fig
ure9.1
1
il
lus
trat
e stheformatus
edwithIPv6.

0 4 1
2 1
6 24 31
TYPE(
137) CODE(
0) CHECKS
UM
UNUS
ED(
MUS
TBEZERO)

ADDRES
SOFAFI
RST-
HOPROUTER

DES
TINATI
ONADDRESSTHATS
HOULD
BEFORWARDEDTHROUGHTHEROUTER

Fi
gur
e9.
11TheI 6r
CMPv edi
rec
tmes
sag
efor
mat
.

Asag eneralrul
e,rout
er sonl
yse
ndI CMPr e
dir
e c
tr eq
uest
stohostsa
ndnot
t
o oth-err outer
s.Laterc hapte
rswil
le x
pla
inp rotoc
olsthatrout
ersuseto
e
xchang
er outingin-
for
ma t
ion.

9.
14De
tec
tingCi
rcul
arOrExc
ess
ive
lyLongRout
es

Becausei nternetr out e


r se ach us el ocali nfor mation whe nf orwa rding
datag r
ams ,e r- r
or sori nconsist
enciesi nf orwa rdi
ngi nforma ti
onc anp roduc ea
cycl
ek nowna sar out-i
ngl oopf orag iv
e nd e
stination,D.Ar outingloopc an
consistoft wor outerst hate achforwa r
dag ivenda ta gr
amt otheot her ,ori t
canc onsistofmul tipl
erout ersthate ac hfor- wardada t a
gra mt othene xtr outer
int hec ycle.I fada tagrame ntersar outingl oop,i twi llpassa r
oundt hel oop
endlessl
y.Asme ntionedp revi
ously,top reventda tagra msf rom cir
cli
ngf orev erin
aTCP/ I
Pi nterne t,e a
chI Pdat agra
mc ontainsahopl imi t.Whe neveritproc ess
e sa
datag r
am,ar outerde crementst hehopl i
mi ta nddi s
ca rdstheda tagram whe nt he
countr ea c
he sze ro.Ar outerdoe snotme rel
yd i
scardada ta g
ramt hatha se xceed
itshopl i
mi t.I nstead,ar outert akest hef urthera ctionofs endi
ngt hesour cea n
ICMPt i
meexc eededmes s age
.
BothIPv
4a ndI
Pv6sendat i
meexc
eededmes
sage
,a ndbothuset
hes a
me
formata sFi
gur
e9.1
2ill
ustr
ate
s.IPv
4setstheTYPE t
o1 1
,a ndI
Pv6set
st he
TYPEt o3.
S
ec.9.
14 De
tec
tingCi
rcul
arOrEx
ces
siv
elyLongRout
es 1
81

0 8 1
6 31
TYPE CODE CHECKS
UM
UNUS
ED(
MUS
TBEZERO)
PREFI
XOFDATAGRAM THATCAUSEDTHEPROBLEM
...

Fi
gur
e9.
12I
CMPt
imee
xce
ede
dme
ssa
gef
orma
t.

I
tma ys eem oddt hattheme ss
ager ef
erst ot i
mewhe nt hee r
rorb ei
ng
reportedi s a hop l
imit.The name is deri
vedf rom IPv4, whic
h or i
gi
nall
y
int
e rpre
tedthehopl i
mita satimetolive(TTL)counter.Thus
,itma desenseto
int
e rpre
tTTLe x pi
rat
ionasex c
eed-
ingat imelimi
t.Althoughtheinterpr
etati
on
oft hefiel
dhasc ha
nged,thenamepersis
ts.
Thet imeexc eededmes sag
ei sa l
sous e
dt oreporta nothert i
mee xpi
rati
on:
ti
me outdur ingt her eas
semblyofaf r a
gmenteddatagram.Re ca
llthatIPsoftware
on a de stina -
tion hos t mustg a
the rf r
agmentsa nd c ons
tructac omp l
ete
datagram.Whe naf ragmentarriv
esf orane wdatagram,thehos tsetsatimer.If
oneormor ef ragme ntsdonota r-
riveb e
forethet i
me re xpi
res
,t hefragments
arediscar
de da ndt her ec
eiv
inghosts endsanICMPt i
meexc eededmes sa
geb ac
kt o
thes ourc
e.I CMPus estheCODEf i
eldinat imeexceededmes sagetoe xp
lai
nt he
natureoft het i
me outb e
ingreporteda sFi
gure9.1
3s hows.

CodeVal
ue Meaning
0 Hopli
mite
xceeded
1 Fra
gmentrea
ssemblyti
mee
xce
ede
d
Figur
e9.13
Inter
pre
tati
on heCODEf
oft i
el
dina CMPt
nI i
meexceeded
me
ssa
ge.Bot
hIPv4a
ndIPv
6usethes
amei
nte
rpr
etation.

9.
15Re
por
tingOt
herPr
obl
ems

Whe n arouterorhos tf indsp r


ob l
emswi th ada tagr
a m notc overe db y
previ
ousI CMPe rr
orme s
sages( e .
g.,a nincorrectdatagram header
),i tse ndsa
parameterprobl
em mes s
aget ot heor i
ginalsource.InI Pv4,ap ossi
blec auseof
suchp robl
emsoc cur
swhe na rg ume ntst oa n opti
on a reincorre
ct.I nI Pv6,
parameterprobl
emsc ana r
iseift hev al
uei nahe aderfiel
di soutofr ange,the
NEXTHEADERt ypeisnotr ecognized,oroneoft heopti
onsisnotr ecognized.I n
suchcases,aroutersendsap aramet erpr obl
em mes-sageandus estheCODEf i
eld
to dis
tingui
sha mong subproblems .Fi gure 9.1
4i ll
us-
tr a
test he forma t of a
parameterprobl
em mes s
age.S uchme s
sagesa r
eonl ysentwhe nap robl
e mi ss o
sev
e r
et hatthedatagr
ammus tb edi s
c a
rded.
1
82 I
nte
rne
tPr
otoc
ol:Er
rorAndCont
rolMe
ssa
ges(
ICMP) Chap.9

0 8 1
6 31
TYPE CODE CHECKS
UM
POI
NTER
PREFI
XOFDATAGRAM THATCAUSEDTHEPROBLEM
...

Fi
gur
e9.
14I
CMPp
ara
met
erp
rob
lemme
ssa
gef
orma
t.

Toma
ket hemessa
geunambi
guous,thes
enderus
esthePOINTERfi
el
dinthe
me
ssag
eheade
rt oi
denti
fytheoc
tetinthedata
gramtha
tcause
dt hep
robl
em.

9.
16Ol
derI
CMPMe
ssa
gesUs
edAtS
tar
tup

Origi
nal
ly,ICMPde finedas etofme s
sa gest ha
tahos tusedatst a
rtupt o
determineitsIPaddre ss
,t hea ddre s
sofar out er
,a ndt headdres
sma s
kus edon
the network.Ev e
n- tuall
y,a p rotocolknown a s DHCP wa sintr
oducedt hat
provi
desa nIPv4hos twi thallt hene ce
ssar
yi nformationinas i
ngleexchange.In
addit
ion,ICMPde finedme ss
a gest hatahos torr oute rcouldusetoob tai
nt he
currentt i
me .Pro
toc olst oe xchanget i
mei nformat i
on havea l
sobeen devi
sed,
ma k
ingt heICMPv ersionob sol
et e
.Asac onse -quenc
e ,IPv4nol ongerusesICMP
me s
sagesthatwerede signedt oob tai
ninforma tionats tart
up.
Interestingl
y,I CMPv 6hasr e turne dt ooneoft hei deast hatwa sor i
ginal
ly
partofI CMPv 4:routerdiscovery.Ats t artup ,anI Pv6hos tmul ti
c astsa nI CMPv 6
Rout erDi scoverymes sagetolear na b outr outersont hel ocalne t
wor k.The rea re
twoc onc ep-tualdifferencesbet we enr out erdi scov erya ndDHCPt hatma k eit
attrac t
ivef orI Pv6.First,becauset hei nf ormat ioni sob ta i
neddi rectlyf rom t he
rout erits e
lf,t hereisne verat hird-p artye r
r or.Wi thDHCP,s uche rrorsa re
possiblebe c
a useaDHCPs e
rvermus tb ec onf i
gur edwi thinf ormationt oha ndout .
Ifane twor kma nagerf ail
stoup datet heDHCPc onfi
g ur at
iona ft e
rane t work
chang es,hos t sma yb eg iven out -of -dat ei nfor ma -ti
on.S econd,I CMP r outer
dis
c overyus e sasofts tatetechniquewi tht imerst op reventhos t
sf r
om r e tai
ning
af orwa rdi
ng t ablee ntrya fterar out e rc rashe s r outersa dve rt
iset hei
r
informa ti
onp eri
odical
l
y,a ndahos tdi scar dsar out eift het i
merf ort her outee x
-pi
r es.

9.
17S
umma
ry

TheI nt
ernetControlMe s
sageProt
ocoli
sar equi
reda ndint
egr
alpa
rtofI P
t
hatisus edtor eporterrorsandtos endcontr
olinformati
on.Inmostcase
s,
I
CMPe rrorme s
-sa
ge sori
gi
na t
ef r
om arouterintheInternet
.AnICMPme s
sage
a
lwa
ysg oesbacktot heori
ginals
ourc
eoft hedata
gramt hatcaus
edthee
rror
.
Cha
pte
r22e
xami
nesDHCPa
swe
lla
sthep
rot
ocol
sIPv
6us
esa
t
st
art
up.
S
ec.9.
17 S
umma
ry 1
83

ICMPi ncludesdesti
nati
onunreac habl
emes sagesthatreportwhe nada ta gr
am
can-notb ef orwardedt oit
sde s
tination,packett oobigmes sagest hatspec i
fya
datagramc annotf itintheMTUofane twork,r edi
rectmessagest hatr equesta
hosttoc hang ethef i
rst
-hopinitsf orwardi
ngt able,ti
meexc eededmes s
agest hat
reportwhe nahopl imitexpi
resorr eas
semblytime sout,andp aramet erpr obl
em
me s
sagesf orot herhe aderprobl
e ms.I na ddit
ion,I CMP echo r equest/r eply
me s
sagesca nb eus edtot e
stwhe therade sti
nationisreachable.As etofol der
ICMPv 4 me s
sa ge
st hatwe reintende dt os up-pl
yi nfor
ma ti
on t o ahos tt hat
bootedarenol ongerused.
AnICMPme ss
agetra
vel
sint hedataare
aofa nI Pdat
agrama ndhasthre
e
fixe
d- l
engthfi
el
dsatthebeg
inni
ngoft hemess
age:anICMPme ss
agetypefi
el
d,a
codef i
eld,andanICMPchec
ksum fi
el
d.Theme ss
agetypedete
rminesthefor
ma t
oft here s
tofthemess
ageaswellasi
tsmeani
ng.

EXERCI
SES

9.
1 Devi
sea
ne x
per
imentt
ore
cor
dhow ma
nyofe
achI
CMPme
ssa
get
ypea
rri
vea
tyour
hos
tduri
ngaday.
9.
2 Examinet hepingapplic
ati
ono nyourc omput
er.Tryus ngp
i i
ngwitha nI
Pv4network
broadcas
ta ddressora nIPv6AllNodesaddress
.How ma nyc omputersa
nswer?Read
the protocoldocume ntsto determi
ne whethera ns
we ri
ng a broa
dcas
tr e
questis
requir
ed,r ec
om- mended,notrecommended,orprohib
ited.
9.
3 Explanhowat
i r
acerouteappl
i
cationcanuseICMP.
9.
4 Shouldar outergiveICMPme ssa
g esp
riori
tyovernormaltraffi
c?Whyorwhynot ?
9.
5 Consi
deranEthernetthathasoneconventi
onalhos
t,H,and12rout
ersc
onnect
edt
o
i
t.Findasing
le(sli
ght
lyill
egal
)fra
mec a r
ryi
nga nIPpac
k e
ttha
twhe nsentb
yhos
t
Hc a
usesHtor e
ceiv
ee xa
ctly24packet
s.
9.
6 Thereis no ICMP me s
saget ha
ta l
l
ows a machi
ne toinfor
m the sourc
et hat
tra
nsmis
sioner-r
orsa recaus
ingdata
gramst oarr
ivewit
ha ninc
orrec
tc heck
sum.
Expl
ai
nwhy.
9.
7 Intheprevi
ousques
tion,unde
rwha tci
rcums
tanc
esmights
uchamessa
geb euseful?
9.
8 Shoul
dICMPe
rrorme
ssa
gesc
ont
ainat
ime
sta
mpt
hats
pec
ifi
eswhe
nthe
yar
ese
nt?
Whyorwhynot?
9.
9 I
frouter
sa tyoursi
tepar
tici
pat
einICMProut
erdi
scov
ery,f
indouthow ma
ny
a
ddr
ess
ese a
chrout
eradv
ert
ise
sone a
chi
nte
rfa
ce.
9.
10 Tryt orea
c haserve
ronanone xi
ste
nthos
tonyourl ocalnetwork
.Alsotr
yt o
communi
-catewi
thanone
xis
tenthostonare
motenet
wor k
.I nwhichcas
e(s
)doyou
rece
ivea
nI CMPerr
ormes
sage,a
ndwhichmes
sag
e(s
)doyour ece
ive?Why?
Chapt
erCont
ent
s
1
0.1 Intr
oduc t
ion,1 85
1
0.2 Usi
ngAPr otocolPor tAsAnUl tima teDe s
tinati
on,185
1
0.3 TheUserDa tagramPr otocol
,186
1
0.4 UDPMe ssageFor mat,1 87
1
0.5 Inter
pretationOft heUDPChe cksum,1 88
1
0.6 UDPChe cksumComp ut ati
onAndThePs eudo-Header,1
89
1
0.7 IPv4UDPPs eudo- Heade rFormat ,189
1
0.8 IPv6UDPPs eudo- HeaderFor mat ,190
1
0.9 UDPEnc apsulationAndPr otocolLa yer
ing,1 90
1
0.1
0 Layeri
ngAndTheUDPChe cks
umComp utation,192
1
0.1
1 UDP Mul ti
plexing,De multipl
exing,And Pr otocolPorts
,
193
1
0.1
2 Reserv
edAndAv a
ila
bleUDPPor tNumb ers,194
1
0.1
3S umma ry,196
1
0

UserDat
agr
amPr
otoc
ol
(UDP)

1
0.1I
ntr
oduc
tion

Previ
ousc hapt
ersde scri
bea na bst
ractint
e r
netc apableoft r
ans fer
r i
ngI P
datagra
msa monghos tc omputers,whereeachdatagrami sf orwardedt hrought he
int
ernetb a sed on t he de s
tinati
onsI Paddress. At t he internetl ayer,a
desti
nati
ona ddressidentif
iesahos tcomputer
;nof urtherdi st
inction i
sma de
regardi
ng whi ch user or whi chap p
li
cati
on on the c omput er wil
lr e
ceivet he
datagra
m.Thi schaptere xt
endst heTCP/IPprotocolsuiteb ya ddi
ngame chanis
m
that di
sti
ng uishesa mong destinat
ionswithi
n ag i
v e
n hos t,a l-l
owing mul ti
p l
e
appl
icat
ion p rograms e xec
uting on a g i
venc omp utert os end a nd r e-ce
ive
datagra
msi nde pe
ndently.

1
0.2Us
ingAPr
otoc
olPor
tAsAnUl
ti
mat
eDe
sti
nat
ion

Theop era
t i
ng s yst
emsi n mostc omp utersp er
mi tmul ti
pl
ea ppl
ica
tionst o
executes i
multaneous l
y. Using op erati
ng system j argon, we r efert oe ach
executi
nga p
pli
c a
tiona sap rocess.Itma ys eem naturaltos aythata na ppl
ication
istheulti
matede stinati
onf orame ss
a g
e.Howe ver,specifyi
ngap artic
ularp roce s
s
onap ar
tic
ularma c
hinea st heul t
imatede st
inati
onf orada tagrami ssome wha t
misl
eadi
ng.First,b ecaus
eap rocessiscreatedwhe nevera nappli
cati
oni slaunc hed
andde s
troyedwhe nt hea p
plic
at i
one xi
ts,as enderseldom hase noughk nowle dge
aboutwhichp rocessonar emot ema chi
neisr un-ningag i
venapp l
ic
ation.Sec ond,
wewoul dlikeas che met hata l
lowsTCP/ IPtob eus edona na rbi
traryop erating
s
yst
em,a
ndt
heme
cha
nis
msus
edt
oide
nti
fyap
roc
ess

1
85
1
86 Us
erDa
tag
ramPr
otoc
ol(
UDP) Cha
p.1
0

varya mong operati


ng s yst
ems.Thi r
d,r eb ooti
ng a comp utercanc hanget he
proces
sa s
-soci
atedwi the achappli
cat
ion,b uts ende
rss houldnotber equir
e dto
know abouts uchc hanges.Fourth,wes ee kame chanis
mt hatcani denti
fya
serv
icethec omp uterof ferswithoutk nowi nghow thes erv
iceisimp l
emented
(e.
g.,toa l
low as e
nde rt oconta
c tawe bs e rv
erwithoutk nowingwhichp roce
ss
ont hedes
tinati
onma chineimple
me ntsthese rverfunct
ion).
Insteadoft hi
nki
ngofar unni
nga ppl
i
c at
ionastheulti
ma t
ede s
tinat
ion,we
willi
ma ginethateachmachi
nec onta
insase tofa b
str
actdest
inati
onpointscal
le
d
protocolpor t
s.Eachprotoc
olp ortiside
nt i
fi
e dbyap osi
ti
veinteger
.Thel ocal
operatingsystemprovi
desaninterfa
ceme chanis
mt ha
tp r
ocess
esuset ospeci
fya
portora c c
essit
.
Mos t op erating s ystems p rov i
de s ynchronous acces
st op orts
.Fr om a n
appl
icationspointofv iew,s ynchr onousa ccessme ansthec omp utat i
ons t
opswhe n
thea pp l
icati
on a ccessest hep ort .Fore xamp l
e,i fa nap pli
cation attemptst o
extract da taf r om a p ortb e forea ny da t
aa rri
ves,t he op erat
ing system
tempor ari
lys top s( blocks)t he a ppl
icat i
on unt ildataa r ri
ves.Onc et he data
arri
ves,t heop er at
ings ystemp as s
est heda t
at ot hea p pl
icati
on a ndr estar
ts
execution.I ng ene r
al,p or tsa reb uffered i fdataa rr
ivesb eforea na ppli
cati
on
i
sr eadyt oa cceptt heda ta,t hep rotocols oftwarewi l
lholdt heda t asoitwi l
lnot
belost.Toa c
hiev eb uffer i
ng ,t hep r
otoc ols oft
wa relocat
e dinsidet heop erati
ng
syst
e mp l
acespac ketst hata r ri
vef orap a r
ticul
arp rot
ocolp ortina( fi
nite)queue
unti
lt hea p
pli
catione xtractst he m.
Toc ommuni catewi thar emot ep ort,as enderne edst ok now b otht heI P
addr essoft he destinati
on ma chine a nd a p rotoc
olp ortnumb e rwi thint hat
ma chine.Ea chme s
sag ecarri
e st wop rotocolp ortnumb e
r :a de
s s
tination port
numb erspecifi
esap ortont hede s
tinationc omp ut
ert owhi c ht heme ssageha s
beens ent
,a ndas ourc eportnumbers pe ci
fi
esap ortont hes endingma chinefrom
whic ht heme ssag
eha sb eensent.Be - causeame ssagecont ai
nst hep ortnumb er
thes e ndi
nga ppl
icati
onha sused,t hea p pl
ic
a- t
ionont hede st
inat ionma c
hineha s
enoug hi nformation t og ene
r atear eplya nd forwar dt he rep lyb a c
kt ot he
sende r.

1
0.3TheUs
erDa
tagr
amPr
otoc
ol

Int heTCP/ IPp r


ot ocolsui
te,t heUs erDat agram Protocol(UDP)pr ovi
dest he
pri
-ma r
yme cha ni
smt ha ta ppl
i
cationp rogramsus et os e
ndda ta
g r
amst oothe r
appl
icat
ionp rogr a
ms.UDPme ssagesconta i
np rotocolportnumb ersthata reus ed
todisti
ng ui
sha mongmul ti
pleappli
cati
onse xe
cut i
ngonas inglecomputer .Thatis,
inadditi
ont ot hedatas ent,e ac
hUDPme s
sagec ontainsb othade sti
na ti
onp ort
numbera ndas ourcepor tnumb er,ma ki
ngi tp ossi
blefort heUDPs oftwa reatt he
des
tinati
ont ode l
ive
ra ni ncom-ingme ssa g
et ot hec orrectr ec
ipi
enta ndf ort he
rec
ipie
ntt osendar eply.
UDPuse
st heunde
rlyi
ngI nter
netPr
otocolt
ot ra
nspor
tames
sag
ef rom one
ma
chinet
oa nothe
r.Surpr
isi
ngly,UDPprov
idesapp
li
cati
onswi
tht
hes a
meb est-
eff
ort ,conne
ctionl
essdat
agram de
li
veryse
ma nti
csasIP.Thatis
,UDPdoe snot
guaranteethatme s
sagesarr
ive
,doesnotguar a
nteeme s
sag
esarr
iveinthesame
ordert he
ya r
es ent,anddoesnotprov
ideanyme cha
nis
mst oc
ontrolt
herateat
whic
hi nformati
onflows
S
ec.1
0.3 TheUs
erDa
tag
ramPr
otoc
ol 1
87

betweenap ai
r of communic
ati
ng hosts
.Thus, UDP me
ssa
gesc a
nb el
ost
,
dupli
cat
ed,orarr
iveoutoforder.Furt
hermor
e,packe
tscanarr
ivefas
tert
han
thereci
pie
ntca
np ro-
ces
sthem.Wec ansummari
ze:

TheUs erDatagram Prot oc


ol(UDP)provi
desanunr el
i
able,bes t
-
effort,c onnecti
onl
ess deliver
ys er
vic
e using I
Pt ot ranspor
t
messagesbet weenmac hines.UDPusesIPt ocarr
ymes sages,but
addst heabili
t ytodis
tinguishamongmulti
pledest
inat
ionswi thi
n
agivenhos tc omput
er.

An imp orta
ntc ons e
quencea risesf rom UDP s emanti
cs:a na ppl
i
cation that
usesUDPmus tt akef ul
lr esp
onsibi
lityf orha ndli
ngt hep rob
lemsofr el
iabi
l
ity,
i
nc l
uding me ss
agel oss,dup l
icat
ion,de l
ay,out -of-order del
ive
ry,a nd lossof
connecti
vity.Unf or-tunatel
y,a ppl
icati
on p rogramme rssome t
imesc hoose UDP
without unde rs
tanding the li
-abil
ity.Mor eover,b ec
ause networks oftwarei s
usuall
yt est e
da cr
oss Loc a
lAr ea Ne t-
wor kst hat have highr el
iabi
l
ity,hi gh
capaci
ty,lowd el
ay,a ndnop acketlos s
,t es
tingma ynote xposepotenti
alf a
il
ures.
Thus,a p
pli
c ati
onstha trelyonUDPt hatwor kwe lli
nal ocalenvi
ronmentc anf ai
l
i
ndr ama t
icwa yswhe nus eda c
rosstheg l
obalInternet.

1
0.4UDPMe
ssa
geFor
mat

Weus
ethetem us
r erdat
agr
am todes
cri
beaUDPmess
age
;theemphas
ison
us
erisme
anttodi
sti
ngui
shUDPdata
gramsfrom I
Pda
tag
rams.Conc
ept
ual
ly,a
userda-t
a g
ramc ons
ist
soft wop art
s:ahe adertha
tc onta
insme ta-
inf
ormat
ion,
suchassourceandde sti
nati
onp r
otocolpor
tnumb e r
s,andap ayloadareathat
conta
insthedat
ab ei
ngs ent
.Fig
ure1 0.
1il
l
ust r
ate
st heorga
niza
tion.

UDPHEADER UDPPAYLOAD

Fi
gur
e10.
1Thec
onc
ept
ualor
gani
zat
ionofaUDPme
ssa
ge.

Theheade
ronaus erda tag
r a
mi sextremelysmall
:itcons
ist
soffourfiel
ds
tha
ts peci
fythep rot
ocolp ortfrom whicht heme s
sagewa sse
nt,theprot
ocol
por
tt owhicht heme ssageisdestine
d,theme s
sagel
ength,andaUDPc he
cks
um.
Eac
hf iel
dissi
x- te
enb it
slong,whi chmeanst heenti
reheaderocc
upi
esatotalof
onl
ye ig
htoctets.Fig-
ure1 0.2il
lustr
ate
st hehe a
derformat.
1
88 Us
erDa
tag
ramPr
otoc
ol(
UDP) Cha
p.1
0

0 1
6 31
UDPS
OURCEPORT UDPDES
TINATI
ONPORT
UDPMES
SAGELENGTH UDPCHECKS
UM
DATA
...

Fi
gur
e10.
2 Thef
orma
toff
iel
dsi
naUDPda
tag
ram.

TheUDPS OURCEPORTf ie
ldcontai
nsa1 6-bi
tp r otocolportnumb e
rus edb y
thesendingappl
ica
tion,andt heUDPDES TINATIONPORTf i
el
dc ontainsthe16-bit
UDP p r
otocolport numb er of t
he rec ei
ving appl
ica t
ion.I ne s
sence,p r
otocol
sof
twa reusesthep ortnumb erst
ode mul t
iple
xda tag ramsa mongt hea ppl
ic
ations
wait
ingt or ec
eiv
et hem.I nt
eres
tingl
y,t heUDPS OURCEPORT i sop ti
onal
.We
thi
nkofi tasi
dentifyi
ngt heportt owhichar epl
ys houldb ese nt.Inaone -wa y
tra
nsferwhe rether ecei
verdoesnots endar ep
ly,t hes ourcepor tisnotne e
de d
andc a
nb esettoze ro.
TheUDPMES SAGELENGTH f i
eldcont
ainsac ountofoc tet
si nt heUDPda -
tagra m,i ncl
udi
ngt heUDPhe ade
ra ndtheus erdat a.Thus
,t hemi ni
mum v a
lueis
eight,t helengthoft heheadera l
one.TheUDPMES SAGELENGTHf ie
ldc onsi
stsof
si
xt eenb its,whic
hme a
nst hema ximum va
luet hatc anber epre
sentedi s65,535.
Asap ra c
t i
calmatter
,howe ver,wewi l
lseet hataUDPme ssagemus tf i
ti nt
ot he
payloa da reaofanI Pda ta
gram.The re
fore,t hema ximum s
izep e
rmi tte
dde pends
ont hes izeoft heIPhe ader(
s),whicharecons i
der
a blyl
arg
eri nanI Pv6da tagra
m
thani na nI Pv4datagram.

1
0.5I
nte
rpr
eta
tionOft
heUDPChe
cks
um

I
Pv 4andI Pv6di ff
eri ntheirinterpre
t a
t i
onoft heUDPCHECKS UM fiel
d.For
IPv
6,t heUDPc hecksum isrequired.ForI Pv4,t heUDPc hecksum isop ti
onaland
neednotb eus eda ta ll
;av a
lueofze roi nt heCHECKS UM fiel
dme ansthatno
chec
k-sum hasb eenc omp uted(i.e.,ar ec
e i
ve rshouldnotv eri
fyt hec hecks
um).
TheIPv4de si
gne rschoset oma k
et hechecksum optionaltoall
owimp l
ementati
ons
toop era
tewi thl itt
lec omputationaloverhea dwhe nus i
ngUDPa crossahi ghl
y
rel
i
ablelocalar
e ane twork.Recall
,howe ver,t hatIPdoe snotcomp uteac hecksum
ontheda taportionofa nI Pda tagram.Thus ,t heUDPc he
cksum providestheonly
wayt oguaranteet hatda tahasar ri
vedintacta ndshouldbeused.
Begi
nne rs often wonder what happens t o UDP me ss
agesf or whi cht he
computedc hecksum i
sze r
o.Ac omputedvalueo fze r
oisp oss
ibl
eb ecauseUDPus es
thesamec he c
ksum a l
gori
thm asIP:itdivi
dest heda tainto16-bitqua nti
tiesand
computestheo ne
scomp l
ementoft hei
rone
sc omplementsum.S urpr i
si
ngly,zero
isnotap roblemb ecaus
eonescomplementa r
ithme ti
chast wor e
p re
se nta
tionsfor
zero:al
lb i
t ssett ozeroora l
lb i
tssett oone .Whe nt hecomp utedc hecksum i
s
zero,UDPus est herepres
entat
ionwi t
ha l
lbitssett oone.
Theaut
horoncee
xpe
rie
nce
dap r
oble
minwhichaf i
l
ecopi
edac
ros
sa nEthernetwasc
orr
upt
ed
b
eca
usetheEthe
rnetNI
Chadfai
le
dandtheap
pli
cat
ion(
NFS)us
edUDPwithoutche
c k
sums
.
S
ec.1
0.6 UDPChe
cks
umComp
uta
tionAndThePs
eudo-
Hea
der 1
89

1
0.6UDPChe
cks
um Comp
uta
tionAndThePs
eudo-
Hea
der

The UDP c he
c ksum coversmor ei nfor
mati
on t hanisp res
enti nt he UDP
datagrama l
one.Inf ormati
oni sextract
e dfrom theI Pheaderandt hec he c
ksum
coverstheext r
ainf ormati
ona swellast heUDPhe aderandUDPp ayl
oad.Aswi t
h
ICMPv 6,weus et het emp
r s
eudo-headert oref
ert ot heextrainformation.We
canima gi
net hatt heUDPc hecksum softwareextractsthep s
eudo-headerf iel
ds,
pla
cest hemi nme mory,a p
pendsac opyoft heUDPme s
s a
ge,a ndc omp utesa
checksumovert hee nti
reobject.
Itisi mport
antt ounderst
andt ha
tap seudo-headeri sonl
yusedf orthe
chec
ksum c omputat
ion.Itisnotp artoft heUDPme s
sage,isnotpl
acedina
packe
t,a ndisnevers e
ntoveranetwork.Toe mphasizet hedif
fer
encebet
we e
na
pse
udo-he a
dera ndot herheade
rf or
ma tsshown thr oughoutthetext
,weus e
das
hedlinesinfiguresthati
l
lust
rat
eap seudo-heade
r .
Thep ur poseofus ingap se udo-hea
de rist ov e
rifyt ha taUDPda tagram has
reachedi t
sc orrectde s
t i
na ti
on.Thek eyt ounde rstandingt hep seudo-he a
derl i
es
inre al-
izi
ngt hatt hec orr e
ctde sti
nati
onc ons i
stsofas peci
ficma chi
nea nda
spec
if i
cp rotocolp or
twi t
hi nt hatma chi
ne .TheUDPhe aderi tsel
fs pe c
ifie
sonl y
thep r
otoc olportnumb e
r .Thus ,tov erif
yt hede s
tination,UDP i ncludest he
desti
na ti
onI Pa ddressi
nt hec he c
ksum aswe llastheUDPhe ader.Att heul timate
desti
na ti
on,UDPs oftwarev er
i-f i
esthec hecksum usingt hede s
tinati
onI Pa ddr e
ss
obtainedf rom thehe ade roft heI Pda tagra
mt hatc arriedt heUDPme ssage.If
thec hecksumsa gree,theni tmus tbet ruet hatt heda tagram ha sr eachedt he
int
ende dde sti
nationhos ta swe llasthecor r
ec tproto-colp ortwi thint hathos t
.

1
0.7I
Pv4UDPPs
eudo-
Hea
derFor
mat

Thep
seudo-
heade
rus e
dintheUDPchec
ksum c
omput
ati
onf
orI
Pv4c
ons
ist
s
of1
2octe
tsofda t
aarra
ngedasFi
gur
e10.
3ill
ust
rat
es.

0 8 1
6 31
S
OURCEI
PADDRES
S
DES
TINATI
ONI
PADDRES
S

ZERO PROTO UDPLENGTH

Fi
gur
e10.
3The12oct
etsoftheI Pv
4ps
eud
o-he
ade
rus
edd
uri
ngUDP
c
hec
ksumcomput
ation.

Thefi
eldsoft
hep s
eudo-heade
rl abe
ledS OURCEIPADDRESSandDESTINA-
TI
ONI PADDRESSc
ontai
nthes ourc
ea ndde st
inati
onIPv
4a ddre
sse
stha
twi l
lb e
pl
ace
dinanI Pv
4data
gram whens endi
ngt heUDPme s
sage.Fi
edPROTOc
l ont
ains
t
heIPv4pr
oto
colt
ypec 1
ode(7f
orUDP)
,andt
hef
iel
dla
bel
ed UDPLENGTH
c
ont
ains
1
90 Us
erDa
tag
ramPr
otoc
ol(
UDP) Cha
p.1
0

t
heleng
thoftheUDPda ta
gram(noti
ncludi
ngthep s
eudo
-heade
r).Tover
ifythe
c
hec
ksum,there
ceive
rmus text
ractt
hesefiel
dsfr
om theIPv4header
,asse
mb l
e
t
hemintot
hepseudo-he
aderf
ormat,andcomputetheche
cks
um.

1
0.8I
Pv6UDPPs
eudo-
Hea
derFor
mat

Thepse
udo-he
ade
rusedintheUDPchec
ks um comput
ati
onf
orI
Pv6c
ons
ist
s
of40oct
etsofdataa
rra
ngedasFi
gur
e10.4il
lustr
at e
s.

0 4 1
2 1
6 24 31

S
OURCEADDRES
S

DES
TINATI
ONADDRES
S

UDPLENGTH
UNUS
ED(
MUS
TBEZERO) NEXTHEADER

Fi
gur
e10.
4The40oct
e t
softheIPv6p
seudo-
hea
derus
eddur
ingUDP
c
hec
ksumcomput
ati
on.

Ofcour
se,thep se
udo-hea
derf orI
Pv6 usesIPv6sour
cea nd dest
inati
on
a
ddr
e s
ses
.Theothe
rc hange
sf r
om IPv4ar
et ha
tt hePROTOfie
ldisr e
place
db y
heNEXTHEADERf
t iel
da ndtheorde
roffi
eldshascha
nged.

1
0.9UDPEnc
aps
ula
tionAndPr
otoc
olLa
yer
ing

UDP pr
ovide
sourf i
rstexampl
e ofa t ransp
ortp rotocol
.Inthe 5-
layer
TCP/IPrefe
rencemodelinChapter4,UDPl iesinthet r
a ns
portla
yera
bovet he
i
nternetla
yer.Concept
uall
y,appl
ic
ationsacc
essUDP,whi chus e
sIPtosenda nd
rec
eivedat
agrams.Fi
gure10.5i
l
lustr
at est
heconceptua
llayeri
ng.

Inprac
tic
e,itispos
sib
let obui
l
dc heck
sum s
oft
war
etha
tpe
rfor
mst
hec
orr
ectc
omp
uta
tion
wi
thoutc
opyi
ngf i
el
dsi
ntoap se
udo-
heade
r .
S
ec.1
0.9 UDPEnc
aps
ula
tionAndPr
otoc
olLa
yer
ing 1
91

Conc
ept
ualLa
yer
ing

Ap
pli
cat
ion

Tr
ans
por
t(UDP)

I
nte
rne
t(I
P)

Ne
twor
kInt
erf
ace

Fi
gur
e10.
5Thec
oncep
tua
lla
yer
ingofUDPb
etwe
ena
ppl
i
cat
ionp
rog
rams
a
ndIP.

Int he c ase of UDP,t he conceptuallayering int he fi


gurea l
soimplie
s
e
ncaps
ula
- t i
on.Tha tis
,b eca
useUDPi slayeredabov eIP,ac omple
teUDPme ssa
g e,
i
ncl
udi
ngt heUDPhe a
de randp ayl
oad,i sencapsulat
e dina nIPda t
agrama sit
t
ravel
sacr ossanint er
ne t
.Ofc ourse
,t heda tag
ra mi sencaps
ulat
edinane twork
f
ramea si tt rave
lsa crossanunde rl
yingne twork ,whichme anstherearet wo
l
eve
lsofe ncapsul
ation.Figure1
0.6ill
ustratesthee ncapsul
ati
on.

UDP
UDPPAYLOAD
HEADER

DATAGRAM
DATAGRAM PAYLOADAREA
HEADER

FRAME
FRAMEPAYLOADAREA
HEADER

Fi
gur
e10.
6Twole
vel
sofencap
sul
ati
onuse
dwhenaUDPmes
sag
etra
vel
s
i
nanIPdat
agra
m,whichtr
avel
sinane
twor
kfr
ame.
1
92 Us
erDa
tag
ramPr
otoc
ol(
UDP) Cha
p.1
0

Ast hef igurei ndicate


s,e nc a
psulati
on wi llr es
ul tin al i
nears equenc eof
headers
.The r
ef ore,ifonec a p
t ured af ramet ha tc ontai
ned UDP,t hef r
ame
woulds tartwi thaf ramehe ade rf oll
owe db ya nI Phe aderfol
lowedb yaUDP
header.I nt ermsof c on-s
t ruc ti
ng a n out goi
ng p ac
k e
t,we c ani magine a n
appl
icat
ions pecifi
esda tat ob es ent .UDPp rependsi tshe adertot heda taa nd
pas
s e
st heUDPda tagramt oI P.TheI Pl ayerp rependsa nI Phe adert owha tit
rec
e i
vesf rom UDP.Fi nall
y,t hene twor kinte r
facel ayere mbedstheI Pda ta g
ra m
i
naf rameb efores endi
ngi tf rom onema chi
net oa nother.Thef orma toft he
fra
med ependsont heunde rlyingne t workt echnology,b utinmos tt e
chnolog i
esa
fra
mei nc l
udesa na dditi
onalhe ader.Thep ointist ha twhe nlooki
nga taf r ame,
theout ermosthe aderc orres
p ondst ot helowe stp r
ot ocolla
yer,whi l
et hei nner-
mosthe adercor re
spondst ot hehi ghe s
tp rotocollayer.
Oni nput,ap acketar ri
veswhe nade vi
c edr ive
ri nthene t
wor ki nte rfa
ce
l
a ye rre- ceiv
e sap acketfrom t hene tworkint e
r facede vi
cea ndp l
acest hep ac
ket
in me mor y.Pr oces
sing beginsa na scentt hroug hs ucc e
ssi
vely higherl aye r
sof
prot ocols oftwa r
e.Conc eptua l
l
y,e achl ayerr emov esonehe a derb eforep assi
ng
theme s
sa geupt ot hene xtl a
ye r
.Byt hetimet het ra
ns por
tl a yerpassesda tato
the r ece i
v i
ng p r
ocess,allhe adersha veb ee
nr emoved.Whe nc onsi
de ring how
he adersa reinserte
da ndr emov ed,iti sim-port antt ok eepinmi ndt hel aye ri
ng
princ i
ple.I np arti
cular
,ob servet hatt helayeringp ri
nc ip
leap plie
st oUDP,whi ch
me anst ha ttheUDPda ta
g ramr ece
ivedf rom I Pont hede stinati
onma chineis
ident i
calt ot heda ta
g r
amt ha tUDPp asse
dt oI Pont hes ourcema chi
ne .Al so,the
da t
at hatUDPde l
iverstoa na p p
lic
ationont her ecei
vingma chinewi l
lb ee xactl
y
theda tat hata na pp
lic
ati
onp asse
dt oUDPont hes endi
ngma chine .
Thedi vi
si
onofdut i
esa mongv a
riousp r
otocoll ayersisrigi
da ndclear:

TheIPlayerisresponsi
bl
eonlyfortrans
ferr
ingdatabetweena
pai
rofhos t
sonani nternet
,whil
etheUDPl ayerisres
ponsi
ble
onl
yf ordif
ferent
iatingamongmulti
plesourcesordest
inati
ons
wit
hinonehost.

Thus
,onlytheIPhe
a de
ri de
nti
fi
esthesourc
eanddest
ina
tionhos
ts;onl
ytheUDP
l
ayeride
nti
fie
sthesourceordest
ina
tionpor
tswi
thi
nahos t.

1
0.1
0La
yer
ingAndTheUDPChe
cks
um Comp
uta
tion

Ob serv
antreaderswillnot iceas eemingcontradi
c t
ionb etweent hel ayeri
ng
rulesandt heUDPc heck
sum c omp uta
tion.Recal
lthatt heUDPc heck
s um incl
ude sa
pseudo- he
aderthathasf i
eldsf orthes ourceanddes t
inationIPa ddr es
ses.I tcan
bea r -
g uedthatthede sti
na ti
onI Pa ddr
essmus tb ek nownt ot heus e rwhe n
sendingaUDPda -tag
ram,a ndt heuse rmus tpas
st hea ddresstot heUDPl ayer
.
Thus,t heUDPlayerc anob t
aint hede sti
nati
onI Pa ddresswi t
houti nteracti
ng
witht heI Pla
yer.Howe ve r,t hesour ceIPa ddre
s sde pendson t her outeI P
c
hoose
sf ortheda t
agrambeca
usetheI Ps our
cea ddr
esside
nti
fie
st hene
twork
i
nte
rfaceoverwhichadata
gramistra
nsmitted.Thus,unl
essiti
ntera
ctswi
ththe
I
Player,UDPcannotknowtheIPsourc
ea ddres
s.
S
ec.1
0.1
0 La
yer
ingAndTheUDPChe
cks
umComp
uta
tion 1
93

Wea s
sumet ha tUDPs oftwarea skstheI Pl ayert ocomp utet hes ourceand
(pos
si-
bly)de sti
na ti
on I Pa ddres
s e
s,us est hemt oc onstr
uc tap seudo-header,
computest hec hecksum,di scardst hep se
udo- header,a ndt henp a s
sest heUDP
datagr
amt oIPf ort ransmis
s i
on.Ana l
ternativ
ea ppr
oa c
ht hatp roduce sgreat
er
effi
ci
encya rrangest oha vetheUDPl ayere ncapsula
tet heUDPda tagrami na nIP
datagr
am,ob t
a i
nt hes ourcea d-dressfrom I P,storet hes ourcea ndde sti
nati
on
addres
sesi nt hea ppropriatef i
eldsoft heda tagram he a
de r,comp utet heUDP
check
sum,a ndt he npasst heI Pda t
agramt ot heI Player,whi chonlyne edstof i
ll
inthere maini
ngI Phe aderf i
elds.
Doesthes trongi nteracti
onb et
we enUDPa ndI Pv iol
ateourb a
sicpremise
thatl ayeri
ng r efl
ectss e
p arati
on off unctional
i
t y? Yes.UDP ha sb eent i
g htl
y
i
nt egratedwit ht heI Pp rotocol.Itisc l
e ar
lyac omp romiseoft helayeri
ngr ules
,
ma def ore ntir el
yp r
ac-tic
a lr ea
sons.Wea rewi l
l
ingt o overl
ookt hel a
ye ri
ng
viol
at i
onb ec
aus ei tisimpossibl
et oidentifyade stinati
ona ppl
ic
ationprogramf ull
y
wi t
houts peci
f yingt hedes t
inationma chine,a ndt heg oa
li stoma kethema pp i
ng
betwe ena ddre sse
sus edb y UDP a nd t hoseus edb yI Pe f
fici
ent.Oneoft he
ex e
rc i
sesexami nesthisiss
uef rom adiffe re
ntp oi
ntofv iew,askingther e
adert o
considerwhe the rUDPs houldb es epa
ratedf romI P.

1
0.1
1UDPMul
ti
ple
xing
,De
mul
ti
ple
xing,AndPr
otoc
olPor
ts

WehaveseeninCha
pter4thatsoftwar
ethroughoutt hel
ayer
sofap r
otocol
hi
era
r-c
hy mustmulti
pl
exo rdemulti
pl
e xamong multi
pl
eob jec
tsatt henex t
l
ayer
.UDPsoft
wa r
eprovi
desa
notherexampl
eofmul ti
pl
exinganddemul
ti
ple
xing
.

Multi
pl
exi
ngoccursonout put.Onag iv
enhostcompute
r,mul ti
p l
e
ap-
pli
cati
onscanus eUDPs i
multa
neousl
y.Thus,wec ane nvis
ion
UDP softwar
ea cce
pti
ng out goi
ng me s
sag
esf rom a s e
t of
app
li
cati
ons,pla
c-ing e
a c
hi n aUDP da t
agram,and pas
sing the
dat
agramstoIPf ortransmi
ssi
on.
Demult
ipl
exi
ngoccursoni np
ut.Wec a
ne nvi
si
onUDPa ccep
tingi
n-
comi
ngUDPda tag
r a
msf rom IP,c
hoosi
ngthea p
p l
i
cati
ontowhich
the data
gram hasb ee
ns ent,and pass
ing the datat othe
appl
i
cati
on.

Conceptual
ly,a l
lmul tipl
exinga ndde multipl
exingb e
twe e
nUDPs of t
wa rea nd
ap-pl
ica
tionsoc curt hr
oug ht hep or tme chani
sm.I np ra
ctic
e,e acha p pl
ic
ation
program mustne gotiatewitht heop erati
ngs ystemt oob ta
inal oca
lp rotocolport
numb e
ra ndc r
ea tether esourcesnee dedtos enda ndr e
ceiveUDPme s
sages.Onc e
theop erati
ngs ystem ha sc re
a te
dt hene cessa
ryr e
sources,thea ppli
cationc an
send data;UDP c ode int he opera t
ing system wi l
lc reat
ea n outgoing UDP
datagra
ma ndplacet helocalportnumb erintheUDPS OURCEPORTf i
el
d.
Conce
p tua
ll
y, onlyt he desti
nat
ion p ort numberi s neededt o handl
e
de
multi
pl
exing. Wheni tp roces
sesani ncoming dat
a g
ram, UDP a c
ceptsthe
da
tagr
amf r
om theI Psof
t war
e,e x
tract
st heUDPDES TINATIONPORTf rom t
he
he
ader,a nd p a
sse
st he d ata to the a p
plic
ati
on. Figur
e 1 0.
7 ill
ust
rates
de
mul
ti
pl
exi
ng.

Fornow,wedes
cri
bethemec
hani
smsa
bst
rac
tly;Chap
ter21p r
ovi
desa
nex
amp
leoft
hes
ock
et
p
rimi
-ti
vestha
tmanyope
rat
ings
yst
emsuset
ocrea
tea ndusepor
ts.
1
94 Us
erDa
tag
ramPr
otoc
ol(
UDP) Chap.1
0

Por
t1 Por
t2 Por
t3

UDP:Demul
ti
ple
xing
Ba
sedOnPort

UDPDa
tagr
ama
rri
ves

I
PLa
yer

Fi
gur
e10.
7Conc
ept
ualv
iewofUDPde
mul
ti
pl
exi
ngi
nco
mingda
tag
rams
.

Thee as
ies
twa yt ot hinkofaUDPp ortisa saqueueofi ncomingda t
ag ra
ms .
In mosti mplementat ions,whe na na ppl
icati
on negoti
ateswi tht he operati
ng
syste
mt oa l
lo-c
ateap ort,t heope rati
ng systemc rea
test heint e
rnalque ue
neededt oholda rrivingda -t
a grams
.Thea ppli
cati
onc anspecif
yorc hang ethe
queues i
ze.Whe nUDPr ec
eivesada ta gr
am,i tc he
ckstos eethatt hede s
tinati
on
portnumb erma t
che soneoft hep or
tsc urrentlyinuse.Ifitf i
ndsama t
ch,UDP
enqueuesthene wda t ag r
ama tt heportwhe r
et heappl
icat
ionp r
ogramc ana ccess
it.Ifnoneoft hea ll
oc atedp ortsma tcht heincomingda ta
gram,UDPs endsa n
ICMPme s
saget oinf or mt hes ourcet hatt hep or
twa sunr eac
habl
ea nddi scards
theda t
agram.Ofc our se,a ne rroralsooc cursifthep ortisfull
.I nsuchc ases,
UDPdi s
cardstheincomi ngdata grama ndsendsa nICMPme s-
sage.

1
0.1
2Re
ser
vedAndAv
ail
abl
eUDPPor
tNumb
ers

How s houl
dp r otocolp ortnumb er sb ea ss
igned?Thep r
oblemi simp or
ta nt
becauseap pl
icat
ionsr unni ngont woc omp utersne edt oa gre
eonp ortnumb ers
beforetheyc ani nt eropera te.Fore xamp l
e,whe naus eronc omput erAde cidest o
pl
aceaVoI Pp honec a l
lt oaus eronc omp uterB,t hea ppli
cati
ons of t
wa rene eds
tok now whi chp rotocolp ortnumb ert hea p
p l
ic
a t
ion on comp uterB i sus ing.
Therea ret wof unda me nta lap-pr
oa c
he st op orta ss
ignment.Thef i
rstap pr
oa ch
usesac ent r
ala uthor ity.Ev e
ryonea gr e
e st oall
ow ac e
ntralaut horitytoa ssign
portnumb ersasne e
de da ndt op ubl
isht hel i
stofa llassi
gnme nts.S oftwarei s
bui
lta c
cordingt ot hel ist.Thea pp
r oa
chi ss ome-timesc al
l
eduni v
er salassi
gnment ,
andt hep orta ssignme nt ss peci
fi
edb yt hea uthorit
ya r
ec all
edwe ll
-knownpor t
ass
ignment s.
I
np r
acti
ce,UDPde
mul
ti
pl
exi
nga
ll
owsa
nap
pli
cat
iont
osp
eci
fyma
tchi
ngonas
our
cep
orta
swe
ll
a
sade
sti
nati
onport.
S
ec.1
0.1
2 Re
ser
vedAndAv
ail
abl
eUDPPor
tNumb
ers 1
95

Thes econda pproacht oporta ss


ignmentus e
sdyna micbi
nding.Inthedynamic
b
indi
nga pp r
oac h,portsa renotg loba
llyknown.I nste
ad,whe neveranappl
icati
on
p
ro-gram ne edsa p rotocolportnumb er,p rot ocolsoftwarei nthe operati
ng
s
ystemc hoosesa n unuse dnumb era nda ssig
nsi tt ot heap pl
i
cati
on.Whe na n
a
ppli
cati
on ne edst ol e
a rnthe currentp rotocolp orta ss
ignmentson another
c
omp uter
,t hea pp
li
c a
t i
onmus ts endar equestt hata s
ksforap ortass
ignment
(
e.g.
, Wha tpor tistheVoI Pp hones erv
iceus -ing ?
).Thet argetmachi
ner e
pli
es
b
yg i
v i
ngt hep ortnumb e rtouse.
The TCP/IP de si
gnersa dopte
d a hyb ri
ds cheme t hata ss
igns some port
numb e
rsap ri
or i
,b utleav
eso the
rsa v
ail
abl
ef orlocalsi
tesora ppl
ic
a ti
onp r
ograms
toa ssi
gn dynamica l
l
y.The we l
l
-known p or
tnumb ersa ss
ignedb yt he cent
r a
l
authori
tyb eginatl ow valuesande xte
ndup wa
r d,leavi
ngl ar
geri ntege
rv al
ues
avai
labl
efordyna mi cas-s
ignment.Thet ab
leinFi gure10.
8l i
stsexamp l
esofwe ll
-
knownUDPp rotocolportnumb er
s.
Port Ke ywor d Descri
ption
0 - Rese r
v ed
7 echo Echo
9 discard Discard
1
1 systat ActiveUs ers
13 dayt i
me Dayt i
me
15 net st
a t Net wor kS tatusPr ogram
17 qot d Quot eoft heDa y
19 cha rgen Cha racterGe nerator
37 time Time
42 name HostNa meS erver
43 whoi s WhoI s
53 name se r
ver Doma inNa meS e r
ve r
67 boot ps BOOTPorDHCPS e
r ve
r
68 boot pc BOOTPorDHCPCl ient
69 tftp TrivialFil
eTr ansfer
88 ker beros Kerb e
r osS ecurityS er
vice
11
1 sunr pc ONCRe motePr ocedureCall(SunRPC)
123 ntp Net wor kTimePr otocol
1
61 snmp Si
mp l
eNe t wor kMa nagementPr otocol
162 snmp -trap SNMPt ra
p s
264 bgmp Borde rGa t
e wayMul t
icas
tPr otocol(BGMP)
389 l
da p Lightwe ightDi rectoryAccessProtocol(LDAP)
512 biff UNI Xc oms at
514 syslog SystemLog
520 rip Rout i
ngI nf orma ti
o nProtocol(RIP)
525 time d TimeDa emon
546 dhc pv6-c DHCPv 6client
547 dhc pv6-s DHCPv 6se rver
944 nsf Net wor kFileS ystem( NFS)servic
e
973 nfsv 6 Net wor kFileS ystem( NFS)overI Pv6
Fi
gur
e10.8Ex
amp
lesofwe
ll
-knownUDPp
rot
ocolp
ort
numb
ers
.
1
96 Us
erDa
tag
ramPr
otoc
ol(
UDP) Cha
p.1
0

1
0.1
3Summa
ry

Mode rnope rat


ings yste
msp er
mitmul ti
plea ppli
cati
onp rogramst oex e
cut e
con-c
ur rentl
y.TheUs erDa ta g
ram Protoc ol
,UDP,di sti
nguishesa mongmul tiple
appl
ic
a -
t i
onsonag ivenma chinebya l
lowings endersa ndrec ei
verst oa ss
igna1 6-
bitprotocolportnumb ert oea c
ha ppl
ic
ation.AUDPme s
sageinc l
udest wop rotocol
port numb erst hatide nti
fya nappli
cation ont he sending c omp uterand a n
appl
ic
a t
ionont hede s
tina-ti
onc omputer.S omeoft heUDPp ortnumb ersarewe l
l
knowni nt hesensethatt heya repermanent l
ya ss
ignedb yac ent ralauthori
tya nd
honoredt hroug
houtt heI nternet.Otherp ortnumb er
sa rea vail
ablef orarbit
rary
appl
ic
a t
ionp rogramst ouse.
UDPi sat hi
np rotocolint hes e
nset hatitdoesnota ddsigni
fi
c a
ntlyt ot he
seman-ti
c sofI P.I tme r e
lyp rovi
desa ppl
ica
t i
on progra
mswi tht hea bil
i
tyt o
communic a
teus -i
ngI Psunr el
iabl
ec onnecti
onles
sp ack
etde l
iv
erys ervi
ce.Thus ,
UDPme ssagescanb elost
,dup li
cated,delaye
d,o rdel
iveredoutofor de r
;ap a
irof
appl
ica
tionp rogra
mst ha
tus eUDPmus tb epr e
paredt oha ndl
et hee rr
or s
.I fa
UDPa ppli
cati
ondoe snotha ndl
et hee rrors,thea p
plic
ationma ywor kcorrectly
overahi g
hlyr el
i
ableLoc alAre aNe t-
wor kb utnotov eraWi deAr eai nternet
wherep robl
emsofde laya ndlossaremor ecommon.

Int heprotocollayer
ings cheme,UDPr esidesatLayer4,thet ransportlaye
r,
aboveLa yer3 ,t hei nte
r netl ayer,andb el
ow La yer5,t hea p
plicat
ion laye
r.
Conceptuall
y,t het rans
por tlaye risinde
p e
nd entoft heinte
rnetl ayer,b utin
prac
ticet heyinteractstrongly.TheUDPc hecksum i
ncl
udesap se
udo- headerwith
theIPs ourcea ndde sti
nat i
ona d-dres
sesinit ,meani
ngt hatUDPs oftwa r
emus t
i
nteractwi thIPsof t
wa ret ofindI Pad-dr
e s
sesb e
foresendi
ngdatagrams .

EXERCI
SES

1
0.1 Bui
ldt woprog
ramsthatuseUDPa ndme as
uretheave
ra g
et ra
nsf
ers
pee
dwith
messa
gesof256,512,1024,2048,4096,and8192octets.Canyoue
xpl
ai
nthe
res
ults
.(Hi
nt:whati
stheMTUoft henetworkyouar
eusing?)
1
0.2 Whyi stheUDPchec
ksum se
pa r
atefrom t
heI Pche
cksum?Woul
dyouobjec
ttoa
pro-
tocoltha
tusedas i
ngl
ec heck
sum f
ort hecompl
eteIPda
tag
raminc
ludi
ngt
he
UDPme s-s
age?
1
0.3 Notusi
ngche
cks
umscanbeda
nge
rous
.Explai
nhow as
ingl
ec or
rup
tedARPpa
cke
t
broa
dca
stb
yma c nePc
hi a
nmakei
timpos
sib
letore
achanothe
rma c
hi ,Q.
ne
1
0.4 S
houl
dt henot
ionofmulti
pl
ede s
tina
tionsi
dent
ifi
edb
ypr
otoc
olp
ort
sha
veb
een
b
uil
tint
oI P?Why,orwhynot?
1
0.5 Whatisthechi
efa
dva
nta
geofus
ingp
rea
ssi
gne
dUDPp
ortnumb
ers
?Thec
hie
f
di
sad-
vant
age
?
1
0.6 Whati
st hechi
efadvant
ageofusi
ngprot
ocolp
ort
sins
tea
dofp
roc
essi
dent
ifi
ers
tos
pec
ifythedest
ina
tionwit
hinamac
hine
?
Ex
erc
ise
s 1
97

1
0.7 UDPp rovi
desunr e
li
abl
eda tag
ramc ommuni
cati
onbeca
useitdoesnotguarant
ee
del
ive
ryoft heme ss
age.Devi
searel
iabl
edatag
ramprot
ocolt
hatusest
ime
outsand
ack
nowl-edgementstog ua
ranteede
liv
ery.How muc
hne t
workove
rheadanddel
ay
doesrel
i
ab i
l
i-tyint
roduce?
1
0.8 NameRegi
str
y.Suppos
eyouwa
ntt
oal
l
ow a
rbi
tra
ryp
air
sofa
ppl
i
cat
ionp
rog
rams
toe s
-tabl
ishc ommuni cationwi thUDP,b utyoudonotwi sht oa ssi
gne itherof
them af i
xedUDPp ortnumb er .Instead,youwoul dl ikepotent i
alcorrespondents
tob eidentifiedb y ac ha r
ac ters tri
ng o f 64 orf e
we rc haracter
s.Thus ,a n
appl
ic
ationonma chineA mi ghtwa ntt oc ommuni catewi tht he speci
al-l
ong- i
d
appl
ic
ationonma chineB.Me anwhi le,supposea na ppl
icati
ononma c
hineCwa ntst o
communicatewi tha na ppl
icationonma chineA t hatha schosena nID my-own-
pri
vate-
id.S how t hatyou onl y needt oa s-
sign oneUDP p ortt o ma kes uch
communicati
onp ossi
b l
eb yde s i
gnings oftwareone achma chi
net hata l
lows( a)a
l
ocala ppl
icati
on t op i
cka n unus ed UDP p ort numb er ov er whi c
hi t wi l
l
communicate,(b)al ocalappli
ca ti
ont oreg i
stert he64- charac
t ernamet owhi c
hi t
res
ponds,and( c)ar emo t
ea pp li
cati
ont ous eUDPt oe stab
li
shc ommuni cati
onus ing
onl
yt he64-cha r
a cterna mea ndde s
t i
nati
oni nterneta ddres
s.
1
0.9 Impl
eme ntthena mer egis
t r
ys of t
wa refromt hep re
viouse xer
c i
se.
1
0.1
0 SendUDPdatagramsa
crossawidea
reane
tworka
ndmeas
urethepe
rce
nta
gel
ost
andt hep
ercent
agereorde
red
.Doesthere
sul
tdepe
ndontheti
meofday?The
networkl
oad
?

1
0.1
1 Thest
andar
ddefi
nesUDPport7tobea
nechopor
t adat
agr
ams enttot
heecho
por
tissi
mplys
entbacktothese
nde
r.Wha
tc a
naUDPechoser
vic
et el
lamana
ger
tha
tanICMPechoserv
icec
annot
?
1
0.1
2 Consi
derap rot
ocoldesig
ni nwhichUDPa ndIPv4a r
eme r
ged,andanaddr
ess
consi
stsof48b i
tst ha
ti ncl
udeac onventi
onal32-b
itI Pv
4a ddr
essanda16-b
it
portnumber
.Wha tisthec hi
efdi
sadvant
a g
eofs uchascheme?
Chapt
erCont
ent
s
1
1.1 Introduc t i
on,1 99
1
1.2 TheNe e dForRe li
ab l
eS e rv i
ce,199
1
1.3 Prope rtiesOfTheRe l
iab l
eDe li
ver yS ervi
ce,200
1
1.4 Reli
a bi
lity: Ac k nowledg eme nts And Re transmi
ssion,
201
1
1.5 TheS lidingWi ndowPa ra digm,203
1
1.6 TheTr ans missi
onCont r olPr otocol ,205
1
1.7 Layer i
ng ,Por ts ,Conne c tions,AndEndp oi
nts,206
1
1.8 PassiveAndAc t iveOp ens ,208
1
1.9 Segme nt s,S trea ms,AndS equenc eNumb ers,208
1
1.1
0 VariableWi ndowS i
zeAndFl owCont r
ol,209
1
1.1
1 TCPS eg me ntFor ma t,21 0
1
1.1
2 OutOfBa ndDa ta,21 2
1
1.1
3 TCPOp t i
ons ,21 2
1
1.1
4 TCPChe cksumComp uta tion,21 4
1
1.1
5 Acknowl edgeme nts, Re tr ansmission, And Ti meouts,
216
1
1.16 Accur ateMe asur eme ntOfRoundTr ipS ample
s,218
1
1.17 KarnsAl g orit
hmAndTi me rBack off,21 9
1
1.18 Respondi ngToHi ghVa ria nceI nDe la
y,220
1
1.19 Respons eToCong estion,223
1
1.20 FastRe cov eryAndOt he rRe sponseModi fi
cati
ons,225
1
1.21 Expli
c i
tFe edba ckMe cha nis ms( S
ACKa ndECN) ,227
1
1.22 Cong estion,Ta ilDr op,AndTCP,228
1
1.23 RandomEa rl
yDe te
c ti
on( RED) ,229
1
1.24 EstablishingATCPConne ction,231
1
1.25 Init
ialS e quenc eNumb er s,232
1
1.26 Closi
ngaTCPConne ction,233
1
1.27 TCPConne cti
onRe s et,234
1
1.28 TCPS tat eMa c hine,235
1
1.29 ForcingDa taDe l
ivery,236
1
1.30 Reserv edTCPPor tNumb ers,237
1
1.31 Sil
lyWi ndowS yndr omeAndS ma l
lPa c
k e
t s
,238
1
1.32 AvoidingS il
lyWi ndowS yndr ome ,239
1
1.33 Buff
erBloa
tAndI
tsEf
fec
tOnLa
tenc
y,242
1
1.34 Summar
y,243
1
1

Rel
iabl
eStreamTr
ans
por
t
Ser
v i
ce(TCP)

1
1.1I
ntr
oduc
tion

Prev
ious c hap
terse x
plorethe unr el
iabl
ec onnect
ionlessp ac
ket deli
very
serv
ice,whichf or
mst heb as
isforal
lInternetcommuni cation,andtheI Pprotoc
ol
thatde f
inesit .Thisc hapterint
roducesa s econd keyp ie
ce oft he I
nt e
rnet
protoc
olsuite,ar eli
abl
es treamserv
iceimplementedb yt heTr ans
missi
onCont r
ol
Protoc
ol( TCP).We wi llseet ha
t TCP a ddss ubstanti
alf uncti
onali
tyt ot he
protoc
olsalreadydiscus
sed,a ndwewi l
lseet hatiti ssubstanti
all
ymor ecomp l
ex
thanUDP.

1
1.2TheNe
edForRe
li
abl
eSe
rvi
ce

Att helowe stlev


el,c omputerc ommuni c
ation networ
ksp rov i
deunreli
able
pac
ke tdeli
very.Packe
tsc anb elos
twhe nt ransmiss
ionerror
si nt
e r
f e
rewithda ta
orwhe nne t-workha r
dwa ref a
ils
.The ycanb ede l
ayedwhe nne tworksbecome
ove
rloaded.Pa ck
ets witc
hing systemsc ha
nger outesdynamical
ly,whi c
h me ans
the
yc a
nde li
verp a
cketsoutofor der
,de l
iv
ert he ma f
teras ubstanti
aldel
ay,or
del
iv
e rdupli
cates
.
Att hehighestlevel
,a ppl
icat
ionp rogramsoftenneedt os endlar
gev olumes
ofda tafrom onecomp utertoa nother.Usinganunreli
abl
ec onnect
ionl
essdeli
very
syst
emf orlarg etransfersb ec
ome st edi
ousa nd a
nnoying;p rog
ramme r
smus t
inc
orp ora
tee rrordet ec
tion and recoveryi nt
oe acha ppl
i
c at
ion.Becausei tis
dif
ficulttode s
ign,under-stand,andi mp l
ementsoft
wa rethatc or
rectl
yp rovi
des
rel
iabil
it
y,ne tworki
ng r ese
ar c
hersha ve wor kedtoc reateag enera
lp ur p
ose
s
olut
ion as
ing
ler
eli
abl
etr
ans
ferp
rot
ocol

1
99
200 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

t
hatallappl
i
cati
onscanuse
.Havi
ngasi
ngl
eg eneralp
urp
oseprot
ocolmea
nst hat
a
p-pl
i
cationprogr
ammersdonotnee
dtoincor
p or
ateareli
abl
etrans
ferprot
ocol
i
ntoeachappl
ic
ati
on.

1
1.3Pr
ope
rti
esOfTheRe
li
abl
eDe
li
ver
ySe
rvi
ce

The re
li
abl
et ra
nsf
ers er
v i
cetha
t TCP pr
ovide
stoa
ppl
i
cat
ions c
anb
e
c
har
a c
ter
izedbyfi
vefeat
ure
st hata
redis
cus
sedb
elow:
StreamOr ie
nt a
tion
Vir
t ualCir
cuitConnecti
on
Buff e
redTr ansf
e r
UnstructuredStream
FullDuplexCommuni ca
tion

St
r eam Orientati
on.When two ap
pli
cati
onp rog
ramsus eTCP tot r
ansf
er
l
argevolumesofda ta
,thedataisvi
eweda sas t
ream ofoctet
s.Theap
p l
ic
ati
on
onthede st
i-nati
onhos trec
eiv
esexac
tlythes a
mes equenc
eofoc te
tsthatwas
se
ntbyt hea pp
lica
tiononthesour
cehost.
Vir
tualCi
rcui
tConnec
tion.Bef
oredatatra
nsf
ers
tarts
,boththesendi
ngand
r
e-c
e i
vi
nga pp
li
cat
ionsmusta g
reetoest
abli
shaTCPconnect
ion.Oneappl
ic
ati
on
con-ta
ctst heot hert oi ni
tiateac onne c
tion.TCPs oftwa reont het wohos ts
communic a
teb ys endingme ss
a g
esa crosst heunde rlyingi nt e
rnet.The yverify
thatthet r
ansferisa uthor-i
ze da ndb oths idesa r
er eady.Onc eallde t
ail
sha ve
beensett l
ed,thep rotocolmo dulesinformt hea ppli
cationp r ogramsone ache nd
thatac onnecti
onha sb eene s
t abl
is
heda ndt ha tt r
ansferc anb egi
n.TCPmoni tors
datat ransfe
r;ifc ommuni cation fai
lsf ora ny rea-son ( e.g.,b ec
a usene t
wor k
hardwarea l
ongt hepathf ail
s),thea ppl
icati
onp rogramsa rei nformed.Weus et he
termv i
rtualcir
cuitt ode sc
ribeaTCPc onnect i
on,b ecauseac on-nec ti
ona c
tslike
ade di
catedha r
dwa rec i
rcuit,e v
ent houg ha llcommuni c at
ioni sp er-formedwi th
packet
s.
BufferedTransfer.Ap p
li
ca t
ionp rogramss endada tas treama c
rossaTCP
c
onne c-t
ion,r ep
e a
tedlyp ass
ing da ta octet
st othe protocolsof t
wa r
e .Whe n
t
ransferringdata,a na ppl
ic
ationus eswha teversizepiece
si tf i
ndsc onveni
ent;
t
hep i
ecesc anbeass mallasas ingl
eoc tet.TCPp l
a c
esdatai np a
ck e
tsa ndsends
t
hep a
cket stothede st
inati
on.Ont her ecei
vinghost,TCPi nsuresdatai spl
aced
i
nt heor i
g i
nalordersot heappli
c a
tionr e
-ceivesoc
t e
tsine xactl
yt hesameor der
t
heywe res e
nt.
TCPi sf r
eet odiv
idethes t
reami ntop acketsindependentoft hep ie
cest he
appli
ca-ti
onp rogra
mt rans
fers
.Toma ket ransf
e rmor eef f
ici
enta ndt ominimize
networkt raf-fi
c,impl
ementati
onsusua l
lyc ol
le
cte noug hda t
af rom as trea
mt o
fil
lar easonabl
ylargedatagr
amb e
foret ransmitti
ngi tacrossa nint ernet
.Thus ,
eveni ft hea ppl
ic
ati
on pro-gr
amg e
ne ratesthes tre
am oneoc teta tat ime,
transfe
ra crossanint
ernetcanb eeffi
-c i
ent.Simil
arly,ifthea ppli
cationp r
ogram
choosestog e
nerateextre
me l
yl ar
geb locksofda t
a ,thep rotocols oftwarec an
c
hoos
etodi
vi
dee
achb
loc
kint
opi
ece
stha
tea
chf
iti
ntoas
ing
lep
ack
et.
S
ec.1
1.3 Pr
ope
rti
esOfTheRe
li
abl
eDe
li
ver
ySe
rvi
ce 201

Fora ppl
icati
onswhe reda tamus tb etransfe r
redwi thoutwa iti
ngt of i
lla
buffer,t hes treams e
r v
icep rovi
desap us
h mec hanismt hata ppl
i
c ati
onsuset o
for
c eimme di
atet r
a nsfer.Att hesendings i
de,ap ushforcesprotocolsoftwareto
tra
ns fera l
lda tatha thasb ee
ng e
ner atedwithoutwa i
ti
ngt of il
lab uffer
.Ont he
rec
e i
vings ide,thep ushc ausesTCPt oma k
et heda t
aa vai
labl
et ot hea p
pli
cati
on
without de l
ay. The p ushf unc-ti
on onl yg ua rantee
st hata llda ta wil
lb e
tra
ns ferr
e d;i tdoe snotp rovidea ny boundaries.Thus ,e ven when deli
veryis
for
c ed,t hep r
otocols oftwarema yc hooset odi vi
det hes treami nune xpec
ted
waysori far ecei
vinga ppli
cati
oni sslow,da t
af roms everalpushedpa c
ketsma ybe
del
iveredt ot heapp l
ica
t i
ona l
la tonce .
Unstruct
uredSt ream.TheTCP/ IPstre
ams ervi
cedoe snotprovides t
ructured
datas tr
eams.Fore x
a mp l
e,ther
ei snowa yforap a
yr ol
lappl
ic
ationt oi de
ntify
thec ontent
so ft hes treama sbei
ngp ayr
olldata,norc anstreams er v
icema rk
boundariesbetwe ene mp l
oyeer e
cords
.Ap pl
ic
ation programsus i
ng t he stre
am
serv
icemus tunde rstands tr
eamc onte
nta nda g
r e
eonas tr
eamf orma tbefore
theyiniti
ateac onnection.
FullDupl ex Communi cation.Connec ti
onsp r ovi
dedb yt he TCP/ I
Ps tream
servi
cea ll
ow c oncurr e
ntt ransf erinb othdi rec
t i
ons .Suchc onnecti
onsa r
ec all
ed
fullduplex.Conc e
pt ual
ly,af ulldup l
exc onne ctionc onsi
st soft woi ndependent
datas treamsf low-ingi nop po sitedire
c t
ions;f rom a na ppl
icationspoi
ntofv i
ew,
thereisnoa p
p are
nti n- teractionb etwee nt het wo.TCPa ll
owsa na p
p l
icati
ont o
terminatef l
owi n one di r e
c tion while dat ac ont i
nuest of l
ow int he other
dir
e c
tion,ma kingt hec onnec tion hal
fdupl ex.Theadv antageofaf ulldup l
ex
connectioni sthatt heunde rlyingp rotocolsoftwa r ecanse ndc ontrolinforma t
ion
forones treamb ackt ot hes ourceinda t
a gramsc arr
yingda tai ntheop posi
te
dir
e c
tion.S uchp i
ggybac kingr educ e
sne tworkt r
a ffic.

1
1.4Re
li
abi
li
ty:Ac
knowl
edge
ment
sAndRe
tra
nsmi
ssi
on

Wes aidt ha tt her eli


a b
les trea
m de l
iverys ervi
ceg ua ranteesde li
veryofa
st ream ofda tas entf rom onec omputert oa notherwi thoutdup l
icat
ionorda ta
loss.Theque sti
ona rises
:how c anp r
otocols oftwareprov ider el
ia
b l
et ransferif
theunde rlyingc ommuni c
a -
t i
ons yst
em offerso nlyunreli
a bl
ep a
cketde li
very?The
ans we risc omp l
icate d,b utr eli
-abl
ep rotocolsr el
yonaf undame ntalte c
hnique
k nown a sp osi
tiveac knowledgementwi thr etransmi
ssi
on ( PAR).The t e c
hnique
re quiresar ecip
ient t o c ommunicate wi th t he sour ce,s ending b ack a n
ac knowledgement ( ACK)eac ht ime dat aarrivess ucc
essful l
y.Whe ni ts endsa
pa cket,t hes e
ndings oftwa res tar
tsat imer .I fana c knowledgeme nta r-ri
ves
be foret het imere xp i
res,t hesenderc ancel
st het i
mera ndp repar
est os endmor e
da ta.I ft he time re xpiresb eforea na c
k nowledge
me nt a r
rive
s ,t he sender
ret ransmitst hep acke t
.
Bef
ore we c
an under
stand t
he TCP retra
nsmis
sion mec
hani
sm,we must
c
onsi
deraf ewbasi
cs.Thesimpl
estpos
sib
ler et
rans
missi
onschemewait
sfora
g
ive
np ac
kettobeacknowl
edg
e dbef
oreitsendsthenextpack
et.Knownass
end-
and-
wai
t,t
hea
ppr
oac
hca
nonl
yse
ndonep
ack
eta
tat
ime
.Fi
gur
e11
.1i
l
lus
tra
tes
t
hep
ack
ete
xcha
ngewhe
nus
ings
end-
and-
wai
t.
202 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

Ev
ent
sAtS
ende
rSi
te Ne
twor
kMe
ssa
ges Ev
ent
sAtRe
cei
verS
ite

S
endPa
cke
t1

Rece
ivePa
cke
t1
Se
ndACK1

Rec
eiv
eACK1
S
endPacke
t2

Rece
ivePa
cke
t2
Se
ndACK2

Re
cei
veACK2

Fi
gur
e11
.1Thepa
cketexc
hang
eforabas
ics
end-
and-
wai
tpr
otoc
ol.Ti
me
pr
oce
edsdownthefi
gur
e.

Thel
eftsi
deoft hefig
ureli
stseve
nt sa
tthese
ndinghos
t,andtherights
ide
ofthef i
gureli
stseventsatther e
cei
vinghos
t.Eachdia
gonall
inecros
singthe
mid
dleshowsthetra
ns fe
rofonep ac
ketoroneACK.
Figure11.2usesthesamef ormatasFigure1
1.1toshowwha tha ppenswhe na
pack
e ti slost
.Thes endertransmitsap a
cketands t
artsat imer.Thep acketis
l
ost,whi c
h me ansno ACK wi llarriv
e.Whe nt he ti
me re xpi
res,the s ender
ret
ra nsmitsthelostpacket
.Thes e
ndermus tst
artat imera ft
err et
r ansmiss
ion
i
nc aset hes e
condcopyisalsolost
.I nthefig
ure,thesecondcopya rr
ivesi nt
act,
whichme anstherece
iversendsa nACK.Whe ntheACKr eac
hest hesendings i
de,
these ndercancel
sthet i
mer.
I
nourde sc
ripti
ona b
ove,as endermustret a
inac opyofap acketthathas
beentra
nsmit
tedinc asethepacke
tmus tberetrans
mitted.Inp r
acti
ce,as e
nder
onl
y needstor etai
nt heda t
at hatg oesint hep ac
keta longwi t
hs uffi
ci
ent
inf
ormati
ontoa ll
ow thesendertor econs
truc
tt hep ac
ke theaders
.Thei deaof
keepnguna
i c
knowledgeddataisimport
antinTCP.
Althoughi tha ndl
esp a ck
e tlossore xcessi
ve de lay,t he acknowle dgement
me c
ha -
nism de scrib
e da bove doe s not s olvea l
lp roble
ms :a p acketc anb e
dupli
cated.Dup li
-catesc ana ri
sei fa ne xcessi
ve de layc ause
sa s ende rt o
retransmitunne c
essari
ly.S olv-i
ngdup l
ic
ation r equiresc arefult houghtb ec
aus e
bothp acketsa nda cknowledgeme ntsc anbedup li
cat ed.Usually,re l
ia
blep rotocols
detect dup l
i
c a
t ep a c
ketsb ya ssi
gning e achp ack e
tas e
que nce numb era nd
requiri
ngt her e c
eivert ore memb erwhi c
hs equencenumb er
si tha sr ec
e ive
d.To
avoid a mbiguity, p osi
tiv
e a cknowledgeme nt p rotocols a r-ra
ng e f or e ac h
acknowledgeme ntt oc ontai
nt hes equencenumb e roft hep ackett hata r
-rived.
Thus,whe na na c
knowl e
dgme nta rri
v e
s,thea cknowl e
dg ementi sea s
il
ya ssocia
t-e d
withap ar
ticul
a rpacket.
Sec
.11
.4 Re
li
abi
l
ity:Ac
knowl
edg
eme
ntsAndRe
tra
nsmi
ssi
on
203

Ev
ent
sAtS
ende
rSi
te Ne
twor
kMe
ssa
ges Ev
ent
sAtRe
cei
verS
ite

packe
S
endPac
ket1 t
St
artTi
mer
los
s
Pac
ketshoul
dhavearr
ive
d
ACKwouldhaveb
e e
nsent
ACKwouldnor
ma l
ly
a
rri
veatthisti
me

Ti
merExp
ire
s

Re
tra
nsmi
tPacke
t1
Sta
rtTime
r
Rece
ivePa
cke
t1
Se
ndACK1
Re
ceiv
eACK1
CancelTi
mer

Fi
gur
e11
.2I
ll
ust
rat
ionoft
ime
outa
ndr
etr
ans
mis
sionwhe
nap
ack
eti
slos
t.

1
1.5TheS
li
dingWi
ndowPa
radi
gm

Beforee xami ni
ngt heTCPs t r
eams erv
ice,wene e dtoe xpl
or ea na ddit
ional
me cha-nismt ha tunde rlie
sr el
i
a bl
et rans
miss
ion.Knowna sas l
idingwi ndow,t he
me chanismi mpr ovesove ral
lthroughput.Tounde rs
tandt hemot i
va ti
onf ors l
iding
windows ,r ecal
lt hes eque nceofe ventsinFigure11.1
.Toa c
hiever eli
abil
ity,t he
sende rt ransmi tsa p a cketa nd then waitsf or ana c
k nowledg e
me nt b efore
transmitt i
nga nothe r
.Ast hefig-ureshows,dataflowsb etwe e
nt hema chinesone
packe t a t a t ime. The ne twork wi l
lr ema i
n c ompletely i dl
e unt i
lt he
acknowl edgeme ntr eturns.Ifwei ma gi
neane tworkwit hhight ransmissi
onde lays,
thep roblemb ec omesc l
ea r:

Asimpl
eposi
ti
veacknowl
edgementpr otoc
olwastesas ubs
tanti
al
amountofnet
workcapac
itybecaus
ei tmus tdel
aysendi
nganew
pac
ketunti
litrecei
vesan acknowledgementf orthepr ev
ious
pac
ket.

The s l
i
ding window t e chni
que us e
s a mor ec omplexf orm of p os
itive
acknowledge-mentandr et
r ansmissi
on.Thek e
yideaisthatas l
idi
ngwindowa l
lows
as endert ot r
ansmitmult i
p l
ep acketsbeforewaiti
ngf ora na c
knowl
e dg
eme nt.
Thee asi
estwa ytoe nvi
si
onas li
dingwindowina ct
ionistot hi
nkofas equenc
eof
packetstob etrans
mi t
-teda sFi g
ure1 1
.3shows.Thep r
otocolpla
cesasma l
l,fi
x ed
-si
ze window on t he se-quenc ea nd t
ransmit
sa llpacke
tst hatlieinsi
de t he
wi
ndow.
204 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

I
nit
ialwi
ndow

1 2 3 4 5 6 7 8 9 1
0 ...

(
a)Wi
ndow

s
li
des

1 2 3 4 5 6 7 8 9 1
0...

(
b)

Fi
gur
e11
.3(
a)As l
idi
ngwi ndow withei
ghtpac
ketsi
nt hewindow,and
(b)t
hewi ndow sl
idings
othatpa
cket9c a
nb esentbeca
use
anac-k
nowl e
dgeme nthasb
eenre
ceive
dforpack
et1 .

Wes aythatap acketisunacknowledgedi fithasb eentra ns


mittedb utno
acknowl
-edgementha
sb eenreceiv
ed.Tec hnic
a l
l
y,t henumberofp a
cketst hatca
n
beuna c
-knowle
dgedata nygiv
ent imeisc onstrai
nedbyt hewindows ize,whichis
l
imitedtoas mall
,fi
x ednumber.Fore xa mple,inas l
idi
ngwindow p rotocolwit
h
windows ze8,t
i hesenderispermitte
dtot ransmit8pa c
ketsb
e foreitr e
ce i
vesa
n
acknowl
edgement.
AsFigur
e1 1.3s
hows,onc ethesenderre
cei
vesanacknowle
dgementf ort
he
f
irs
tp ac
ketinsi
dethewi ndow,itsl
ides
thewindow a
longandsendst hene
xt
p
acket
.Thewi ndowsl
ide
sf orwar
de a
cht i
meanacknowl
edgementar
rives
.
Thep erformanc
eofs li
dingwindowp r
otocol
sdependsont hewi
ndows i
zea nd
thes p
eeda twhi chthenetwor kacc
eptspacke
t s
.Fi
gure1 1
.4showsane x
amp l
eof
theop erat
ionofas l
i
dingwindow prot
ocolforawi ndow si
zeofthreep ac
ket s
.
Notet hatt he sendert ransmi
tsa l
lt hreep ac
k etsb e
forer ec
eivi
ng any
acknowledgeme nt
s.
Withawi ndows izeof1,as l
i
dingwi ndowp rotocolisex a
ctlyt hesamea sour
si
mp l
ep os
iti
vea cknowledgementp r
otocol.Byi ncreasingt hewi ndow size,itis
poss
i-bl
etoe li
minatene tworki dl
et i
mec omple
tely.Tha tis,int hes t
e a
dys ta
te,
thesendercant ra
ns mitpacketsasf as
ta st henetwor kcant ransferthem.Tos ee
theadvantag
eofs l
idi
ngwi ndow,c omparet heratea twhi c
hda tai stransfe
rredin
Fig
ures11.
1a nd11.4.Thema i
np oi
nti s
:

Becauseawel l-tuneds l
idi
ngwindow prot
ocolkeepsthenet work
com- pl
etelysaturatedwi thpacket
s,itc anobtainsubstanti
al
ly
higher t hr
oughput t han a simple posi
ti
ve acknowledgement
protocol
.
Concep
tuall
y,asl
i
dingwindowprotoc
olal
wa ysr
ememb
erswhi
chpac
ket
shave
b
eenacknowle
dgedandkeep
sas epa
ratetime
rf oreac
hunac
knowl
edg
edpac
ket
.
I
fa
Sec
.11
.5 TheS
li
dingWi
ndowPa
radi
gm
205

packetisl ost
,t het i
me re xpiresa ndt hes enderret r
ansmitst hatp a c
ket.Whe n
thes enders li
desi t
swi ndow,i tmov e
sp asta l
la cknowledgedp ackets.Att he
rec
e i
vinge nd,t hep rotocolsof t
wa rek eepsa na nal
ogouswi ndow,a ccepti
nga nd
acknowledgingp ack e
tsa st heya r ri
ve.Thus,t hewi ndow pa r
t i
tionst hes e
quence
ofp acketsintot hrees ets:t hosep acketst othelef toft hewi ndow ha vebeen
success
fullytransmi tted,r ec
e i
ved ,anda c-k
nowl edge
d;t hosep acketst otheright
havenotye tbeent ransmitted;a ndt hosepacketsthatlieint hewi ndowa rebeing
tra
ns mitted.Thel owe s
tnumb er
e dp acketint hewi n-dow ist hef ir
s tpacke
ti n
theseque ncetha tha snotb e
e na cknowledged.

Ev
ent
sAtS
ende
rSi
te Ne
twor
kMe
ssa
ges Ev
ent
sAtRe
cei
verS
ite

S
endPa
cke
t1

Rece
ivePa
cke
t1
S
endPa
cke
t2 Se
ndACK1
Rece
ivePa
cke
t2
S
endPa
cke
t3 Se
ndACK2
Rece
ivePa
cke
t3
Re
cei
veACK1
Se
ndACK3

Re
cei
veACK2

Re
cei
veACK3

Fi
gur
e11
.4Ane
xamp
leofs
li
dingwi
ndowwi
thawi
ndows
izeoft
hre
e.

1
1.6TheTr
ans
mis
sionCont
rolPr
otoc
ol

Nowt
hatweunde
rst
andt
hep
rinc
ipl
eofs
li
dingwi
ndows
,wec
ane
xami
net
he
Tr
ans
mis
sionCont
rolPr
otoc
ol(
TCP)
,thep
rot
ocolt
hatp
rov
ide
sre
li
abl
est
rea
m
s
ervi
ce.Thestre
ams e
rvi
ceissos
igni
fi
cantt
hatt
hee
nti
reI
nte
rne
tpr
otoc
ol
s
uit
eisrefe
rre
dt oa
sTCP/IP.
Wewi llmakeak eydi
sti
nct
ionb etwe
ent heTCPp rotocolandthes oft
wa re
thatimp l
ement
sTCP.TheTCPp r
otocolprov
idesas pec
ifi
cati
ona na
logoust oa
bluepri
nt;TCPs oftwa
reimpl
ementst hespec
ifi
cati
on.Althoughitiss ometi
me s
convenie
ntt othinkofTCPasap iec
eofs oft
wa r
e,r e
adersshouldrecogni
zet he
dist
incti
on:

TCPi
sac
ommuni
cat
ionpr
otoc
ol,notapi
eceofs
oft
war
e.

Ex
act
lywha
tdoe
sTCPp
rov
ide
?TCPi
scomp
lex
,sot
her
eisnos
imp
lea
nswe
r.
Theprot
ocolspe
cif
iest
hef or
matofthedataandac
knowl
edge
mentsthatt
wo
comp
utersexc
hangetoachi
eveare
li
abl
etra
nsfe
r,aswel
lastheproc
edur
esthe
comp
utersus
et o
206 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

ensuret hatt he dataa rri


vesc orre
ctly. Itspeci
fi
es how TCP s oftware
dis
ting
uis
hesa mong mul ti
ple des
t i
nati
ons on a g i
ven ma c
hine
,a nd how
communicat
ingma c
hinesre-
coverfrom error
slikel
ostordupl
ica
tedp a
ckets
.The
protoc
olals
ospeci
fieshowtwoc omputersini
tia
teaTCPc onne
cti
ona ndhowt he
y
agreewhenitiscomp l
ete
.
I
ti sa ls
oi mportantt o unde rs
tand wha tt he p rot
oc oldoesnoti nclude.
Althought heTCP s pecif
icat
ion de s
crib
eshow a ppli
cation programsus eTCP i n
generalt e
r ms,i tdoe snot di ctatet he de ta
ilsoft he interfac
eb etwe ena n
appli
cati
onp r
og rama ndTCP.Tha ti s,thep rotocoldocume ntati
ononl ydi scusses
the op e
rationsTCP s uppli
es;i t doesnot s pe c
ifyt he e xactp rocedurest hat
appli
cati
ons i nvoket oa cces
st he op er
ations. The r ea-son for l eavi
ng t he
appli
cati
oni nterfaceuns pe
cifi
edisf lexi
bil
i
ty.I np art
icular
,b e
causeTCPs oftwa re
i
sp a
rtofac omp utersoperati
ngs ystem,itne edst oe mploywha teverin- te
r face
theop erat
ings ys t
ems uppli
es.Allowingimp l
eme ntersflexi
b i
l
ityma k e
si tp os
si-b l
e
toha veas i
ng l
es pec
ificat
ionf orTCPt hatc anb eus edt ob uil
ds oftwaref ora
varietyofc omput ersystems.
Beca
us ei
tdoe snotma kea ssump ti
onsa boutt heund er
lyi
ngcommunicati
on
sys-t
em,TCPc anb eusedacrossawi dev ar
ietyofunde r
lyi
ngnetworks.Itcan
runa cr
ossas atell
i
tewi thlongde lays,awi reles
sne tworkwhe r
ei nt
erfer
ence
causesma ny p
acketst obel os
t ,oral e
asedc onnecti
on in whi
ch del
aysvary
dramati
call
yde pe
ndingont hec urrentc ongesti
on.I t
sa bi
li
tyt oacc
ommoda t
ea
l
a r
gev a
rietyofunde r
lyi
ngnetwor ksisoneofTCP ss tre
ngths.

1
1.7La
yer
ing,Por
ts,Conne
cti
ons
,AndEndp
oint
s

TCP,whichr es
ide
si nthet ra
nspor
tlaye
rj usta boveI P,a l
lowsmul t
ipl
e
ap
p l
i
c at
ionprogramsonag ive
nc omputert
oc ommunicatec oncurr
e nt
ly,andit
demulti
ple
xesin-
comingTCPtraff
icamongtheappl
ic
ations.Thus ,i
nt ermsofthe
l
ayeringmodel
,TCPi saconc
eptualpee
rofUDP,asFigure1 1
.5s hows
:

Conc
ept
ualLa
yer
ing

Ap
pli
cat
ion

Re
li
abl
eSt
rea
m(TCP) Us
erDa
tagr
am(
UDP)

I
nte
rne
t(I
P)

Ne
twor
kInt
erf
ace
Fi
gur
e11
.5Thec
onc
ept
uall
aye
ringofUDPa
ndTCPa
bov
eIP.
Sec
.11
.7 La
yer
ing
,Por
ts,Conne
cti
ons
,AndEndp
oint
s
207

Al
thoughthe
ya reatt
hes
amec oncept
uall
aye
r,TCPandUDPp rov
idecompl
etel
y
di
f-fer
entserv
ice
s.Wewi
llunders
tandmanyoft hedi
ffe
renc
esa sthechapt
er
pr
oceeds.
Li
ket heUse
rDa ta
gram Protoc
ol,TCPusesp r
otocolportnumber
stoident
ify
ap-pl
ica
tionprog
rams.Als
ol i
keUDP,aTCPp or
tnumb erissi
xteenbi
tsl
ong.Each
TCP porti sass
igne
d as mallintegeruse
dt oi denti
fyi t.Itisimport
antt o
understandthatTCP portsa r
ec oncep
tual
lyindependentofUDP p or
ts one
appl
icat
ion ca
n useUDP p ort30,000 whi
lea nothera pp
li
cati
on us
esTCP port
30,000.
Wes ai
dt hataUDPp ortconsi
stsofaque uet hatholdsincomingdatagrams.
TCPp ortsaremuc hmorec omple
xb eca
useas i
ng l
ep or
tnumb erdoesnotide nti
fy
ana ppl
i-ca
tion.I nst
ead,TCPha sbeende si
gne donac onnec t
ionabstrac
t i
on in
whichtheob -je
ctst obeidenti
fiedareTCPc onne cti
ons,notindivi
dualport
s .Each
TCPc onnecti
oni sspeci
fi
edb yap airofe ndpoi
nt sthatcor r
espondt othep airof
communicati
ng a ppl
ic
a-ti
ons. Understa
nding t hat TCP us est he notion of
connecti
onsisc rucia
lb e
causeithe l
pse xpl
ai
nt heme ani
nga nduseofTCPp ort
numbe r
s:

TCPus estheconnec
tion,nott heprot
ocolport
,asits
fundamentalabs
trac
tion;connecti
onsareident
ifi
edbyapai
rof
endpoi
nts.

Ex actl
ywha ta rethe e
ndpointsofaTCPc onnection?Weha ves
aidt hata
con-nec ti
onc ons
ist
sofav irtua
lc i
rc uitb e
twe e
nt woa ppli
cati
onp r
ogr
a ms,soit
mightb ena turaltoa ss
umet hata na ppl
icat
ionp rogr a
ms erve
sa stheconnecti
on
endpoint.I ti sno t.Inste
ad,TCPde f i
nesa ne ndpointt obeap ai
rofi nteger
s
(host,p ort),whe rehostist heIPa ddr e
ssf orahos ta ndp ortisaTCPp orton
thathos t.Fore xample,anI Pv4e ndp oi
nt( 128.
1 0.2.3,25)s peci
fie
sTCPp ort25
ont hema chi
newi thI Pv4address
128.10.2.3.
Now tha t we have defi
nede ndpoi
nts
,iti se as
yt o under
stand TCP
c
onnect
ions
.Re cal
lthatac onnect
ionisdefi
nedbyi t
st woendp
oint
s.Thus,if
t
hereisac onnec
tionfrom machi
ne(18.
26.0.
36)atMI Ttomachi
ne(128.1
0.2.
3)
a
tPurdueUni v
ersi
ty,i
tmightb edefi
nedbytheendp
oints
:
1
(8.
26.
0.36,1
069)and(
128.
10.
2.3,25)
.
Meanwhil
e,anothe
rc onnec
tionmi ghtb ei
np r
og r
essfrom machi 1
ne(28.
9.0.
32)at
theInformati
onScie
nc e
sIns ti
tutetot hesamema c
hinea tPur
due
,ide
ntif
iedby
i
tsend-point
s:
(1
28.9.0.32,1184)and(128.1
0.2.3,53)
.

Sofar
,oure xample
sofc onnec
tionshavebeenstr
a i
ghtf
orwardbeca
usethe
p
ortsus
edata l
le ndpoi
ntsha
veb ee
nuni que
.However
,t heconnec
tiona
bstra
cti
on
a
ll
owsmultip
lec onnecti
onstos harea nendpoi
nt.Fore xampl
e,wec ouldadd
anot
herconne
c- t
iontothet woli
ste
da bov
ef r
om ma
chi 1
ne(28.
2.254.
139)at
CMUt ot
hema chi
neatPurdueus
ingendp
oint
s:
1
(28.
2.254.
139,1
184)and(
128.
10.
2.3,53)
.
I
tmi ghtsee
ms t
ranget
hattwoc
onnec
tionsc
anusetheTCPp t53onma
or chi
ne
1
28.10.2.
3s i
mul
tane
ous
ly,b
utthereisno ambi
gui
ty.Bec
ause TCP a
ssoc
iat
es
i
ncom-
208 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

i
ngmess
ageswit
hac onnect
ionins
teadofap r
otoc
olport
,itus
esb
othendpoi
nts
t
oide
ntif
yt heapp
ropri
ateconnec
tion.Thei
mport
antideator
eme
mberis:

Becaus
eTCPidenti
fi
esaconnecti
onbyapairofendpoints,a
giv
enTCPportnumberc
anbes haredbymul
ti
pl
econnec
tionson
thesamemac
hine.

From ap rogramme r
sp ointofv iew,thec onne c
tiona bs
tractionissig
nifi
cant.
Itme ansap r
ogramme rc ande viseap rogra
mt ha tprovidesc oncurre
nts ervi
ceto
multip
lec onne cti
onss imultaneously,withoutne edi
nguni quel ocalportnumb ers
fore achc on- nec
tion.Fore x ample,mosts ystemsp rovidec oncurrenta cc
essto
thei
re le
c t
r onicma ilserv
ice,a l
lowingmul ti
plec omput er
st os e
ndt heme lect
ronic
ma i
lsimulta neous
ly.Be -causei tus esTCPt oc ommuni cate,t hea ppli
cati
ont hat
acceptsincomi ngma ilonl
yne edst ouseonel oca lTCPp or t,e v
e nthoughmul ti
pl
e
connecti
onsc anproc ee
dc on-cur r
ently.

1
1.8Pa
ssi
veAndAc
tiv
eOp
ens

Unl ike UDP, TCP i sa c onnecti


on-orientedp r
otoc olt hatr e quiresb oth
endpoi ntst oa greet op artici
p ate.Thati s,beforeTCPt r aff
icc anpa ssa crossa n
i
nt erne t,a ppli
cati
onp rogramsa tb othe ndso ft hec onne ct
ionmus ta g reet hat
thec onne c ti
oni sdesired.Todos o,thea p p
li
c a
tionp rogram ononee ndp e
rfor ms
ap assiveopenbyc ontactingt hel o-ca
lop erati
ngs ystema ndi ndi
cati
ngt ha titwi l
l
accepta ni ncomingc onnec t
ionf oras peci
f i
cp ortnumb er .Thep rotoc olsoftwa re
prepar est oa cceptac onne c
tiona tthep ort.Thea ppli
cationp rogramont heot her
endc ant henp erforma na ct i
veopenbyr eque st
-ingt ha taTCPc onne cti
onb e
established.Thet woTCPs oft wa r
emodul esc ommuni -ca
t et oe s
tabli
sha ndv erify
ac onne ction.Onc eac onne cti
onha sbeenc reated,a pp
lic
a -ti
onp rogramsc anb egin
top a ssda ta;theTCP s of twa remodul esa te a c
he nde xchangeme ss
ag est hat
gua r
a nt eer e l
i
ab l
e de l
ivery. We wi l
lr e t
ur nt ot he de tail
s of e stabli
shing
conne ctionsa fterexa mini
ngt heTCPme s s
agef ormat.

1
1.9S
egme
nts
,St
rea
ms,AndS
eque
nceNumb
ers

TCP v
iewst
heda
tas
tre
ama
sas
eque
nceofoc
tet
stha
titdi
vi
desi
nto
s
egment
sfort
rans
mis
sion.Us
ual
l
y,e
achs
egme
ntt
rav
elsa
cros
stheunde
rlyi
ng
i
nt ernetinas i
ngleIPda tagra
m.TCPus esaspeci
ali
zeds l
i
dingwindow me chani
sm
thatop ti
mizest hroughputa nd handl
esf l
ow control.Liket hes li
ding window
protocoldescr
ibede arl
ie
r ,theTCPwi ndow mechanism makesitp ossi
b l
et os e
nd
multipl
es eg
me ntsb ef
orea na ck
nowl-edgementarri
v es
.Doings oi ncrease
st otal
throughputb e
causeitk eepsthenetworkb us
y.Wewi l
lseet ha
tt heTCPf orm of
as li
dingwindow p rotocolals
os ol
vest heend-to-end fl
ow controlpr oblemb y
a
ll
owingtherec
eiv
ertor e
str
ictt
rans
mis
sionunt
ili
tha
ssuf
fic
ientb
uff
ers
pac
e
t
oa c
commoda
temor eda
ta.
Sec
.11
.9 S
egme
nts
,St
rea
ms,AndS
eque
nceNumb
ers
209

TheTCPs l
idingwi ndow me chanism operatesa ttheo ctetl evel
,nota tthe
segme ntorp acketle v
el.Oc te tsoft heda tas t
rea ma r
enumb eredsequential
ly,
andas enderk eepst hreep oint e
r sassoci
atedwi the ve
ryc onne c
tion.Thep ointers
defineas li
di ngwi ndowa sFig ure1 1.6il
lustr
ates.Thef irstpointerma rksthel eft
oft hes li
dingwi n- dow,s epa
r atingoc tetsthatha veb eens enta nda ck
nowl edg
e d
from oc tetsye tt ob ea c-knowl edged.As ec
ondp oi
nterma rkst herightoft he
sl
idi
ngwi ndow a ndde finest hehi ghestocteti nt hes e
que ncet hatc anb es e
nt
befor e mor ea cknowledg eme ntsa r er e-cei
ved.The t hi
rdp ointer markst he
bounda ryins idet hewi ndow t hats eparate
st hoseoc tet
st ha tha vealrea
dyb e
e n
sentf rom t hoseoc tetst hatha venotb e
ens ent.Thep roto-colsof t
wa r
es endsa l
l
octet sinthewi ndow wi thoutde la
y,s ot heb oundaryins i
det hewi ndow usually
mov esf r
oml eftt orightqui ck l
y.

Cur
rentwi
ndow
.
.
.
.
.
.
1 2 3 4 5 6 .7 8 9 1
011...
.
.
.
.

Fi
gur
e11
.6Anexa
mp l
eofTCP ssli
dingwindow whe reoctetsthr
ough2
havebeensenta ndacknowl
edged,oc te
ts3t hrough6ha v
e
bee
ns entb utnota cknowl
edged,oc te
ts7t hough9 hav
e
notbeensentb utwil
lb ese
ntwi thoutde l
ay,andoctet
s10
andhi
gherca nnotbes
entunt i
lthewi ndowmov es.

Weha vede s
cri
bedhow t hes ender
sTCPwi ndow s l
idesa l
onga ndme nti
oned
thatther ecei
vermus tma i
nt ai
nas i
milarwi ndow t or ecreatethes tream.Itis
i
mp ort
antt ounderstand
,howe ver
,t hatb ecauseTCPc onnectionsaref ul
lduple
x,
twot r
ansfersproceedsi
mult a
neouslyov e
re ac hconnect i
on,onei ne achdire
cti
on.
Wet hi
nkoft het ra
nsfersasc ompletel
yinde pendentb ecausea tanyt i
meda tacan
fl
ow acrossthec on-necti
oni nonedi r
ec t
ion,ori nb othdi recti
ons.Thus,TCP
s
of twar
eonac omputerma intai
nst wowi ndowsp erc onne c
tion:onewi ndows l
i
des
alongasthedatas t
reami ssent,whiletheot he rsli
desa l
onga sda t
ai srecei
ved.

1
1.1
0Va
ria
bleWi
ndowS
izeAndFl
owCont
rol

Onedi fferenceb etweentheTCPs l


idingwindow p rotocola ndt hes i
mp l
i
fied
sl
i
d- i
ngwi ndow p rotocolpres
ent
edi nFigur e11.
4a r
isesb eca
us eTCPa ll
owst he
window si
zet ov a
ryov ertime.Eacha c
knowl e
dgeme nt,whi chspe c
ifieshow ma ny
octetshaveb eenr ece
ived,cont
ainsawi ndow adverti
sementt hats peci
fieshow
manya dditionaloc -
tetsofda tat herece i
verispr epar
e dt oa cceptb eyondt he
databeinga cknowledged.Wet hi
nkoft hewi ndowa dvertis
e menta ss pec
ifyi
ngt he
recei
ver
sc urrentb uffersi
ze.Inr es
ponset oanincreasedwi ndowa dverti
sement,
t
hes
ende
rinc
rea
sest
hes
izeofi
tss
li
d-

Fi
gure1
1.4c
anb
efoundonp
age
205.
21
0 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

i
ngwi ndow andp r
oceedst osendoc tet
st hatha v
enotb eena cknowl e
dged.I n
r
esponsetoade creas
edwi ndow adver
tis
e me nt,t hes e
nderde cre
ase sthes i
zeof
i
tswindowa ndst opssendi
ngoc t
etsbeyondt heb oundary.TCPs oftwa r
emus tnot
c
ontradic
tp revious adverti
sementsb ys hr i
nking t he window p astp reviousl
y
a
cceptabl
ep ositi
ons int he oc-tets t
r eam. I nstead, small
era dverti
seme nt
s
a
ccomp a
nya cknowledgements,sot hewi n-dow s izeonlyc hangesa tt het i
mei t
s
li
desforward.
Thea dva nta
geofus i
ngav ari
abl
es i
zewi ndow i
sthatitp r
ovide
st hea bil
it
y
to handl
ef low control
.To a voi
dr ece
ivi
ngmor edatat ha
ni tc ans tor
e,t he
re
c ei
verse ndss mall
erwi ndow advert
ise
me ntsasitsbufferf il
l
s.Int hee xtreme
ca
s e,ther e
c ei
vera d-v
e rt
isesawi ndow sizeofze rotos topa lltransmis
sions.
Later,whe nb uff
ers paceb e-c
ome savai
lable
,t herece
ive
ra dvert
ise
sanonze r
o
windowsizet otrigg
ert hef l
owofda taa g
a i
n.
Havingame chanis
mf orf l
ow c ontrolise s
s e
ntialina ne nvir
onme ntwhe re
comput-e r
sof v a r
iouss peedsa nd s i
zesc ommuni catet hrough ne t
wor ksa nd
routersofv ariouss pe
e dsa ndc ap a
c i
ti
es.The rea ret woi ndependentp roblems.
Firs
t,p rotocol
sne edt op r
ov i
dee nd-to-endf lowc ontrolbetweent hesour cea nd
ulti
ma t
ede s
tina ti
on.Fore x-ample,whe naha nd-helds mar
tp honec ommuni cates
withap ower f
uls upercomp uter,t hes martphonene edst ore g
ulatethei nfluxof
dataorp r
otoc ols oftwar ewillbeov errunqui ckl
y.Thus ,TCPmus timpleme nte nd
-to-end flow c ontrolt og uaranteer e
liabl
e de l
i
very.S econd,a me c
ha nism is
neededt hata llowsi nterme diatesystems( i
.e.
,r outers
)t oc ontr
olas our cet hat
sendsmor et raff i
ct hant hema chinec ant ol
erate.
Whenint
ermedia
temachinesbe
comeov erl
oade
d,t hecondit
ionisca l
l
edc onges
-t
ion, and mecha
nisms t
os ol
vet he probl
em a r
ec a
ll
edc onges
tion control
mechani
sms.TCPus esi
tss l
i
dingwi ndow sc
hemet os ol
vet hee nd-to-endf l
ow
c
ontrolp
roblem.Wewi l
ldiscusscongesti
onc ont
r olla
ter,butitshouldbenot e
d
t
hatawe ll
-designedproto-c
o lcande te
cta ndr ecoverfrom c
ongesti
on,whilea
p
oorl
y-des
ignedp rotoc
olwi l
lma kec ongest
ionwor s
e.I npart
icul
ar,ac ar
e ful
l
y
c
hos
enr etransmiss
ion sc
hemec a
n he l
pa voidc ongesti
on,butap oorl
yc hose
n
s
che
mec ane xace
r b
ateitb yaggres
siv
e l
yr e-
transmitti
ng.

1
1.1
1TCPS
egme
ntFor
mat

Theuni
toft
rans
ferb
etwe
ent
heTCPs
oft
war
eont
woma
chi
nesi
sca
ll
eda
s
eg-
ment
.Se
gme
ntsa
ree
xcha
nge
dtoe
sta
bli
shac
onne
cti
on,t
rans
ferda
ta,s
end
acknowl-
e dgements,a dver
tisewindow si
zes
,a ndc l
oseconnec
tions
.Bec
auseTCP
al
lowsp i
ggy-backing,anac knowle
dgementtravel
ingfromcomputerAtocomput
er
Bmayt ravelinthes ames egmentasdatatrav
e l
i
ngf rom c
omputerAtocomput
er
B,ev e
nt hought hea c
- k
nowl e
dgementrefer
stoda tasentfrom BtoA.
Therea ret woexcept
ionstotrans
miss
ionwhe nthewindow s
izei
sze r
o:asendertr
ansmi
tsa
segmentwi tht heurgentb i
ts e
twhe nurgentda tai
sa vai
l
abl
e,andas enderpr
obesaze r
o-s
ize
d
windowp er
iodic
a l
lyi
nc as
eanonze r
oadvert
isementisl
ost.
Inpra c
tice,pi
ggyback
ingdoesnotusuall
yoc c
urb e
causemostapp
li
cati
onsdonotse
ndda t
ain
bothdire
ctionssimul
taneousl
y.
S
ec.1
1.1
1 TCPS
egme
ntFor
mat 21
1

Li
kemostprotocol
s,amess
ageisdi
vi
dedi
ntot
woc onc
eptua
lparts
:aheader
t
hatcont
ainsmeta-dat
aa ndapayl
oadare
athatc
arr
iesdata
.Figur
e1 1.
7shows
t
heTCPsegmentformat.

0 4 1
0 1
6 24 31
S
OURCEPORT DES
TINATI
ONPORT
S
EQUENCENUMBER
ACKNOWLEDGEMENTNUMBER
HLEN RES
ERVED CODEBI
TS WI
NDOW
CHECKS
UM URGENTPOI
NTER
OPTI
ONS(
IFANY) PADDI
NG
PAYLOAD
...

Fi
gur
e11
.7TCPs
egme
ntf
orma
twi
thaTCPhe
ade
rfol
l
owe
dbyap
ayl
oad
.

Thehe a
de r,k nowna st heTCPhe ader
,c onsis
tsofa tl ea s
t20oc tetsa ndmay
con-tai
n mor ei ft he seg me nt c a
rr i
e soptions.The he ader ha st he ex p
ect
ed
i
de nt
ifi
cati
on a nd c ontroli nf ormation.Fi edsS
l OURCE PORT and DESTI NATION
PORTc ontai
nt heTCPp or tnumb erst hatidentifythea pp l
i
c ati
onp rog r
amsa tt
he
endsoft hec onnec ton.TheS
i EQUENCENUMBERf i
el
di dentifiesthep osi
tioninthe
sender
soc tets t
r eam oft he da t
ai nt he segme nt.The ACKNOWLEDGEMENT
NUMBER f ie
ldi denti
fiest henumb eroft heoc tett hatt hes ourcee x p
e c
tsto
recei
vene xt
.Not et hatt hes equencenumb err e
ferst ot hes tre
a mf lowinginthe
samedirecti
ona st hesegme nt ,whi l
et heac-knowledgeme ntnumb err eferstothe
strea
mf lowingi nt heopp ositedi rect
ionf romt hes egment .

TheHLENf i
e l
dcontai
nsanintegert ha
ts p e
cifi
esthelengthofthesegment
he
aderme a
sur
edin32- bi
tmulti
ple
s.I tisneededb ecaus
et heOPTIONSfie
ldvarie
s
i
nl e
ngth,depe
ndingonwhi choptionsa r
ei ncluded.Thus,t hesi
zeoft heTCP
he
adervari
esdepe
ndingont heopti
onss el
ected.The6- bi
tf i
el
dma rkedRESERVED
i
sreser
vedforfutureuse(alat
erse ct
iondescribesap r
oposeduse).
S
ome s eg
me ntsc arr
yo nl
ya na c k
nowledg e
me nt,whi l
es ome c a
rry data
.
Other
sc arr
yr equeststoest
abl
i
shorc loseac onnection.TCPs of
twa r
eus e
st he6
-bi
tf ie
ldla-beled CODE BI
TS to de
te rmi
net hep urposea nd cont
entsoft he
segment.Thesixb i
tstel
lhowtointerpretotherf ie
ldsint heheaderaccor
dingto
thetabl
einFigur e11.
8.
TCPs oft
warea dver
tis
e show muchdataitiswilli
ngt oa c
cepte ver
ytimei t
s
endsas egmentb ys pec
ifyingitsbuf
fers i
zeint heWI NDOW f i
eld.Thef i
el
d
c
ontai
nsa 1 6-b
it unsig
nedi nte
gerin networ
k-standardb yte order.Window
a
dvert
ise
me ntsprovideane x ampl
eofp i
ggybac
kingb eca
us etheya ccompa
nya ll
s
egment
s,inc
ludi
ng t
hos
eca
rry-
ing da
taa
swe
lla
sthos
eca
rryi
ng onl
yan
a
cknowl
edg
ement.

TheTCPsp
eci
fi
cat
ions
a heHLENf
yst iel
di heof
st fsetoft
heda
taa
reawi
thi
nthe
se
gment.
21
2 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP)
Cha
p.1
1

Bi
t(l
efttori
ght
) Meaningifbitsetto1
URG Urgentp ointerf i
eldisval
id
ACK Acknowledge mentf ie
ldisval
id
PSH Thissegme ntr equestsapush
RST Resetthec onnecti
on
SYN Synchronizes equencenumb ers
FIN Senderha sr eachedendofi tsbyt
est
rea
m

Fi
gur
e11
.8Bi
tsoft
heCODEBI
TSf
iel
dint
heTCPhe
ade
r.

1
1.1
2OutOfBa
ndDa
ta

Althoug hTCPi sas tr


eam-or i
e nte dp rotocol,itiss ometimesimpor t
a ntfor
thep ro- grama tonee ndofac onne c
tiont os endda taoutofb and,wi t
hout
waiti
ngf ort hep r
o-grama ttheot he re ndoft heconnecti
ont oconsumeoc tets
alr
eady i nt hes tream.Fore xamp le ,whe n TCP i susedf orar emot ede skt
op
appl
ication,t heuserma yde c
idet os endak eyboards e
quencet ti
ha nterruptsor
abortst hec urrentl
yr unni
ngp rogra m.S uchs ignal
sa remos toftennee dedwhe n
ana ppl
icationo nther emotema chinef reezesa ndf ai
lstor e
spondt omous ec l
icks
ornor ma lk eys
trokes.Theinter
r upts ig
na lmus tb esentwi thoutwa i
ti
ngf orthe
remotep rogramt or eadocte
tsa lrea dyi nt heTCPs tream( oronewoul dnotb e
abl
et oa b
or tprogramsthatstopr ea dingi nput).
Toa c
commoda teout-of-b a
nds i
gnali
ng,TCPa l
l
owst hesendert ospe
cif
yda ta
asurgent,me aningthatt her ec
eivi
nga ppl
i
c a
t i
onshouldbenot i
fie
dofi tsa r
r i
val
asquicklya sp oss
ibl
e,r egardl
essofi t
sp ositi
on int hestream.Thep rotocol
sp
ecifi
est ha
twhe nur gentda taisf ound,t her e
ceiv
ingTCPs houldnot i
fyt he
appl
icat
ionp r
o grama s
sociat
-e dwitht hec onnecti
ont og ointo urg
entmode .
Afte
ra llurgentda tahasb eenc on-sumed,TCPt el
lsthea p
pli
cati
onp rogramt o
ret
ur ntonorma loperat
ion.
Theexactde t
ail
sofhow TCP i nf
ormsa na pp
li
cation a
bouturgentda t
a
dependonthec omputer
soper
ati
ngs yst
em.Theme chani
sm usedt omar
kur ge
nt
datawhent ransmi
tti
ngi tinase gmentconsi
stsoft heURG c odebi
ta ndthe
URGENT POINTER fie
ldint hesegmenthe ade
r.Whe nt heURG b iti
ss et
,the
URGENTPOI NTER fi
eldspec
ifi
esthep os
iti
onint hesegme ntwhereurge
ntda t
a
ends
.

1
1.1
3TCPOp
tions

AsFigure11.7indic
ates,aTCPhe adercancontai
nze roormor eop t
ions;t
he
nextsecti
onse xpl
ai
nt hea vai
l
ab l
eop t
ions.Eachopti
onb egi
nswitha1 -octetfi
el
d
thatspeci
fiestheop t
iontypef ol
lowedb ya1 -
octetlengthfi
eldthatspeci
fiest
he
si
zeoft heop tioninoc te
ts.Re cal
lthatt heheaderlengthissp
e ci
fie
di n32-bit
multi
ple
s.I ftheo pti
onsdonotoc cupya nexactmultipl
eof32b i
ts,PADDING is
a
dde
dtot
hee
ndoft
hehe
ade
r.
S
ec.1
1.1
3 TCPOp
tions 21
3

1
1.1
3.1Ma
ximum S
egme
ntS
izeOp
tion

As enderc anc hooset hea mountofda tat hati sp lacedine ac


hs egme nt.
Howeve r,bot he ndsofaTCPc onnectionne edt oa g reeonama xi
mum s e
g me nt
theywi lltrans f
e r.TCPus e sama ximum s egments ize( MSS)opt iont oallow a
recei
vert os pe c
ifyt hema x-imum s i
zes egme ntt hati tiswi l
li
ngt orecei
ve .An
embedde dsys t
e mt ha tonlyha saf ew hundr edb ytesofb uffers pacecans pecify
anMS St hatr e
s tri
ct ssegme ntssot heyf itint heb uffer
.MS Sne goti
ationi s
espec
iall
ys igni
f i
cantb ecausei tpermit sheterogene -
ouss ystemst oc ommuni cate
as upercomp ut erc ancommuni cate wi th as ma l
lwi re-l
esss ensornode .To
maximizet hroug hput ,whe nt woc omp utersattacht ot hes a
mep hysi
calnetwor k,
TCP us uall
yc omp ute sa ma xi
mum s egment size s ucht hatt he resul
t-ing I P
datagramswi llma tc ht hene tworkMTU.I ft hee ndp ointsdonotl ieont hes ame
physi
calne twor k,t heyc ana ttemptt odi s
covert hemi nimum MTUa l
ongthep ath
betweent hem,or c hoose a ma ximum s e gment s ize equa lt ot he minimum
datagramp ay-loa ds i
ze .

Inag e
neralinternete nvi
ronment,c hoosingag oodma xi
mum s egments i
ze
canb edi ffic
ult
,b ecaus ep e
rformancec anb ep oorf ore it
here xt r
eme l
yl a
rge
segments izesore xtremelys mallsegments izes.On t heoneha nd,whe nt he
segments izeissma l
l,ne t-workut i
l
izati
onr ema inslow.Tos eewhy,r ecal
lthat
TCP s eg
me ntst ra
v e
le nca
p s
ulate
di nI P da t
a gramswhi cha r
ee nc aps
ulate
di n
physic
alne tworkf rame s.Thus,e achf ra
mec a r
r i
esa tle a
st20 oc tet
sofTCP
headerp lus20 oc t
etsof I P header( IPv6i slarger).The ref
or e,da t
agrams
carryi
ngonl yoneoc te tofda t
aus ea tmos t1 /41oft heunde rlyi
ngne twork
bandwidthf ortheda tab ei
ngt ra
nsferr
e d(les
sf orI Pv6).
On t heot herha nd,e xtr
eme l
yl a
rges egmentsizesc ana l
soproducep oor
p
erfor-
ma nc
e.La rgesegmentsr es
ultinlarg
eI Pdatagrams.Whe nsuchdatagrams
t
ravela c
r os
sap a
th wi thsma l
lMTU,I P mustf r
ag mentt hem.Unli
k eaTCP
s
egment,af r
ag -
me ntc a
nnotb eacknowle
dg e
dorr etransmi
ttedindep
endently;al
l
f
ragmentsmus ta rri
veort hee nti
reda ta
gram mustb ere t
ransmi
tted.Ift he
p
robabi
lit
yofl osi
ngag i
venf ra
g-menti snonzero,increa
singt heseg
me nts i
ze
a
bovet hef ragmentationt hr
esholdde-cr
e a
sesthep robabi
li
tyt hedatagram wil
l
a
rri
ve,whi chde c
reasesthroughput.
Int heory,t heop timum segme nts ize,S ,oc curswhe ntheI P da tagrams
carryi
ngt hes e gme ntsarea slargea sp ossi
blewi thoutr equiri
ngf r
a gment at
ion
anywherea longt hep ath,from thesour cet othede stinati
on.Inp racti
ce,f i
nding
S meansf i
ndingt hep athMTU,whi chi nvolvesp robing.Foras hort-li
vedTCP
connecti
on( e.g.,whe reonlyaf e
wp a cketsaree xchang ed)
,p r
obingc a nintroduce
dela
y.S econd,b ecauser outersinani nternetc anc hanger outesdyna micall
y,t he
pathda tagramsf oll
ow b et
wee nap a i
rofc ommuni ca ti
ngc omput ersc anc hange
dynamical
lya nds oc anthes i
zea twhi c
hda -t
agramsmus tbef ragme nted.Third,
theop t
imum s izede p
endsonl ower-l
e velprotocolhe aders(e.g.
,t heTCPs eg ment
si
zewi l
lb es ma l
leri ftheI Pda tag
ra mi ncl
udesI Pv4op -ti
onsorI Pv6e x
te ns
ion
headers
).
21
4 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

1
1.1
3.2Wi
ndowS
cal
ingOp
tion

Becauset heWI NDOW fi


eldintheTCPhe aderis16b i
tsl
ong,thema xi
mum
s
izewindowi s64Kb yte
s.Alt
houghthewindowwa ssuf
fici
entf
ore a
rlynetworks
,
alar
gerwi ndowsizeisneededtoobta
inhighthroug
hputonane twork,suc
ha sa
s
atel
li
tec han-nel
,thathasal arg
ede l
ay-band
widthproduct(
inf
ormallycal
le
da
l
ongfatpipe).
Toaccommodatelar ge
rwindow size
s,awi ndow sc
ali
ngopt ion wasc r
e ated
forTCP.Theo pti
oncons i
stsofthreeoctet
s:at ype,ale
ng t
h,a ndas hiftvalue,
S.Inesse
nc e
,theshif
tv al
uespec
ifi
esab i
naryscal
ingfact
ort ob eappli
edtot he
window v
alue.Whe nwi ndow s
cal
ingisine ffe
ct,ar ecei
vere x
t ra
ctst hev alue
fr heWI
om t N-DOW fi
eld,W,a ndshifsW l
t eftSb i
tstoobtainthea ctualwindow
si
ze.
Severaldetai
lscompli
catethede s
ign.Theop tioncanb ene goti
atedwhe nt he
con-necti
on i si ni
tial
l
y e sta
bli
shed, in whi ch c as
e a lls ucce
ssi
ve wi ndow
adverti
sementsa rea s
sumedt ous et heneg oti
ateds c
ale
,ort heoptionc anb e
speci
fi
edone a
chs egment,inwhi c
hc a
set hes cal
ingfactorc anv a
ryf r
om one
segmentt oa nother.Furthermore,ife i-
the rsideofac onnecti
on implements
window scali
ngb utdoesnotne edtos cal
eitswi n-dow,thes idesendst heoption
settoze ro,whichma kesthescal
i
ngf actor1.

1
1.1
3.3Ti
mes
tampOp
tion

TheTCPt imestampopt ionwasi nventedt ohelpTCPc omputet hede l


ayon
t
heunde rl
yingne twork.Itc anals
oha ndlet hec a
sewhe reTCPs eque ncenumb er
s
32
e
xceed2 ( known a sProt ectAgai nstWr appedSequenc e number ,PAWS
s )
.I n
a
ddit
iont ot her e
quiredt ypea ndle ngthf i
e lds,at i
me s
tampop ti
oni ncludest wo
v
alues
:at i
me stampv a
luea nda ne chor e
plyt imestampv al
ue.As ende rplacesthe
t
imef rom itsc urrentc l
oc ki nthet imesta mpf ie
ldwhe ns endingap a
c k
et;a
r
ecei
verc opi
e st hetime s
ta mpf ie
ldi ntot hee c
hor epl
yf ie
ldb ef
or er et
urninga n
a
cknowledgeme ntf ort hep acket
.Thus ,whe na na cknowledge
me nta rrives
,t he
s
endercana ccur atel
yc omp utethet ot alel
ap sedtimesincethes eg
me ntwa ssent.

1
1.1
4TCPChe
cks
umComp
uta
tion

TheCHECKS UM fi
el
di ntheTCPhe aderisa1 6-bitonescomp l
eme ntc hecksum
usedt ov erifythei
ntegri
tyo ft heda t
aa swe l
last heTCPhe ader.Aswi thot her
chec
k -sums ,TCPuse s16-bi
ta rithmeticandt akest heone
sc omp l
eme ntoft he
one
sc omple-mentsum.Toc omp utet hec he
cksum,TCPs oftwa r
eont hes ending
machinef ollowsaproceduresimilartot heonede s
cribedinCha pter1 0f orUDP.
Concep tua
lly,TCPprependsap seudo-headertot heTCPs egment,a p
p endse noug h
zerob itst oma kethes egmentamul t
ipl
eof1 6b its
,a ndc ompute st he1 6-b i
t
chec
k sum ov ertheentir
er es
ult.Aswi thUDP,t hep seudo-headerisnotp artof
thes eg ment,andisne vertrans mit
tedi nap a ck
et.Att her ecei
vings i
te,TCP
s
oftwaree
x t
rac
tsfi
el
dsfrom t
heIPheader
,r e
con-s
truct
sapse
udo-hea
der
,a nd
p
erformsthesamechec
ksum comp
uta
tion toveri
fyt ha
tthesegmentarri
ved
i
nta
c t
.
S
ec.1
1.1
4 TCPChe
cks
umComp
uta
tion 21
5

Thep urposeofus i
ngaTCPp seudo- heade risexactlyt hesamea sinUDP.I t
al-
lowst her ec
eivert ov e
rifyt hatthes egme ntha sreachedt hec orre
cte ndpoi
nt,
whichin- c
ludesb otha nI Pa ddressa ndap rot oc
olp or
tnumb er.Bot hthes ource
andde st
inationI Pa ddress
esa r
ei mp ortantt oTCPb e
ca us
ei tmus tus et hemt o
ident
ifyt hec onnectiont owhi cht hes egme ntb el
ongs.The refore,whe nevera
datagrama rriv
esc arryingaTCPs e
g me nt,I Pmus tpasst oTCPt hesour c
ea nd
desti
nati
onI Pa ddressesf r
om t heda - t
a grama swellast hes e
gme ntitsel
f.Figure
11.
9s howst hef o r
ma toft hep seudo- headerus edi nt hec hecksum comp utat
ion
forIPv4a ndFi gure1 1
.10showst hef orma tf oranI Pv6p seudo-header.

0 8 1
6 31
S
OURCEI
PADDRES
S
DES
TINATI
ONI
PADDRES
S

ZERO PROTOCOL TCPLENGTH

Fi
gur
e11
.9The12oc
tetsoftheIPv4p
seudo-
hea
derus
edi
nTCP
c
hec
ksumcomput
a t
ions
.

0 4 1
2 1
6 24 31

S
OURCEADDRES
S

DES
TINATI
ONADDRES
S

TCPLENGTH
UNUS
ED(
MUS
TBEZERO) NEXTHEADER

Fi
gur
e11
.10The40oct
etsoft heIPv
6ps
eudo-
hea
derus
edi
nTCPc
hec
k
-s
umcomputa
tions.

Of course,t he IPv4 ps
eudo-heade
r usesIPv4 s ourc
ea nd desti
nat
ion
addres
sesa ndt heI Pv6pseudo
-headerusesIPv6addres
ses.ThePROTOCOLf iel
d
(IPv
4)ort heNEXTHEADER f i
el
d( IPv
6)isassi
gnedthev aue6,t
l hev a
luefor
datagr
amsc a
rryingTCP.TheTCPLENGTHf i
e l
dspeci
fi
est hetot
all
e ng
thoft he
TCPs eg
me ntincludingtheTCPhe a
der.
21
6 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

1
1.1
5Ac
knowl
edge
ment
s,Re
tra
nsmi
ssi
on,AndTi
meout
s

Be cause TCP s ends da ta i n v ariab l


e l e ng th s egme nt s a nd b ecause
retransmit ted s egments c an i nclude mor e da ta t han t he or igi
na l
, a n
acknowl e
dg eme ntc annote asil
yr efert oada t
ag ra m oras eg ment.I nstead,a n
acknowl e
dg eme ntr eferstoap ositi
oni nt hes t
r ea m us ingt hes trea ms equence
numb ers. The r ec ei
verc oll
ec ts data oc te t
sf r om a rriving s eg mentsa nd
reconstruc tsa nexa c
tc opyoft hes tre
a mb eings e nt .Be causes egment stravelin
IPda tagr ams ,theyc anb el ostorde li
vere doutofor der;t her ece
iv erusest he
sequencenumb erine achse gme ntt ok now whe ret heda tai nt hes egme ntf i
ts
intot hes t
re am.Ata nyt i
me ,ar ecei
verwi llha v er econstruc tedze roormor e
octetsc ont iguousl
yf rom t he b eg i
nning of t he s tream,b ut ma ya lso have
additi
ona lp i
e cesoft hes tre amf r
om s eg me ntst ha ta rr
ivedoutofor der.The
recei
ve ra lwa ysacknowl e
dge st hel ongestc ontiguousp refi
xoft hes tre
a mt hat
hasb eenr ec ei
vedc orrect
ly.Ea cha c-knowl ed geme nts peci
fiesas equenc evalue
oneg reat ert hant hehighes toc tetp osi
tioni nt hec ont iguousp refi
xi tr ecei
ved.
Thus,t hes e nderre ce
ivescont inuousf eedb ackf r om t her eceive rasi tp rogres
ses
throug ht hes trea
m.Wec ans umma r i
zet hisi mpor ta nti dea:

ATCPac knowledgementspeci
fiesthesequenc
enumberoft
he
nextoc
tett hatt herec
eiverexpec
t st
or ecei
ve.

TheTCPa ck
nowl e
dg ements chemei sc a
ll
edc umulativebecauseitr eportshow
muc hoft hestream ha saccumul a
te d.Cumul ati
v ea c
knowledgeme ntsha v
eb oth
advan-tagesanddisadvantages.Onea dvantageist hatacknowledgeme ntsa reb oth
eas
y t o g enerat
e a nd una mbiguous. Anot he r a dva
ntage i s t hat l ost
acknowledgementsdonotne c
e s
sari
lyf or c
er etransmis
sion.Ama j
ordi s
a dvantage
i
st hat t he sender doe s not r e -
ceive infor mat
ion a bout a l
ls uc c
e s
sful
tra
ns mis
sions
,b utonl ya b
outa s inglep osi
ti
on i nt he str
e amt hatha sb ee
n
rec
e i
ved.
Tounde rstandwhy l ackofi nformat i
on a b
outa llsucce
ssfult ra
ns miss
ions
mak e
sc umul ati
vea cknowle dge
me ntsle s
se ffic
ient,thi
nko fawi ndow t hats pans
5000 oc t
et sstarti
nga tp osi
tion1 01int hes tream,ands upposet hes enderha s
transmitteda lldatai nt hewi ndow b yse ndi
ngf iv
es egments.S upposef urther
thatt hef i
rsts egmenti sl ost,b uta llot her
sa rri
vei nta
ct.Ase achs egme nt
arri
ves,t he r ecei
vers endsa na ck
nowl edge-ment,b ut eacha cknowledg e
me nt
spe
c i
fiesocte t101,thene x thighestcont i
guousoc te
tite xpect
st or ece
ive.The re
i
snowa yf ort her ece
ive rtot el
lt hes endert hatmos toft heda t
af ort he
currentwi ndowha sa rri
ved.
I
noure xample
,whenat i
me outoc cursatt hese nder
ss i
de,asendermus t
cho
oseb et
we entwop ote
nti
all
yi ne f
fic
ientscheme s
.I tma yc hooset
or et
ransmit
onesegmentora l
lfiv
esegments.Re transmitt
inga l
lfivese g
me ntsi
sineff
ici
ent.
Whent hefir
sts e
g-mentarri
ves,t hereceive
rwi l
lhavea lltheda t
ainthewindow
and wil
la c
knowledge 51
01.Ift he senderf oll
owst he ac c
e pt
edstandarda nd
ret
rans
mi t
sonl yt he fi
rst unac
-knowl
edgedsegment,it must wai
tf or the
ack
nowledgement beforeitc an dec
ide wha
ta nd how mucht os e
nd.Thus ,
ret
rans
mi s
sionreve
r tstoas end-
and-wai
tp a
radi
gm,whichlos
est headv
a nt
ages
ofhavi
ngal argewindow.
S
ec.1
1.1
5 Ac
knowl
edg
eme
nts
,Re
tra
nsmi
ssi
on,AndTi
meout
s 21
7

Oneoft hemos timp ortanta ndcompl


exideasinTCPise mbeddedint hewa y
ithandlestime outa ndr etr
ansmissi
on.Likeotherrel
i
abl
ep rotocols
,TCPe x
pe c
ts
thedes-tinationt osenda cknowledgement
swhe nev
eritsucc
e ss
fullyrecei
vesne w
octe
tsf rom t heda t
as tream.Ev erytimeitsendsasegment,TCPs ta
rtsat imer
andwa itsf ora na c-
k nowl
ed g
eme nt.Ift hetimerexpi
resb eforeda t
ai nt he
seg
me ntha sb eena cknowl-edged,TCP assumesthatthes egme ntwa slostor
corr
up t
eda ndr et
ransmi t
sit.
To unde rs
tand why t he TCP r etransmis
sion a l
gorithm di f fe
rsf rom t he
algorithm us edi nma nyne tworkp rotocols
,wene edt or ememb ert hatTCPi s
intende df orus eina ninternete nvironme nt.Ina ni nternet,as egme ntt ravel
ing
betwe enap airofma chinesma yt rav er
seas i
ngleLoc alAre aNe t
wor k(e .
g.,ahi gh
-speedEt he rnet),oritma yt r
a v
ela crossmul ti
pleinterme diatene t
wor kst hr
oug h
mul ti
ple r out er
s. Thus ,i ti si mp ossi
b l
e to k now a p ri
or i how qui ckly
acknowl edg eme ntswi l
lr eturnt ot hes ource.Furt her-mor e,t hede laya te ach
route rde pe ndsont raf f
ic,sot het otalt i
mer equir
e df oras eg-me ntt ot rav
e lto
the de s t
ina tion and a na cknowledg ement t or eturnt ot he s ourcec a nv ary
drama ticall
yf rom onei nstantt oanot her.Tounde rstand,c onsi
de rt hewor l
df or
whi c
hTCPwa sdesig
ne d.Figure1 1
.11ill
ustratesthes ituationb ys howingme asure-
me ntsofr oundt ri
pt i
mes( RTTs )f or1 00c onsecut i
vep acke
tss enta crosst he
globalI n-te rnetoft he1 980s.
Although mostmode rn ne t
wor ksdo notb ehavequitea sb adl
y,t hep l
ot
il
lustrate sthes i
tuati
onst ha tTCPi sde s
igne dt
oa c
commodate:incredi
blylong
delaysa ndchangesint her oundt ri
pde l
ayonag i
venconnec
tion.Toha ndlethe
si
t uation,TCPus esana dapt i
ver et
ransmi
ssional
gor i
thm.Thati s
,TCPmoni t
ors
the r ound t ri
pt ime on e achc onnect
ion and computesreasonabl
ev al
ue sfor
ti
me out s .Asthep er
forma nceofac on-nectionc
ha nges
,TCPr evis
esitst i
meout
value( i.e.,i
tadaptstot hec hange).
Toc ol
l
ectt heda t
ane e dedf ora na dapti
vea l
gorithm,TCPr ecordst het i
me
atwhiche achs e
g menti ssenta ndt het imea twhicha na c
k nowledgeme nta rr
ives
fortheda taint hats egment .Fr om t hetwot imes,TCPc omp utesane l
apsedt i
me
knowna sar oundt r i
ps ample.Whenev eritobtainsane wr oundt rips a
mp le,TCP
musta dj
ustit sno t
ionoft hea verager oundt ri
pt i
mef ort hec onnection.Todo
so,TCPus esawe ight-eda vera get oe sti
ma t
et her oundt ript i
mea ndus ese ac
h
newr oundt ripsamp let oup -dat et hea vera
ge.Theor igi
na laveragingt echni
que
usedac onstantwe ighti
ngf a ctor,,whe r
e0<1 ,towe ig
htt heol da verag
e
agai
nstthel a
t es
tr oundt ri
ps amp le
:

RTT = RTT+(1
)Ne
w_Round_
Tri
p_S
amp
le

Theideaist hatchoosi
ngav al
uefor cl
oseto1ma ke
st hewei
ght
eda ver
age
i
mmunet ochangesthatla
stashor
tt i
me(e.
g.,asi
ngl
esegmentt
hatencounter
s
l
ongde l
ay).Choosi
ngav al
ueforclos
eto0ma k
estheweig
htedav
erageres
pond
tochangesindela
yv er
yquick
ly.
Whenits e
ndsasegment,TCPcomput
esatime
outva
lueasaf unc
tionofthe
current r
ound tri
pe s
timat
e.Ea r
lyimpl
ement
ati
onsof TCP us
e dac ons
tant
weighti
ngf a
ctor, ( >1),andma detheti
meoutgr
eaterthanthec ur
rent
roundtripavera
ge:

Ti
meout=RTT
Ala
ters e
c t
ionexp
lai
nshow t
hec omputat
ionhasb ee
nmodi
fie
dinsub
sequentver
sionsofTCP.
Thes i
mpl
ist
icf ormul
aus e
dine ar
ly TCP impl
ementat
ionsmake
si te
asyto under
stand thebas
ic
conc
e p
tofar ound-tr
ipest
ima
tethatchang
e soverti
me.
21
8 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

1
0s

x. .
.. . x
x

.. .
.. .
x
.. .
8s x.x. . .
. x
.
.
. . .
.
. .
.
. .
.
. .
.
. .
.
. .
. . .
x
. . .
. x. .
.
. .
.
. . .

6s
. x .
. . .
. . x. .
. .
.
. .
. .
. x
.
.
.

.
.
. .
.
. .

. .

Ti
me . . x.x. .
. ..
.
.
xx . . . . .
. x ..
. .
.
.
. . .. . xx
. . .
. x. ..
. x .
. . . . .
.
. . .
. . . .
. . .

. x x. . .
..
.
.

. .
. . . x.x.
x.x. .. . .
. . .
. . . .. x. .
x x
4s . . . . . .. . . ..
.
.
. .
. x . x . .. x.
.
. x x. . x... .
.. xx . .

. . x. .
xxx . . . . .
.
. x. .
. . . x .
.. x . . .
.

. x. x. .
.
.
.
. . . .
..
. .
.
.. .
.
. . x

x.
. .. . . x . .. .
. . . ..
. . . . . . . x. . .
.
. .
. . x. . .
. . . . . x . .. x

x.x.
.
. . . . . x. . . . . .
.
. . .
. . . . . .
. . . . . .
. . ..
. . . . x
.
. . . . . . x x . .

x .
x.
. .
. .
. . .
. . x.
. .x . . . . x . . . .
.
. . x. . x. . . x . .
. . .. . x. xx x . . . x
x .
. . . . . ..
. .
.
. . . . x . . .. x .
.
x . x . . . x . x. x. .x
. .
.. . . . . . x . x
.

x x x . .
x .
.
.x x . .
2s
..
x . . .. . . .
. . .. xx.x .
. x .
.
. ..
. .
. x
x
.
.

x .
. x.

x.

1
0 20 30 40 50 60 70 80 90 1
00
Da
tagr
am Numb
er

Fi
gur
e11
.11Anext
remec as
ef orTCP:ap lotofInter
netroundtri
p
ti
mesfrom t
he1980s.Alt
houghtheInt
ernetnowope
rat
es
wit
hmuc hl
owerde l
ay,del
ayss
til
lva
ryovertime
.

Wec
ans
umma
rizet
hei
dea
spr
ese
nte
dsof
ar:

Toac commodatethev aryi


ngdelaysencounter
edinani nter
net
en-vi
ronment,TCP us esan adaptiv
er et
rans
miss
ion al
gori
thm
thatmoni-tor
sdelaysoneac hc
onnectionandadjus
tsitsti
meout
parameterac-c
ordi
ngly.

1
1.1
6Ac
cur
ateMe
asur
eme
ntOfRoundTr
ipS
amp
les

I
nthe
ory, me
asur
ing a r
ound t
rips
amp
lei
str
ivi
al i
tcons
ist
s of
s
ubtra
ctingt hetimea twhi c
ht hesegmentissentfrom thetimeatwhichthe
a
cknowledgement arriv
es. However,compli
cat
ions ari
seb ec
ause TCP us
esa
c
umulati
v eacknowle
dgeme ntschemeinwhic
ha na c
knowledg
ementrefer
stodata
r
ecei
ved,a ndnottot heinsta
nceofa
S
ec.1
1.1
6 Ac
cur
ateMe
asur
eme
ntOfRoundTr
ipS
amp
les 21
9

s
peci
fi
cda t
agramt hatcarri
edt heda ta.Consi
derar etra
nsmissi
on.TCPf ormsa
s
eg-ment,pl
acesitinada tagrama nds endsit
,thetimere xpi
res,andTCPs ends
t
hes e
g-mentag a
ininas econdda tagram.Be c
aus
eb othda t
a g
ramsc ar
rye xac
tly
t
he same seg-
me nt data,the s e
nde r has no way of k nowing whethe
ra n
a
cknowle
dgementc orr
espondst ot heor igi
nalorretransmitted da
tagra
m.Thi s
p
henomenonhasb ee
nc al
l
eda cknowl
- edgementambi
guity.
Should TCP a ssume a na ck nowledgeme nt be l
ong swi tht he earlie
st( i.e.
,
origi
nal
)t ransmiss
ion or t he la t
est( i.e.
,t he mos tr ecent r etransmis
sion)?
Surpri
singl
y,ne i
thera s
-sump ti
onwor ks
.As so
c i
atingt hea cknowledgeme ntwi th
theor i
g i
nalt ra
nsmissi
onc anma k ethee s
timatedr oundt r i
pt imeg row without
bound inc as eswhe rea ni nterne tlose sda tagrams .I fa na cknowledgeme nt
arri
vesa fte
roneormor er etr
ans missi
ons,TCPwi llme asuret her oundt ri
ps amp l
e
from theor i
g i
naltransmis
s i
on,a ndc omp uteane wRTTus ingt hee xcessi
vel
yl ong
sample.Thus ,RTTwi l
lg row sli
g htl
y.Thene xtt imeTCPs endsas e
g ment,t he
l
a rg
erRTT wi l
lr e
sultins lig
htlyl ong e
rt imeouts,s oifa na c-knowledgeme nt
arri
vesa fte
roneormor er etra
ns missi
ons,t hene xts amp l
er oundt riptimewi llbe
evenlarger,a ndsoon.
Associati
ngt hea ck nowl edgeme ntwi tht hemos tr ec entr e transmiss i
onc an
alsof ai
l.Cons i
de rwha tha p p
e nswhe nt hee nd- to-endde lays udde nlyi ncreases.
Whe nTCPs endsas egme nt,i tus e stheol dr oundt ri
pe sti
ma tet oc omp utea
timeout,whi c
hi snow t oos ma ll
.Thes egmenta rrivesa nda na ck
nowl edg ement
startsb ack,b ut t he i ncre a
s ei n de l
ay me anst he time re xpiresb ef oret he
acknowledge menta rrives ,a ndTCPr etr
a nsmitst hes e
gme nt.S hortlya f terTCP
retransmits,t he f ir
sta cknowl edg ement a rrivesa nd isa ssoc i
ated wi tht he
retransmiss
ion.Ther oundt ri
ps amp lewi l
lbemuc ht oosma l
la ndwi l
lr esulti na
sl
ightde creaseoft hee stimat edr oundt ri
pt i
me ,RTT.Unf or tunate l
y,l owe ri
ng
thee sti
ma tedr oundt ript i
meg ua r
a nteesthatTCPwi l
lsett het imeoutt oos mall
fort hene xts e
g me nt.Ul t i
ma tely,t hee s
t i
ma t
e dr oundt ript imec ans t
ab il
izea ta
value,T,s ucht hatt hec orr ectr oundt ript imei ss li
g htl
yl onge rt ha ns ome
mul t
ipeofT.I
l mp l
e me nt ati
onsofTCPt hata ssociatea c
knowl edg eme ntswi t
ht he
mos trecentr e-tr a
ns mis si
onwe reob servedinas tab l
es ta
t ewi thRTTs l
ig htl
yl ess
thanone -
ha l
foft hec or re
c tv alue( i.
e.,TCPs endse achs e
g me nte xact l
yt wi c
e
event houghnol ossoc cur s).

1
1.1
7Ka
rn
sAl
gor
ithmAndTi
merBa
ckof
f

Iftheor i
ginaltr ans
missi
ona ndt hemos trec e
ntt rans
missionb othf ai
lt o
provi
dea c
curater oundt ripti
me s
,wha ts houldTCPdo?Thea cceptedansweri s
si
mp l
e: TCP should not up datet he round t r
ipe s
timatef or r et
ransmitted
segments
.Thei dea,k nowna sKarnsAlgorithm,av oi
dst heproble
m ofa mbig
uous
acknowl
edgementsa l
togetherb y onlya djust
ing the e s
timat
edr ound tripf or
unambig
uousa ck nowledgements(a ck
nowl -
e dgementst hata rr
ivef or se
gme nts
thathaveonlybe entransmitte
donc e).
Ofc
our
se,as
imp
li
sti
cimp
leme
nta
tionofKa
rn
sal
gor
ithm,onet
hatme
rel
yig
-nor
estimesfrom r
etr
a ns
mi t
tedseg
ments,ca
nleadtofai
lur
easwe l
l.Cons
ide
r
whathappenswhenTCPs endsas egme
nta ft
eras ha
rpincr
eas
einde l
ay.TCP
comput
esat imeo
utusingt heexi
sti
ngroundtri
pesti
mat
e.Thet i
meoutwil
lbe
toosmal
lforthe

Theest
ima
tec
anonl
ygr
owa
rbi
tra
ril
yla
rgei
fev
erys
egme
nti
slos
tat
l
eastonc
e.
220 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

new del
ayandwi
llforc
eret
ransmi
ssi
on.I
fTCPignor
esa c
knowl
edg
eme
ntsfr
om
re-t
rans
mitt
edse
g ment
s,i
twi l
lneverupda
tet
hee sti
mateandthecyc
lewil
l
conti
nue.
To a ccommoda t
es uchf ai
lures
,Ka rnsa l
gorit
hm r equiresthe sendert o
comb i
ner e
- tr
ansmis
sion timeoutswi h at
t imerbac koffs trate
gy.Theb a
ck off
techniquec omputesani niti
altimeoutusingaf ormulaliket heoneshowna bove.
Howe ver,ift het i
me re x-pi
resa ndcausesar et
ransmiss
ion,TCPi ncre
a s
est he
timeout .Inf act,eacht i
mei tmus tr e
t r
ansmitas eg
me nt,TCPi ncre
a s
est he
timeout ( to k eep t imeouts f rom b ec
oming r i
di-
culously long
, mos t
i
mp leme nt
at i
onsli
miti ncreas
est oa nupperb oundt hatisla r
gerthant hede lay
alonga nyp athintheint e
rnet).
I
mpl
eme
ntati
onsuseav ar
iety of te
chni
que
st ocomp
uteb
ack
off
.Mos
t
c
hoos
eamul
tip
li
cati
vef
act
or,
,a ndsetthenewvalueto:

ne
w_t
ime
out=t
ime
out

Typi
cal
ly, is2.( Ithasbeena rgue
dthatva
lue
sof l es
sthan2 l
eadto
i
nstab
il
iti
es.
)Otherimpl
ement
a t
ionsuseat
abl
eofmult
ipl
i
cat
ivefa
ctor
s,a
ll
owi
ng
arb
itr
aryb a
ckof
fa teac
hstep.
Karn
sal
gor
ithm c
omb
inestheba c
kofftec
hniquewithroundt
ripe
sti
mat
ion
t
osolv
et hep
robl
emofneveri
ncrea
singroundtri
pe s
tima
tes
:

Karns al
gorit
hm: when c omputing t
he round trip est
imate,
i
gnor esamplesthatcorres
pondt or et
ransmit
tedsegments,but
useabac koffstrat
egy and retainthet i
meoutv al
uef rom a
ret
r ans
mittedpacketforsubsequentpacket
suntilav al
idsample
i
sobt ai
ned.

Ge nerall
ys peaking,whe na ni nternet misbe
ha ves
,Ka rn
sa l
gorithm s ep
ar ate
s
comp ut a
- ti
ono ft het i
me outv al
uef rom thecur r
entr oundt r
ipe s
tima te
.I tus e
s
ther oundt r
ipes -ti
matet oc omputea niniti
alt i
meoutv al
ue,b utt henb ac
k soff
thet ime outone a c
hr e-t
r ans
mi ss
ionunt i
litca nsuccessful
lyt rans
f eras egme nt.
Whe ni ts endss ub s
equents eg-ments,TCPr eta i
nst hetime outv al
uet hatr esult
s
from b ackoff.Fi nal
ly,whe na na c-knowle
dge menta r
r i
vesc orrespondi
ng t oa
segme ntt hatdi d notr equirer etransmi
ssi
on,TCP r ecomp utest her ound t ri
p
estimat ea nd re s
etst he t i
me out accordi
ngly.Ex p
eriences hows t hat Ka rn
s
algori
t hmwor kswe lleveninne tworkswi thhighp ac
k etloss
.

1
1.1
8Re
spondi
ngToHi
ghVa
ria
nceI
nDe
lay

Resea
rchi ntor ound t r
ipesti
mati
on ha ss hown t hatt he computati
ons
des
cribeda b
ov edonota da pttoawi der angeofv ar
iati
oni nde la
y.Que ue
ing
the
or ysuggeststha
tt heroundtri
pt i
mei ncreas
esproportionalto1/(1L)
,whe re
List hecurrentnetworkload,0L<1 ,a ndthev ar
iati
oni nr oundtripti
me ,,
2
isproporti
onalto1 /
(1L) .I faninterneti srunni
nga t50% ofc apaci
ty,we
exp
ec tther oundtri
pde l
ayt ovar
yb yaf a c
-torof4f romt heme anr oundt ri
p
ti
me.Whe nt
heloadr
eache
s80%,weexpec
tav a
ria-t
ionbyaf
acorof25.The
t
ori
gi
nalTCPst
anda
rdspe
cif
iedt
hete
chni
quefores
timati
ng

BSDUNI Xusesatab
leoffac
tors
,butval
uesint
hetablea
ree qui
val
enttousi
ng=2.
PhilKarndev
elop
edtheal
gori
thmforTCPcommuni
cat
ionacr
os sahi
gh-l
ossa
ma t
eurr
adi
o
connect
ion.
S
ec.1
1.1
8 Re
spondi
ngToHi
ghVa
ria
nceI
nDe
lay 221

roundtri
ptimet
hatwede
scri
bedearl
i
er.Us
ingtha
tt e
chni
queandl
imit
ingto
thesugg
este
dvaueof2me
l ansther
oundtri
pest
imati
oncanada
pttoloadsofa
t
most30%.
The1 989s p
eci
fi
cationf orTCPr equire
simp le
me ntat
ionstoe st
imateb otht he
aver-ager oundt ri
pt i
mea ndt hevarianceandt ouset hee s
timatedva ri
ancei n
pl
a c
eoft hec onsta
nt.Asar esul
t,ne wi mplementati
onsofTCPc ana dapttoa
widerr ang e of vari
ation in de l
aya nd yie
lds ubstanti
all
y higherthr oughput.
Fortunately,t heapproxi-
ma tionsr e
qui reli
ttlecomp utati
on;extremel
ye ffi
ci
e nt
programsc anb ederiv
e dfromt hefoll
owi ngsimpleequati
ons:

DI
FF=S
AMPLEOl
d_RTT

S
moot
hed_
RTT=Ol
d_RTT+DI
FF

DEV=Ol
d_DEV+(DI
FF Ol
d_DEV)

Ti
meout=S
moot
hed_
RTT+DEV

whereDEVi sthee sti


matedme ande viati
on,i saf ra
c t
ionb et
we n0a
e nd1t hat
con-tr ol
show qui c
k l
yt hene ws amp lea ffect
st hewe ighteda v
e r
age, i sa
fractionb etween0a nd1t hatc ontrolshow quickl
yt hene ws ampleaffec
tst he
me a
nde viat
ion,a ndi saf actort hatc ontrol
show muc ht hedev i
ati
ona f
fects
ther oundt riptimeout.
Toma ket hec omputa
tione ffi
c i
ent,TCPc hoose
s a nd t oe achb ea n
n
i
nv er
s eofap owe rof2,s cal
est hec omput a
tionby2 f orana ppropri
aten,a nd
usesint ege
ra ri
t hmet-i
c.Resea
rchs ug g
e s
tsusingvaluesof:

3
=1/2
2
=1/2

=4

The or
igi
nalval
ue f
or in 4.
3BS
D UNI
X was 2. Af
tere
xpe
rie
ncea
nd
meas
urement
sitwasc
hang
e o4i
dt n4.
4BSDUNI
X.
Toi l
lustratehowc urre
ntv ersi
onsofTCPa daptt ocha ngesinde l
ay,weus ed
arandom- numberg eneratort oproduceas etofr ound-tript i
me sandf edt heset
i
ntot her ound-tri
pe stimatede s
cribeda bove.Figure1 1.
12i ll
ustrat
est her esul
t.
Thep lots howsi ndiv
idua lround-triptime splotteda sind i
vidualpointsa ndt he
comput e
dt imeoutp lot-teda sas ol
idline.Not ehow t her etransmis
siont imer
vari
esa st he round-tript ime changes.Al thought he r ound-tri
pt i
me sa re
arti
fic
ial,t heyf oll
ow ap attern obser
ve dinp rac
tice:s uccess
ivep ac
k et
ss how
smal
lv ari
a ti
onsinde laya stheovera l
laverager i
sesorf al
ls.
Notet hatfrequentcha
ngei nthe r
ound-t
ript
ime,incl
udi
ng a cyc
le of
i
ncrea
sea nd de
crease
,c a
np roduc
ea nincre
aseinthe ret
rans
mis
sion ti
mer.
Fur
thermore,al
thoughthetimertendstoinc
reas
equi
ckl
ywhe ndel
ayr is
es,it
doe
snotde
cre
asea
sra
pidl
ywhe
nde
layf
all
s.
222 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

1
00ms

.
...
....
.
.
.
80ms .. ..
.... .. .
. ..
....

. . .. .
. .
. . .
. .
.. . ....
..
.
....... ..
. ...
.
.. .
.. . .
.

.
.
..

60ms ..
. .
. .
.
..
.
...
.
..

. ..
. .
...

. . ...
. .
. . ..
..
. . .
.
40ms ..
..
.
.. .
.
. . .
.
.
. .... .
..
. . .
. .
.
.
.
.
.
. . . .
. ....
. .
. .......
.. .
.
.. . .
.
.
20ms ... . .
.
.
...
.
..

.
....
..
.

20 40 60 80 1
00 1
20 1
40 1
60 1
80 200
Da
tagr
amNumb
er
Asetof200(randomlygene
rated
)r ound
-tri
pti
messhown
Fi
gur
e11
.12as
dot
s,andtheTCPr et
rans
missi
ontimershownasasol
id
l
ine.

Al
thought he r andomly-generated datai l
lus
tratest he a l
gorithm, iti s
i
mp ort
antt os eehow TCPp erf
ormsonwor stcas
eda t
a.Figure1 1.1
3us est he
measurementsf rom Fi
g ure11.11toshowhowTCPr espondstoa ne xtremec a
seof
vari
ancei n del
ay.Re -cal
lt hatt he goali sto havet he retransmissi
on timer
est
imate t he a ctual r ound-tri
p t ime a s cl
osely a s p ossi
ble wi thout
underes
timating.Thef i
gures howst hatalthoughthet i-
me rrespondsqui c
kly,it
canunde re
stimat e
.Fore xamp l
e,b etweent hetwos uccess
ivedat a
g ra
msma rked
witharrows,t hede la
ydoub l
e sfrom les
st han4s econdst omor et han8.Mor e
i
mp ort
ant,t hea bruptc hangef ol
lowsap e
r i
odofr elati
vestabi
lityinwhi cht he
v
ariati
onindela
yissmal
l
,ma k
ingiti
mp os
sib
leforanyal
gori
thmt
oanti
ci
pat
et he
c
hange.Int hecas
eoftheTCPa l
gori
thm,b ec
ausetheti
meout(
app
rox
imate
ly5
s
econds) subst
anti
al
ly unde
rest
imat
es t he large del
ay, a
n unnece
ssary
r
etransmi
ssi
onoc-
Sec
.11
.18 Re
spondi
ngToHi
ghVa
ria
nceI
nDe
lay
223

cur
s.Howev
e r
,theretra
nsmis
sionti
merres
pondsqui
ckl
ytot hei
ncr
eas
einde
lay,
meani
ngthatsuc
ces
siv
ep ac
ketsarr
ivewi
thoutret
rans
miss
ion.

1
0s

x
x..
.. .
x

.. .
.
. .
x
.. .
8s x
.x. .
.
. x
.
.
. . .
.
. .
.
. .
.
. .
.
. .
.
. .
. . .
. x. .
. x. .
. .
. .
.
x
.

6s
. .
. .
. .
. . x. .
. .
.
. .
. .
. x .
.
.

.
.
. .
. ..

. .

Ti
me . .
xx .
x.x. .
.
.

.
..
.
.
. .

. x . .. .
..
. . .. . xx
. . .
. .. . x
. x .
. . . . .
. . .
. . . . . . . .
. .
. . x x . .
..
.
. . . x.x.
x.x. ... . .
. .
. . . .. x. . .
x x
4s . . . . . .. . . ..
.
.
. . . x . .. x . .. x.
.
. x x. . x. .
.. xx . .

. . x. . xxx . . . . .
. .
. x. . ..
x .
. . . x .
.. . .. .

. x. x. .
. . . . . . ..
.
.
.
.

. . . . . x . .. .
.
x
..
.
. .
.
..
.
.
.
. . . . .
.
. . .. . x x
. . .
x. . . . . x . .. x

..
.
. . . . x. . . . .
.
xx
. .
. . .
. . . . . .
. . . . . .
. . . . . . . . x
.
. . . . . x. . x x .

.
x. . .
..
. x.. . . . . .
. . x . . . x . .
.
.
. . x. . x. . . x . .
. . . . x. xx x . . . x
.
x
. . . . . . .
...

. . .x . . x
.
x . x
. . . . .
.
x . .
x . x.. .
.
x
. . . . x .
. x

.
x x
.
. x .
2s
. . x. . x. .

.x . .
x . . .. . . .
.
. . x x .
x .. x .
. x
.. .. . .
.
x
. .
x . .
x.

x
.

1
0 20 30 40 50 60 70 80 90 1
00
Da
tagr
am Numb
er

Fi
gur
e11
.13Theval
ueofTCP sret
r a
nsmi
ssi
onti
merf ortheext
reme
datai
nFigur
e1 1
.11
.Arrowsmarktwosuc
cess
iveda
tagr
ams
wherethede
laydoubl
es.

1
1.1
9Re
spons
eToConge
sti
on

I
t ma yseem that TCP s
oftwar
ec ouldb e desi
gne
db ycons
ide
ring the
int
eract
ionbet
we e
nt het woendp
oint
sofac onnect
iona ndt
hecommunicat
ion
del
aysb et
wee
nt hoseendpoi
nts
.Inp rac
tic
e,howe ver,TCPmustal
sor ea
ctt o
c
onges
tioni
nani
nte
rne
t.Cong
est
ioni
sac
ondi
ti
onofs
eve
rede
layc
aus
edb
yan
over
loadofda t
agramsa toneormor es wi
tchi
ngp oi
nts(e.
g.,a tr outers
).Whe n
conges
tionocc
urs,delaysinc
r e
aseandt herouterbegi
nst oe nque ueda t
ag r
ams
unti
litc a
nforwardthem.Wemus tre
me mberthateachrouterha sf i
nit
es torag
e
capa
cityandthatdatag
r a
msc ompeteforthatst
orage
224 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

(
i.
e.,in ada t
ag ra
m-ba s
edi nter
net,ther
ei snopreal
l
ocat
ion ofres
ourcesto
i
ndi
vidua
lTCPc onnec
tions)
.I nt hewors
tc a
se,thetota
lnumb erofdatag
rams
a
rri
vinga tthec ongestedro ut
erg r
owsunt i
ltherouterrea
chescapa
cit
ya nd
s
tart
st odropda t
agrams.
Endp oi
ntsdonotus uall
yk now t hedetai
lsofwhe recongest i
onha soc cur
re d
orwhy.Tot hem,c ong esti
ons i
mp lyme ansincr
ea s
edde l
ay.Unf ortunately,mos t
trans-portp r
otocol
sus et imeouta ndr etr
ansmis
sion,sotheyr e
sp ondtoi ncreas
e d
delaybyr e
-transmi
ttingda t
a grams .Retrans
missi
onsa gg
ravatec ongesti
oni nst
ea d
ofa l
levia
t i
ngit.Ifunc hecked,t hei ncre
asedtrafficwil
lproducei ncre
asedde lay,
l
e a
dingt oi ncrea
sedt ra f
fic,a nds oon,unt i
lthene tworkb ecome susele s
s.The
condit
ioni sknowna sc ongestionc oll
apse.
TCPc a
nhe lpavoidcongest
ionbyr e
duci
ngt ra
nsmis
sionrate
swhe nc ongesti
on
oc-curs.I n f act, TCP r eac
ts quick
ly b y re
duci
ng t he transmiss
ion rate
automa t
icall
ywhe n-everdelaysoccur.Ofc our
se,al
gori
t hmstoa voi
dc ongesti
on
mustb ec onstr
uc t
edc ar
e-full
yb ec
auseevenundernorma lop
erati
ngc ondit
ionsan
int
er ne
twi llexhi
bitwidev a
ri-ati
oninroundt r
ipdel
ays.
To a void c ongesti
on, the TCP s tanda rd now r ecomme nds usi
ng t wo
t
e c
hni que:s
s l
ow- startandmult i
pli
cati
vedec r
eas e.Thet woa r
er el
atedandc a
nb e
i
mp l
eme ntede asi
ly.Wes aidthatf ore achc onne c
tion,TCPmus trememb e
rt he
s
ize of t he r ecei
ver
s wi ndow ( i.e
. , t he b uf
fer s i
ze a dver
tis
ed i n
a
c k
nowl edgeme nts).Toc ontr
olc ongesti
on,TCPma int
ainsas ec
ondl i
mit,call
ed
hec
t ongesti
onwi ndow si
zeorc ongesti
onwi ndow t hatitus est orest
rictdata
f
low t olesst hant her ece
ive
rsb uffe
rs izewhe nc ongest
ionoc curs
.Tha tis,at
a
nyt i
me ,TCPa c
t sasifthewi ndows i
zeis:

Al
l
owe
d_wi
ndow=mi
n(r
ece
ive
r_a
dve
rti
seme
nt,c
ong
est
ion_
window)

Int hesteadystat
eonanon- congest
edc onne
ct i
on,theconges
tionwindowis
t
hes a
mes i
zea stherece
ive
rswi
ndow.Re duci
ngt hecongesti
onwindow reduce
s
t
het raf
- f
icTCPwi lli
nje
ctintothec onnecti
on.Toe s
timateconge
stionwindow
s
ize
,TCPa s-s
ume sthatmostdat
ag ra
ml osscomesf rom conge
sti
ona ndusesthe
f
oll
owings t
rategy:

Multipl
i
cativ
eDec reas
eConges ti
onAv oi
danc
e:uponlossofas eg-
ment ,reducethec ongesti
onwi ndow byhal f(butnev erreduce
the window tol esst han one s egment)
. When t ransmit
ting
segmentst hat remaini nt he allowed window, backofft he
retrans
missi
ontimerex- ponenti
all
y.

Because TCP reduce


st he congest
ion wi
ndow by hal
ff or e v
eryl oss,it
decrea
sest he window exponential
lyi flossconti
nues.In ot her wor ds
,i f
conges
tionislikel
y,TCPr educesthev ol
umeoft ra
ffi
ce x
ponenti
al
lya ndt her at
e
of r e
transmiss
ion e x
ponential
l
y. I fl os
sc onti
nues, TCP eve ntual
ly limits
trans
missiontoas i
ngl
eda tagr
ama ndconti
nuestodoubleti
meoutv a l
uesb e
f or
e
r
etra
nsmitti
ng.Theide
aistoprov
idequi
ckands
igni
fi-
canttr
affi
cr e
ducti
ont
o
a
ll
owr out
ersenoughti
metocl
earthedat
agr
amsal
readyinthe
irqueues.
Sec
.11
.19 Re
spons
eToCong
est
ion
225

How canTCPr ec
overwhe ncongesti
one nds?Youmi ghts us
pectthatTCP
shoul
dr ev
ersethemultipl
i
cati
vedecre
a s
ea nddoub lethecongest
ionwindowwhen
tra
f f
icbe-gi
nstof l
owa gai
n.However,doi
ngs op roducesanunstabl
esyste
mt ha
t
osc
ill
ates wi
ld-
lyb etween no traff
ica nd c ongesti
on. Ins
tead, TCP use
sa
tec
hniquenameds l
ow-start
t osc
aleupt rans
mi s
sion.

Slow-St
art( Additi
ve)Rec overy:whenevers t
arti
ngt raf
ficona
new c onnection or i ncreasi
ng t raff
ic after a period of
congest
ion,startt hec ongesti
onwi ndow atthesizeofas ingl
e
segmentandi ncreasethec ongesti
onwindowbyones egmenteach
timeanac knowledgementar -riv
es.

S
low-
startav
oids s
wampi
ng the unde
rlyi
ng i
nte
rne
t withaddi
ti
onaltra
ffi
c
i
mmedia
tel
yaft
erconge
sti
onc
learsaswella
swhenanewconne
cti
onsta
rts
.
Thet ems
r low-startmaybeami snomerb ecauseund eridealconditions,the
startisnotv erys l
ow.TCPi ni
tial
izest hecongestionwindowt o1 ,sendsa ninit
ial
segment,a nd wa it
s. Whe nt he a cknowledgeme nt ar
r i
ves,i ti ncreasest he
congesti
on wi ndow t o 2, s ends two s e
gme nts,a nd wa it
s. Whe nt he t wo
acknowledge
me nt sarriv
et heye achinc rea
set hec onges
tionwi ndow by1 ,s oTCP
cans end 4 segme nts
.Ac knowledg e
-me ntsf ort hosesegme ntswi l
linc r
e as
et he
congesti
onwi ndowt o8.Wi t
hinf ourr oundt ri
pt imes,TCPc ans end16s egme nts,
oftene nought or e
acht her eceiver
swi ndow lim- i
t.Ev e
nf ore x
t r
e melyl ar
ge
windows,itta kesonlylog2 Nroundt r
ip sbeforeTCPc ans endNs egme nts.
Toa voi
dincrea
s i
ngt hewi ndows i
zetooqui c
klyandc ausinga dditi
onalconges
-ti
on,TCPa ddsonea dditi
onalrestri
cti
on.Onc ethec ongestionwi ndow r eac
hes
oneha l
fofi tsori
ginalsizeb eforeconge
stion,TCPente rsac onges tionav oi
dance
phaseands l
owsdown t her ateofi ncrement.Duringc ong estion a v
oidance,it
inc
reasesthec o
ngesti
onwi ndowb y1onlyifa l
lsegmentsint hewi ndowha vebeen
acknowledge
d.Theov erallapproachisknowna sAddit
iveI ncr easeMul ti
pli
cati
ve
Decreas
e( AIMD).
Tak
en t oget
her,s l
ow-start
,a dditi
ve increa
se, mul t
ipl
icat
ive decr
ease,
measure
me nt of v a
riat
ion, and e x ponent
ialt i
me r ba c
koff improve t he
pe
rformanceo fTCPdr amati
cal-
lywit houta ddi
nga nysignif
icantcomputati
onal
ov
erheadt ot heprot
ocolsoftware.Ve rsi
onsofTCPt hatus et hesetec
hniques
hav
ei mprove
dt heper
formanceofp re
v i
ousv ersi
onssi
gnif
icantl
y.

1
1.20Fa
stRe
cov
eryAndOt
herRe
spons
eModi
fi
cat
ions

Minormod i
fi
cati
onsha veb ee
n ma de to TCP ov erma ny years.An e arl
y
vers
ionofTCP,s ometi
me srefer
redt oasTa hoe,use dther etransmis
sionscheme
descr
ibeda bov
e,wa i
ti
ngf oratimert oe xpi
reb eforeretransmitti
ng.In1 990,the
Reno ve r
sion of TCP appeare
dt hati ntr
oduc eds evera
lc ha
ng es,incl
uding a
heuri
sticknowna sfastrecov
eryorf astret
rans mitthatha shigherthroughputin
case
swhe reonlyoccasi
onallos
soc curs.Foll
owi ngt heRenov ersi
on,r es
earcher
s
e
xpl
ordaVe
e gasv
ers
ion.

Thetems
r l
ow-
star
tisa
ttr
ibut
edt
oJohnNa
gle
;thet
echni
quewa
sor
igi
nal
l
yca
ll
ed
sof
t-s
tart
.
226 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

The t rick us ed in f as t recovery a ri


ses f r
om TCP s cumula t
ive
acknowl edgements cheme:lossofas i
nglesegme ntme anst hatthea rr
ivalof
subseque ntsegmentswi l
lcauset herecei
vert ogenerateanACKf orthepointi n
thes trea m wheret hemissi
ngs egmentb egi
ns.From as enderspoi
ntofv i
ew,a
l
ostp acketme ansmul tip
lea cknowl-e
dgementswi llarri
vet hate a
chc ar
ryt he
same s equence numb er.The fa stretra
nsmithe uris
ticus e
sa s eri
esoft hree
dupli
cat eacknowledgements(i.
e.,a nori
gi
nalp l
usthreeidenti
calcopi
es)totrigger
ar etransmissi
onwi t
houtwa it
ingf orthetimert oexpi
re.
In ac as
ewhe reonlyo nes egme ntisl ost ,wa i
t i
ngf ort her etransmitted
segme ntt ob ea cknowle
dgeda l
sor e ducest hroughput.The r
efore,t oma i
nta i
n
hi
g hert hroughput,thefastr etra
nsmi the uristi
cc ontinue stos endda taf r
om t he
window whi l
e a wai
ti
ng a c-knowledg eme nt of t he r etransmitte
d s e
gme nt.
Furthe r
mor e,t he congest
ion wi ndow i sa r t
ific
ial
lyi nfl
a ted:t he congestion
window i sha lve
df ort her e t
ransmis si
on,b utt hent hec ongest
ion window i s
i
ncr easedb yonema xi
mum s izes e
gme ntf ore a c
hdup l
icateACKt hatp revi
ous l
y
arriv
e d or ar ri
vesa f
tert he r etrans mi
ssion oc curs.Asa r es
ult,whi lef ast
retransmitoc curs,TCPk ee
p sma nys e gment sinf li
ghtb e
t weent hesende ra nd
re-cei
v er.
Af urtherop ti
mizati
onoft hefastre transmithue risticwa sincor poratedina
l
a t
er modi fi
cat
ion of TCP k nown a st he Ne wReno v e r
sion.The op ti
mi zat
ion
handlesac asewhe ret wos egme ntsarel ostwi thinas ingl
ewi ndow.I nes se
nce,
whenf astretransmitoc curs
,Ne wRenor ecordsi nfor ma ti
ona boutt hec urrent
window a nd retransmitsa sde scri
beda b ove.Whe nt he ACK a rriv
e s,fort he
retransmitte
dse gment,t her
ea ret wopos sibi
liti
es:t heACKs pecifi
est hes equence
numb era tthee ndoft hewi ndow ( i
nwhi chc aset her e transmitteds egme ntwa s
theonl ys egmentmi ssi
ngf rom t hewi ndow) ,ort heACK s pe c
ifi
e sas equence
numb erhighertha nthemi ss
ings egment,b utl esst hant hee ndoft hewi ndow( i
n
whichc aseas e
c onds eg
me ntf rom thewi ndow ha sa l
sob ee nlost).Int hel a
tter
case,Ne wRenop rocee
dst oretransmitthes econdmi s
sings eg ment .
Minormodifi
cat
ionst
otheAI MD s
cheme ha
vebeenp ropose
da ndusedin
l
ate
rv ersi
onsofTCP.Tounders
tand,cons
ide
rhow AIMDc ha ng
esthes e
nder
s
c
ongest
ion wi w, w, i
ndo nre
sponsetos egment l
oss or the arr
iva
lof a n
a
cknowledge
ment:

w w aw whenl
ossi
sde
tec
ted
b
w w whenanACKarri
vesw

I
ntheorig
inalsc
heme,ais.5a ndbi s1.Int hinki
nga boutp rot
ocol
slik
e
STCP,whi
chisuse
di nsens
ornetworks
,r e
sear
cher
sp r
opose
ds et t
ingat o0.1
25
and bto0.01top r
eventtheconge
stionwindow from osci
ll
atinga ndinc
reas
e
throughputs l
ight
ly.Ot herp roposal
sf ormodi fi
cati
ons( e
.g.ap rot
ocolknowna s
HSTCP)s ug g
estma king a a nd b functionsofw ( i.e
.,a (w)and b(w))
.Finall
y,
propos
a l
sf orTCPc onge s
tionc on-trolsucha sVegasandFASTus einc
reas
ingRTT
asame asureofc ongesti
on i nst
ea dofp ack
etl os
s,a ndde fi
net heconges
tion
window sizet obeaf unctionoft heme as
uredRTT.Typ i
cal
l
y,t hemodifi
cat
ions
onlyle
adt op e
rformanceimp
rov
e me
ntsi
nspeci
alcas
es( e
.g .
,networ
kswit
hhi
gh
bandwi
dtha ndlow los
sr a
tes
);theAIMDcong
esti
onc ontrolinNewRenoi
sus
ed
forgener
alc a
ses.

AIMDi sde
fine
dint
hep
rev
ious
se
ction.
Sec
.11
.20 Fa
stRe
cov
eryAndOt
herRe
spons
eModi
fi
cat
ions
227

Af inalpropos
a lr e
latedtoTCP c onges
tion c ontrolconc e
rnsUDP.Ob ser
ve
thatalthoughTCPr educ e
st r
ans missi
onwhenc ong es
tionoc curs,UDPdoe snot ,
whichme ansthatasTCPf l
owsc ontinuetoba c
kof f,UDPf l
owsc onsumemor eof
the bandwidth.A s oluti
on known a s TCP Friendly Rate Cont rol(TFRC)was
propos
ed.TFRC a t
t emptst oe mul ateTCP b ehaviorb y having aUDP r ec
eiv
er
reportda tagr
aml ossb ac
kt ot he senderand b y ha vi
ng t he senderus ethe
report
edl osstocomp utear atea twhi c
hUDPda tagramss houldbes ent;TFRChas
onlybeena dopte
df ors peci
alc
a s
e s.

1
1.21Exp
lic
itFe
edb
ackMe
cha
nis
ms(
SACKa
ndECN)

Mos tv er
sionsofTCPus eimplici
tt e
chniquestodetec
tlossandc onges
t i
on.
Thati s
,TCPus estimeouta nddupli
cateACKst odet
ectlos
s,andchangesinround
tri
p t ime st o de tect conges
tion. Researche
rs have obse
rved that s l
ight
i
mp roveme ntsa rep oss
ibl
ei f TCP i ncl
udes mechani
sms thatp rovi
de s uch
i
nfor mation expli
ci
tly.Thenextt wos ec-t
ionsdesc
ribetwoe xp
li
citt ec
hniques
thatha veb e
enp roposed.

1
1.21
.1S
ele
cti
veAc
knowl
edge
ment(
SACK)

Thealte
rnati
vet oTCPsc umula t
iveacknowledgementme chanismisknowna s
aselecti
veacknowledgementmec hani
sm.I ne ss
ence,s el
ect
ivea cknowl
edgements
al
l
ow ar ecei
vertos peci
fye xa
c t
lywhi chdataha sbe enreceiv
eda ndwhi c
hisstil
l
mis
sing.Thec hi
efa dvantag
eofs ele
cti
vea cknowledgementsa r
isesins i
tuat
ions
whereoc c
asi
onallossoccurs
:s el
e ct
ivea c
knowledgementsa l
low as ende
rt oknow
ex
act l
ywhichseg-mentst oretransmit.
TheS el
ectiveACKnowl edgement( SACK)mec hani
smp roposedforTCPdoe snot
comp letely r ep l
acet he c umulativea cknowl edgement me chanis
m, nor i si t
ma nda tory.Ins tead,TCPi ncludest woop ti
onsf orS ACK.Thef i
rstopti
oni sused
whe nt hec on- ne c
t i
oni se st
a bl
is
he dt oa ll
ow as endert os peci
fyt ha
tS ACKi s
permi tted. The s econd op t i
on i s us ed b y a r ecei
v e
r whe n s ending a n
acknowl edg e
me ntt oi ncl
udei nforma t
iona bouts peci
ficblocksofda tat hatwe re
received.Thei nf ormat i
onf ore ac
hb l
ocki n-cludesthef ir
sts e
quencenumb erina
block( c al
ledt he l eftedge)andt hes e quenc enumb eri mme di
atel
yb eyondt he
block( c a
lledt her ightedge) .Be causet hema ximum s i
zeo fas egmenthe aderis
fixed,a na c
k nowl edgeme ntca ncont a
ina tmos tf ourS ACKb loc
ks.Inter e
stingl
y,
theS ACKdoc ume nt sdonots peci
fye xact l
yhow as enderr esp
ondst oSACK;mos t
i
mp leme nt at
ionsr etransmitallmissi
ngb locks.

1
1.21
.2Exp
lic
itConge
sti
onNot
ifi
cat
ion

Ase
condprop
osedtechni
quetoa
voidi
mpli
ci
tme as
urementisintendedto
ha
ndl
econge
sti
on i
nt he net
work s Ex
.Known a pl
i
citCongest
ion Not
ific
ati
on
ECN)
( ,theme c
hanis
mr e
quiresr out
erst hroughoutaninter
nettonoti
fyTCPas
c
onge
sti
on occurs
.The me chanism isc oncep
t ual
l
ys tr
aig
htfor
war
d:a sa TCP
s
egmentpass
esthroughtheinternet,routersa l
ongthepathuseapai
rofbit
sin
t
heIPhe a
dertor e
cordcong
e s
tion.
228 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

Thus , whenas egme nt arri


ves
,t he recei
ve rk nows whetherthe segment
expe r
ienc
edcongest
iona tanyp oi
nt.Unfort
una te
ly,thes e
nder
,nott herec
eiv
er,
nee dstolear
na boutc ongest
ion.Theref
ore,t here c
eiv
erusest henextACKt o
i
nf orm the sendert hatc onges
tion oc
curred.The s endert henresp
onds by
reducingitsc
ongesti
onwi ndow.
ECN usestwob i
tsint heI Phe adert oall
ow routerst or ec
or dcongesti
on,
andus e
st wobitsint heTCPhe ade r(takenf r
omt her ese
r vedarea)toa l
low the
sendi
nga ndre-ce
ivingTCPt oc ommuni ca
te.Oneoft heTCPhe a
derb i
tsisusedb y
ar ec
eive
rt osendc ongest
ioninfor mationb ac
kt oas ender;theot herbitall
owsa
sendertoinfor
mt here-ceivertha tthec ongest
ionnot i
fi
cationhasb eenrecei
ved.
Bitsi
nt heIPhe aderaret akenfr om unus edbit
sint heTYPEOFS ERVICEf i
el
d.A
routercanchooset os e
te itherbitt os peci
fythatcong es
tionoc c
ur re
d( t
wob i
ts
areusedt omaket heme chanis
mmor erobust).

1
1.22Conge
sti
on,Ta
ilDr
op,AndTCP

Wes a i
dt hatc ommuni ca t
ion p rot ocol
sa redi vi
de dint ola yerst oma kei t
poss
ibleforde si
gnerst of ocusonas ing l
ep roblema tat i
me .Thes epa r
ationof
functi
onali
tyintol ayersi sbot hne cessa ryandus e f
ul i tme anst hatonel ayer
canb echangedwi thouta ff
ec t
ingot he rl ayers,b uti tme anst ha tlayersop erate
i
n i s
olati
on. For e x
a m- pl
e,b ecausei t op eratese nd-to-end, TCP r ema i
ns
unchangedwhe nt hep at hbetwe ent hee ndpointsc hang es(e.g.,r outesc hangeor
addi
tionalne tworksr outersa r
ea dde d). How- e ver
,t he isolation of l ayers
rest
rictsinter
-layerc ommuni cation.I np arti
c ul
ar ,althoughTCPont heor igi
nal
sourceinterac
tswi thTCPont heul t i
ma tede sti
na ti
on,i tc a
nnoti n-teractwi th
l
owe r-l
ayere l
eme ntsa longt hep ath.Thus ,ne i
t hert hes endingnorr ecei
v-ing
TCPr ecei
vesrepor t
sa boutc onditionsi nt hene t
wor k,nordoe se ithere ndinfor m
l
owe rlayersal
ongt hep athbe f
oret ra nsferri
ngda ta.
Rese arc
hersha veob s
ervedt hatthel ackofc ommuni cat
ionb etweenl a
yers
me a
nst hatt he choice ofp ol
icy ori mplementa t
ion a tone la yerc an havea
dramatice ffectont hep erforma nceofhi g
he rlayers.Int heca s
eofTCP,p ol
ici
es
thatr out e
rsus etoha ndl
ed at
a gramscanha veas igni
f i
cante f
f ectonb otht he
performa nceofas ingleTCPc on-necti
ona ndt hea ggregatet hroughputofa l
l
connections.Fore xamp l
e,ifar out erdel
ayss omeda t
ag r
amsmor et hanothe r
s,
TCPwi llb ac
ko ffitsret r
ansmi s
siont i
mer.Ift hede laye x
ceedsther e tr
ansmiss
ion
timeout,TCPwi llassumec ongest i
onhasoc curred.Thus ,a l
thoug he achlayeris
defi
nedi nde p
endently,r es
earcher strytode vi
seme cha-ni
smsa ndi mplementati
ons
thatwor kwe l
lwithp rotocolsinot herla
yers.
Themos timportanti nt e
ract
ionb etweenIPimp l
ementati
onp oli
ciesandTCP
oc-curswhenar oute
rb ecome soverr
una nddropsdatagrams
.Be causear oute
r
plac
e seac
hincomingda t
a gra minaque ueinme moryuntili
tc a
nb ep roces
sed,t
he
poli
cyf oc
usesonqueuema nagement.Whe ndatagr
amsa rri
vefasterthant heyc
an
bef orwarde
d,theque ueg rows;whe nda t
a g
ramsa r
riv
es l
owert hant heycanbe
forwa r
ded,theque ues hr inks.However,b eca
useme moryi sf i
nit
e,t hequeue
cannotg row wit
houtb ound .Earlyr outersuseda tail
-drop pol
icyt oma na
ge
que
ueov
erf
low:

TheExpl
i
citConge
sti
onNoti
fi
cati
onsc
hememe nt
ione
dab
oveha
snotye
tbe
en
a
dopt
ed.Vari
ancei
ndela
yisrefe
rredtoasj
itt
er.
Sec
.11
.22 Cong
est
ion,Ta
ilDr
op,AndTCP
229

Tai
l-Dr
opPol
ic
yForRouters
:ifapacketqueueisfi
ll
edwhena
da-
tagrammustbepl
acedonthequeue,di
scar
dt hedat
agr
am.

Thenametai
l-
dropari
s e
sf romthee ff
ectofthepoli
cyona narri
vi
ngs e
quenc
e
ofda-t
agr
ams.Oncet heque uefi
ll
s,therouterbegi
nsdis
cardi
nga l
laddi
ti
onal
dat
agr
ams.Thati
s,ther out
erdis
cardsthet
ail
ofthese
quence.
Tail
-drop ha sa ni nteres
ting effec
t on TCP.I nt he s i
mp lec ase whe re
datagrams t raveli
ng t hroughar outerc a r
rys egme ntsf r
om a s ingl
e TCP
connecti
on,t helossc ausesTCPt oe nte
rs low- s
t art
,whi chr educ esthroughp ut
untilTCP b eg i
nsr eceivi
ngACKsa ndi ncreasest hec ongestion window.A mor e
severep robl
e mc an oc cur,howe ver,whe nt heda tagramst raveli
ngt hrougha
routerc arrys egment sfrom ma nyTCPc onnec- t
ionsb ecauset ai
l-dropc anc ause
glob
a lsynchr onizati
on. To s ee why, ob servet hat da- tagra
ms a r
et ypic
a l
ly
multipl
exed,wi t
hs uc cess
iveda ta
gramse achc omingf rom adi f-ferents ource.
Thus,at a i
l-dropp ol
icyma ke
si tli
kelytha tther outerwi l
ldiscardones egme nt
from N c onne ct
ionsr athert hanN s egment sf rom onec onnection.Thes i
mul -
taneouslossc ausesallNi nst
ancesofTCPt oe nters l
ow- st
a rtatt hes a
met i
me .

1
1.23Ra
ndom Ea
rlyDe
tec
tion(
RED)

How canar outera v


oidg l
obalsync
hroni
zation?Thea nswerlie
si nac l
eve
r
sc
he me tha ta voids tai
l-
drop whe nev
e rpossi
b l
e. Known as Ra ndom Earl
y
Detecti
on,Random Ear l
yDr op,orRandom Ear lyDi s
card,thes c
hemei smore
frequentl
yr ef
err e
dt ob yitsacronym,RED.Theg ener
alideabehi
ndREDl iesi
n
randomizati
on:i nste
ad of wa it
ing untila que ue fi
ll
sc omp
letel
y, a route
r
monitorst he queue size.As t he queue b
egins tof il
l,the routerchooses
datagramsa tra
ndomt odrop.
Arouterthatimple
me ntsREDr unsthealgori
thm oneac
hqueue(e.g
.,e a
ch
net-workconnec
tion)
.Tos i
mpli
fyourde sc
rip
tion,wewi l
lonlydis
cus
sas ingl
e
queueanda s
sumet hereaderreal
ize
st ha
tthes ametechni
quemustbeappl
ie
dt o
otherqueues
.
Arout
erus e
stwothres
hol
dva l
uest
oma
rkp os
iti
onsi
ntheque :Tmi
ue nand
Tmax.The gener
alop
erat
ion of RED c
anbe des
cri
bedbyt hr
eer ul
esthat
de
ter
minet
hedi
spo
-si
ti
onofada
tag
ramt
hatmus
tbep
lac
edi
ntheque
ue:

I
ftheque
uec urr
ent
lycont
ainsfe
wert
han Tmi
nda
tag
rams
,add
t
hene
wdatag
ra mtotheque
ue .
Iftheque
uec
ont
ainsmor
et nTmax da
ha tag
rams
,di
sca
rdt
hene
w
da-
tagr
am.
Ifthequeueconta
insbet
wenTmi
e nandTmaxdat
agra
ms ,r
andomly
dis
-cardt
heda t
agram wi
thapr
obab
ili
ty,p,thatdepe
ndsont he
curre
ntqueuesi
ze.
Int
erest
ing
ly,gl
oba
lsynchr
oni
zati
ondoe
snotoc
curi
fthenumb
erofTCPc
onne
cti
onss
har
inga
l
i
nki
ssuffi
ci
entl
ylar
ge(>500)andtheRTTsva
ry.
23
0 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

The r
andomnessofRED me ansthatinste
ad ofwa i
ting unt
ilthe queue
over
f l
owsandthendri
vi
ngma nyTCPconnec
tionsintos
low-
start,aroute
rs l
owly
andr a
ndomlydrop
sdatag
ramsasconge
sti
onincrease
s.Wecansumma ri
ze:

RED Policy For Router


s:ift he i
nput queue isfullwhen a
datagram arri
ves,dis
cardthedatagram;ift heinputqueuei s
bel
ow ami nimum thres
hol
d,add thedat agram tothequeue;
otherwis
e,discar
dt heda-t
agr
am withapr obabi
li
tythatdepends
ont hequeues i
ze.

Thekeyt
oma ki
ngREDworkwel
llie
sinthec
hoic
eoft het
hre
s dsTmi
hol nand
Tmax andt
hedis
car
dp r
oba
bil
i
typ.Tmi
n mustbel
arg
ee nought
oensur
et ha
tthe
queueha ssuf fici
ent l
yhi ght hroug hp ut.Fore xamp le,ift heque uei sc onne ctedt o
an out p ut l i
nk ,t he que ue s houl d dr ivet he ne twor ka t hi gh ut il
iza ti
on.
Furthe r mor e,b ecaus eRED op era te sliket ai
l-dropwhe nt heque ues izee xceeds
Tmax,t hev alueofTmax mus tb eg reatert han Tmi nb ymor et hant het ypica
l
increasei nque ues izedur ingoneTCPr oundt r i
pt i
me( e.g.,s etTmax a tl east
twicea sl argea sTmi n).Ot he rwise,REDc a
nc auset hes a meg loba los cill
ationsa s
tai
l-dr op( e.g ,Tmi
. nc a nb es e tt oone -
ha lfofTmax) .
Comp utationoft hedi sc ardp r ob abil
ity,p ,ist hemos tc omp lexa s pec tofRED.
In-stea dofus ingac ons t
a nt ,ane wv alueofpi sc omp ut e df ore achda tag ram;
thev a luede pendsont her elati
ons hipb etwe ent hec urr entque ues izea ndt he
threshol ds .Tounde rsta ndt hes che me,ob servet hata l
lRED p roce s
s i
ngc a nb e
viewedp roba bi
lis
tically.Whe nt heque ues i
zei sl esst ha n Tmi n,R ED doe snot
dis
c a
rda ny da tagrams ,ma k i
ng t hedi scardp rob abil
ity 0.S imilarly,whe nt he
queues izei sg r e
at ert ha nTmax,REDdi s- c
a rdsa llda tagrams ,ma ki
ngt hedi scard
probab ility1 .Fori nte rme diat ev alue sofque ues ize,( i.
e.,t hoseb etwe enTmi na nd
Tmax),t hep roba bi
li
tyc anv a ryf rom 0t o1l inearly.
Alt houg ht hel ine ars che mef or mst heb asi
sofRED sp r oba bi
lityc omp uta ti
on,
ac hang emus tb ema det oa voi
dov er
r eacting.Thene edf ort hec ha ngea ri
ses
because ne twor kt ra ffici sb ur st y,whi chr e s
ult si nr ap i
df luctua t i
onsof a
router sque ue.I fREDus e das imp li
sti
cl ine a
rs cheme ,l at erda t agra msi ne ach
burstwoul db ea ssigne dhi g hp rob a bi
li
tyofb ei
ngdr op ped( b ec
a uset he ya rri
ve
whe nt heque ueha smor ee nt r
ies).Howe v e
r ,ar out e rshoul dnotdr opda tag rams
unne ces sar i
ly,b ecaus edoi ngs oha sane gativei mp actonTCPt hroug hp ut .Thus ,if
ab urs ti ss hor t,iti sunwi set odr opda -tagramsb e causet heque uewi llne ver
overflow.Ofc our se,REDc a nnotp ostponedi s-car dinde f
inite l
yb eca useal ong-
termb ur stwi llov erflow t heque ue ,r esulti
ngi nat ail-
dr o pp oli
c ywhi chha st he
potent ialt oc auseg lob alsync hr oniza t i
onp r
ob lems.
Howc anREDa ss
ignahig he
rdi sc
ardprobabil
i
tya sthequeuefil
lswi thoutdis
-c
ardi
ngda ta
gramsf r
om e achbur s
t?Thea nswerli
e sinat ec
hniqueb orrowed
fr
om TCP:inst
eadofus i
ngt heac t
ualqueues i
zea tanyins
tant,REDc omp utesa
wei
ghtedaveragequeues i
ze,a vg,andus esthea veragesi
zet ode t
e rminet he
pr
obabi
li
ty.Thev a
lueofa vgi sa ne xp
onentia
lwe ig
ht e
da v
erage,up datede ach
t
imeada
tag
rama
rri
vesa
ccor
dingt
othee
qua
tion:

a
vg= (1)Ol
d_a
vg + Cur
rent
_que
ue_
size
S
ec.1
1.23 Ra
ndomEa
rlyDe
tec
tion(
RED) 231

whe r
ede not esav al
ueb etwe en0a nd1 .I fi ss ma l
le noug h,t hea v erag ewi l
l
tracklongt er mt r ends,b utwi l
lr ema inimmunet os hor tb ur sts

Ina dditiont oe qua t i
onst hatde te
rmi ne,REDc ont ainsot herde tail
st ha t
weha veg l
os sedov er.Fore xamp le,RED c omp uta tionsc anb ema dee xtreme ly
effi
cientb yc hoos ingc ons tantsa sp ower soft woa ndus ingi nte gera r i
thme tic.
Anotheri mp or ta ntde tailc onc e
r nst heme asure me ntofque ues ize ,whi cha ffects
botht heREDc omp utationa ndi tsov eralle ffectonTCP.I np articul ar,b e ca
us e
thet i
mer equi re dt of or war dada -tagrami sp rop or ti
ona lt oi tss ize,i tma kes
senset ome asur et heque ueinoc tetsr athert ha ni nda tagr ams ;doi ngs or equires
onlymi norc ha ng est ot hee q uat i
onsf orpa nd.Me asuringque ues izei noc tets
affectst het yp eoft r a ffi
cdr opp edb ec ausei tma kest hedi s cardp rob abi
lity
proportionalt ot hea mountofda taas ende rp ut sint hes t ream,r athe rt hant he
numb erofs e gme nt s.Sma llda tagrams( e.g .
,t hoset hatc a rryr emot el og i
nt raf-
fi
corr eque stst os erve r s
)ha v el owe rp rob abil
ityofb e ingdr op pedt hanl a
r ge
datagrams( e.g .,t hos et ha tc arryf iletra nsfert ra ffic).Onep ositivec ons equenc e
ofus i
ngda tag rams i
zei st ha twhe na ck nowl edge me ntst r avelov erac ong es
t ed
path,t heyha veal owe rp robabili
tyofb eingdr opp ed.Asar esult,i fa( large )da ta
segment doe sa r ri
v e,t he s ending TCP wi l
lr eceivet he ACK a nd wi l
la void
unneces s
a ryr e tra nsmission.
Botha nal
ysisa nd s
imulati
ons show tha
t RED wor ks wel
l.It handl
es
congest
ion,avoi
dst hesynchroni
zati
on tha
tr esul
tsfrom t
ail
-dr
op,a ndall
ows
shor
tb urstswithoutdroppi
ngda tag
ramsunnecess
ari
l
y.Conseque
ntly,theIETF
nowr ecommendsthatrouter
si mpl
ementRED.

1
1.24Es
tab
lis
hingATCPConne
cti
on

Toe sta
b l
i
s hac onnecti
on,TCPus esat hree-wayhands hake.Thati s
,t hree
mes-sa ge
sa ree xchangedthata l
low eachsidet oa greet of orm ac onnect
iona nd
know t hatt heot hersidehasa greed.Thef i
rsts egme ntofaha nds ha
kec anb e
i
dent i
f i
edb ecauseitha stheS YNb itseti nthec odef iel
d.Thes e c
ondme ssage
hasb otht heS YNa ndACKb itssett oindi
ca t
et hati ta cknowledgest hef i
rstSYN
segme nta ndc ontinuestheha ndshake.Thef i
na lha ndshakeme s
sa geisonlya n
acknowledg e
me nta ndi smerelyus e
dt oinformt hede s
tinati
ont hatb oths i
des
agreet hatac onne ct
ionhasbeene st
a b
-li
shed.

Usual
ly,theTCPs oftwareononema chinewa i
tsp as
siv
e l
yf ort heha ndshake
,
andt heTCPs oftwareona notherma chi
nei niti
atesit.Howe ver
,t heha ndsha k
eis
caref
ullydesig
nedt owor ke venifb ot
hma chinesattemptt oini
t ia
teac onnecti
on
si
mult a
neousl
y.Thus ,ac onnecti
onc anb ee st
abli
shedf r
ome i
t here ndorf rom
bothe ndss i
multaneous-l
y.Onc et hec onnec ti
onha sb e
ene s
ta bl
is
hed,da t
ac an
fl
ow i nbothdirecti
onse quall
ywe l
l(i.e
.,t hec onnecti
oni ssymme tr
ic)
.Tha tis
,
therei snoma s
terors l
ave,a ndt hes i
det hatiniti
ate
st hec onne cti
onha sno
speci
ala b
ili
ti
esorp rivi
l
eg es
.I nt hes implestc as
e ,theha ndsha kep roceedsas
Fig
ure1 1.
14ill
ustrat
e s
.
Anexamp l
eval
ues ugg
e s
tedforis.002.
SYNstandsforsynchroni
zat
ion,andispronounc
ed
sin
;thes
egme
ntc
arr
yingt
heS
YNi
sca
ll
ed
t
he
sins
egme nt.

232 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

Ev
ent
sAtS
ite1 Ne
twor
kMe
ssa
ges Ev
ent
sAtS
ite2

S
endS
YNs
eq=x

Re
cei
veS
YNs
egme
nt
S
endS
YNs
eq=y,ACKx+1

Re
cei
veS
YN+ACKs
egme
nt
S
endACKy+1

Re
cei
veACKs
egme
nt

Fi
gur
e11
.14Thesequenc
eofme ss
agesi
nat hre
e-wa
yha ndsha
ke.Ti
me
proce
edsdownt hepage
;di
agona
lli
nesrep
resentseg
ments
sentbetweens
ites
.

Itma ys eemt ha ta t wo-me s


sagee xchange woul ds ufficet oe stabl
i
sha
connec ti
on.Howe ver ,t het hree-wayha ndshakei sb othne ces s
arya nds uffi
cient
forc or re
cts yn- c
hr onizati
on b etweent he t wo e ndsoft he conne ction given
inte
rne t de l
ivery s ema ntics. To unde rstand t he r eason t ha t c onnection
establ
ishmenti sd i
fficult,r ememb erthatTCPus esa nunr e l
iabl
ep a
c k
e tde l
ivery
servi
ce .Therefore,me s
s a
g e
sc anb elost
,de layed,dup lic
a t
ed,orde l
iveredoutof
order.Toa ccommoda tel os
s,TCPmus tr etransmitr e-quests .Howe ver,t roub l
e
cana riseife xcess
ivede l
ayc ausesretransmissi
on,whi chme a nsb otht heor igi
nal
and r etrans
mi ttedc opya rrive whil
et he c onne c
tion isb e
ing e s-tabli
shed.
Retrans mi
ttedr eque stsc ana lsob edelayedunt i
la fterac onne c
tion ha sb een
establ
ished,us ed,a nd t erminated!The t hree-wa y ha ndshak ea nd r ulest hat
preventr e-s
tartingac onnec ti
ona ft
eritha st erminateda rec arefull
yde si
gnedt o
compe nsatefora l
lp ossi
b l
es i
tuations.

1
1.25I
nit
ialS
eque
nceNumb
ers

The t hr e
e-wa y ha nds hak e a cc
omp li
shest wo i mp ortant f uncti
ons.I t
guaranteestha tb oths i
de sa r ereadyt ot ransferda t
a( andt hatt heyknow t hey
areb othre ady)a ndita l-lowsb oths i
de stoa greeoni nitialsequencenumb e rs
.
Sequencenumb ersares enta nda cknowledgedd uri
ngt heha ndshake.Eachma chine
mustc hoosea ni niti
als eque ncenumb era tr andom tha ti twi lluset oident i
fy
octetsinthes t
rea miti ss e nding.S e-
que ncenumb ersc annota l
wayss tar
ta tt he
samev al
ue .I np arti
cular,TCPc annotme re-l
yc hooses eque nce1e ve
ryt i
mei t
creat
e sac onnection( oneoft hee xerc
isese x
amine sproblemst hatcana ri
seifi t
does)
.Ofc ourse,i tisi mp or tantt hatb oths i
desa greeona ni ni
tia
lnumb er,s o
oc
tetnumb
ersus
edi
nac
knowl
edg
eme
ntsa
gre
ewi
tht
hos
eus
edi
nda
tas
egme
nts
.
S
ec.1
1.25 I
nit
ialS
eque
nceNumb
ers 233

Tos eehow ma chinesc anagreeons equencenumb e rsfort wos t rea


msa fter
onl
yt hre eme ssages
,r ecal
lthate achs egmentc ontainsb othas eque ncenumb er
fi
elda nda nacknowle dgeme ntfie
ld.Thema chi
net hati niti
atesaha nds hake,cal
lit
A,pas sesi tsini-t
ials equencenumb er,x ,int hes eque ncef i
eldoft hef i
rstS YN
seg
me nti nt het hree -wayha ndshake.Theot herma chine,B,r e
ceive stheS YN,
rec
or dst hes equencenumb er,andr eplie
sb ysendingitsi nit
ialsequenc enumb e
ri n
these que ncef i
eldaswe llasa nac-knowl e
dg e
me ntt hats pecif
iesBe xpectsoctet
x+1.Int hef i
nalme ssag eoft hehands hak,A
e acknowle dges
r ecei
vingf rom Ba l
l
octetst hroughy.I na llcases,ac-knowledgementsf oll
ow t hec onventionofus ing
thenumb e roft hene xtoc tetexpected.
Wehav ed escr
ibedhow TCPus uall
yc ar
riesoutt het hree
- wayha ndshakeb y
ex-c
hangi
ngs e g
me ntsthatc ontai
nami nimum a mountofi nforma t
ion.Becauseof
thepro-t
oc olde s
ign,iti sp os
sibl
et osendda taa l
ongwi tht hei ni
tia
ls equence
numbersint heha ndshakes egments.Insuchc ases,theTCPs oftwaremus thold
thedataunt iltheha ndshakec omple
tes.Onceac onnec
tionha sb eene s
tab l
i
shed,
the TCP softwa rec anr elease datab e
ing helda nd de l
i
veri tt o a wa i
ting
appl
ic
ati
onp r
og ra
m qui c
k l
y.Ther ea
derisr ef
er r
edt ot hep r
ot ocolspec
ifica
tion
forthedetail
s.

1
1.26Cl
osi
ngaTCPConne
cti
on

Two a ppl
icati
ons t ha t us e TCP t o c ommuni cate c an t ermi nate t he
conver s
ati
ong raceful
lyus ingt hec l
oseoper at i
on.Onc ea gain,i ti simp ortantt hat
boths i
desa greet oc l
oseac onnectiona ndb oths ide sknow t hec onne ctioni s
cl
os e
d.The r ef
ore,TCP us e
sa t hree -wa y ha ndsha ket oc l
os ec onne ctions.To
unde r
s t
andt heha ndshakeus edt oc l
oseac onne ction,r e
callt hatTCPc onne ct i
ons
aref ulldup l
exa ndt hatwev i
ewt he ma sc on-ta i
ningt woi nde p
e ndents tre am
transfers,oneg oingi ne achdi recti
on.Whe na na pp li
-cationp rogra mt e l
lsTCP
thatitha snomor eda tat os end,TCPwi llc loset hec onnec- tioninonedi rect i
on.
To c l
osei t
sha l
fofac onne cti
on,t hes e nding TCP f i
nishe st rans mitting t he
rema i
ning data,wa i
tsf ort her eceivert oa cknowl e dgei t,a nd t hens endsa
segme ntwitht heFI Nbits et.Up onr e ce
iptofaFI N,TCPs e ndsa na c k
nowl e dge-
me nta ndt heninf or
mst hea ppl
ic
ationt hatt heot he rsideha sf inisheds e
ndi ng
data.Thede t
ail
sde pendont heop eratings ys tem,b utmos ts ys t
emsus et he end-
of-fil
eme cha-nis
m.

Onceaconne cti
onha sbeenclosedinag i
vendire c
t i
on,TCPr efuse
st oacc
ept
more dataf ort hatdirecti
on.Me anwhile
,da tac a nc onti
nue t oflow inthe
opposi
tedi
rectionuntilthesenderclosesit.Ofc ourse,aTCPe ndpoi
ntt ha
tissti
l
l
rec
e i
vi
ngdatamus tsenda ck
nowledge ments,eveni ft hedatat ra
nsmissi
oninthe
rev
e rs
edire
ct i
onha sterminat
ed.Whe nb othdir
e ct
ionsha vebeenc l
osed,theTCP
sof
t warea
te ache ndpoi
ntdelete
si t
sr ecordoft hec onnecti
on.
Thede
tai
l
sofcl
osi
ngaconne
ctionaree
venmoresub
tlet
hansugge
ste
dabov
e
b
e-c
a us
eTCPuse
samodif
iedthree
- wa
yhands
hak
et ocl
oseaconne
cti
on.Fi
gur
e
1
1.1
5il
-l
ustr
ate
st heme s
sag
e st
hatareexc
hang
edf ort
hetypi
calca
s ewhe
rea
ll
c
ommunic
ati
onhasfini
shedandthec
onne
cti
oniscl
osedi
nbot
hdirec
tions
.

Ase
g mentwi
tht
heFI
Nbi
tse
tisc
all
eda
fin
se
gment.

23
4 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

Ev
ent
sAtS
ite1 Ne
twor
kMe
ssa
ges Ev
ent
sAtS
ite2

(
app
lic
ati
onc
los
esconne
cti
on)
Se
ndFI Nseq=x

Re
cei
veFI
Nsegme
nt
Se
ndACKx+1
(
inf
orma
ppl
ic
ati
on)
Re
cei
veACKs
egme
nt

(
app
lic
ati
onc
los
esc
onne
cti
on)S
end
FI
Nse
q=y,ACKx+1

Re
cei
veFI
N+ACKsegme
nt
SendACKy+1

Re
cei
veACKs
egme
nt

Fi
gur
e11
.15Thethr
ee-
wayha
nds
hakeuse
dt oc
los
eac onne
cti
onwi
tha
n
ex
traACKse
nti
mmedi
ate
lyuponrec
eip
tofaFI N.

Thedi ffere
nceb etweent hree-wayha ndshak
e sus edt oe stablisha ndc lose
c
onnec-ti
onsoc cursa f
t erama chinereceiv
est heinit
ialFI Ns e
g me nt.I nsteadof
g
enerati
ngas ec
ondFI Ns e
gme ntimme diatel
y,TCPs endsa na cknowl edgeme nta nd
t
heni nforms the a pplic
ation of t he requestt os hut down.I nf orming t he
a
ppli
cati
onp rogramoft her equestandob tai
ningar esponsema yt ak ec onsi
derab l
e
t
ime( e.
g.,i tma yi nvolvehu- mani nteracti
on).Thea cknowledgeme ntp revents
r
etrans
mi s
sionoft hei nit
ialFI Ns eg-
me ntdur i
ngt hede l
ay.Fi nall
y,whe nt he
a
ppli
cati
onp r
ogrami nstructsTCPt os hutdownt hec onnecti
onc omp l
etel
y,TCP
s
endsthes econdFINs e gmenta ndt heorigi
nalsit
er epl
ieswi tht het hirdme s
sage,
a
nACK.

1
1.27TCPConne
cti
onRe
set

Normally,ana ppli
cati
onp r
ogram usest hecloseoper ati
ont os hutdowna
c
onnec-ti
onwhe ni tfini
shessendingdata.Thus,closingc onnecti
onsisconsi
dered
anormalp artofus e,analogoust oclos
ingf i
les
.Wes a yt ha
tt hec onne
ction
t
erminat
edg r
aceful-ly.Howev er,someti
me sabnorma lconditi
onsa r
isethatforce
a
na ppl
ic
ationo rt hene t
-wor ksoftwaretob reakac onnec t
ionwithoutag rac
eful
s
hutdown.TCPp rovidesares e
tf aci
li
tytoha ndl
eab norma ldis
connecti
ons.
Tor es
etac onnecti
on,o nesideini
tia
test e
rminati
onb ys endi
ngas egment
witht heRS T(RESET)bi ti ntheCODE f i
eldset.Theot hers i
der esp
ondst oa
resetsegmentim-me di
atel
yb ya b
or t
ingtheconnecti
on.Whe nar esetoccur
s,TCP
inf
or msanyl oc
ala p-p
li
cationthatwa susingthec onne
ction.Not ethatar e
set
occursimme di
atel
ya ndc an-notbeundone .Wet hi
nkofi ta sa ninst
antaneous
a
bor
tthatt
ermi
nat
est
rans
feri
nbot
hdi
rec
tio
nsa
ndr
ele
ase
sre
sour
ces
,suc
has
b
uff
ers
.
S
ec.1
1.28 TCPS
tat
eMa
chi
ne 235

1
1.28TCPS
tat
eMa
chi
ne

Lik
emos tprot
ocol
s,theop e
rati
on ofTCP canbes
tb ee xp
lai
ned wi
tha
the
or eti
calmode
lc a
ll
edafini
testatemachi
ne.Fi
gure11
.16showstheTCPs t
ate
machine,withc i
rcl
esrepr
esent
ing s
tate
sa nd a
rrowsrepr
e s
enti
ng tr
ansi
ti
ons
bet
we ent he
m.

anyt
hing/r
ese
t

begi
n CLOS
ED

pas
siv
eopen c
los
e

LI
STEN ac
tiv
eopen/s
yn

s
yn/s
yn+a
ck
s
end/s
yn
r
ese
t
S
YN s
yn/s
yn+a
ck S
YN cl
ose/
t
imeout
RECVD S
ENT /
r
ese
t

a
ck s
yn+a
ck/a
ck

ES
TAB- f
in/a
ck CLOS
E
c
los
e/fi
n
LI
SHED WAIT

c
los
e/f
in
c
los
e/f
in

FI
N f
in/a
ck LAST a
ck/
CLOS
ING
WAIT-
1 ACK .
.
.
f
in-
ack/ .
...
ack .
a
ck .
..
a
ck/ / ..
.
t
imeoutaf
ter2s
egmentl
i
fet
imes
.
.
.
.
FI
N f
in/a
ck TI
MED .
.

WAI
T-2 WAIT
Fi
gur
e11
.16 The fini
tes t
ate mac
hine for TCP. La
bel
s on st
ate
trans
iti
ons s
how the i
nput tha
tc ause
dt he tr
ans
iti
on
fol
lowedbytheoutputi
fa ny.
23
6 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

I
nt hef i
gure,t hel abelon e ac
hs tatet ransiti
on s howswha tc ausest he
transitiona ndwha tTCPs endswhe nitp erformst het ransiti
on.Fore xa
mp l
e,t he
TCPs of t wareate ac
he ndpoi
ntb eginsint heCLOS EDs ta t
e .Appli
cat
ionp r
og r
a ms
mus ti s
s uee i
therap as s
iveopenc omma ndt owa i
tf orac onnecti
onf rom another
mac hi
ne ,ora na cti
veopen c omma ndt oi ni
tia
teac onne cti
on.Ana c
tiv
eop en
comma ndf orcesatrans i
tionfromt heCLOS EDs tatet otheS YNSENTs tate
.Whe n
i
tf ollowst hetrans
iti
ont oSYNSENT,TCPemi t
saS YNs eg ment.Whe ntheot her
si
de r e turnsa s eg
me ntwi tht he SYN a nd ACK b itss et,TCP mov est ot he
ESTABLI SHEDs ta
te,e mitsanACK,a ndb e
-g i
nsdatat ransfe r.
The TI MED WAI Ts tater eveal
show TCP ha ndless ome of t he pr obl
e ms
incurred wi th unr el
iabl
e de l
i
very.TCP k e
epsa not on of ma
i xi
mum s egment
l
ifetime( MSL),t hema xi
mum t i
mea nolds egmentc anr ema ina li
vei na nint ernet.
Toa voi
dha vi
ngs eg
-me nt sfrom ap r
ev i
ousc onnectioni nterfe r
ewi thac urrent
one ,TCPmov est otheTI MEDWAI Ts tatea fterclosingac onne cti
on.I tr ema i
ns
int hats tatef ort wicet hema x i
mum s egmentl i
fetimeb eforede l
etingit sr ecord
oft hec onnection.Ifa nydup li
-cates egmentsa rrivef ort hec onne cti
ondur ing
thet i
me outint erval
,TCPwi l
lr ej
ectt hem.Ho we ver,t oha ndl ec as
e swhe ret he
l
a s
ta cknowledg ementwa sl ost,TCPa c-knowledgesv a
li
ds egme ntsa ndr e s
tarts
thet ime r.Becaus ethet imera ll
owsTCPt odi s-
tinguishol dc onne ct
ionsf rom ne w
one s
,i tp reve
nt sTCPf rom s e
ndingar e s
eti nr es
pons et ode layeds eg ment sfrom
anol dc onnection( e.
g.,ift heot herendr etransmitsaFI Ns egme nt).

1
1.29For
cingDa
taDe
li
ver
y

Wes aidthatTCPi sf reetodivi


det hes t
ream ofda tai ntos eg
mentsfor
t
ransmi
s-s
ionwi thoutr eg
a r
dt othesizeoft ransf
e rthata ppli
cati
onsuse.The
c
hiefadvantage ofa ll
owing TCP toc hoos
e a divi
sion i
se ffici
ency.TCP can
a
ccumul
atee noughoc t
etsinab uffe
rtoma kesegmentsreasonabl
yl ong,r
educi
ng
t
hehighoverheadt ha
toc curswhenseg
me ntscontai
nonlyaf ewda taocte
ts.
Alt
houg hbufferi
ngimp rovesnet
wor kt hroughput,itcaninterfer
ewi thsome
a
ppli
-ca
t i
ons.Cons i
der us i
ng a TCP c onnection top assc harac
tersf rom a n
i
nter
activetermi-
nalt oar emotemachine.Theus e rexpectsins
tantr e
sponset o
e
achk eystr
oke.Ift hese ndi
ngTCPb ufferst heda t
a,r es
ponsema yb ede l
ayed,
p
erhapsf orhundredsofk ey-st
rokes
.S imila
rly,be c
auset her e
ceivi
ngTCPma y
b
ufferda tabeforema kingi tavai
l-
ablet ot hea ppli
cati
onp rogram onitse nd,
f
orci
ngt hesendertot ra
ns mitdatama ynotb es uf
f i
ci
entt oguaranteedel
ivery.
Toa cc ommodatei ntera
ctiv
eus er
s,TCPp rovi
desap ush operat
iont hata n
appl
ica-
tionc a
nus et of or
cede l
iveryofoc t
etscurrentl
yi nthes tream without
wa i
ti
ngf ort heb uffe
rt of i
l.Thep
l ushoper
ati
ondoesmor ethanf orcethel oca
l
TCPt os endas e
g -
me nt.Ita l
sore quest
sTCPt osett hePS Hbitint hese g
me nt
code fi
eld,s othe da ta wil
lb e deli
veredtot he appl
icat
ion program on t he
recei
vi
nge nd.Thus,a ninteract
ivea p-pl
ic
ati
onusesthep ushfunc t
iona f
tere ach
k
eys
trok
e.S
imi
l
arl
y,a
ppl
i
cat
ionst
hatc
on-
S
ec.1
1.29 For
cingDa
taDe
li
ver
y 237

t
rolar emotedispl
ayc
anuset hep
ushfunc
tiontoinsuretha
ttheda
taisse
nt
a
cros
st hec onne
cti
onpromp
tlyandpas
sedtot hea
p p
lic
ati
onontheothe
rsi
de
i
mmedia
t el
y.

1
1.30Re
ser
vedTCPPor
tNumb
ers

Like UDP,TCP us esa c ombi


nat i
on ofs tati
cal
l
ya nd dynamica
ll
ya ssi
gned
p
rotoc olportnumb er
s.As e tofwe l
l-knownpor tshavebeena ss
ignedbyac entr
al
a
uthor ityforc ommonlyi nvokeds e
rv i
ces(e .
g.,webs erve
rsa nde l
ectr
onicma i
l
s
ervers )
.Othe rportnumb ersa r
ea vai
labl
ef oranop e
r a
tingsystemt oal
locateto
l
ocala ppl
ica
tionsasne e
d-e d.Ma nywe ll
-knownTCPp ortsnow exis
t.Figur
e1 1.
17
l
is
tss omeoft hecurr
entlya ss
ignedTCPp orts
.

Port Ke
ywor
d De
scr
ipt
ion
0 Rese
rved
7 echo Ec
ho
9 discard Di
scard
13 dayt ime Dayti
me
19 char genCharacterGe ne rator
20 ftp- dataFil
eTr ansferPr otocol( da t
a)
21 ftp Fil
eTr ans ferPr otoc ol
22 ssh SecureS he l
l
23 telne t Te r
mi nalc onne ction
25 smt p Simp l
eMa i
lTr anspor tPr ot
ocol
37 time Time
53 doma i
n Doma inna mes erver
80 www Wor ldWi deWe b
88 kerb eros Kerbeross e curitys ervice
1
10 pop 3Pos tOffi
cePr ot ocolv ers.3
123 ntp Ne tworkTi mePr otoc ol
1
61 snmp Simp l
eNe twor kMa na gementProt
ocol
179 bgp Borde rGa tewa yPr ot ocol
443 http s SecureHTTP
860 iscsi iSCSI( SCS Iov erI P)
993 ima ps SecureI MAP
995 pop 3s SecurePOP3
30301 bittor r
ent Bi tTor r
e nts ervice

Fi
gur
e11
.17Ex
amp
lesofc
urr
ent
lya
ssi
gne
dTCPp
ortnumb
ers
.

We s houl
dp oi
nt out t hata l
though TCP and UDP p ort numbersa re
i
ndependent,thede si
gnershavechose
nt ouset hesameinte
g erportnumb er
sf or
anyservi
cet hatisacces
sib
lef r
omb ot
hUDPa ndTCP.Forexa mple
,adoma i
nna me
s
e r
vercanb eac-c
e s
sedeithe
rwi t
hTCPorwi thUDP.Whe nus i
nge i
therprotoc
ol,
acli
enta ppli
cati
onc anuset hesamep ortnumber,53,becauseIANAa ss
igned53
a
sthedoma
inna
mes
er-
vic
epor
tforb
othTCPa
ndUDP.
23
8 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

1
1.31S
il
lyWi
ndowS
yndr
omeAndS
mal
lPa
cke
ts

Researcher
swhode ve l
op edTCPob servedas eriousp e rforma nceproblemt hat
canr esult whent he s ending a nd r e
ceivi
ng a p
p l
icationsop era teat different
speeds.Tounde rsta
ndt hep robl
e m,r ememb e
rt ha tTCPb uffersincomingda ta,
andc onsi
derwha tcanha pp enifar eceivi
nga ppl
icationc hoos est oreadi ncoming
dataoneoc tetatat i
me .Whe nac onnecti
oni sf irste sta b
lis
he d,ther ecei
ving
TCP a l
l
oc a
tesa b uff er of K b ytes,a nd us est he WI NDOW f iel
d i n
acknowledgementsegme ntst oadve r
tisethea vai
labl
eb uffe rsizet othese nder.If
thes endinga pp
li
cati
on g eneratesda taqui ckl
y,t hes endi ngTCP wi l
lt ransmit
segmentswi thdatafort hee ntirewi ndow.Ev entua l
l
y,t hes ende rwil
lrec ei
vea n
acknowledgement thats pe ci
fie
st he e nti
re wi ndow ha sb e
enf i
ll
eda nd no
additi
onalspaceremainsint herec ei
versbuffer.
Whent her e
ce i
vi
ngappli
cati
onr eadsa noctetofdatafrom af ul
lbuffer,one
oct
etofs paceb ecomesava
ilabl
e.Wes ai
dt hatwhens p
aceb e
comesa vai
la
b l
ei ni
ts
buff
er,TCPont her ec
eiv
ingma c
hineg eneratesana ck
nowledgementt hatuses
the WINDOW f i
eldt oinform the s ender.Int he exampl
e,t he recei
ver will
adve
rtis
eawi ndow of1oct e
t.Whe ni tlearnsthatspaceisavai
l
a bl
e,thes endi
ng
TCPr e
spondsb ytr a
nsmi
tti
ngas e
gme ntt hatcontai
nsoneoctetofda ta
.
Al
thoug hs i
ng l
e-oct
etwi ndow a dv
ertis
eme nt
swor kc orrec
tlyt ok e
ept he
recei
ver
sb uff
e rfill
ed,theyr e
s ul
tinas e
riesofsmalldat
as egments.Thesendi
ng
TCPmus tc ompos eas egmentt hatc onta
insoneoc tetofdata,placethesegment
i
na nIPda ta
gr am,a ndt r
ansmitt her es
ult.Whe nthereceiv
inga ppl
ic
ati
onr eads
another octet,TCP g en-erat
e sa nothera cknowle
dgement,whi chc aus
est he
sendert ot ransmi tanothers e g
me nt thatc ontai
nsone oc tet of dat
a.The
resul
ti
ngi nteraction ca
nr e
achas tea
dys tatein whichTCP s endsas epara
t e
segmentfore achoc tetofda ta
.
Transferr
ings ma llse gme ntsunne cessari
lyc ons umesne tworkb andwi dtha nd
intro-ducesc omp utat i
ona lo verhead.S ma l
ls eg me ntsc ons ume mor e ne twork
bandwi dthp eroc t e
tofda t at hanl argesegme ntsb ecausee achda tagram ha sa
heade r.Ift heda tagra m onl yc arriesoneoc tetofda ta;t her atioofhe ade rto
datai sl arge
.Comp ut ationa lov e
r -
heada ri
sesb eca useTCPonb otht hes endi
ng
andr ecei
vingc omp ut ersmus tp rocessea c
hs egme nt.Thes endi
ngTCPs of twa r
e
mus ta ll
ocateb uffers pace,f orm as egmenthe ade r,a ndc omp uteac he c
k sum for
thes egme nt.S i
milarly,I Ps of t
wa reont hes endingma chinemus te ncap s
ula tethe
segme ntinada t a
g ram,c omp uteahe ade rchecksum,f or-wa rdtheda ta g
r am,a nd
transferi ttot hea p prop riatene tworki nterface.Ont her ecei
v-ingma chi ne,IP
mus tv erifyt heI Phe aderc hecksum a ndp asst hes egme ntt oTCP.TCPmus t
verifyt hes egme ntc heck sum,e xaminet hes eque nc enumb e
r ,extr a
c tt heda ta,
andp l
aceitinab uf fer.
Al
though we have descr
ibed how smallseg
me nt
sr esul
t whe n ar ecei
ver
a
dvert
isesas mallava
il
abl
ewi ndow,as endercana l
soc aus
ee achs e
gme ntt o
c
ontai
nas mallamountofda ta.Forexamp l
e,i
magineaTCPi mp l
ementati
ont hat
a
ggres
siv
elysendsdatawhe neveritisavail
abl
e,andc ons
iderwhatha ppensifa
s
endi
nga ppl
i
catio
ng en-er
atesda taoneoc tetatat ime.Af t
ert hea pp
lica
tion
genera
tesano c
tetofdata,TCPc r
e a
tesa ndt r
ans
mitsaseg
me nt.TCPcana
lso
se
ndas mal
lsegmentifanappl
ic
ationg enera
tesdatainf
ixed-
sizedbl
ocsofB
k
octe
ts,andthesendi
ngTCPextr
actsda t
af rom
Se
c.11
.31 S
il
lyWi
ndowS
yndr
omeAndS
mal
lPa
cke
ts
239

t
heb uff
eri
nma x
imumsegments
ize
dbl
ock
s,M,whe
reM B,b
eca
uset
hel
ast
b
loc
ki nabuf
fercanbes
ma l
l
.
Thepr
obl
emofTCPs endi
ngsmal
lsegment
sb e
camekno
wnasthes
il
lywi
ndow
s
yndrome(
SWS).Ea
rlyTCPimple
mentat
ionswerepla
gue
dbySWS.Tos
ummari
ze,

Earl
yTCPi mpl
ementati
onsexhi
bit
edapr oblem knownass il
lywin
-dow syndr
ome,i n whi
ch each ac
knowledgement adv er
tis
esa
smal
lamountofs paceavai
l
ableandeachs egmentc ar
riesas mal
l
amountofdata.

1
1.32Av
oidi
ngS
il
lyWi
ndowS
yndr
ome

TCPspecifi
cati
onsnowi ncludehe uris
ticst hatpreventsil
lywindows yndrome.
Ahe uri
sti
cus edont hes endingma c
hinea voi
dst ransmitti
ngas ma l
lamountof
dataine achs egment.Anot he rhe uristi
cus e
dont her ec
eivi
ngma chinea voi
ds
sendi
ngs mallincre
me ntsinwi ndow a dvertisementst hatcant ri
ggers malldata
packet
s.Althought hehe uri
st i
cswor kwe l
lt ogethe
r,ha vingbotht hesendera nd
recei
veravoids i
ll
ywi ndow he lpsensur eg oodp erf
or manceint hec as
et hatone
endofac onnec t
ionfail
st oc orrect
- l
yi mpleme ntsi
ll
ywi ndowa voi
dance.
I
np ra
ctic
e,TCPs of
twaremus tcontainbothse
nderandrecei
versi
ll
ywindow
avoi
danc
ec ode.Tounderst
andwhy,r e
callthataTCPconnec
tionisful
lduple
x
datacanflow inei
therdirec
tion.Thus,a nimpl
ement
ati
onofTCPi nc
lude
sc ode
tosenddataaswe l
lascodetor ece
iveit.

1
1.32.
1Re
cei
ve-
SideS
il
lyWi
ndowAv
oida
nce

Thehe uri
sticar e
c e
iverusest oa voi
ds i
ll
ywi ndow isstrai
ghtf
orwa rda nd
easi
ert ounde rs
ta nd.I ng e
neral,ar ecei
verma int
a i
nsa ninternalr
ecordoft he
currentlyavai
labl
ewi ndow,b utdelaysa dve
rti
singa ni nc
reaseinwindow sizet o
these nderunti
lt hewi n-dow cana dvanceas i
gnifi
canta mount.Thede fi
nit
ionof
si
gnific
antdependsont her ec
eive
r
sb uff
ersizea ndt hemaximum segmentsize.
TCPde fi
nesitt ob et heminimum ofoneha lfoft her ec
eiver
sbufferort he
numb erofda t
aoc t et
si nama ximum- s
izedsegme nt
.
Receiv
e -
sides ill
ywi ndow prevent ssmallwindow a dv e
rtis
e mentsint hecase
wherear eceivi
nga ppl
ic ati
one xtr
ac tsda taoctetsslowl y.Fore xample,whe na
recei
versbuf ferf il
lsc omp l
etel
y,its endsa na c
knowle dgeme ntt hatc ontai
nsa
zerowi ndow a dv e
r-tis
e me nt.Ast her ece
ivi
nga ppl
icatione xt ract
soc t e
tsf r
om
theb uffer
,t her ecei
vingTCPc omp ut esthene wlyavailablesp ac
ei nt heb uff
er.
Inst
ea dofs endi ngawi ndow advertisementimme diatel
y,howe v
e r
,t her ecei
ver
waitsunt i
lt hea vai
lables pacereache soneha l
foft het otalb uffers i
zeora
maximum s i
zeds e gment.Thus ,thes e nderalwaysreceivesl ar
gei ncreme ntsinthe
currentwi ndow,a ll
owi ngi ttot ra nsferlarges eg
me nt s.Thehe uristiccanb e
summa ri
zeda sf oll
ows :
240 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

Receiv
e-Si
deSil
lyWi ndow Avoi
dance:beforesendi
nganupdated
win-dowadvert
isementafteradver
t isi
ngazerowindow,wai
tfor
spacetobecomeav ai
l
ablethatisei
t heratleas
t50% ofthetotal
buffersi
zeorequalt oamaximums izeds
egment.

1
1.32.
2De
laye
dAc
knowl
edge
ment
s

Twoa pproa c
he sha vebeent ak entoi mp l
eme ntsil
lywi ndow avoidanceont he
re-
ceives i
de.Int hef i
rstapproa ch,TCPa ck
no wledgesea c
hs eg
me ntt hata r
r i
ves,
butdoe snota dve r
tisea nincreas eini tswind ow untilthewi ndow r eache
st he
l
imitsspecifi
edb yt hes i
ll
ywi ndow a voidancehe uris
tic.Int hes econda pproach,
TCP delayss endinga na ck
nowle dgeme ntwhe ns il
l
y wi ndow a v
oidances peci
fies
thatthewi ndowi snots uffi
-cient l
ylarget oadv erti
se.Thes tandardsr e
comme nd
del
ayinga ck
nowl edge ments.
De l
aye da cknowl edgeme ntshaveb ot hadv ant a gesanddi sadvantages
.Thec hief
advantag ea risesb ecause de l
ayeda c knowl edgeme ntsc an de creasetr af
fica nd
therebyi n-cre as
et hroughp ut.Fore xa mple,i fa dditi
onalda taa rri
vesdur i
ngt he
delayp eriod,as i
ng lea c
k nowl edgementwi l
la c
k nowl edgea lldatar ece
ived.Ift he
recei
vinga pp
lica-tiong ene ra t
esar esp onsei mme diatel
ya fte rdataa rr
ives(e.g.
,a
charactere cho f or a ni n- te
r a
ctiv
es es
sion),a s hortd elay ma yp ermitt he
acknowle dgeme ntt op iggyb ackonada taseg me nt .Fur ther
mor e
,TCPc annotmov e
itswindowunt i
lther eceivinga ppli
ca-tione xt ract sdataf romt heb uffer.Incases
whe r
et her e cei
vinga ppl
ica ti
onr e
adsda taa ss oona si ta rri
v e
s,as hor tdelay
all
owsTCPt os endas i
ngles egmentt ha tack nowl edg e
st heda taa ndadv er
tis
esa n
updatedwi ndow.Wi thoutde l
ayeda ck nowledg eme nts,TCPwi lla c
knowledget he
arri
valofda tai mme di
ate ly,a ndl at
e rs enda na ddi
tionala cknowl-e
dg ementt o
updatet hewi ndows i
ze .
The di s
advant
a ge
s of d el
aye da cknowledgeme nt
ss houldb ec l
ear. Mos t
i
mp ortant,ifar ecei
verdelaysac knowledge
me ntst oolong ,thes endi
ngTCPwi l
l
retransmitthes egment.Unne c
es s
ar yretransmissi
onslowe rt hroughputb e
c ause
they wa ste ne t
wor k b andwidth. I n a ddit
ion, r etransmissi
ons r equire
comput at
ionalover
headont hesendinga ndr e
c ei
vi
ngma c
hines.Fur ther
more,TCP
usest hea rri
valofa cknowledge
me ntstoe s-timater oundt r i
pt imes;delaying
acknowledgementsc a
nc onfuset hee sti
matea ndma ker etransmissi
ont i
mest oo
l
ong .
Toavoidp ot
entia
lp roblems,theTCPs tandardsplac
eal imitont het i
meTCP
de-l
aysa na c
knowledgeme nt.Imp l
eme nta
tionsc annotde l
aya na ck
nowl e
dgement
formor ethan500mi ll
i
s econds.Furthermore ,tog uarante
et hatTCPr ecei
vesa
suf
fici
entnumb erofr ound t ri
pe stimates
,t he s t
andardr ecomme ndsthata
rec
eivershoul
da c-k
nowle dgea tleas
te veryot he
rda tasegment.
S
ec.1
1.32 Av
oidi
ngS
il
lyWi
ndowS
yndr
ome 241

1
1.32.
3Se
nd-
SideS
il
lyWi
ndowAv
oida
nce

Thehe ur i
sti
cas endi
ngTCP us est oa voids i
ll
y window s yndromei sb ot
h
surpri
s-i
nga nde l
egant.Recal
lt hattheg oalistoa voidsendings ma l
lsegments.
Als
or ecal
ltha tas endi
nga ppl
ic
a ti
onc ang enerateda tainar bi
trari
lys mal
lb l
ocks
(e.
g.,oneoc t e
ta tat ime).Thus ,toa chievetheg oal
,as endingTCPmus ta ll
ow
thesendinga ppli
cati
ont oma k
emul ti
plec al
lstowr ite(orsend)andmus tc ol
lect
thedatat ransferre
di neachcallbeforet ransmit
tingitinas i
ngl
e ,la
r gese
g ment.
Thatis,as e ndi
ngTCPmus tde l
ays endingas e
gme ntunt i
litc ana ccumulatea
reas
onableamountofda t
a.Thet echni
quei sk nowna sclumping.
Theque s
tionar i
ses,how longs houl
dTCPwa itbeforetrans
mittingdata?On
oneha nd,ifTCPwa i
tst oolong,t hea pp
li
cationexpe
r i
ence
sl ar
gede la
ys.Mor e
important,TCPc annotk now whethert owa itbeca
usei tcannotk now whether
thea p
p l
ic
ati
onwi l
lg eneratemor eda tainthene arfut
ur e
.Ont heot herhand,if
TCPdoe snotwa i
tl onge nough,seg
me nt
swi l
lbesmallandthroughputwillb
el ow.
Prot ocolsdesi
gnedp rior t
o TCP c onfrontedt he same problem a nd used
techni
que st ocl
umpda tai ntolarg
e rpacket
s .Fore xa
mp le,toa chi
evee ffi
ci
ent
transf
era crossane t
work,e arl
yr emotet erminalp rot
ocolsdelayedt r
ans mitti
ng
eachk eys trokeforaf ew hundr edmi l
l
isec
ondst ode terminewhe thert heus er
wouldc ont i
nuet opres
sk eys.Be-causeTCPisde s
ignedt obeg eneral
,howe ver
,it
canb eus e dbyadi v
ersesetofa ppli-
cati
ons.Cha r a
ctersma ytravelacros saTCP
connection b ec
auseaus eri st ypi
ng on ak e
yb oard orb ec
aus eap rog r
ami s
transf
er ringaf i
le.Afixe
dde layisnotop t
ima lfora l
lappli
cati
ons.
Likethealgorithm TCPuse
sf orr etransmi
ssi
onandt hesl
ow- sta
rta l
gor i
thm
usedt oavoi
dc ongesti
on,thetechniqueas endi
ngTCPus estoa v
oids endi
ngs ma l
l
packetsisa da
p ti
ve t hedel
ay de pendson thec urre
ntp erformanceoft he
underlyi
nginternet.Lik
es l
ow-s
tar t
,s end-si
desi
ll
ywindowa v
oidanceisc a
ll
e dself
cl
ockingbecauseitdoe snotcomp utede la
ys.Inst
ead,TCPusest hea rri
valofa n
acknowledge
me nttot rigge
rthet ransmissi
onofa ddi
ti
onalpac
ket s
.Thehe uri
st i
c
canb esumma r
ized:

Send-Si
deSi ll
yWi ndowAv oi
dance:whenas endingapplicationgen
-eratesaddi t
ionaldatat obes entoverac onnec ti
onf orwhi c
h
previ
ousdat ahasbeent rans
mi tt
edbutnotac knowledged,pl ac
e
thenew dat ai ntheout putbuf ferasus ual,butdonots end
additi
onals egments unt ilt herei ssuffi
c i
ent dat at of i
l
la
maximum- sized segment .I fs til
lwai ti
ng t os end when an
acknowledgementar r
ives,sendal ldat
at hathasac c
umul atedin
thebuf fer.Applyt her ul
eev enwhent heus err e-questsapus h
operati
on.

Ifanapp
li
cati
ongene
ra t
esdataoneocte
ta tat i
me,TCPwi l
lsendt hefirs
t
oc
tetimme
dia
tel
y.However,unti
ltheACKarri
ves,TCPwi l
laccumula
tea ddi
tional
oc
tetsini
tsbuff
er.Thus
,i ftheappl
ic
ati
onisre a
sonab
lyf a
stc ompar
edt othe
net
work(i
.e.
,af i
l
etr
ans
fer
),s
ucc
ess
ives
egme
ntswi
l
lea
chc
ont
ainma
nyoc
tet
s.
Ifthea
ppl
ic
ationi
s
242 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

sl
owcompa
redtothene
twork(e.
g.,aus
ert
ypi
ngonak
eyb
oar
d),s
mal
lse
gme
nts
wil
lbes
entwit
houtl
ongdel
ay.
Knowna stheNaglealgorithm af te
ri tsi
nventor
,t hetechniquei se s
peci
al
ly
e
legantb e
ca useitre
quireslitt
lec omputat
iona
loverhead.Ahostdoe snotne e
dt o
k
e epseparatet i
mersfore a
chc onnecti
on,nordoe sthehos tnee dt oe xami
nea
c
lock whe na na ppl
ic
a-tion g ene ra
tes data. Morei mporta
nt,a lthought he
t
e c
hniquea daptstoarbitr
a r
yc omb i
-nati
onsofne t
wor kdela
y,ma xi
mum s egment
s
ize,anda ppli
cati
onspeed,itdoe snotlowerthroughputinconventionalcases
.
Tounde rstandwhyt hroughp utr emainshighforc onventi
onalcommunicati
on,
ob-servet ha ta ppl
i
cati
onsop ti
mi ze dforhi ghthroug hputdonotg enerat
eda ta
one oc teta tat i
me (doing s o woul di ncur unne cess
ary operat
ing system
overhead).I nstead,suchap -pl
i
ca tionswr it
el ar
geb locksofda tawithe achc a
ll
.
Thus,t heout goingTCP b ufferb e-gi
nswi ths uffi
cientda tafora tl e
astone
ma x
imum s ize segment.Fur ther more,b e
causet he a ppl
ica
tion pr
oduces data
fastert ha
nTCPc antransferda ta ,thes endi
ngb uf fe
rr emainsnearl
yf ulland
TCPdoe snotde l
ayt ra
nsmissi
on.Asar esult,TCPc ontinuestosends eg
me ntsat
what eve
rr a t
et he underl
ying i nternetc ant ol
e rate,whi l
et he appli
ca-ti
on
continuest of i
llthebuffer
.Tos umma r i
ze:

TCPnowr equi
rest hesenderandrecei
vertoi mpl
ementheur is
tics
that avoid the s il
ly window syndrome. A r eceiver avoids
adver
t i
si
ngas mallwindow,andas enderus esanadaptivescheme
todelaytransmis
sionsoi tcancl
umpdat aintolar
ges egments.

1
1.33Buf
ferBl
oatAndI
tsEf
fec
tOnLa
tenc
y

TCPisde si
gnedt oma x
imizet hroughputb ya da
ptingtoc ondi
ti
onsi nthe
network.Asar esul
t,TCPk eepsb uffersinne tworkde vi
cesnearl
yf ull
.Over
sev
eraldecade
s,thep ri
ceofme moryha sdropp
e dandv e
ndorshaveincr
easedthe
amountofme mor yinnetworkdevic
e s
.Ev enas mal
lhomeWi -Firoute
rha sorde
rs
ofma gni
tudemoreme morythant helargestroutersofthe1980s.
I
tma ys eemt ha
ta ddi
ngme morytoane tworkde vi
cewil
lalwa ysimprove
per
for-manceb ec
auset he d e
vic
ec anaccommodatep a
cketburstswi thf ewer
pac
ketsb ei
ng dropped.Howe ver,a se
riousprobl
em cana r
ise when ne twork
devi
ceshavel a
rgeme morie
sa nds e
ndp ack
etsacrosssl
ow l
inks
:l ongl at
ency.
Inc
reasedlat
encyme anst hatreal
-ti
mecommunica
tion,suchasVoIPp honec al
l
s,
bec
ome sunusab
le.
Toa p
pr e
ciat
et heprobl
em,c onsi
deraWi -
Firouterinahome .Assumetwo
user
sa reus i
ngt heI nt
ernet:onei sdownloadi
ngamov ieandtheot he
risusing
Skypet oma keap honec al
l
.As s
umet herouterusesonly4MBofme moryasa
pack
e tbuffer(ac onser
vati
vee s
timate).Becaus
eitusesTCPa nda l
wayshasdata
tos end,t he mov i
e download willk ee
pt he buffer ne
arl
yf ul
l.The Skype
convers
ati
ons endsda taatamuc hlowerr at
et ha
nt hedownloa
d.Whe naS kype
pac
ketarr
ive
s,thep a
cketwil
lbep
lacedint
heb ac
kofthebuf
fer,a
ndwil
lnotbe
del
iv
eredunti
lallthep a
cke
tstha
twe r
ewa i
ti
ngi nt
hebuffe
rhavebe
ens ent
.
Howlongdoesi
tt a
ket oemptyabuf
fer?AWi -
Sec
.11
.33 Buf
ferBl
oatAndI
tsEf
fec
tOnLa
tenc
y
243

Ficonnec
tionus ing802.11ghasa ne ff
ectivede l
ive
r yr a
t eofa pproxi
mately20
Mbps.Ame gabyteofme moryc ontai
ns8, 388,608b its,soa4me gabyt
eb uffe
r
hol
ds33,554, 432 bi
ts.Wek now thatt her e ce
iverwi l
lt ra
ns mi
tACKs ,whi c
h
meansther outercannotsenddatafromt heb ufferc onti
nuousl
y.Forp urposesof
anal
ysi
s,assumeab es
tc as
ewhe rethene tworkha snoot hertraff
icandt he r
ei s
no del
ayb etwe e
np a
ck-ets
.Ev en undert hei deal
izedc ondi
tions
,t het imet o
tra
nsmitab ufferofda t
ais:
7 1
.68
3.
3610b i
ts
Buf
ferdel
ay bit
s / s
econds
7
2.
010s econd

I
n other wor
ds,the use
r who isat
temp
ting t
oc onductaSk
ypeca
llwi
ll
e
xper
ienc
ea nintol
era
bledel
ay.Thedel
ayisnoti
cea
blee v
eni
fauseri
sonl
y
b
rowsi
ngtheWe b
.
Weusethet emb
r uff
erbloatt odescr
ibet heus eofv erylar
g ebuf fersin
net
workdevic
es.Themos tsurpr
isi
nga s
pectofb ufferbloatistha
ti ncr
e a
s i
ngt he
net
workb a
ndwidthbeforet hebottl
eneckli
nkwi llnotimp r
oveperforma ncea nd
mayma k
ela-tenc
ywor se.Thatis,payi
ngforahi ghe
r-speedInte
rne tconne c
tion
wil
lnotsol
vetheprobl
em.Formor einf
ormatio
nont hes ub
ject
,seet hefollowing
vi
deo:

ht
tp:
//www.
yout
ube
.com/
wat
ch?v
=-D-
cJNt
Kwuw

1
1.34S
umma
ry

TheTr ansmiss
ionCont
rolProtocol,TCP,define
sak e
ys erv
iceforint
ernet
com-munication,na mel
y,rel
iabl
es t
r eam de
li
very.TCP prov
idesa ful
lduple
x
connect
ionb e twe
ent woma c
hines,al
lowingthemt oex
changelargevol
umesof
dataeffic
iently.
Bec
auseitus esasl
idi
ngwindow p
rotocol
,TCPc a
nma keeffi
ci
e ntuseofa
net-work.Be c
auseit makesfew ass
ump t
ions ab
out t
he underl
ying de
liv
ery
sys
tem,TCPi sflex
ibl
eenoughtoope
rateoveralargev
ari
etyofdeli
verysys
t e
ms.
Becaus
eitp rovi
desfl
ow cont
rol
,TCPa l
lowssyst
emsofwidel
yv a
ryingspeedsto
communicat
e.
Thebasi
cuni toft rans
ferus edb yTCPisas egment.Segmentsareus edto
p
assda taorcontrolinformati
on( e
.g.,toall
owTCPs oftwareontwoma c
hinesto
e
stabli
shconnecti
onsorb re
akt hem).Thes egmentformatp e
rmi
t sama chineto
p
iggybackac-knowledgementsforda tafl
owinginonedirecti
onbyi nc
ludi
ngt he
m
i
nthes egmenthe a
de rsofdataflowingintheopposi
tedire
cti
on.
TCPimplementsfl
ow controlbyha v
ingtherecei
v e
ra dve
rti
set
heamountof
da
taiti
swill
ingt oac
cept
.I talsosupportsout
-of
- b
a ndme s
sage
sus
inga
nur g
ent
da
tafac
il
i-t
y,a ndforc
esde l
iv
er yusi
ngap ushmechanism.
ThecurrentTCPs tandardspeci
fi
e sex p
onentialbackof
ff orr e
transmis
sion
ti
mer sandcongest
iona voi
danceal
gorithmsl i
keslow- s
tart
,a ddi
ti
veincr
e as
e,a nd
multi
pli
ca-
tiv
ede crease
.I na ddi
ti
on,TCPus esheur i
sti
cstoa voi
dt ransfe
rring
smal
lp a
ckets
.Fi-nal
ly,theI ETFrecomme ndsthatr outer
suseREDi nste
a doft ai
l
-dr
opb eca
usedoings oavoidsTCPsynchronizati
ona ndimprovesthr
oughput.
244 Re
li
abl
eSt
rea
mTr
ans
por
tSe
rvi
ce(
TCP) Chap.1
1

EXERCI
SES

1
1.1 TCPus esaf i
nit
ef i
el
dt oc
onta
inst
rea
ms e
quencenumbe
rs.Studyt
heprot
ocol
spe
cif
i-cat
iontof i
ndouthow i
tal
l
owsa nar
bit
raryle
ngt
hs t
reamtopa
ssfrom
onema c
hinetoanother
.
1
1.2 Thet ex
tnotesthatoneoftheTCPop ti
onsper
mitsarec
eiv
ert os pe
cifythe
maximum s
egments
izeiti
swil
li
ngtoacce
pt.WhydoesTCPsuppor
ta noptionto
spe
cify max-
imum se
gment s
ize whe
ni ta l
so ha
s a wi
ndow a dv
ertis
ement
mechani
sm?
1
1.3 Under whatcondi
tions of de
lay,bandwi
dth,load,a
nd p
ack
etl
oss wi
l
lTCP
retr
ansmi
tsig
nif
ica
ntv ol
umesofda t
aunnecess
ari
l
y?
1
1.4 Asing
lel
ostTCPa
cknowl
edg
eme
ntdoe
snotne
ces
sar
il
yfor
cear
etr
ans
mis
sion.Ex
-
pl
ai
nwhy.
1
1.5 Ex
peri
me ntwi thlocalmachi
nestodete
rminehow TCPhandl
escompute
rr eboots
.
Es
-tabl
i
shac onne
c t
ionfrom mac
hineXtoma c neYa
hi ndleav
etheconnect
ionidle
.
Re-
bootma chineYa ndthenforc
et heap
pli
cat
iononmac neXt
hi ose
ndas egme nt
.
Whathappens?

1
1.6 Imagineanimp l
ementati
on ofTCP thatdisc
a r
dss e
gmentst hatarri
veoutof
order,ev
eniftheyf al
linthecur
rentwindow.Tha tis
,theima g
inedvers
iononl
y
acce
pt ss
egmentsthate xte
ndtheb ytestre
ami thasal
readyr ec
eiv
ed.Doesit
work?Howdoe sitcomparetoasta
ndardTCPi mple
mentat
ion?
1
1.7 Consi
derc omp ut
ationofaTCPc he
cksum.Assumethatal
t houghthechec
ksum fi
el
d
inthese g
me ntha snotb eensettoze r
o,ther e
sul
tofc omp uti
ngthecheckum i
s s
zero.Wha tcanyouc onc
lude?
1
1.8 Wha ta ret he ar g
ume ntsf or and agai
nsta utoma
t ica
lly cl
osi
ng idl
e TCP
connec
tions?
1
1.9 Iftwoa p
plic
ationpr
ogra
msuseTCPtos enddatabutonlys
endonechar
act
erpe
r
seg
- me
nt(e .
g.,byusi
ngthepus
hoper
a t
ion),whatist
hema xi
mum p
erc
entoft
he
networkbandwidtht
heywil
lhav
eforthei
rd at
awi t
hIPv4?WithI
Pv6?
1
1.1
0 S
uppos
ea nimple
me nt
ati
onofTCPus esi
nit
ials
equenc
enumbr1whe
e ni
tcre
a t
esa
c
onnec
tion.Ex
p l
ainhow asys
temc r
ashandr es
tartcanc
onf
usear
emotesys
tem
i
ntobel
ievi
ngthattheol
dconnec
tionremai
nedop e
n.
1
1.1
1 Findouthow i mplementat
ionsofTCPs olvetheoverl
appi
ngs egmentproblem.The
probl
e ma r
ise
sb ecausether e
ceiv
e rmusta c
ceptonlyonec opyofa llbytesfrom
theda tastrea
me venifthes e
nde rt
ransmitstwosegmentst ha
tp a
r ti
al
lyoverla
p
onea nothe
r( e.
g.,thefirs
ts eg
me ntcar
riesbyt
e s1
00t hr
oug h200a ndt hese
cond
carri
esbytes150t hroug
h250) .
1
1.1
2 Tra
cetheTCP fi
nit
es t
atema c
hinetr
a ns
iti
onsf ortwoe ndsofac onne
cti
on.
As
sumeonesideexec
utesapassi
veopena ndt heothers
idee x
ecut
esa nact
ive
op
en,ands
tepthr
oughthethr
ee-wayhandshake
.
1
1.1
3 Re
adtheTCPspec
ifi
cat
iontof
indoutthee
xac
tcondi
ti
onsunde
rwhi
chTCPc
an
maket
hetr
ans
iti
onfrom FI
NWAIT-1t
oTIMEDWAIT.
1
1.1
4 Tra
cetheTCPs
tat
etr
ans
iti
onsf
ort
woma
chi
nest
hata
gre
etoc
los
eac
onne
cti
on
gr
ace-
ful
ly.
1
1.1
5 As
sumeTCPi
sse
ndi
ngs
egme
ntsus
ingama
ximum wi
ndow s
izeof64Kb
yte
sona
channelt hat ha
sinfi
nit
ebandwi
dthand a
na ver
ager ound-tr
ipt i
me of 20
mil
lis
e conds.Wha ti
sthemax
imum thr
oug
hput?How doe
st hroughp
utc ha
ngeif
ther ound- t
ripti
me
Ex
erc
ise
s 245

i
ncr
eas
esto40mi
ll
is
econds(
whi
lebandwi
dthre
mainsi
nfi
nit
e)?Di
dyoune
edt
oas
-
sumeIPv
4orIPv
6t oanswe
rthequesti
on?Whyorwhynot ?
1
1.1
6 Canyoude ri
veanequa
tionthatexp
ressesthemaxi
mum poss
ibl
eTCPthr
oughput
asaf uncti
onofthene tworkba
ndwidth,thenetwor
kde la
y,a ndt
hetimet o
pr
oces
sas e
gmenta
ndg enera
teanacknowle
dgeme
nt.(Hint
:consi
dert
heprevi
ous
exe
rci
se.)
1
1.1
7 Des
cri
be(abnormal
)cir
cumst
ance
st ha
tcanle
aveoneendofac onnecti
onins
tat
e
FI
NWAI T-
2i ndef
ini
tel
y.(Hi
nt:t
hinkofda
tagra
mlossands
yst
emc r
ashes.
)
1
1.1
8 Show that when ar out
erimplementsRED,the pr
obabi
li
ty apac
ket wi
llb
e
dis
carde
df rom ap a
rti
cul
arTCPc onnec
tioni
sprop
orti
ona
lt othep
erce
ntag
eof
traff
ictha
tt hecon-ne
cti
ongene
rates.
1
1.1
9 Arguetha
tfa
stret
rans
mi tcoul
db eeve
nfaste
rifi
tusedonedup
li
cat
eACKa
sa
tr
igger
.Whydoe
sthestanda
r drequi
remul
ti
pl
edupl
i
cat
eACKs?
1
1.20 ToseeifaS ACKs c
hemei snee
de di
nt hemodernI
nte
rnet
,measur
et hedata
gram
l
ossonal ong-l
i
vedTCPc onnec
tion(e.
g.,avide
ost
rea
mingap
pli
cat
ion).Howmany
se
g-mentsa r
elost
?Wha tc a
nyouc oncl
ude?
1
1.21 Consi
dera wirel
essr outerwit
h a 3 Mb
psc onne
cti
on t
ot he I
nte
rneta nd a
(bl
oate
d)bufferof256MB.I ftwous
ersaredownl
oadi
ngmovie
sandathir
dus er
tri
est oc
ont a
ctg oogle.
com,whatistheminimum ti
meb e
forethethi
rdus er
rece
ive
sar e
sponse
?
1
1.22 I
nthepr
evi
ousex
erci
se,doesyourans
wercha
ngei
fthec
onne
cti
onb
etwe
ent
he
r
out
era
ndtheInte
rnetis10Mbps?Whyorwhynot
?
Chapt
erCont
ent
s
1
2.1 Introduc ti
on,247
1
2.2 TheOr iginOfFor wardi
ngTa b
les
,248
1
2.3 Forwa rdingWi t
hPa rti
alInformati
on,249
1
2.4 Origi
na lInternetArchi
tectureAndCores,251
1
2.5 BeyondTheCor eArchit
ectureToPe erBa c
kbone
s,
253
1
2.6 Automa t i
cRout ePropagati
onAndAFI B,254
1
2.7 Distance-Vector(Bel
lman-Ford)Routi
ng,255
1
2.8 Re l
i
ab i
l
it yAndRout i
ngPr otocol
s,257
1
2.9 Link-State( S
PF)Rout i
ng,258
1
2.1
0 Summa r y,259
1
2

Routi
ngArc
hitect
ure:Cor
es,
Peer
s,AndAlgor
ithms

1
2.1I
ntr
oduc
tion

Previ
ousc hapt
ersconc
entrateonthec ommuni c
ati
onser vic
esTCP/IPoffer
s
toa p-
p l
ic
ationsandthedetai
lsoftheprotocolsi
nhostsandr outerst
hatp r
ovi
de
thes e
r v
ices
.I nthedisc
ussi
on,wea ss
ume dt hatroute
rsalwa yscont
aincorrec
t
routes,ands awthataroutercanusetheI CMPr edi
rec
tme chanismtoinst
ructa
dir
ectl
y- c
onne c
tedhosttochangearoute.
Thisc hapterc onsiderst wo b r
oad que sti
ons: whatv aluess houlde ach
f
orwa rdingt abl
ec ont ai
n,a ndhow c ant hosev al
uesb eobt
ained?Toa nswe rthe
f
irstque sti
on,wewi llconsidertherel
a t
ionshipb e
twe e
ninterneta rc
hit ec
t ureand
r
out i
ng.I np arti
cula
r ,wewi l
ldisc
ussinternetss t
ructuredaroundab ackbonea nd
t
hosec omp os
edofmul tiplepeerne twor k
s,a ndc onsi
derthec onsequenc esfor
r
out i
ng.Thef orme ri st ypi
calofac orporatei ntra
net;thel a
ttera pp l
iest othe
g
lobalI nternet.Toa nswe rthes ec
ondque s
- t
ion,wewi llc
ons i
de rthet wob asi
c
t
ype s of r outep r
op aga t
ion alg
orit
hms a nd see how e achs up
pliesr out
ing
i
nforma tionautoma tical
ly.
Web egi
nbydi sc
ussi
ngf orwardi
nging ener
al.Lat
ers ecti
onsconcentrateon
i
nte
r-neta r
chi
tecturea nd descri
bethe a l
gori
thmsr outersuset oe xchange
r
outi
nginformati
on.Cha pters13a nd14c onti
nuet oe xp
andourdi scus
sionof
r
outi
ng. Theye xpl
orep r
oto-col
st ha
tr outer
s owne db yt wo i ndependent
a
dmini
str
ativ
eg r
oup suset oe xc
hangein-
for mati
on,andp rotoc
olsthatas i
ngle
g
roupusesamongallitsr
out ers
.
24
7
248 Rout
ingAr
chi
tec
tur
e:Cor
es,Pe
ers
,AndAl
gor
ithms Chap.1
2

1
2.2TheOr
igi
nOfFor
war
dingTa
ble
s

Recallf rom Chapte


r3t hatI Pr outersp r
ovidea cti
vei nterconnecti
onsamong
net-works.Ea chroutera tt
ache stot woormor ep hysicalne tworksa ndforwards
IPd a-tagra msa mongt hem,a c ce
ptingda tagramst hata rr i
veov eronene twork
int
e r
facea nds endi
ngt hem outov era notherinterface.Ex cep tforde st
inati
ons
ondirectlya tt
achednet works
,hos tsp assallIPt r
aff i
ct or outerswhi c
hf orward
datagramsont owardt hei
rf i
- nalde sti
nati
ons.I nt heg ene r
a lcase,ada tagram
travel
sf rom r outertor outerunt ilitreachesar out ertha ta ttac
hesdirectl
yt o
thes amene twor kast hef i
nalde stinati
on.Thus ,t her outers ystemf ormst he
archi
tectur alb asi
sofa ni nterneta nd handle
sa llt raf-fice xceptf ordi r
ect
del
iveryfr omonehos tt oanothe r
.
Chapter8de s
crib
est hea l
gor
ithm thathos tsandr outer
sf ol
l
ow whent hey
forwardda ta
gr a
ms ,andshowshow t hea lgori
thm usesat a
blet oma kedeci
si
ons.
Eache nt
r yint hef orwardi
ngt abl
eus esa na ddres
sa ndama skt ospeci
fyt he
networkp refi
xf orap a
r -t
icul
arde s
tinati
ona ndg ive
st hea ddressofthene xt
routeralongap athus e
dt oreacht hatne twork.Inp racti
ce,e achentr
ya l
so
speci
fi
esal ocalnetworkinterfa
cethats houldbeus e
dt oreacht henexthop.
Weha venots aidhow hostsorroutersobt
aint heinformation forthei
r
f
orwardi
ngtables
.Thei s
suehastwoaspec
ts:whatval
ue sshoul
db ep la
cedinthe
t
able
s,a nd how r oute
rso bt
ainthe v a
lues
. Bothc hoices depend on the
a
rchi
tect
uralcomple
x i
tyandsi
zeoftheinter
netaswellasadminist
ra t
ivepol
i
cie
s.
I
ng enera
l,es
tabl
i
shi
ngr out
esi
nvolv e
st wostep s
:i ni
ti
ali
zati
ona ndup date
.A
hos
torr outermustest
abl
isha ni
nitia
lt ableofr out eswhe nitstarts,a ndit
mustup datethetabl
ea srouteschange( e.g.
,whe nha rdwarefails
,ma k
inga
par
ticul
arne t
workunus-ab
le).Thi
sc hapterwi l
lf ocuso nr out
ers;Cha pter22
des
cri
b e
showhos t
suseDHCPt oobtai
ni nit
ialentr
iesf oraf orwar
dingt a
ble.
Initi
alizati
on de pends on t he ha rdwar ea nd opera
t i
ng s ystem.I ns ome
systems,t her outerr eadsani niti
alf orwardingt ab
lefrom seconda rys toragea t
startup,e itheradi skorf la
shme mor y.I not hers,ther outerb egi
nswi tha n
emp tytablet hatisfil
ledinb ye x-ecut i
ngas t
artupscri
ptwhe nt her out erboot s
.
Amo ngot he rt hi
ngs,t hes tartups c ri
ptc ontai
nsc omma ndst ha tinit
ia l
izet he
networ k ha rdwarea nd configurea nI Pa ddressfore ach net worki nte r
fa c
e.
Final
ly,somes yste
mss tar
tb yb roa dcas
ting (ormul ti
casti
ng)ame ss aget hat
disc
ov e
rsne ighborsa nd requestst he neighborst os uppl
yi nf ormation a bout
networ kaddr esse
sb ei
ngus ed.
Onceani niti
alf orwardingt a
b l
eha sb e
e nb uil
t,ar outermus taccommoda te
changesi
nr out e
s.I ns mall
,s l
owlyc hangi
ngi nternets,ma nage rscane s
tabl
isha nd
mod i
fyroutesb yha nd.Inl arge,r a
p i
dlychanginge nvir
onme nt s,howe ve
r,ma nual
up-dateisimp oss
iblys l
ow a ndp ronet ohuma ne rrors.Aut oma tedme thodsa re
needed.Beforewec an understand thea ut o
ma ti
cp rotocol
sus edt oe xchange
routi
ng inf
orma -tion,we ne edt or evi
ews everalunde r l
ying ideas
.The ne xt
secti
onsdoso,p rovidingthene cessaryconceptualfounda tionf orr out
ing.
Sec
.12.
3 For
war
dingWi
thPa
rti
alI
nfor
mat
ion
249

1
2.3For
war
dingWi
thPa
rti
alI
nfor
mat
ion

The p
rinci
paldiffer
enc eb e
twee nroute
rsa nd typi
calhos tsist hathos t
s
usual
lyknow li
ttl
ea boutt hes t
ructureoftheint er
nett owhi chtheyc onnect
.
Host
sdonotha vecomp l
etek nowle
dg eofallpossi
bledesti
nat i
ona ddre
sses,or
evenofa l
lp oss
ibl
ede st
i-nati
onne tworks.Infa c
t,ma nyhos tsha veonlyt wo
entr
iesintheirforwardi
ngt able:ane ntr
yfort heloca
lne twork,a ndade faul
t
entr
yf oradi re
ctly-
connectedr out
e r
.Theho s
ts endsallnonlocaldatag
ramst o
theloca
lrouterfordeli
very.Thep oi
nti s
:

Ahostcanforwarddatagramss
ucces
sful
lyeveni
fitonl
yhas
par
tialf
orwar
dinginformati
onbec
auseitcanrel
yonar out
er.

Canr out ersa l


sof orwarddatagramswi thonl ypartia
li nformation?Ye s,b ut
onlyunderc ertai
nc i
r c
ums t
ances.Tounde rstandt hecri
teria,ima g
inea ni nternet
tob eaf oreignc ountryc ri
ssc
rosse
dwi t
hdi rtr oadsthatha vedirectionalsigns
posteda ti nter-s
e c
tions.Ima g
inet hatyouha v
enoma p
,c a
nnota skdi re
ctions
becauseyouc annots peakthelocallanguage,a ndha v
enok nowledgea boutv isi
b l
e
l
a ndmarks,b utyo une e dtot ra
velt oav il
lag
ena medS ussex.Youl e a
veonyour
journey,f oll
owingt heonl yroadoutoft own,a ndb eg
int olookf ordi recti
onal
signs
.Thef ir
sts i
gnr eads:

Nor
fol
ktot
hel
eft
;Ha
mmondt
other
ight
;ot
her
sst
rai
ghta
hea
d.

Beca
uset hedesti
nati
onyous eeki snotlis
tede
xpli
ci
tl
y,youconti
nuestra
ight
ahea
d.I nrouti
ngjargon,wes a
yyouf ow ade
ol
l faul
tr out
e.Af
tersev
era
lmor e
si
gns,youfina
ll
yf i
ndonet ha
tr ea
ds:

Es
sext
othel
eft
;Sus
sext
other
ight
;ot
her
sst
rai
ghta
hea
d.

Youturntot
her
ight
,fol
l
ows
eve
ralmor
esi
gns
,ande
mer
geonar
oadt
hatl
eads
toSuss
ex.
Ourima gi
nedt rave
lisa nalogoustoada tagramt raversi
nga ninternet,a nd
ther oadsignsa rea nal
ogoust of orwardi
ngt abl
esinr outersa l
ongt hep ath.
Withoutama porot herna v
igationala
ids
,t r
av e
liscomp l
ete l
yde p
endentonr oad
s
igns,justasda tag
ramf orwa rdinginaninternetdependse ntir
elyonf orwarding
tabl
es.Clear
ly,itisp os
sib
let ona vi
gat
ee ve
nt houghea chr oadsigncontai
nsonl y
parti
alinf
orma t
ion.
Ac e
nt r
alque s
tionc onc er nscorrect
ne s
s.Asat ra v
eler,youmi ghtask:How
c
anIb esuret hatfollowingt hes i
gnswillle
adt omyde s
tinati
on?Youa ls
omi ght
a
sk:How canIb es uret hatf oll
owingt hesi
gnswi llleadmet omyde sti
nati
on
a
longas hortestpath?The seque st
ionsma ysee me spe
cial
lytroubles
omei fyou
p
assmanys ignswithoutf indingyourde sti
nat
ionlistedex pl
i
cit
ly.Ofc ours
e,the
a
nswersde pendo nt het opolog yoft her oads yst
ema ndt hec onte
ntsoft he
s
igns
,butt hef undame nta lide aisthatwhe nt akena sawhol e,theinformati
on
onthes i
gnsshoul
dbebot
hc onsi
ste
ntandcomp l
ete
.Lookinga
tthi
sanot
herway,
wes eethatitisnotnece
ssaryforeachint
ersec-t
iontohaveasig
nf ore
very
des
tinat
ion.Thesi
gnsc
anlis
tde f
aultp
athsaslongasall

Fortuna
tel
y,s
ignsa
rep
rint
edi
nal
ang
uag
eyouc
an
read.
250 Rout
ingAr
chi
tec
tur
e:Cor
es,Pe
ers
,AndAl
gor
ithms Chap.1
2

expl
i
c i
tsignspoi
nta
longashor
tes
tp a
th,andtheturnsfors
hort
estp
a thstoal
l
des
tina-t
ionsarema
rked.Afewexampl
eswil
lexp
lai
ns omewayst
hatconsi
ste
ncy
ca
nb ea c
hieve
d.
Atoneextre
me ,cons
ideras i
mp l
estar-s
hape
dt opol
ogyofroa
dsi
nwhich
e
achtownhasexact
lyoner oadl
eadingt oit
,a ndal
ltheroadsme
etatace
ntr
al
p
oint
.Fig
ure12.
1ill
ust
rate
st hetopology.

Nor
fol
k Es
sex

S
uss
ex Conc
ord

Bos
ton Le
xingt
on

Fi
gur
e12.
1Ane
xamp
les
tar
-sha
pedt
opol
ogyofr
oadsc
onne
cti
ngt
owns
.

Wei ma gi
neas ignatthec entra
lint e
r sec
tiont hatli
stseac
hp oss
ibl
et own
andt her oadtor eac
hthatt own.Inot herwor ds
,onlyt hecentra
linters
ecti
on
hasinforma t
ionabouteac
hp ossi
bl
ede s
tination;at ra
v e
leral
waysp r
oceedstothe
cent
r ali
nt e
rsect
iononthewa ytoa nyde s
tinati
on.
Atanotherextreme,wec ani ma g
ineana r
bit
rarysetofconnec
tedroadsand
asignate a
c hinter
secti
onlis
tinga llpos
sibl
edesti
nat
ions
.Tog uar
anteethatthe
s
ignslea
dt ravel
ersalongthebe stroute,itmustbetruethatatanyinters
ect
ion
i
ft hesi
gnf orde s
-tinatonDp
i oint
st oroadR,nor oadotherthanRl e
adstoa
s
ho rt
erpatht oD.
Nei
t he r of the a rc
hitect
urale xtreme swor kswe l
lf or a l a
rgeri nt ernet
routi
ngs ys -tem.Ononeha nd,thec entralintersecti
ona pproac
hf ai
lsbe c
a useno
equipmenti sfaste nought os er
vea sac entralswitcht hroughwhi cha llt r
af fi
c
passe
s.Ont heotherha nd,ha v
inginformationa b
outa l
lp ossi
bl
ede sti
nat i
onsi na l
l
routersi si mp ra
ct i
calb ecause itr e
qui resp r
opagating large v olume s of
i
nf or
ma tionwhe neverac hangeoc cursint hein-ternet.The r
ef ore,wes ee
ka
sol
utiont hata l
l
owsg roupst oma nageloca lroutersa utono-mous l
y,a ddingne w
network i nterc
onne cti
ons a nd r outes wi t
hout c hang i
ng t he f orwa rd-ing
i
nf or
ma tioni ndist
antr outers.
Tounde rs
tandt her outinga rchit
ectureus edi nt heInternet,consi
dera
thi
rdt opolo-gyinwhi c
hha lfoft hec iti
esliei
nt heeasternpartoft hecountry
andha lflieint hewe s t
ernp art.S upposeas inglebridgespanst herive
rt hat
sep
ara t
ese astf r
om we st.As-sumet hatp eopl
el i
vingint heeast
e r
np artdonot
l
ikewe sterners,sot he
ya r
eunwi ll
ingt oa l
low anyr oads i
gnint hee a
stt oli
st
dest
inationsint hewe st.Assumet ha tpeopleli
vingint hewe stdot heopposit
e.
Routing wi l
lb ec onsi
stent ife veryr oa dsigni nt he e a
stl i
stsa l
le as
tern
dest
inationse x
pli
citl
ya ndp oi
ntsthede faul
tp a
t ht otheb ri
dge,ande ver
yr oad
s
igninthewes
tlist
sal
lwest
erndes
tina
tionsexp
li
ci
tl
ya ndpoi
ntsthede
faul
t
p
atht otheb
ridg
e.Howev
er,the
reisac at
ch:ifat o
uris
tarri
veswho ha
s
a
cci
denta
ll
y
S
ec.1
2.3 For
war
dingWi
thPa
rti
alI
nfor
mat
ion 251

wri
tten down t
henameofanon-ex
ist
entt own,thetouri
stcouldcros
st he
br
idgeonewaya ndt
henf
indt
hatt
hedefaul
tp a
thpoi
ntsbac
kt othebr
idge.

1
2.4Or
igi
nalI
nte
rne
tAr
chi
tec
tur
eAndCor
es

Muc hofourk nowledgeoff orwardi


nga ndr out epropaga
t i
onp rotocol
sha s
been de ri
vedf rom e xperi
enc e wi tht he I nter
ne t
. Whe n TCP/IP wa sfirst
devel
oped,p arti
c i
- patingr e
se arc
hs i
teswe rec onnectedtot heARPANET,whi ch
ser
v e
da sab a
c kbonene t-workc onne c
tinga l
ls i
tesont heInternet.Duringiniti
al
experi
me nts,eac hs itema nag edf orwardingt abl
esa ndinsta
ll
edr outest oot her
desti
nationsbyha nd.Ast hef ledglingInternetb eg
ant og r
ow,itb ecamea pparent
thatma nualma intena nceofr outeswa sim- p
ra c
tic
al;automatedme chanismswe re
needed.Thec once ptofab a ckbonene tworkc ontinuestob eus ed:ma nyl arge
enterpr
iseshaveab ackbonet hatc onnectssite
sont heenterp
rise
sintranet.
TheI nternetde signersse l
ectedar out erarchitec
t ur
et hatfollowedt hes ta
r-
shape dt opol
ogyde s c
r i
b eda bove.Theor i
ginalde s
ignus edas mall,cent r
a lsetof
route rst hatk eptc omp let
ei nforma ti
on a bouta llp os
siblede sti
na ti
ons,a nd a
l
a r
g ers etofout l
yingr outerst hatk eptp a r
tialinforma tion.Int ermsofour
analog y,itisl ik
ede si
g nati
ngas ma l
lse tofc entral
l
yl oca tedinte r
sectionsthat
haves ig
nsl i
sti
nga llde stinati
ons,a nda l-
lowingt heout lyingi nt
e rsec
tionst olis
t
onlyl ocaldestinati
ons .Asl onga sthede faul
tr outea te achout lyi
ngi nte rs
ecti
on
pointst ooneoft hec entralinter
s e
ctions,t ravel
erswi lle vent
ua ll
yr eacht hei
r
destina t
ion.
Thec entralsetofr oute rsthatma i
ntai
nedc omp leteinfor mationwa sk nown
ast hecoreoft heI nter net.Be caus
ee ac
hc or erout ers toresar out
ef ore ach
pos
sibl
ede stina-
t i
on,ac or er outerdoe snotne edade faultrout e.Therefore,t he
setofc orer outersi ss ome timesr eferredt oa st he default-freezone.The
advantageofp artit
ioningI nternetr outingint o at wo-tiers ystemi st ha tit
permitsloc
a ladministr
a torst oma nagel ocalchang e
si nout l
yingr oute
r swi thout
aff
e ct
ingot herp ar
tsoft heI nternet.Thedi sadvan-tag eistha titintroducest he
potenti
alfori nconsi
stency.I nt hewor stc as
e,a ne rrori na nout l
yingr outerc an
makedi s
tantr outesunr ea c
ha bl
e.
Wec ans umma ri
zet hei de as
:

Theadvantageofac or erout i
ngar chi
tec
t ureli
esinautonomy:
themanagerofanonc orer outerc anmakec hangesl
ocal
ly.The
chi
efdi
sadvantageisi
nconsi
s tency:anoutlyingsi
tecanint
r oduc
e
err
orsthatmakes omedestinationsunreac
hable.

I
ncons
iste
nci
esa mong forwardi
ng tabl
esc ana ri
sef rom er
r or
si nt he
al
gori
thmst hatc omputef or
wa r
ding t
able
s,incorr
e c
t datasuppl
i
e dt ot hose
al
gori
thms,ore r
ror sthatocc
urwhi l
etransmi
tti
ngt heresul
tstootherrouter s
.
Prot
ocoldes
igner
sl ookforwayst oli
mittheimpactofe r
rors
,withtheob j
ective
b
eingtokee
pa l
lroutescons
ist
entata
llt
ime
s.I
frout
esb
ecomei
ncons
ist
ent
,the
r
outingp
rotoc
olsshoul
db erob
ust
252 Rout
ingAr
chi
tec
tur
e:Cor
es,Pe
ers
,AndAl
gor
ithms Chap.1
2

e
noughtodetec
tandcor
rectt
heerror
squi
ckl
y.Mos
timp
ort
ant
,thep
rot
ocol
s
s
houl
dbedes
ignedt
ocons
tra
inthee
ffec
toferr
ors
.
Thee arl
yI nterneta
r c
hit
ectureisea
syt ounderst
andifonereme mbe
r stha
t
t
heI n-ter
nete vol
vedwithawi de-ar
eabackbone
,t heARPANET,al
readyinp l
ace.
Ama jormotiva
t i
onf orthecoreroutersys
temc amef rom t
hedes
iret oconnec
t
l
oca
lne tworkstot hebac
k b
one.Fig
ure12.2il
lust
ratestheidea.

BACKBONENETWORK

Core
R1 R2 ... Rn Rout
ers

Loc
alNe
t1 Local Net2 Loc
alNe
tn

Fi
gur
e12.
2Thee a
r l
yI nt
ernetcoreroutersys
temv i
ewe
da sasetof
rout
erst hatconne
ctloca
la re
ane t
workstothebac
kbone
.
Thearchi
t e
c-t
ureisnowus e
di ne
nterp
ris
enetwor
ks.

Tounde rstandwhyr outersi nFigure1 2.2c annotusep a r


tialinfor ma t
ion,
considert hep athada tagramf ol
lowsifas e
tofr outersuseade faul
tr oute.At
thes ources i
te ,thel ocalr outerc heckstos eeifi thasa ne xp l
ici
tr out et ot he
de s
tinati
on,a ndi fnot ,sendst heda tagrama l
ongt hep at
hs p ec
ifiedb yitsde fault
route .Alldata gr
a msf orwhi c
ht her outerha snoe xp
li
citr outef oll
ow t hes ame
de f
aultp athr egar dl
essoft heirulti
ma tedesti
na t
ion.Thene xtr out e
ra longt he
pathdi vertsda tag ramsf orwhi chitha sa ne xpl
icitroute,a nds endst her est
alongi t
sde fa
ul tr oute.Toe nsureg l
obalconsi
sten-cy,thec hainofde faultr outes
mus tr eache veryr oute
ri nag iantcyc l
e.Thus ,t hearchi-tecturer e quiresa l
l
l
oc alsit
est oc oordinatethe irde f
aultroutes.
The r
ea r et wop rob l
emswi thar out i
nga rc
hit e
c turet hatinvolvesas etof
defaul
tr oute s.First
,s upposeac omput e ra cc
identa l
l
yg eneratesada ta
g r
amt oa
nonexi
s tentde sti
nation( i
.e.,toa nI Pa ddresst hatha snotb eena ss
igned).The
hostsendst heda -tagramt othel ocalr oute r
,t hel ocalroute rfol
lowst hede f
aul
t
pathtot hene xtrout e
r,a nds oon.Unf or tunatel
y,b e causede f
aultr outesf orma
cycl
e,t heda tagramwi llgoa roundt hec ycleunt i
lt hehopl imite x
p i
re s
.S econd,i
f
wei gnoret hep r
oblem ofnone xi
stenta ddr es
se s
,f orwarding i
si ne ffi
cient.A
datagramt ha tfoll
owst hede faultrout esma yp asst hroughn1r outersb efor
e
itreachesar outerthatc onnect stot hel o-calnet wor koft hede sti
na ti
on.
Toavoi
dtheineffi
ci
enc
iesa ndpot
entialrouti
ngloopst ha
tde faul
troutesc
an
ca
use ,t
hee ar
lyI nt
ernetprohi
b i
teddefaultroutesinc orer out
er s
.Inst
eadof
usi
ngde -
faul
tr outes
,thede si
gnersarr
ang edforr out
er stoc ommunicat
ewith
oneanot
herandexcha
nger
out
ingi
nfor
mat
ions
otha
tea
chr
out
erl
ear
nedhow
tofor
wardda
t a
gra
ms
S
ec.1
2.4 Or
igi
nalI
nte
rne
tAr
chi
tec
tur
eAndCor
es 253

dir
ect
ly.Arra
ngingf orcor
eroute
rstoe x
cha
ngerout
inginfor
mat
ioni
seas
y
the rout
ersa l
la t t
acht othe ba
ckb
one net
work, whi
ch mea
ns t
heyc a
n
communic
atedir
e c
tly.

1
2.5Be
yondTheCor
eAr
chi
tec
tur
eToPe
erBa
ckb
one
s

The introduc t
ion oft he NS FNET b a ckb
one intot he Inter
ne tadded ne w
complexi
tyt ot her outi
ngs tructureandf orceddesi
gnerstoinventane wr out
ing
archi
tecture.Mor ei mportant ,the c hang ei narchi
tecturef oresha
dowe dt he
currentInt e
r netinwhic has etofTi er-1I SPseachhaveawi de
-areab ack
bonet o
whichc ustome rs i
tesc onnect.I n ma ny wa ys,thewor k on NSFNET a nd the
routi
nga rchitecturethatwa sc reat
edt os uppor
titwa sk e
yi nmov i
nga wayf r
om
theor i
gi
na lInternetarchite
ct uretot hec urrentInter
neta rchi
tecture.
The primaryc hanget hat occurred wit
ht he NSFNET backbone wasthe
ev
olutionf r
om as i
ngl
e ,centra
lba ckbonetoas etofp eerbackbonenetworks
,
of
tenc a
ll
edp eersorr out
ingpeers.Althoughtheg l
obalInterne
tnow ha ss
evera
l
Ti
er-1p eers
,wec anunde rst
andt her outi
ngs i
tuati
onb yc ons
ideri
ngonlytwo.
Fi
gure1 2.3il
lust
ratesa nIn-t
ernett op
ologywithap airofbackbonenetwork
s.

HOS
T1 BACKBONE1 HOS
T2

R R R
1 2 3

HOS
T3 BACKBONE 2 HOS
T4

Fi
gur
e1 3Ane
2. xampl
eoftwopee
rbac
kbone
sinter
conne
ctedbymulti
pl
e
r
out
erss
imil
art
othetwopee
rbackb
onesintheInt
erne
tin1989.

Tohe l
pusunde rs
tandt hediffi
culti
esofIPr outi
nga mongp e
erb ackbones,
thef i
g-ureshowsf ourhostsdirectl
yc onne
cte
dt ot heb a
ckbone
s .Althoughs uch
dir
ectc onnec
-ti
onma ys ee
m unr eal
isti
c,itsi
mp l
if
iest heexample.Looka tt he
fi
gurea ndconsiderroutesfr t3t
om hos t2.As
ohos s
umef ort hemome ntt hat
thefigureshowsg eograp
hicor i
entat
ion:host3isont heWe stCoa stattachedt o
backbone2,whi lehost2 i sont heEa stCoas
ta ttachedtob ackbone1 .Whe n
estab
lis
hingroutesbetweenhos ts3and2,t hema nager
smus tdecideamongt hree
opti
ons:
254 Rout
ingAr
chi
tec
tur
e:Cor
es,Pe
ers
,AndAl
gor
ithms Chap.1
2

(
a)Routethe tra
fficfr t3 t
om hos hr
oug
hthe We
st Coa
st
rout
er,R1,a
ndt he
nacros
sba
ckb
one1
.
(
b)Forwa
rdthet
raf
ficfr t3a
om hos c
rossba
ckbone2,t
hroug
h
theMidwe
str
oute,R2,a
r ndthe
na cr
ossbac
k b
one1tohost
2.
(
c)For
wa r
dt het raf
fica
cros
sback
bone2,t
hroug
htheEa
st
Coas
tr out
er,R3,andt
hent t2.
ohos

Amor ec ir
cuitousr outeisp ossi
bleaswe ll
:traffi
ccouldf l
ow f rom hos t3
throught heWe stCoa s
tr oute
r,a crossbac
kbone1t ot heMi dwestr outer,b ack
ontob ackbone2t ot heEa stCoa stroute
r,a ndf i
nal
lyacrossbackbone1t ohos t
2.Suc har outema y orma y notb eadvisab
le,dependi
ngon t hep olic
iesf or
networ kusea ndt hec apacityofv ari
ousroutersandb a
ckbones.Never thel
ess
,we
wil
lc oncentrateo nrout i
ngi nwhi c
hada tagram neve
rt ra
v e
rsesane t workt wice
(i
.e.,nevermov estoane twork,mov esoffthene twork,andt he
nmov esbackt o
thene tworka gain)
.
Intuit
ive
ly,wewoul dl i
kealltraffict ot a
k eas horte
stp at
h.Tha tis,we
wouldl i
ket raf
ficb etweenap ai
rofg e ogr
a phi
cal
lyc l
osehoststot akeas hort
pathindependentoft herouteschose
nf orlong-di
stancetraff
ic.Fore xa
mple,it
i
sde sir
a b
lefort rafficfr t3t
om hos ohos t1t of l
ow throught heWe stCoast
router,R1,becausesuc hap athmini-mizest hetotaldis
tancethatt hedata
gram
travel
s.Mor eimp ort
a nt,ifada tagr
a m mus tt rav
ela cr
ossab ackbone,anI S
P
wouldl iket ok e e
pt he datag
r am on i tsb ackbone (be-c
ause doing soi s
economical
lyles
se xpensi
vethanus i
ngap ee
r).
Theg oa l
sa boves ee ms traig
ht for warda nds ensib
le.Howe v er,t heyc annotb e
transla
tedi ntoar easona blerout ings chemef ortwor ea
s ons .First,a lthought he
stan-dardI Pf orwa r
dinga lgori
thm us est hene tworkp ortionofa nI Pa ddressto
choosear out e,op tima lf orwar ding in ap eerb a
ckbonea rchitecturer equir
es
indi
vidualroute sfori ndi vi
dualhos ts.Fore xamp le,consi
de rt hef or wardingt abl
e
inhos t3.Theop t
ima lne xthopf orhos t1i st hewe st-coa str oute r,R1,a ndt he
optimalne xthopf orhos t2i st hee a st
-coa str outer,R3.Howe v
er ,hos ts1a nd2
bothc onnec tt ob ackb one1 ,whi chme anst heyha vet hes amene twor kp refi
x.
Therefore,i ns
t eadofus ingne t wor kp ref i
xe s,thehos tf or wardingt ablemus t
containhost -s
p e
cificr out es
.S econd,ma na ge rsoft het wob ackbone smus tagree
tok eepr outesc onsis
t enta monga llrout ersoraf orwar dingl oop( routingloop)
cande vel
opi nwhi chas etoft her out ersf orwa rdt oeachot he rinac ycle.

1
2.6Aut
oma
ticRout
ePr
opa
gat
ionAndAFI
B

We sai
dt hatt he ori
gi
nalI nt
ernetc or
es yst
em a voi
de d de
f aul
tr outes
b
eca
useitp r o
p agate
dc omple
tei nf
ormati
on abouta l
lp oss
ibl
e destinat
ionsto
e
ver
yc or
er out e
r.Ma nycorpora
teintrane
tsnow useas imilarapproach t he
y
p
ropa
gateinforma t
ionabouteachdesti
nati
onint hecorpo
r at
iont oallroutersi
n
t
hei
rintr
anet
.Thene xtsec
-ti
onsdiscus
st wobasi
ct yp
esofalgori
thmst hat
c
omput
ea nd prop
agat
er out
ing i
nfor
ma -
tion;l
ate
rc hapte
rsdi
scus
sp rot
oc ol
s
t
hatus
ethealgori
thms.
S
ec.1
2.6 Aut
oma
ticRout
ePr
opa
gat
ionAndAFI
B 255

Routi
ngp rotocol
ss er
vetwoimporta
ntf unctions
.Firs
t,theycomputeas et
ofshortestpaths.S e
cond,the
yr e
spondtone twor kfai
l
uresortopol
ogychang e
s
bycon- t
inual
lyup datingtherouti
nginfor
ma tion.Thus,whenwet hi
nka bout
rout
ep ropaga
-t i
on,iti si
mport
anttoconsi
dert hedynamicbeha
viorofprot
oc ol
s
anda l
gori
thms.
Conc ep
tua l
l
y,r outi
ngp r
otocolsopera t
eindepe nde
ntlyf r
om t heforwar
ding
mecha -
nism.Tha tis,rout i
ngp rotocolsof t
warer unsa sas epara
tep roc
essthat
usesI Pt oex-changeme ssa
g eswithr outingprot
oc olsoftwareonot herrouters
.
Routing protocolslear
na boutde sti
nations,comp uteas hort
estp at
ht oeach
dest
ination,a ndp a
s sinforma-ti
ont ot her o
utingp r
otocolsoftwareonot her
routers.
Althoughar outingp rotocolcomputesshor
testp at hs,ther out
ingp r
otocol
softwa r
edoe sno ts toreinfor mati
ondirect
lyint her outer
sf orwardingt a
ble.
Instead,routings oftwarec reatesaFor wardi
ngI nformat ionBase( FIB).AFI B
ma yc ontai
ne xtrai nfor
- mat i
onnotf oundi naf orwa rdi
ngt abl
e,s ucha st he
sourceoft her outinginforma ti
on,how oldtheinforma tionis(i.
e.,thel a
stt i
me
ar out i
ngp rotocolon a notherr oute
rs entame ss
agea boutt her oute),and
whet herama nagerha stemp orari
lyoverr
iddenas p
e ci
ficr oute.
Whe nt heFIBc hanges,r outi
ngs oftwa rerecomputesaf orwardi
ngt ab
lef or
t
her outera ndinsta
ll
st hene wf orwardingt abl
e.Ac ruci
alstepoc c
ursbetwe en
i
temsb ei
ngp l
acedinaFI Ba ndt heitemsb ei
ngp r
opa g
atedt ot heforwarding
t
able
:p ol
icyr ul
esarea p
p l
i
e d.Polici
esallowama nagertoc ontr
olwhichitemsa re
a
utoma ti
cal
lyi nst
all
edi nt he for war
di ng tabl
e.The refore,e v
e nifr outing
s
oftwaref i
nds a shorterp atht oap a
r -
tic
ular dest
inati
on and place
st he
i
nformati
oni ntheFIB,p olic
ie sma ypre ventthep athf r
om b e
inginjec
tedi nto
t
hef orwardingtabl
e.

1
2.7Di
sta
nce
-Ve
ctor(
Bel
lma
n-For
d)Rout
ing

Thet erm distanc e- v


ec torr e ferstoac l
assofa lgorithmsus edt op r
op aga
te
routi
ngi nforma ti
on.Thei de ab ehinddi stance-vectora lg
or i
thmsi squi t
es imple.
Eachr out erk eepsal istofa llk nownde stinati
onsi ni tsFI B.Whe ni tb oots,a
routeri niti
ali
zesit sFI Bt oc ontaina ne ntryf ore achdirect l
yc onne ctednetwor k.
Eache nt ryint heFI Bi dentifiesade s
tinationne twor k,ane xt-hopr outerus edto
reacht hede stina
t ion,a ndt he dis
tanc e
t ot hene twor k( accordingt os ome
me a
sur e of di sta
nc e).For e xamp le,s ome di stance-vector p rotocols uset he
numb erofne twor khop sa same a sureofdi st
ance.Adi rectl
y-c onnectedne twork
iszerohop sa way;i fada tagram mus tt r a
velt hroughN r oute r
st or eacha
desti
nat ion,thede stinationi sN hop sa wa y.Figur e12. 4i l
lus t
ra t
est hei nit
ial
contentsofaFI Bonar out ert hata ttachest ot wone twor ks.I nt hef i
gure,e a
ch
entryc or re
spondst oadi rectly-conne ctedne twor k(zerohop sa way).
Thetemsv
r ect
or-di
stance,For
d-Ful
ker
son,Bel
l
man-For
d,andBell
manar
esynonymouswit
h
di
stance-
vec
tor;t
helas
tthr eearetake
nfromt hena
mesofrese
arche
rswhopubl
i
shedtheide
a.
Rout
ingArc
hit
ect
ure
:Cor
es,Pe
ers
,And
256 Al
gori
thms Chap.1
2

De
stinat
ion Di
sta
nce Rout
e
Net1 0 di
rec
t
Net2 0 di
rec
t

Fi
gur
e12.
4Ani ni
ti
a lFIBusedwithadi s
tance
-vec
toralgor
ithm.Eac
h
ent
ryc ontai
ns the I
Pa ddres
s of a di
rec
tlyc onne
cte
d
net
wor ka ndaninte
gerdi
stanc
et othenet
work.

Whenus i
ngdist
ance-vect
or,rout
ings
oftwareoneachroutersendsacopyof
i
tsFIBtoanyot he
rr outeritcanrea
chdi
rectl
y.Whenar epor
ta r
rivesatrout
er
Kfrom r
outerJ,Ke xaminesthesetofdes
tina
tionsr
eport
eda ndthedis
t a
nceto
ea
chanda p
-pli
esthreerules
:

IfJl
ist
sades
tina
tiont tKdoe
ha snothav
eini
t B,Ka
sFI ddsa
newe
ntryt
oit
sFIBwi t
hthene
xthopofJ.
IfJknowsashor
terwaytore
achade
sti
nat
ionD,Kr
epl
ace
sthe
nex
thopini
tsFIBent
ryforDwihJ.
t
IfKsFIBentryforde s
tina
tionDa l
rea
dyli
stsJasthenexthop
and J
sdis
tancetot hede sti
nat
ionhaschange
d,K re
pla
cesthe
dis
tanc
einitsFIBent
r y.

Thef i
rstr ulecanb einter
pre
ted, I
fmyne ig
hbork nowsawa yt or eac
ha
des
tina-t
iont hatIdon tknow,Icanus ethene i
g hborasane x
thop .
Thes e
cond
rul
ec anb ein-te r
pret
ed,Ifmyne ighb
orha sas hor t
erro utetoade st
ina
t i
on,I
canuset hene i
g hborasane xthop.Thet hi
rdr ulecanb ei nt
erp
re t
e d,I
fIa m
usi
ngmyne ighb orast henexthopf orade sti
nat i
ona ndt heneighborscostto
reac
ht hedes t
ina t
ionchanges
,myc ostmustc ha
ng e.
Fi
gure1 2.5showsa ne xi
sti
ngFI Bi n ar outer,K,a ndadi s
tance-
ve c
tor
update mess
a g
ef rom a notherr oute,J.Thr
r eei temsi nt he mess
agec ause
changesint he FIB.Not et hati fJ r eportsa di stance N hopstoag i
ven
desti
nati
ona ndKus esJa sane xthop ,thedistances tore
di nKsFIBwillhave
dis
tanceN+1( i
.e.
,t hedista
ncef rom Jt othede stinati
onp l
usthedist
ancet o
reachJ).Thet hi
rdc olumninoure xampl
eFI Bi sla
b eldRout
e e.Inprac
tice,the
col
umn c ont
a i
nst he IPa ddres
sof a ne xt
-hop r outer.To ma keite asyt o
underst
and,thef i
gures i
mplyli
stsas ymbol
icname( e .
g ,Rout
. erJ).
Thet erm dis
tance- vect
orc ome sfrom thei nformati
ons enti nthep e
riodi
c
mes-sages
.Ame ssag
ec ontainsal i
stofp ai
rs(D,V) ,whe reDi sadi s
tancet oa
dest
inati
ona ndVi dentifiesthede s
tinati
on(call
edt hevector).Notethatdist
a nc
e
-vec
tora lgor
ithmsr eportr outesint hef i
rstper s
on( i
.e.
,wet hinkofar out e
r
adverti
si
ng, Ic anr e
a chde s
ti-
nation V atdistanceD )
.I ns uchade si
gn,a ll
routersmus tp a
rtic
ipat eint hedi s
t a
nce-vec
tore x c
hangef ort heroutestob e
effi
cie
nta ndconsis
tent .
S
ec.1
2.7 Di
sta
nce
-Ve
ctor(
Bel
l
man-
For
d)Rout
ing 257

De
sti
nat
ion Di
sta
nce Route De
sti
nati
on Di
stanc
e
Ne
t1 0 dir
ect Net1 2
Ne
t2 0 dir
ect Net4 3
Ne
t4 8 RouterL Net17 6
Ne
t17 5 RouterM Net21 4
Ne
t24 6 RouterJ Net24 5
Ne
t30 2 RouterQ Net30 1
0
Ne
t42 2 RouterJ Net42 3
(
a) (
b)

Fi
gur
e12.
5(a)Anexi
sti
ngFI
Binr
outerK,and(
b)aninc
omingrouti
ng
upda
temess
agef
romrout
erJthatwil
lca
usechang
es.

Al
thoughtheya reeasyt oi
mp l
ement,dista
nce-vectora l
gori
thmsha vesev
er a
l
disadvantage
s.Inac omp le
telystat
icenvironment,di
s t
a nce-
vectora l
gori
thmsdo
indeedc omputeshortes
tp athsandcorrectl
yp r
opagater outestoa l
ldesti
nati
ons.
Whe nr outeschangerapidl
y,howe v
er,thec omputati
onsma ynots tabi
li
ze.Whe n
ar outec hanges(i.
e,a ne w conne
c t
ion appears or a n ol
d one f ai
ls
),t he
informa ti
on pr
opagatess l
owlyf r
om oner outertoa nother.Me anwhil
e,some
rout er
sma yhaveincorrectrout
inginfor-mati
on.

1
2.8Re
li
abi
li
tyAndRout
ingPr
otoc
ols

Mostr out
ing protocol
s usec onnec
tionle
sst ransport e arl
yp rotoc
ols
e
ncaps
ula
tedme ss
agesdire
c t
lyinI
P;mode rnr outi
ngp rotoc
olsusua
ll
ye ncaps
ulate
i
nUDP.Unf or
-tunatel
y,UDPof fe
r sthes ames emantic
sa sIP:mess
ag e
sc anb e
l
ost
,dela
yed,dupli
cat-e
d,c orr
upte
d,orde l
iveredoutofor de
r.Thus,ar outing
p
rotoc
olthatusesthemmus tcompensateforf ai
l
ur e
s.
Rout i
ng p r otocol
s us es everalt echni que st o handler e
liab
il
ity. Fi r
s t
,
checksumsa reus edtoha ndlec orrupti
on.Los si seitherhandledb ysofts t
ateor
througha c
kno wl-edgeme ntsa ndr e
transmission.S equencenumber sareus edt o
handlet wop rob l
ems .First
,s equencenumb er sa ll
ow ar e
ceivertoha ndleout -of-
orderde li
veryb yp lac
ingin-comi ngme ssage sb ac
ki nthec orrec
tor der.S econd,
sequencenumb e rscanb eus edt oha ndler epl ay,ac ondi
tiont hatcanoc curi fa
dupli
cateofame ss
agei sdela
ye da ndar -
rive sl onga fternewe rupdatesha veb een
processe
d.Cha pter1 4i l
lustr
at eshow di s
ta nc e-vectorp rotocol
sc ane x
hibits l
ow
convergence,a nddi scussesaddi t
ionaltech- nique st hatdistance-vect
orp rotoc ol
s
uset oa voi
dp r oblems.I nparticular,thec ha p terc over
ss pli
thorizona ndp oison
reversetechnique s.
Thenextchapt
e rdi
scus
sesa
ne xc
ept
ion arout
ingpr
otoc
olt
hatus
es
TCP.Recal
lthatsof
ts t
aterel
i
esontime
outstoremov
eold
i
nformat
ion.
258 Rout
ingAr
chi
tec
tur
e:Cor
es,Pe
ers
,AndAl
gor
ithms Chap.1
2

1
2.9Li
nk-
Sta
te(
SPF)Rout
ing

Thema indi s
adv antageoft hedist
a nce-
vect
ora lgori
thm ist hatitdoe snot
s
calewe l
l.Be si
dest hep robl
em ofslow resp
onsetoc hangeme ntionede arl
i
er,the
a
lgorithm requi
rest hee xchangeoflargeme ss
ages be ca
usee ac
hr outi
ngup da
te
c
onta i
nsa ne n-t
ryf oreverypossi
bl
ene twork,me s
sages i
zeisprop orti
onaltothe
t
otalnumb erofne t-worksina ni nt
er net
.Fur t
he r
mor e,b e
ca useadi stanc
e-
v
ectorp rotocolrequi reseveryroutertop arti
ci
pate,t hevolumeofi nformati
on
e
xcha ngedcanb ee normous .
Thep r
imarya l
ternativ
et odis
tance-ve
ct oral
gorithmsi sac l
assofa l
gorit
hms
knowna sli
nks tate,links t
atus ,orShortestPathFi r
st( SPF).TheS PFalgori
thm
re-quire
se achp a r
tici
patingr outertoc omput etopol
og yi nformation.Thee asi
est
wayt othinkoft opologyinf ormati
onist oi mag
inet ha te veryrout e
rha sama p
thats howsa l
lot herrout ersa ndthenetwor kstowhi cht heyc onnect.Inab s
tract
terms ,ther oute r
sc orrespondt onode sinag r
a p
h,a ndne tworksthatc onnect
routersc orresp
ondt oe dges.The reisa ne dge(li
nk)b etwe entwonode si nt he
topologyg raphifa ndonlyi ft hecorre
spondingroutersc anc ommunicatedirec
tly.
Inste
adofs
e ndi
ngmes
sagestha
tcont
a i
nalis
tofdes
tina
tionst
hatarout
er
c
anr
e a
ch,ea
chrouterp
art
ici
pati
ngina
nS PFal
gori
thmp
erformstwotas
ks:

Act
ivel
yt e
stthesta
t usofea
chnei
ghb
ori
ngrout
er.Tworoute
rs
ar
ec ons
ider
ednei
ghborsi
fthe
yatt
achtoacommonnet
wor
k .
Peri
odic
all
yb r
oadcas
tlink
-st
ateme
ssa
ge softhef
orm,Thel
i
nk
between mea ndroute
rX isupor Theli
nkbe
tween mea
nd
route
rXi sdown.

To testt hes ta
tusofadi re ct
lyc onne cted ne i
ghbor,t het wo ne ig hbor s
exchangeshortme ssage
st hatv e
r i
fyt hatt hene ighborisa l
ivea ndr eac
ha b l
e.I f
thene i
ghborre -
pli
es,thel i
nkb e
t we e
nt he mi ss ai
dt ob eup .Otherwise,t hel ink
i
ss ai
dt ob e down.To i nform a llot he rr outers,e achr outerp eriodi c
a l
ly
broadcas
tsame ssa
get hatlist
st hes tatus( s
tate)ofe achofi tsl i
nks.As tatus
me s
sagedoe snots peci
fyr outes i ts imp lyr eport
swhe therc ommunica tioni s
possi
blebetweenp ai
rsofr outers
.Whe nus ingal i
nk-statealgori
thm,t hep r otoc ol
softwaremus tfindawa ytode l
ive reachl ink-stateme ssag
et oa l
lrouters,e v en
i
ft heunde rl
yingne t
wor kdoesnots up p
or tb roadcast.Thus ,i
ndi v
idualcop iesof
eachme ss
agema yb eforwa r
dedp oint-to-point.
Whe neveral i
nk-sta
t eme ss
a gea rrive
s,s oftwa rer unningont her out eruses
thein-forma ti
ont oup dateitsma poft heint e
r net.Fi r
st,ite xtractst hep airof
routersme n- t
ionedi ntheme ss
a gea ndma kess uret hatt hel oca
lg ra
phc ontai
ns
ane dgeb e
t we enthet wo.S econd,i tus est hes tatusr eportedint heme s
s ag
et o
markt helinka supordown.Whe nevera ni ncomingme ssagec ause sac ha ngein
thelocaltop ol
og yg ra
ph,t helink -
stat ealgorit
hm r e
c omput esroute sb ya pplyi
ng
Dij
kstra
sa lgorithm.Thea l
gori
t hm c omput est hes hor t
estp at
hf rom t hel ocal
routertoe ac hde s
tinati
on.Ther esulti
ngi n-forma ti
oni sp l
a c
edi nt heFI B,a ndif
poli
cie
sp er
mi t,us edtoc hanget hef orwa r
dingt a b
le.

Di
jks
tra
,t he i
nvent
oroft he al
gori
thm,coine
dt he na
me
sho
rte
stp
athf
irs
t,b
uti
tis
mi
sl
eadi
ngbe-c
auseal
lrouti
nga
lgori
thmscomput
es hor
tes
tpaths.
I
np ra
cti
ce,t
op re
ventosci
l
lat
ionsb
e t
weentheupanddownst
ates
,ma nyprot
ocol eak
sus -
out
-
of-
nr ul
etotestl
ive
ness,mea
ningthattheli
nkr
e ma
insupunti
las
igni
fi
cantpe
rcentag
eofre
quest
s
ha
venor
epl
y,a
ndt
heni
tre
mai
nsdownunt
ilas
igni
fi
cantp
erc
ent
ageofme
ssa
gesr
ece
ivear
epl
y.
Sec
.12.
9 Li
nk-
Sta
te(
SPF)Rout
ing
259

Oneoft hec hi efa dvant agesofS PFa l


gorithmsi sthate achr outerc omp utes
routesi ndepende nt l
yus i
ngt hes ameor ig i
nals tatusdata;t heydonotde p endon
thec omp uta-t i
onofi nterme diater oute rs.Co mp arethea pproa c
ht oadi stance-
vectora lgori
thm i nwhi che achr out erup datesit sFIBa ndt hens endst heup dated
informa ti
ont one i
g hbors
i ft hes oftwa rei na nyr out era longt hep athi sincorrec
t ,allsuc ce
ssiver outers
wil
lr e -cei
vei ncorr ecti nforma ti
on.Wi thal ink-statea l
gor i
thm,r out e
rsdonot
depend on i nter-me dia tec o mput ati
on t he link-s
tatus me s
s agesp r opagate
throug houtt he ne twor k un- c
ha nged,ma k
ing iti se asi
e rt o de bug p rob l
ems.
Becaus ee a
chr o ut e
rp e
r forms t he s hortestp athc omp utation l ocall
y, t he
comp ut a
tioni sgua r a
nt eedt oc onv erge.Fi nal
ly,b ecauseea chlink- s
tatusme s
sage
onlyc a r
riesinfor ma ti
ona boutt hedi rectc onne cti
onb etwe e
nap airofr out er
s,
thes izedoe snotde pendont henumb e
rofne twor ksint heunde rl
yingi nte r
net.
The r
e fore,SPFa l
g orit
hmss ca l
eb ettert handi stance-vect
ora lgo-rithms .

1
2.1
0Summa
ry

To e
nsuret hata l
lne t
wor ksr emainr eachabl
e with highr el
i
abil
i
ty,a n
inte
rnetmustp rovi
deg lobal
lyc onsis
tentforwa rdi
ng.Hos tsand mostr out
ers
contai
nonlyparti
alrouti
ngi nforma ti
on;theyde pendonde faultroutestosend
datagr
amst o di
sta
ntde s t
ina-ti
ons .Orig
ina
ll
y,t he gl
obalInternetsolve
dt he
routi
ngp r
obl
emb y usi
ngac or
er outerarchitect
urei n whi
ch as etofc ore
router
seachcontai
nedcomp let
einf ormati
onab outallnet
wor ks
.
Whenadditi
ona
lb ack
bone ne
tworkswer
ea ddedtot he I
nternet,a new
r
outi
ngar-c
hite
cturearos
et omatchthee
xtendedtopol
ogy.Curre
ntly,ase
tof
s
epara
tel
yma na
gedp e
erb ac
kbonenet
worksexis
tt hati
nterc
onnecta tmul
t i
pl
e
p
lac
es.
Whe nt heye xchanger outi
ngi nf
orma ti
on,r out
e rsus ual
lyus eoneoft wo
basi
ca l-gorit
hms ;dis t
ance-vect
or or link-s
tate( al
s oc all
edS PF).The chi
ef
dis
advantageofdi stance-vec
tora l
gori
thmsi st hatt heyp e
rform adist
rib
uted
short
estp a
t hc omput a
tion thatma y notc onvergei ft he statusofnetwork
connecti
onsc hangescont i
nuall
y.Thus,forlargeinternetsori nternet
swherethe
underl
yingt opol
ogyc hang e
squickl
y,SPFa l-
gorit
hmsa r esuperior
.

EXERCI
SES

1
2.1 S
upp
osearoute
rdisc
oversi
tisab
outtoforwa
rda nI Pda
tag
ramb a
ckove
rt he
s
amenet
-worki
nte
rfaceonwhi
chtheda
tag
ramarr
ived.Whats
houl
ditdo?Why?
1
2.2 Afte
rr eadingRFC823a ndRFC1812,ex
p l
ainwha
tanInt
ernetcor
er oute
r( i
.e.
,
onewithc ompleterout
inginf
ormat
ion)shoul
ddoint
hesi
tuat
iondesc
ribe
di nthe
pre
viousque s
tion.
1
2.3 How c
anr oute
rsinac or
esys
tem us
ede
faul
trout
est
ose
nda
lli
l
leg
alda
tag
rams
toaspec
ificmachi
ne?
260 Rout
ingAr
chi
tec
tur
e:Cor
es,Pe
ers
,AndAl
gor
ithms Chap.1
2

1
2.4 Imagi
net hatama nageracc
ide
ntall
ymi sc
onf i
guresar outertoa dv
erti
sethati t
hasdire
ctc onnect
ionstosixspeci
fi
cne tworkswhe ni tdoesnot.How canot her
route
rst hat re-cei
ve the adverti
sement p rote
c t the
ms e
lvesf r
om i nv
a l
i
d
adve
rtis
eme ntswhil
estil
lac
-cepti
ngotherup date
sf romuntruste
drouter
s?
1
2.5 WhichICMPme s
sagesdoesaroutergenerat
e?
1
2.6 Ass
umear outerisusi
ngunrel
i
ab l
et rans
portfordel
iv
ery.How ca
nt heroute
r
det
ermi
newhe the
rade si
gna
tedne i
ghbor
sstat
usisupordown?( Hi
nt:c
onsul
t
RFC823tofindouthowtheori
ginalcoresys
temsol
vedtheprob
lem.
)
1
2.7 Supposetwor oute
rseachadvert
isethesamecost,k,toreac
hag i
vennet
wor,N.
k
Desc
r i
bet hec i
rcumst
ancesunderwhichforwar
dingthroughoneofthe
m maytak
e
fewert ot
a lhopsthanforwardi
ngt hr
oug
ht heotherone.
1
2.8 How doe
sarout
erk
now whe
the
rani
ncomi
ngda
tag
ramc
arr
iesar
out
ingup
dat
e
mes-
sage?
1
2.9 Consi
dert
hedi
sta
nce-v
ectorup
dateshowni
nFigur
e12.
5c a
reful
ly.Foreac
hitem
up-da
tedi
nthetabl
e,gi
vetherea
sonwhyther
outerwi
llp
erformt heup
date.
1
2.1
0 Consi
dertheuseofseque
ncenumber
st oens
urethattworout
ersdonotbec
ome
con-f
usedwhendata
gramsaredup
li
cate
d,del
ayed,ordel
i
ver
edoutoforde
r.How
shoul
dini
ti
alse
quenc
enumb e
rsbesel
ect
ed?Why?
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
Chapt
erCont
ent
s
1
3.1 Int
r oduc tion,263
1
3.2 TheS cop eOfARout ingUp datePr otocol
,263
1
3.3 Determini ngAPr acticalLimi tOnGr oupSize,264
1
3.4 AFunda me nt alIde a:Ex traHop s,266
1
3.5 AutonomousS ystemConc ept,267
1
3.6 ExteriorGa tewa yPr otocolsAndRe achabi
li
ty,268
1
3.7 BGPCha r
a cter i
stics,269
1
3.8 BGPFunc t iona l
ityAndMe ssageTyp es,270
1
3.9 BGPMe s s
a geHe ade r
,271
1
3.1
0 BGPOPENMe s sage,272
1
3.1
1 BGPUPDATEMe ssage ,273
1
3.1
2 Comp ressedI Pv 4Ma s k-Addre s
sPa i
rs,274
1
3.1
3 BGPPa thAt tribut es,274
1
3.1
4 BGPKEEPALI VEMe s
s age,276
1
3.1
5 Inf
or ma tionFr omTheRe ceiver
sPe rsp
ecti
ve,277
1
3.1
6 TheKe yRe st
r i
ctionOfEx te r
iorGa t
ewayPr otoc
ols
,
278
1
3.17 The I nter ne tRout ing Ar chitec
ture And Re gi
str
ies
,
280
1
3.18 BGPNOTI FI CATI ONMe ssage ,280
1
3.19 BGPMul tip rotocolEx tensi
onsForI Pv6,281
1
3.20 Multiprotoc olRe achab l
eNLRIAt tribute,283
1
3.21 Int
e rnetRout ingAndEc onomi cs
,284
1
3.22 Summa ry,285
1
3

RoutingAmong
AutonomousSys
tems
(BGP)

1
3.1I
ntr
oduc
tion

Theprevi
ousc hapt
e rintroducest heideaofroutep r
opaga
tion.Thischapter
e
x-tendsourunder s
tandingofi nternetroutingar
chi
tectur
esa nddiscuss
est he
c
onceptofautonomouss ystems.Wewi l
lseethata
utonomoussystemsc or
respond
t
olargeISPsorlargee nterpris
es,a ndt ha
te acha
utonomoussystemc ompris
e sa
g
roupofne t
wo r
ksa ndrout e
r sop e
ratingunderoneadmini
str
ativ
ea uthori
ty.
Thec e
nt raltopi
cofthecha p
terisarouti
ngprotocolna
me dBGPt hatisuse
d
top rovi
der outingamonga ut
onomouss ys
tems.BGPi sthek e
yr out
ingp rot
ocol
use
da tthec enteroftheInternettoal
loweachma j
orI SPtoinf
orm otherpeers
aboutdestina-tionst
hatitcanr e
ach.

1
3.2TheS
cop
eOfARout
ingUp
dat
ePr
otoc
ol

Af unda mentalprinci
plegui
dest he desi
gn ofa routing architec
ture:no
r
outi
ngup - dat
ep rotocolcansca
let oall
ow al
lr out
ersi
nt heg l
obalI nter
netto
e
xchanger outingin-formati
on.Instea
d,r outer
smus tbedi v
idedi ntos e
para
te
g
roups,andr outi
ngp rot
ocol
sde s
igne
dt oop eratewit
hin ag roup .Thereare
t
hreereasonst ha
tr outersmustbedivi
d-ed:
26
3
264 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

Tr
aff
ic.Ev
eni
fea
chs
iteonl
yha
sas
ing
lene
twor
k,nor
out
ing
proto- c
olc ana cc
ommoda teana rbi
trarynumb erofs ites
,b ecause
addings i
tesincreas
esr out i
ngt raf
fic i fthes etofr out er
si s
suffici
ent l
yl arge,t he r outi
ng t r
afficb e
come s overwhelming.
Dist
a nce-vectorprotoc olsr e-
quirerouterstoe xchangethee ntire
setofne tworks(i.
e.,t hes i
zeofe ac
hup dateisp roporti
onalt o
thes izeofaf orwardi ngt abl
e )
.Link-st
atep rotocol
sp eri
odical
l
y
broadc a
s tannounceme nt sofc onnect
ivi
tyb et
we enp ai
rsofr outers
(i
.e.,b roadcast
swouldt ra
v e
lt hr
oughouttheI nte
r net)
.

I
ndi
rec
tCommuni
cat
ion.Bec
aus
ethe
ydonots
har
eac
ommonne
t-
work,route
rsint hegl
oba
lI nternetcannotcommuni
catedi
rectl
y.
Inma nycases
,ar o
ute
risf a rfrom thecenteroftheInter
net,
meani
ngt hattheonlypat
ht her out
erc a
nus etore
a c
ha l
lother
rout
ersgoesthroughmanyint er
me di
atehops
.
Admi
nis
trat
ive Boundar
ies
.Int
he I
nte
rne
t,t
he ne
twor
ksa
nd
routersarenota l
lowne da ndma nagedb yas i
ngl
ee nt
ity.Mor e
i
mp ortant
,s hor
t estpathsa renota lwaysused!Inst
ead,largeISPs
routet ra
f f
ica longp athst ha
tg enera
ter evenueorha vel ower
fina
ncialcost.The re-
for e
,ar outi
nga rchi
tecturemustp rovi
dea
wa yfore acha dminis
tra t
ivegr oupt ocontrolrouti
nga nda cce
ss
i
nde pe
ndently.

Thec onse
quencesofl i
mit
ing r
outerinter
act
ion a
res ig
nifi
cant
.Theidea
p
rovi
dest he motivat
ion f
or much of the r
outi
ng archi
tect
ure usedinthe
I
nterne
t ,andexpla
inssomeoft hemec
hanis
mswewi lls
tudy.Tos ummari
zethi
s
i
mportantpri
ncip
le:

Al
though i ti s desi
rabl
ef or routersto exchange routi
ng
i
nformation,iti simpracti
calf orallrout
ersin an arbi
trar
il
y
l
argeinternet,suchast hegl obalInter
net,toparti
cipat
ei na
si
ngl
er outingupdateprotoc
ol.

1
3.3De
ter
mini
ngAPr
act
ica
lLi
mitOnGr
oupS
ize

Thea bovedis
cussi
onleavesma nyquesti
onsope
n.Fore xa mpl
e ,whatinterne
t
si
zei sc ons
ider
edl ar
ge?I fonl yal i
mitedsetofr oute
rsc anp arti
cipat
ei nan
exchangeofr outi
nginformation,wha thapp
enstorouterstha taree xc
luded?Do
theyf uncti
onc orr
ectl
y?Ca nar outerthatisnotp ar
tici
patinge v
erf orwarda
datagramt oar outerthatisp arti
ci
pati
ng?Canap arti
cip
atingr outerforwarda
datagramt oanon- pa
rtic
ipa
tingr oute
r?
Theans
wertotheques
tion ofs
izeinv
olv
esunders
tandi
ngt hetraff
ica
s
pec
ifi
cpr
o-toc
olwi
l
lgene
rat
e,t heca
paci
tyoft hene
tworkstha
tc onne
ctt he
r
oute
rs,and ot
herre-
quire
ments,sucha s whethe
rthe p
rot
ocolr
equi
res
b
roa
dcas
t.The
rearet
woiss
ues:de
-la
ya ndov
erhead.
S
ec.1
3.3 De
ter
mini
ngAPr
act
ica
lLi
mitOnGr
oupS
ize 265

Delay.Themai nde l
a yofi ntere
sti snothow l ongi tta kesas i
ng l
er outi
ng
upda
t eme s
sag
et op ropagate.I ns
tead,theque stionconc e
rnsc onverg e
nc et i
me,
thema xi
mum delayunt i
la l
lr oute
rsa r
ei nformeda boutac hange.Whe nr oute
rs
useadi s
tance-
vectorp rotocol,eachrout ermus tr ec
e i
vet hene wi nfor mati
on,
upda
t eitsFIB,a nd the nf or-wardt he informa t
ion toi tsne i
ghb ors.I na n
i
nternetwithNr oute
r sarrang edinalineartopology,Ns tepsa r
er e
qui red.Thus,
Nmus tbelimi
tedt oguarante erapi
ddistri
butionofi nformation.
Overhead.Thei ssueofov erheadisa lsoeasytounde rsta
nd.Be causee a
ch
routerthatp arti
ci
patesinar outi
ngp rot
oc olmustsendmessages,alarg
e rsetof
part
icip
ating routers me ans morer outi
ng t raf
fic
. Furthermore,ifr outi
ng
messagescontainalistofp os
sibl
edesti
nations,thesi
zeofe achme ss
ageg rowsa s
thenumb erofr outersandne t-worksincrease
.Toe ns
uret hatrouti
ngt r
affi
c
remainsas ma l
lpercentageoft hetotaltraffi
cont heunde r
lyi
ngne tworks,the
si
zeofr out i
ngme ss
ag esmustbelimi
ted.
Infact,few networ
kma nage
rshav
es uf
fic
ienti
nfor
ma t
ionaboutrout
ing
p
rotoc
olstop e
rform det
aile
da nal
ysi
softhede l
ayoroverhead
.Inste
ad,they
f
oll
owas i
mpleheuri
sti
cguidel
ine
:

Itissaf etoal l
owupt oadozenrouter
st opart
ici
pateinasingle
rout-ing informati
on protoc
olacross a wide area net
wor k;
approximatelyf i
vetimesasmanycans af
elyparti
cipat
eacrossa
setofl ocalareanetworks
.

Ofc ours
e,t her ul
eonlyg iv
esg ene
raladvic
eandt her
ea remanye xcepti
ons.
For examp l
e,i ft he under
lyi
ng ne tworksha veesp
ecial
l
yl ow del
aya nd hi
g h
capac
ity,t henumb erofp artic
ipat
ingr outer
sc a
nb el arger.Simil
arl
y,i ft he
underl
yingne tworkshaveunus ual
lylowc apa
cityorahigha mountoft r
a f
fic
,t he
numb e
r of p artic
ipati
ng routers mus tb es mal
l
ert oa void ove
rloadi
ng t he
networkswi t
hr outingtraf
fic.
Be causea ninter neti snots ta ti
c,i tcanb ediffi
cul
tt oe s
tima tehow muc h
trafficr outingp rotocolswi llgene ra t
eorwha tpercentageoft heunde rlyi
ng
bandwi dtht her out-ingt rafficwillc onsume .Fore xample,ast henumb e
rofhos ts
onane twor kg rowsov ert i
me ,incre asesint het r
afficg e
ne ratedc onsumemor e
oft hes parene tworkc apaci
ty.Ina ddition,increasedtrafficc a
na r i
sef r om ne w
appl
icat i
ons.The refor e
,ne t
wor kma nagersc annotr el
ys olely on t heg uide l
i
ne
abovewhe nc hoosi
ngar outinga rchitec-ture.I nst
ead,t heyus uall
yi mple me nta
trafficmoni t
or i
ng s cheme .Ine s s
e nce,at rafficmoni t
orl iste
nsp assivelyt oa
networ ka ndr ecordss tatist
icsab outt het raffi
c.Inp a
r t
ic-ular,amoni torc an
comp uteb otht he ne twork utilization (i.e.
,p e
rcentage of t he unde rly-i
ng
bandwi dthb eingus ed)a ndt hep er centageofp acketsca r
ryingr out ingp rotocol
me s
-s a
g es.Ama nage rc anob ser
v et raffi
ct rendsb yt aki
ngme asur eme ntsov er
l
ong p e ri
ods( e.g.
,we e
k sormont hs )
,a nd c an uset heout putt o de ter mi
ne
whet hert ooma nyr out ersarep a
r ticipati
ngi nas i
ngleroutingp rotocol.
266 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

1
3.4AFunda
ment
alI
dea
:Ext
raHop
s

Al
thought henumb erofr outer
st hatp art
ici
pateinas i
ngler outi
ngpr otocol
mustb elimited,doings ohasa nimp ortantconsequencebecaus ei tmeanst ha t
some routerswi l
lb e outsi
de the g roup.For e xampl
e,cons iderac orp ora
t e
i
ntranetwi t
hab a ckb
onea ndas etofr outer
st hata l
lpar
t i
cipa teinar out i
ng
updateprotocol.S upposeane w dep art-mentisa ddedtot hene tworka ndt he
newde par
tme ntac qui
r esarouter.Itmi ghtseemt hatthene wr outerwoul dnot
needtop arti
cipat
ei nt herout i
ngup datep r
otocol theoutside rcoul
dme rel
y
useame mb e
roft heg roupasade fault.
Thes amesituationoc c
ur r
edi nt hee ar
lyI nternet.Asne ws i
teswe r
eadded,
t
hec ores ys
temf uncti
one da sac e ntr
a lrout i
ngme chanis
mt owhi chnoncore
r
outerssentdata g
r amsf orde l
iv
ery.Re searchersunc overeda ni
mp ort
antles
son:
i
far outeroutsideofag roupus esame mb eroft heg r
o upasade faul
troute,
r
outi
ngwi llbesubop ti
mal.Mor eimp ortant,onedoe snotne edalargenumberof
r
outersor a wi de a rea network t he p roblem c an occur ev
eni n asma l
l
c
orp
or atenetworki nwhi chanonp arti
ci
p at
ingr oute rusesap art
ici
pati
ngrouter
f
orde l
i
very.
To unde
rsta
nd how nonopt
imalf
orwa
rdi
ng oc
cur
s,c
ons
ide
rthe e
xamp
le
ne
tworkconfi
gura
tioni
nFigure1
3.1
.

Loc
alNe
t1 R1 Ba
ckb
oneNe
twor
k R2 Loc
alNe
t2
p
art
ici
pati
ng p
arti
ci
pati
ng
rout
er route
r
R3
nonp
artic
ipa
ting
router

Fi
gur
e13.
1An e xa
mplearchi
tect
uret hatc a
nc a
usethe e
xtra hop
p
rob
lemi fa nonpa
rti
cipa
ting r
outeruse
sa par
tic
ipa
ting
r
oute
ra sade
faultnexthop.

I
nt hef igure,r out e
rsR1 a ndR2 c onne ctt olocalareane twork s1a nd2,
res
pecti
ve -l
y.Ea c
hr outerp a
r ti
c i
patesinar outingp r
otocol,andk nowshow t o
rea
chb ot hne t-wor ks.Ane wr out er,R3 i
sa dded.Inst
eadofc onfi
g urngR3 t
i o
par
tici
pat eint her out-ingup datep rotocol
,t hema nagerconfiguresitt ouseone
ofthee xist
ingr oute rs
,s ayR1,a sade fault.
fR1 ha
I sad at agram destinedf orahos tonl oca
lne twork1 ,nop roblem
occ
urs.Howe ver,ifR3 ha sada tagram de s
t i
ne dforlocalnetwork2,i twil
ls end
thedatag ra
ma crosst heb ack
b onet oR1,whi chmus tthenf orwardt heda t
a gram
bac
ka crosst heb ack-bonet or outerR2.Theop ti
malroute,ofc ourse
,r equi
r esR3
tosendda t
ag r
a msde s
tinedforne twork2di rectl
yt oR2.Not icethatt hec hoi
ce
ofap art i
ci
pa t
ingr outerma ke snodi fference:onlyde sti
nati
onst hatl i
eb eyond
t
hec
hos
enr
out
erha
veop
tima
lrout
es.For
S
ec.1
3.4 AFunda
ment
alI
dea
:Ex
traHop
s 267

a
llotherdest
inat
ions,adatagram wil
lmak eas econd,unnecess
arytripacr
ossthe
b
ack-bonenetwork.Als
or e
calltha
tr oute
r scannotus eICMPr edi
rec
tme ss
agesto
i
nf m R3t
or hati
tha snonopti
ma lroute
s,be c
auseI CMPr edi
rectmessage
scanonly
b
es e
ntt otheorigi
nalsourc
ea ndnott ointermediaterouters
.
Wec a
llt hea nomalyi l
lustratedinFigure1 3.1thee xtr
ahoppr obl
em.The
prob-lemisi nsi
diousb e
causee v erythi
ngappearst oworkc orrec
tly da t
agrams
doi ndeedre acht heirde s
t i
nation.Howe ver
,b ecauserouti
ngi snotop ti
ma l
,t he
systemi se
xt reme -lyineff
icient.Ea chdat
agramt hattakesane xtrahopconsume s
resourcesont hei nt e
r -
me diater outeraswe l
last wiceasmuc hoft heb ackb
one
capacit
ya si tshoul d.Thee x-trahopp r
oblem wa sfi
rstdiscove
redint hee arly
Internet.S olvi
ng t he p roblem r equi
red us toc ha
nge our v i
ew of r outi
ng
archite
cture:

Treati
ngagr oupofr outersthatparti
c i
pat ei
nar outi
ngupdate
proto-
colasadef aultdeliv
erysystemc ani ntr
oduceanextrahop
for da-tagram t raffic; a mechanis
m i s needed that all
ows
nonparti
cipati
ng r outerst ol earnr out es from parti
ci
pati
ng
router
ss ot heycanc hooseoptimalroutes.

1
3.5Aut
onomousS
yst
emConc
ept

How shouldt heI nt ernetb edi vi


dedintos et
sofr outerst hatca ne achr una
routi
ngup datep rot oc ol?Thek e yt othea ns
we rliesinr e a
li
zingt hatt heI nternet
doesnotc on-sistofi ndepende ntne tworks
.I nstead,ne twork sandr outersa re
ownedb yor ganiza tionsa ndi ndividual
s.Becauset hene tworksa ndrout e
rsowne d
byag i
vene ntit
yf allunde ras ingleadmini
strati
v ea uthority,t hea uthorityc an
guaranteethati nt erna lroutesr emainconsist
enta ndv i
ab l
e.Fur thermor e,t he
adminis
trati
vea ut horityc anc hooseoneormor eofi tsr outerstoa ppr i
set he
outsi
dewor ldofne t wor kswi t
hi nt heorganizat
iona ndt ol earna b
outne tworks
thatareout si
det heor ganizati
on.
Forp urposesofr out i
ng,ag r
oupofne tworksa ndr outerscontroll
edb ya
si
nglea d-mini
strati
vea uthorityiscall
eda nAut onomousSys tem (AS).Thei de
ai s
that we wi l
ll e
te a
c ha utonomous s yst
e m c hooseits own me chanis
ms f or
dis
cov ering,propagati
ng,v al
i-dat
ing,a ndc hec ki
ngt hecons i
ste
nc yofr outes(the
nextc hapterr evi
ewss omeoft hep rot ocol
st ha ta ut
onomouss yste
msus et o
propa gater outi
ngi nformation i
nte r
na ll
y).The n,wewi l
la rrangewa ysf ora n
autonomouss ystemt os umma ri
zer outinginf orma-tionands endt hesumma ryt o
neighbor i
nga utonomouss ystems.
Isa na utonomouss ys
tema nI S
P?I tc a
nb e,buta nautonomouss ystemc an
als
ob eal a rg
ee nterpri
se(e.g.
,ama jorcorporati
onoruni versi
ty).Althoug ht he
defi
nitionofa na utonomoussystemma yseemv ague,thedefiniti
oni si
nt endedt o
incl
udea lmosta nyg roupthatr unsal argene twork.Ofc our s
e,t heb ounda r
ies
betweena utonomouss ys-te
msmus tb e defi
nedp reci
sel
yt oa l
low a utoma ted
alg
orithms t o ma k
er outi
ng deci-
sions,a nd top r
event t he routi
ng up date
p
rotoc
olsusedi n oneautonomouss ys
temf r
om acci
denta
ll
ys p
il
li
ng overint
o
a
nother.Fur
t hermore
,ea c
ha utonomoussys
tem def
inesas etofp ol
ic
ies
.For
e
xample,a
na utonomoussyst
emma yp re
fertoavoi
drouti
ngp a
ck-
268 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

etst hr
oug hac ompeti
tor
sa utonomouss ystem,e venifs uchap at
he xi
sts
.To
ma k
ei tp ossibl
ef or aut
oma tedr out i
ng a l
g orithms to di s
ting
uis
h a mong
autonomouss yste
ms ,eachi sa s
signe
da na utonomouss ystem number by the
centralauthor i
tyt hatisc harged witha ssi
gning a llI
nte rnetnumb e
rs.Whe n
routersint woa utonomouss yste
mse x -changer out i
nginfor mati
on,theprotocol
arrangesfore achroutertole a
rnt heot hersau-t onomouss yst
emnumb er.
Wec ans umma ri
zetheide a:

TheI nternetisdivi
dedintoautonomoussys t
emst hatareeach
owned and operated by a s
ingl
e admini
strati
ve author
ity.An
autonomous system isf ree toc hoose an internalrouti
ng
arc
hitectureandproto-c
ols
.

I
np racti
ce,alt
houghs omelargeor g
ani
zat
ionshaveob ta
inedautonomous
sys
tem numberstoa l
low the
mt oconnecttomulti
pl
eI S
Ps ,i
tiseasi
esttot hi
nk
ofeachautono-moussyst
ema scor
respondi
ngtoalarg
eI SP.Thepoi
ntis:

Inthecur
rentI nt
ernet,eachlar
geISPisanaut
onomoussyst
em.
Duri
ng i
nformaldiscus
sions,engi
neer
sof t
en r
efertor outi
ng
amongmajorI SPswhent heymeanrouti
ngamongautonomous
sys
tems
.

1
3.6Ext
eri
orGa
tewa
yPr
otoc
olsAndRe
acha
bil
it
y

Wes a
idt hata na ut onomouss ystem mus ts umma r
izei nforma tionf rom i
ts
routingup datep rotocolsa ndp rop a
g atet hati nf or
ma ti
ont oot hera utonomous
systems .Todos o,a na ut onomouss yste
mc onf iguresoneormor eofi tsr oute
rs
toc ommuni catewi thr out ersinot he rautonomouss ystems.I nforma tionf l
owsin
twodi rect
ions .First,t her outermus tc oll
ecti nforma ti
ona boutne t
wor ksinsi
de
itsa utonomouss ystema ndp asst hei nforma tionout .S e
cond,t her out ermus t
accepti nfor ma t
ion a bout ne twor ksi n ot h-e ra utonomous s yste m(s)a nd
dis
semi natet he infor ma tion inside.Te chnically,we s ayt hatt he a utonomous
systema dver ti
s sne
e twor kr eachabili
tyt ot heout si
de,a nd weus et het erm
Exter i
orGat ewayPr otoc ol( EGP)t ode notea nyp rotocolus edtop assne t
-work
reachab i
li
tyi nf ormationb e tweent woa utonomouss ystems.S tric
t l
ys peaking,an
EGPi snotar out i
ngp rotoc olbecaus eadv er
tisingr eachabil
ityi snott hes ameas
pro-p agati
ng r outing i nf orma t
ion. I n p r
ac tic
e , howe ver, mos t ne tworki
ng
profe s
sionalsdonotma k eadi sti
nc ti
on onei slik
e l
yt ohe arex t
e riorg ateway
protocolsr eferr e
dt oa sr out i
ngp rotocol
s .
Curr
entl
y,as ing
leEGPi suse dtoe xchanger eachab
il
ityinformati
oninthe
Inter
-net.Knowna stheBorderGat ewayPr otocol(BGP),ithase vol
vedthr
ough
four(qui
tediffe
rent)vers
ions
.Ea chversi
oni snumb ered,whic
hg i
vesri
setothe
formalnameoft hec ur
rentv er
sion,BGP- 4.Fol l
owingstanda
r dp ra
cti
ceinthe
networki
ngindus
try,wewi l
lusethet erm BGPi np l
aceofBGP- 4.
Theterminol
ogywa
scoi
neda
tat
imewhe
nar
out
erwa
sca
ll
edag
ateway,andhas
per
sis
ted.
Sec
.13.
6 Ex
ter
iorGa
tewa
yPr
otoc
olsAndRe
acha
bil
i
ty
269

Whenap ai
rofa utonomouss ys
te msa gr
eet ouseBGPt oe xchangerouti
ng
inf
or -ma
t i
on,e achmus tdesig
na t
ear oute r
t hatwi l
ls p
eakBGPoni t sbeha
lf;
thet wor out
e rsares aidtob ecomeBGPp eersofoneanot her.Becausear outer
speaki
ngBGPmus tc ommuni catewithap e erina not
he rautonomouss yst
em,i t
mak essenset osele
ctama chi
net hati sne artheb order(i.
e.,thee dge)oft he
autonomouss ystem.He nce,BGPt erminologyc al
lsther out
erab ordergatewayor
borderrouter.Figure1 3.2il
lustra
testhei dea.

Autonomous BGP Autonomous


System1 us
ed System2

R1 R2

Fi
gur
e13.
2Conc ept
ua li
ll
ustr
ati
onofBGPusedbe
t wee
nrout
erR1i
n
onea utonomoussys
temandrout
erR2 i
nanot
her
autonomouss ys
tem.

Int he fi
gure,infor
mati
on f l
owsinb ot h dir
ections.Rout er R1 ga
thers
i
nfor
ma t
ionaboutne t
worksi
na utonomouss ystem 1a ndus esBGPt or epor
tt he
i
nfor
ma t
iontor out
erR2,whil
er outerR2 g
a thersinforma t
ionaboutne tworksin
a
utonomoussystem 2anduse
sBGPt oreportt heinforma t
iontor outerR1.

1
3.7BGPCha
rac
ter
ist
ics

BGP is unus
uali nsever
alwa ys.Mos timp ortant
,be c
ausei ta dv
erti
ses
r
eac
habi
li
tyinstea
dofr outi
nginfor
mation,BGPdoe snotusee i
therthedist
ance-
v
ect
ora l
gori
thm ort heli
nk-sta
tea l
gori
thm.I nste
a d,BGPus esamodi f
icat
ion
k
nownasap ath-vec
toralg
o-ri
thm.BGPi schar
ac t
erizedbythefoll
owing
:

I
nt er
-AutonomousSys tem Communi
cat
ion.Bec
auseBGP isde s
igne
da san
e
xte
ri-org a
tewayp rot
oc ol
,itspri
maryrol
ei st
oa l
low onea
utonomoussys
tem
t
ocommuni -ca
tewitha nother
.

Coordi
nati
onAmongMul ti
pl
eBGPSpeaker s
.I fanautonomouss ys
tem has
multi
-pleroutersea
chc ommunic
ati
ng with apeerinan out s
ide a
utonomous
sys
t e
m,af or
m ofBGPk nownasiBGPc a
nb eusedtocoo
rdinateamongr out
ers
i
nsidethesystemtogua
ra nt
eethatthe
ya l
lprop
agatec
ons
istentinf
ormati
on.

Al
thoug
hiti
spo
ssi
bl
etor
unBGPonas
yst
em ot
hert
hanar
out
er,mos
taut
onomouss
yst
ems
c
hoo
set
orunBGPonar
out
ert
hatha
sadi
rec
tconne
cti
ont
oanot
hera
utonomouss
yst
em.
27
0 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

Propagat
ionOfReac habi
li
tyI nf
ormat i
on.BGPall
owsanautonomoussys
tem
t
oa dvert
isedest
ina
tionsthata r
er eacha
bleeit
herinorthr
oughit,andtolear
n
s
uchinfor-mati
onfroma notherautonomoussyste
m.

Next
-HopPar
adi
gm.Li
kedis
tance-
vec
torr
out
ingp
rot
ocol
s,BGPs
upp
li
esne
xt
hopi
nfor
mati
onforeac
hdest
ina
tion.

Poli
cySupport.Unli
kemos tdist
ance-vec
torp rotocol
sthatadvertis
ee xact
ly
ther outesi
nt heloc
alforwardi
ngtable,BGPc a
nimp lementpol
ic
iesthatt heloc
al
adminis-
trat
orc hoos
es.Inp ar
tic
ula
r,ar outerrunningBGPc anb econfiguredto
dis
tinguis
hb etweent hes e
tofde s
tinati
onsreachableb ycomputersi nsi
deits
autonomouss yst
ema ndt hesetofde sti
nati
onsadv ert
ise
dt oothera utonomous
systems.

Rel
i
able Trans
por
t. BGP is unusua
la mong p
rot
ocol
sthatpa
ssrout
ing
i
nformationbecaus
eitassume
sr e
liab
letrans
port
.Ther
efor
e,BGPus
esTCPfor
a
llcommunicati
on.

Pat
hI nf
or mation.Inste
adofs peci
fyi
ngde st
ina
tionst
hatcanberea
c hedand
anexthopf ore ach,BGPus sap
e ath-vectorpara
digminwhichadv
ertise
ments
s
pec
ifypathi nfor
ma ti
ont hata l
l
owsar ec
eivertolearnaser
iesofautonomous
s
yst
emsa l
ongap a
tht ot hedesti
nat
ion.

IncrementalUpdat
es.Toconser
venet
workb andwidt
h,BGPdoesnotp a
ssf
ull
i
n-f
or mati
onine achupdatemess
age.I
nst
ead,ful
li nf
ormati
oni
se xc
hang
edonce,
a
ndt hensucce
s s
ivemessa
gescar
ryincr
ementalc
ha ngesc
all
edde
ltas
.

Suppor
tForIPv4andIPv6.BGPsupp
ort
sI Pv
4clas
sle
ssaddr
ess
esa
ndI
Pv6a
d
-
dre
s s
es.Thati
s,BGPsendsaprefi
xle
ngthal
ongwit
he acha
ddress
.

RouteAggregat
ion.BGPc ons
e r
v e
sne twor
kbandwi
dthbyall
owi
ngasender
t
oa ggr
egat
er outei nfor
mat
iona nds endas i
ngl
eentr
yt orep
rese
ntmul
tipl
e,
r
ela
teddest
i-na
t i
ons( e
.g.
,manyne tworksownedbyasi
ngl
eAS)
.

Authent
icat
ion.BGPall
owsar
ece
ive
rtoa
uthe
nti
cat
eme
ssa
ges(
i.
e.,v
eri
fy
t
hei
denti
tyofas ende
r).

1
3.8BGPFunc
tiona
li
tyAndMe
ssa
geTyp
es

BGPp eersperf
ormt hreeb asi
cfunc tions.Thef i
rstfuncti
onc ons is
tsofi nit
ial
peerac qui
siti
ona ndaut hentica
tion.Thet wop eersestabl
is
haTCPc onnectionand
perfor
m a me ssagee x changet ha
tg uaranteesb oths ide
s ha v ea greedt o
communi cate.Thes econdf uncti
onf ormst hep ri
ma ryf oc
usoft hep rotocol
eachsides endsposi
tiv
eorne gati
ver e
a chabil
ityinformati
on.Thati s,as endercan
advert
is ethatoneormor edes-tinat
ionsa r
er eachabl
eb yg i
vi
ngane xthopf or
each, or t he senderc an de cl
ar et ha t one or mor ep re
vious lya dv er
tis
ed
desti
nat i
ons a r
e no l ong err eachabl
e . The t hi
r df unct
ion p rov i
des ong oi
ng
v
eri
fi
cati
on tha
tt he p
eer
sand t
he ne
twor
kconne
cti
onsb
etwe
ent
hem a
re
f
uncti
oni
ngcorrec
tly.
S
ec.1
3.8BGPFunc
tiona
li
tyAndMe
ssa
geTyp
es 271

Toha ndlethethr
eefunc
tionsde
scr
ibe
dab
ove
,BGPde
fine
sfi
veb
asi
cme
ssa
ge
t
ype
s .Fig
ur e13.3c
ontai
nsa
s
umma ry.

Typ
eCode MessageType Des
c r
iption
1 OPEN Ini
ti
a l
izecommunic ati
on
2 UPDATE Advertis
eorwi t
hdr awr outes
3 NOTIFICATION Responsetoa ni
nc orrectmessage
4 KEEPALIVE Acti
velyt e
stpeerc onnecti
vi
ty
5 REFRESHRequestr
eadverti
sementfrom peer

Fi
gur
e13.
3Thef
iveb
asi
cme
ssa
get
ype
sinBGP.

1
3.9BGPMe
ssa
geHe
ade
r

Ea
chBGPme s
sag
eb egi
nswithafix
edheade
rtha
tide
nti
fi
est
heme
ssa
ge
t
ype
.Figur
e13.
4il
l
ustra
testhehe
ade
rforma
t.

0 1
6 24 31

MARKER

LENGTH TYPE

Fi
gur
e13.
4Thef
orma
toft
hehe
ade
rtha
tpr
ece
dese
ver
yBGPme
ssa
ge.

Int hef i
gure,the16-octetMARKER f i
el
dc ontai
nsav al
uet hatb ot
hs ides
agreetous et omarkt heb egi
nningofame ss
a g
e.The2- octetLENGTH f ield
spe
c i
fi
est het o
talmessagele
ng thmeasure
dinoc tets
.Themi nimum me ssa
g esize
s1
i 9oc tets(forame s-s
agetyp ethathasonl
yahe adera ndnoda t
af ol
lowingt he
header)
,a ndt hemax i
mum a l
lowabl
elengthis4096oc te t
s.Final
ly,the1 -octet
TYPEf i
eldc ontai
nsoneoft hef iv
ev al
uesfortheme s
sagetyp eli
stedinFi g
ur e
13.
3.
The MARKER f i
eldma ys ee
m unus ual.Int hei niti
almessa
g e
,t hema rk
er
consi
stsofa ll1s;ift hep e
ersagreet ous ea na uthenti
cati
onme c
hanism,the
ma r
k e
rc anc ontai
na uthenti
cat
ion informati
on.I na ny case
,b oths idesmust
agreeo nt hevaluesoi tc anbeus edf orsynchronizati
on.Tounder s
t a
ndwhy
synchroni
zati
onisne cess
ary,rec
allthata l
lBGPme ss
a gesareexchangeda cr
ossa
streamt r
ansport(i
.e.,TCP),whichdoe snotidentifyt heboundaryb et
we enone
me s
sageandt hene xt
.I nsuchane nvir
onme nt,as i
mp leerr
orone i
thers i
decan
have drama
ticc ons
equenc
es.Inp
art
icul
ar,i
fe i
therthe s
ender or r
ece
ive
r
sof
twa r
emiscountstheoct
etsi
names
sag,as
e ync
hroni
zat
ionerr
or
27
2 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

wil
loc curi nwhi char ec
eiverincorrectl
yr e
adsi t emsi nt hestrea
ma saheader.
Morei mport a
nt ,b ecauset he t ra
ns p
ortp rot ocoldoe s not s peci
fy messag
e
boundaries,thet ransportp r
otocolwi l
lnota l
ertt her e c
eiv ertothee rr
or.Thus,
toe nsuret hatt hese nderandr e c
eiverrema i
ns ync hronized,BGPp l
acesawe l
l-
knowns e
que ncev al
uea tt hebe -
g i
nningofe achme s sa
g e,a ndrequir
esar ec
eiver
tove r
ifyt hatt hevalueisintactb eforeproces
singt heme ssage
.

1
3.1
0BGPOPENMe
ssa
ge

Ass
oona
stwoBGPp
eer
ses
tab
li
shaTCPc
onne
cti
on,t
heye
achs
enda
n
OPEN messagetodecl
arethei
ra utonomoussyste
m numb e
ra ndestabl
i
shother
oper
ating p
aramete
rs.Ina d
diti
on tot he st
andard he
ader,an OPEN mes
sag
e
cont
ainsav al
ueforahol
dt i
mert hatisuse
dt ospeci
fythema x
imum numb
erof
s
econdswhi
chmayel
aps
ebetwe
ent
her
ece
iptoft
wos
ucc
ess
iveme
ssa
ges
.Fi
gur
e
1
3.5il
lus
tra
test
hef
ormat.

0 8 1
6 31
VERS
ION
AUTONOMOUSS
YSTEMSNUM
HOLDTI
ME
BGPI
DENTI
FIER
PARM.LEN

Op
tiona
lPa
rame
ter
s(v
ari
abl
e)

Fi
gur
e13.
5Thef ormatoft heIPv
4BGPOPENme s
sag
et ha
tissentat
st
art-up.Oct
etsshownint
hef i
gur
ef ol
lowthest
andar
d
mess
ag ehe
ader.

Mos tf ie
ldsint hef i
gur ea restraightforwa rd.TheVERS ION fi
eldi dentifi
es
thep rotocolv e
rsionus ed( thev ers
ionf ort hef orma tshowni sv e
rsi
on4;al ater
secti
ondi s
c usse
sBGPe xtensionsforI Pv6).Re cal
lt hate ac
ha utonomouss ys t
emi s
assi
gned a uni que numb er. Field AUTONOMOUS S YSTEMS NUM gi vest he
autonomouss yste
m numb eroft hesende r
ss yst
e m.TheHOLDTI MEf iel
ds p
ecifi
es
ama x
imum t i
met hatt her ece
ivershouldwa itf orame s
sag ef r
om t hes ender.
Ther e c
eiveri sre quiredt oi m- p
lementat imerus i
ngt hes peci
fie
dv alue.The
timeri sre seteac ht imeame ssagea r
- ri
ves;ift het i
me re x p
ires
,t her ecei
ver
assumest hes ende risnol ongera vai
l
a bl
e( ands top sforwa rdingda t
agr a
msa long
routeslearnedf romt hesende r).
S
ec.1
3.1
0 BGPOPENMe
ssa
ge 273

FieldBGPI DENTIFIERc ontai


nsa32-biti
ntegerval
uethatuniquel
yidenti
fi
es
t
hes ender.Ifama c
hinehasmul ti
plepe
ers(e.
g.,perha
psinmultipl
eautonomous
s
ystems),t hema c
hinemus tus et hesameidenti
fie
ri nallc
ommuni ca
tion.The
p
rotocolspeci
fi
est hattheidentif
ierisa
nI Paddre
ss.Thus
,ab orderroutermust
c
hooseoneofi tsIPv4a ddr
e sse
st ousewit
hallBGPp ee
rs.
Thel a stfiel
dofa nOPEN me ssag
ei soptional
.I fpres
ent,f iedPARM.LEN
l
speci
-f i
est helengthme as
ur edinoc tets
,andt hef i
e l
dlab
eldOp
e tionalParamet ers
containsal is
tofp arameters.Thep arameterl i
stha sbeenl a
be l
e dvariabl
et o
i
ndicat et hatt hes i
zev arie
sf rom me s
saget ome ss
age.Whe np a r
ame t
e rsa re
present,e achp arameterint hel i
stisp re
cededb ya2- oct
e the ader,wi tht he
fir
stoc tets peci
fyingthet ypeoft heparam-etera ndthesecondoc tetspe ci
fying
thele ngth.I ftherearenop a r
ame ter
s,thev alueofPARM.LEN i sze roa ndt he
me s
sag eendswi thnof urtherda ta.
Whe nitaccep
tsani nc
omingOPEN me s s
age,aborderroutersp e
akingBGP
r
espondsbyse ngaKEEPALI
ndi VEmes sag
e( disc
ussedb
e l
ow).Eachpeermus tsend
n OPEN a
a ndrece
ivea KEEPALIVE mess
ageb ef
oretheyc a
ne xchanger out
ing
i
nfor-mat
i ,aKEEPALI
on.Thus VEmessagef uncti
onsastheacknowle
dg e
me ntfor
nOPEN.
a

1
3.1
1BGPUPDATEMe
ssa
ge

OnceBGPp e
ershavecreatedaTCPc onnection,sntOPENme
e ss
ages,a ndac-
k
nowledg
edthem,t hepee
rsus eUPDATEme ss
ag estoa dve
rti
sene
w de s
tinati
ons
t
hatarereac
habl
eort owithdrawprevi
ousa dv
er ti
sementswhenadest
inationhas
b
ecomeunreac
hable
.Fig
ure1 3.
6ill
ust
ratesthef ormatofUPDATEme s
sages.

0 1
5
WI
THDRAWNLENGTH
Withdr
awnDe
sti
nat
ions(
var
iab
le)
...
PATHATTRLENGTH
Pat
hAt
tri
but
es(
var
iab
le)
...
De
sti
nat
ionNe
twor
ks(
var
iab
le)
...

Fi
gur
e13.
6BGPUPDATEme ss
ageforma
tinwhichva
r i
abl
esi
zeare
asof
t
he me s
sag
e ma yb e omi
tte
d. The
se octe
tsfol
l
ow the
s
tanda
rdme ss
ageheade
r.

Asthef
igureshows,ea
chUPDATEme s
sag
eisdi
vi
dedi
ntot
wop art
s:t
hefi
rst
p
artli
stspr
evious
lya dv
ert
ise
ddesti
nat
ionstha
tarebei
ngwithdr
awn,andthe
s
econdpar
tsp
eci
fi
esne
wde
sti
nat
ionsb
einga
dve
rti
sed.Thes
econdp
artl
i
stsp
ath
a
ttri
but
es
27
4 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

fol
lowedb yas etofde sti
nati
onne tworksthatus et heattri
bute s
.Fi el
dslabe
led
vari
abledonothav eaf i
xeds i
ze.Inf a
ct,variabl
e-si
zef ie
ldsdonotne edtob e
prese
nt i ft he i nforma t
ion isnot ne e
dedf or a parti
cular UPDATE,t he
corres
pondi
ngf iel
di somi ttedf rom t
heme ssage
.Fi edWI
l THDRAWNLENGTHi sa
2-octetfiel
dt hats pecif
iest hesizeoft he WithdrawnDes tinationsf i
el
dt hat
fol
lows.Ifnode s
tina t
ionsa reb ei
ngwith-drawn,WI THDRAWNLENGTHc ontai
ns
zero.S i
mil
arl
y,t he PATH ATTR LENGTH f i
eldsp eci
fi
est hes izeoft he Path
Attri
butesthata rea s
s oci
atedwi thnew desti
nationsb e
inga dvertise
d.I fthere
arenone wde s
tinations,t hePATHATTRLENGTHf ieldcon-tai
nsze ro.

1
3.1
2Comp
res
sedI
Pv4Ma
sk-
Addr
essPa
irs

Boththe Wi t
hdrawnDes tinati
onsandt he Des
tinati
onNetwor ksfi
el
dsc a
n
contai
n al i
stofI Pv4 networka ddres
ses
.Conc ept
ua l
l
y,BGP s houldsend a
n
addressmaskwithe ac
hI Pv4addr e
ss.I ns
tea
dofs endi
nga naddres
sa ndama s
ka s
separa
t e32-bi
tqua nti-ti
es,BGP us esac ompres
sedr epre
sent
ation toreduce
me s
sagesi
ze.Figure13.7il
lus-
tratest heformat
:

0 8 31
LEN
I
Pv4Addr
essPr
efi
x(1
-4oc
tet
s)

Fi
gur
e13.
7Thecompres
sedformatBGPus
estostor
eanI Pv
4
de
sti
nat
ionaddr
e s
sandtheas
soc
iat
edaddr
essma s
k.

Ast hef ig
ures hows ,BGP doe snota c
tual
lys endab itma s
k.I nstead,it
encodesi nforma ti
on a b
out t he ma s
ki ntoas i
ngle octett hatp recedese ach
address.Thema skoc tetc ontainsab i
na r
yi ntegertha tspeci
fie
st henumb e rof
bitsint hema sk( ma s
kb itsarea ss
ume dt ob ec ontiguous)
.Thea ddre s
st hat
foll
owst hema s
koc tetisa ls
oc ompressed onl yt hoseoctetsc overedb yt he
ma s
ka r
ei ncluded.Thus ,onl yonea d-dressoctetf oll
owsama skv alueof8or
l
e ss
,t wof oll
ow ama skva lueof9t o16,t hreefoll
ow ama s
kv alueof1 7t o24,
andf ourf ol
lowama s
kv alueof25t o32.I ntere
s t
ing-l
y,t hestandarda l
soa ll
ows
ama skoc tett oc ontai
nze ro(inwhichc as
enoa ddressoc-tetsfoll
ow it).Aze ro
l
e ngthma skisus efulbecaus ei
tc or
respondst oade fa
ultr oute
.

1
3.1
3BGPPa
thAt
tri
but
es

Wes aidt ha
tBGPi snotat ra
ditionaldist
a nce-
ve c
torprotocol
.Inste
adof
mere
lya dver
t i
si
ng a di
stancet oe ac
h de st
ination,BGP a dve
r ti
sesaddi
tional
i
nforma
tion,in-cl
udi
ngap a
t h.Theadditi
onalinformationisc
ontainedinthePa t
h
At
tri
but
esf
iel
dofa
nup
dat
eme
ssa
ge.As
ende
rca
nus
ethep
atha
ttr
ibut
est
o
s
peci
fy:anex
thopfort
hea dver
tis
edde
sti
nat
ions
,al
i
stofa
utonomouss
yst
ems
a
longthep
athtot
hedes
tina
t i
ons
,
S
ec.1
3.1
3 BGPPa
thAt
tri
but
es 275

andwhethe
rt hep
athinfor
ma ti
onwaslear
nedfrom anot
hera
utonomouss
yst
em
orde
riv
edf romwi
thi
nt hesender
sa
utonomouss
yste
m.
Itisimpor
tanttonot ethatthepathattribute
sa ref a
ctoredtor e
ducet he
s
izeoftheUPDATEme ssage
,me ani
ngtha
tt hea ttr
ibut
e sapplytoalldes
tinati
ons
a
dverti
sedintheme ss
age.Thus,ifaBGPs enderintendst oadverti
sep at
hst o
s
ever
alsetsofdesti
na-ti
onsthateachhavetheirownp a t
ha ttr
ibut
e s
,BGPmus t
s
endmultipl
eUPDATEme s-s
ages
.

Patha ttri
butesa rei mpor tant i n BGP f or t hreer eas
ons . Firs
t,p ath
informa tiona l
-l
owsar ece i
vert oc heckf orf orwa rdingl oops.Thes enders peci
fi
es
ane x actp athofa u-tonomouss ystemst hatwi llbeus edt or eacht hede sti
nati
on.
Ift her ec e
iver
sautono- mouss ystema p pea rsont helist,t headv e
r t
isementmus t
ber e j
e c
te dort herewi l
lb eaf orwa r
dingl oop.S e c
ond,p athinforma ti
ona ll
owsa
receivert oimp l
eme ntp oli
cyc on-straint s( e.g.,r ejectap atht hati ncl
udesa
comp et i
torsautonomouss ystem) .Thi rd,p athi nf orma ti
ona l
l
owsar eceiv
ert o
knowt hes ourceofa l
lrout e
s.I na dditiont oa l
lowingas e
nde rtos peci
fywhe ther
thei nforma ti
onc amef romi nsidei tsaut onomouss ystemorf roma nothersystem,
thep atha ttri
butesa ll
ow t hes endert ode cl
a rewhe thert hei nfor-ma t
ionwa s
coll
ec t
e dwi thane xt e
riorg atewa yp rot ocols ucha sBGPora ni nteri
org ate-way
protoc ol
.Thus ,ea c
hr e c
e i
verc ande cidewhe thert oa cceptorr e j
e c
tr outesthat
originatei nautonomouss yste
msb eyondi tsp eer s
.
Conc
eptua
ll hePa
y,t thAt
tri
but
esf
iel
dcont
ainsal
i
stofi
tems
,whe
ree
ach
i
temcons
ist
sofatri
pl
e:
(
type,l
engt
h,v
alue)

Instea
d ofus i
ngf i
x e
d- s
izefiel
dsf ort hethreeite
ms ,thedesi
gnerschos
ea
fle
xibl
ee n-codi
ngs chemet hatminimizesthespac
ee ac
hi te
m occ
upi
es.Thetype
fie
ldha safixedsizeoft wooc t
ets,thelengt
hf i
el
disoneort woocte
ts,andsi
ze
oft hev al
uef iel
dde pendsont hel eng
th.Figur
e1 3.
8i l
lus
tra
testhatthetype
fie
ldisdivi
dedintot wooc -te
ts.

012345678 1
5
Fl
agBi
ts Typ
eCode

(
a)

Fl
agBi
ts De
scr
ipt
ion
0 0forr equiredattr
ibut
e,1ifoptional
1 1fortr ansi
ti
ve,0f ornontra
nsi
ti
v e
2 0forc omp l
ete,1forparti
al
3 0iflengt hfi
eldisoneoctet
,1ift wo
5-7 unus
ed( mus tbezero)
(
b)

Fi
gur
e13.
8(a
)Thet
wo-
oct
ett
ypef
iel
dtha
tap
pea
rsb
efor
eea
chBGP
a
ttr
i-b
utep
athi
tem,a
nd(
b)t
heme
ani
ngofe
achf
lagb
it.

Thenextcha
pte
rde
scr
ibe
sint
eri
org
ate
way
prot
ocol
s.
27
6 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

Eachit
eminthePat
hat t
ributesfi
eldcanha
veoneofe
ightp
oss
ibl
etyp
e
c
ode
s .Fi
gur
e13.
9summa
rize
sthep oss
ibi
l
iti
es.

Typ
eCode Meaning
1 IDoft heor i
ginoft hepa t
hi nforma ti
on
2 Lis
tofa utonomouss ystemsonp atht odesti
nati
on
3 Nexthopt ous ef orde st
inat i
on
4 Disc
rimina t
orus edf ormul tipleASe xitpoints
5 Prefere
nc eus edwi thina na utonomouss ystem
6 Indi
cationt hatr out eshaveb eena ggregated
7 IDofa ut onomouss ystemt hata ggregatedroutes
8 IDofc ommuni tyf ora dvertis
edde sti
na t
ions

Fi
gur
e13.
9TheBGPa
ttr
ibut
etyp
ecod
esa
ndt
heme
ani
ngofe
ach.

Foreac
hi temint hePathAttri
but
eslis
t,al e ngt
hf iel
df ol
l
owst he2-octet
t
ypef i
el
d,andise i
theroneortwooc tet
slong .AsFig ur
e1 3.8shows
,f l
agb t3
i
s
pec
ifi
esthes i
zeoft heleng
thfie
ld.Ar e
cei
ve ruse sthetyp efi
eldtodetermine
t
hes i
zeoft helengthfie
ld,andthenusest hec ontentsoft helengthfie
ldt o
c
omputethesizeoft heva
luefi
el
d.

1
3.1
4BGPKEEPALI
VEMe
ssa
ge

TwoBGPp eer
sp e
riodi
call
ye xc
hangeKEEPALIVE messa
gest otes
tne t
work
con-necti
vityandt ov eri
fyt hatbothp e
ersconti
nuet ofunct
ion.AKEEPALIVE
me s
sagec onsi
stsoft hes ta
ndardme ss
ageheaderwithnoa ddi
tiona
ldata
.Thus,
thet ot
alme s-s
agesizeis19oc tet
s(themini
mumBGPme s
sagesi
ze).
Therea ret wor ea sonswhyBGPus e sKEEPALI VEmes sages.Fi rst,peri
odicme s
-
sagee xchang eisne ede db ecaus eBGPus esTCPf ort ransport ,andTCPdoe snot
i
n-cl
ude a me chanism t oc ontinua ll
yt es
t whe t herac onne ction endpoint is
r
eachabl
e.Howe ver,TCPdoe sr ep orta ne rrort oa na ppl
icationi fa na tt
emp tt o
s
endda taf ails.The refor e,a slonga sb oths ide sp eri
odicall
ys endaKEEPALI VE,
t
heywi llb ei nforme di ft heTCPc onne ctionf ai
ls.S econd,KEEPALI VE messag e
s
c
onserveb andwi dthc om- paredt oot he rme ssages.Ma nye arlyr outingprotoc ol
s
r
eli
edonp eriodice xcha ngeofr out i
ngi nforma tiont ot estc onne ctivi
ty.Howe ve r,
b
ecauser outingi nf orma t
ionc ha ngesi nfrequent ly,t heme ssagec ontents el
dom
c
hanges.Unf or t
una tely,b ecauser outingme s
-sa gesa reof tenl arge,r es
endingt he
s
ameme ss agewa s
tesne twor kb andwi dth.Toa v oidt heine f
ficiency,BGPs eparat e
s
t
hef unct i
ona l
ityofr out eup dat ef rom c onne ctivi
tyt e
st-ing ,a ll
owingBGPt o
s
ends mallKEEPALI VEmes sa
gesf reque ntlya ndr eservi
ngl arge rUPDATEme ssag e
s
f
ors i
tuationswhe nr eac habi
li
tyi nf orma t
ionc ha nge s
.
Re
cal
ltha
taBGPs
pea
kers
pec
ifi
esahol
dti
merwheni
top
ensac
onne
cti
on;
theholdtime
rde f
inesamaxi
mum timet
hatBGPi
stowa i
twit
houtrec
eiv
inga
messag
e.Asa s peci
alca
se,the hol
dti
mercanbe ze
rot ospec
ifythat no
KEEPALIVEmess
ages
S
ec.1
3.1
4 BGPKEEPALI
VEMe
ssa
ge 277

areus e
d.I ftheholdtimeri sgrea
tert han zero,thes t
andardrecommends
set
tingtheKEEPALIVEi
nter
v altoonethi
rdo ft heholdtimer.Innocasecana
BGPp eermaketheKEEPALIVEinterv
alles
st hanones ec
ond( whi
chagreeswith
therequir
ementtha
tanonze r
oholdtimercannotbel e
ssthanthrees
econds)
.

1
3.1
5Inf
orma
tionFr
omTheRe
cei
ver
sPe
rsp
ect
ive

AnEx teriorGa tewa yPr ot ocol


,s ucha sBGP,di ffersfrom traditi
ona lrouti
ng
proto- c
olsi nas i
gnifi
c antwa y:ap e e
rt hatus esa ne xte
riorpr otocoldoe snot
me relyr e
porti n-forma tionfr om itsownFI B.I nstea
d,e xteri
orp rotocolsprovi
de
i
nf orma ti
on t hati sc orr e
ctf rom t heout si
de r
sp erspec
tive.Wes ayt hata n
exter i
orp rotocolsuppliest hi
r d-partyr outingi nformation.Therea retwoi s
sues:
polic
iesa nd op t
imalr outes.The p ol
icyi ssue i sob v
ious:a r out eri ns
ide an
autonomouss ys
tem ma yb eallowe dt or e
ac hs omede stinat
ionstha tout si
dersa r
e
prohibitedf rom reaching .Ther outingi s
sueme ansthatap eermus ta dve
r t
isea
nex thopt ha tisop tima lf r
om t heout side r
sp e
rspecti
ve.Thea r
chitecturein
Figure1 3.1
0c anbeus edt oil
lus t
r a
tet heide a.

Top
eeri
not
herAut
onomousS
yst
em

Ne
t5

R1 R2 RunsBGP

R3 Ne
t2
Ne
t1

Ne
t3
R4

Ne
t4

Fi
gur
e13.
10Ex
a mpl
eofa nautonomoussystem wheeR2 r
r unsBGPand
re-por
tsinf
ormati
onf rom theoutsi
der
spe
rs p
ect
ive
,not
fromitsownforwardi
ngt a
ble.
27
8 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

Int hef i
gure,r outerR2 hasb ee
nde si
gna te
dt ospeakBGPonb ehalfoft he
autono-mouss ystem.I t mus tr e
portr eachabil
i
t yt o ne tworks1t hrough 4.
Howe ve
r,whe ng i
v-ing a nexthop ,its houldr eportne twork 1asr eac
hab l
e
thr
oug hr oute r R1,ne tworks3 a nd 4 a sr eachabl
et hroughr out
e r R3,and
network2a sr eachablethroughR2.Thek eyp oi
nti sthati fR2 l
istsi
t se
lfast he
next hop f or allde s
tinati
ons i
nt he autonomous s ys -te
m, routing willb e
subopti
ma l.Thep eerwoul dsenda l
ltraff
ictoR2.I np ar
t icul
ar,whenada ta
gram
arr
ivesfr omt hep eerdestinedfornetworks1 ,3,or4,t hep eerwoulds endtoR2
andt heda tagramwoul dt hentakeane xt
rahopa crossnet work5.

1
3.1
6TheKe
yRe
str
ict
ionOfExt
eri
orGa
tewa
yPr
otoc
ols

We ha veal
ready see
n t hatb ec
ausee xte
rior p rot
ocol
sf oll
ow poli
cy
r
est
rict
ions
,thenetwor
kst he
ya dve
rti
sema ybeas ubs
etoft hene t
work
st hey
c
anr e
ach.Howev
er,thereisamor efunda
me nt
alli
mi t
ationimpose
done xteri
or
r
outi
ng:

Anexter
iorgat
ewayprotoc
oldoesnotc
ommunicat
eori
nter
pret
di
s-t
ancemetri
cs,ev
enifmetri
csareavai
l
abl
e.

Al
t houghi ta llows a p eert o decl
aret hat a destination hasbecome
unreacha b
le or tog i
veal is
t of autonomous systems on t he pathtot he
dest
inat i
on,BGPc annott r
ansmitorc omparethec ostoft wor outesunl
essthe
routesc omef rom withinthesamea utonomoussystem.Ine sse
nc e,BGPcanonly
spec
ify whe thera p a
the xis
tst oag iv
en desti
nati
on;itc annott r
ans
mitor
computet heshor
teroft wopaths.
Wec a nseenow whyBGPi sc ar
efult ol abelt heo r
igi
nofi nformati
oni t
sends.Thee s
senti
alobser
vationisthis:whe nar outerr e
cei
vesa dverti
sementsfor
ag iv
ende s-ti
nati
onf r
om p eersint wodi fferenta utonomouss yste
ms ,itcannot
comp arethec ost
s.Thus,adv ert
isi
ngr eachabil
i
tywi t hBGPi sequival
entt osayi
ng,
Mya utonomouss ys
-temp rovidesap atht ot hisne twork.
The r
ei snowa yf or
the rout ert os a
y, My a uton-omouss ystemp r
ov i
desa b etterp atht ot hi
s
networ kt hananotherautonomouss ystem.
Looki
nga ti nt
e rpre tationofdi st
a ncesa l
l
o wsust os eet hatBGPc a
nnotb e
useda sar outinga lgor it
hm.S upposear outer,R,r ece
ivesBGPa dve
rti
se ments
from twos eparatea ut onomouss yst
ems .Fur thermore,supposee achoft het wo
autonomouss ys-temsa dvertis
esr eac
ha bi
lit
yt oade sti
na t
ion,D.Oneoft hem
adverti
sesap aththa tr e -quiresadatag r
amt ot r
avelthrought hreeASesa ndt he
othera dv
e r
tis
esap atht ha tr e-
quiresada ta
g ra
mt otravelt hr
oug hfourAS e s
.
Whichp athhaslowe rc os t
?S urpr
isi
ng-l
y,r oute rRc a
nnott el
l.
I
tma ys e
emt hatap eers houl
dus
et helengthofthep athwhe ncompar
ing
BGPa d-v
erti
seme
nt s
.Afterall,ifonep
athlis
tsautonomoussystemsF,G,H,a nd
I,andanoth-erp
athl i
stsautonomouss
ystemsX,Y,a ndZ,intuit
iontel
lsusthat
thelatt
erp a
thisshorter.Howe ver
,ag i
venautonomoussyste
mc a
nb elar
geor
sma
ll
.Onceadatagra
mr ea
chesthea ut
onomoussystem,thedat
agram mayneed
totra
ver
semult
ipl
ene t
works.How many?Wha tarethenetwor
kc har
act
eri
sti
cs
ofdel
ayandt
hroughput
?Ab orderr
outercannotanswert
hequesti
onsbec
ause
:
Se
c.13.
16 TheKe
yRe
str
ict
ionOfEx
ter
iorGa
tewa
yPr
otoc
ols
279

Theinter
nalstructureofanautonomoussyst
em i
shi
dden,and
noin-format
ion aboutthecos
tofpat hsins
idet
hesystem i
s
prov
idedbyBGP.

Thecons
equenceisthatap e
erha snowayofcompari
ngt here
alcos
toft wo
pat
hsi fallt
hep eerrec
e i
vesisalis
tofa ut
onomoussyst
ems.I tc
ouldtur
nout
tha
tap a
thwi t
hf ourASesinv
olvesmuchfas
ternetwor
kst ha
nap athwi
tht hr
ee
ASes
.
Bec
a us
eBGPdoe snotall
ow anautonomoussyst
emt os
peci
fyametr
icwit
h
e
achroute,thea
ut onomoussyste
m mustb ecar
efultoa
dver
tis
eonl
yrout
esthat
t
raf
ficshoul
dfol
low.Wec a
ns ummari
ze:

BecauseanExt eri
orGat ewayProtocolli
keBGPonlypr opagates
reachabili
ty infor
mat ion, a r ec
eiver can impl
ement pol icy
constraints,butc annotc hoos
eal eastcos
tr out
e.Ther efore,
BGPs houldonlybeus edt oadverti
sepathsthattraf
fics hould
foll
ow.

Thek e
yp oi
nthereis:ana utonomouss ys
temt hatuse
sBGP top rovi
de
e
xteri
orroutinginf
ormati
onmus teitherrel
yonp ol
ic
iesorass
umethate v
ery
a
utonomoussys-t
emt r
ansi
tisequal
l
ye x
pensi
ve.Alt
houghitmaysee
minnoc
uous,
t
herestr
ict
ionhassomesurpr
isi
ngconsequenc
es:

1
.Al t
houg hBGPc ana dv e
r t
isemul tipl
ep athst oag ive
nne t
wor k
,i t
doesnotp rovideawa yf ora na utonomouss ystemt or e
que s
tt hat
traffi
cb ef orwa r
de dov ermul t i
plepaths .Thati s
,a ta nyg iven
ins
tant,a llt raf
fics ent f rom a c omput eri n one autonomous
syste
mt oane tworki na not h-erwi l
ltr avers
eonep ath,eveni f
multipl
ep hys i
calc onne c
tions a rep resent.Al s
o not et hata n
outsi
dea utonomouss ystem wi l
lonlyus eoner et
urnp ath,eveni f
thes ources ystem dividesout goingt raffi
ca mongt woormor e
paths.Asar esul
t,de laya ndt hroughputb et
we enap airofhos ts
canb ea s
ymme tri
c,ma ki
ngt ra
f f
icdiffi
c ulttomoni tororde b ug
ande rror
sdi ffi
cul
tt or eport.
2.BGP doe snots upportl oa
ds hari
ngon p eer
sb etwee narbitr
ary
autono-mouss ys
tems .Ift woa utonomouss yste
msha vemultipl
e
routerscon-necti
ngt hem,onewoul dl i
ket ob a
lancet hetraffi
c
equall
ya mong a l
lr outers
.BGP a l
lowsa utonomouss ystemst o
div
idet heloadb yne t
-wor k(e.g
.,t op arti
tion themsel
vesinto
multi
plesubsetsandha vemul-ti
pler outer
sa dverti
sep ar
tit
ions)
,
butitdoe snotsupportmor egeneralloadshari
ng.
3.Asas peci
alcas
eofp oint2,BGPa lonei
si nade
quateforopti
ma l
rout-i
ng inana r
chitectur
et ha
tha stwo ormor e wide a
rea
networksint
er-connecteda tmulti
plepoints
.I ns
tea
d,ma nager
s
mustma nual
l
yc onfig
- urewhic
hne tworksarea dv
erti
sedbyeach
exter
iorrout
er.
280 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

4.To haver a
tiona
li
zedr out
ing
,a llautonomous sys
tems inthe
Inte
rnet musta gr
ee on a consi
ste
nt sc he
me for adve
rti
si
ng
reac
habil
i
ty. Thati s
, BGP a l
one will not g
ua r
anteeg l
obal
cons
ist
ency.

1
3.1
7 TheI
nte
rne
tRout
ingAr
chi
tec
tur
eAndRe
gis
tri
es

Fort heInt er
nett oop er
atef la wl
e ss
ly,r outi
ngi nformationmus tb egloball
y
con- si
ste
nt .Indivi
dualp rotocol
ss uc ha sBGPt hatha ndlet hee xc
hang eb etweena
pairofr out e
r s
,donotg uaranteeg lobalc onsis
tency.Thus ,f urthere ffor
ti s
nee dedt or a
t i
onal-
ize r outi
ng inf orma tion g l
obal
ly.I nt he or i
ginalI nternet
rout i
ng a rchi
tecture,t he c ores ys te
mg ua ranteedg loball
yc onsistentr outing
informa t
ion b ecausea ta ny t i
me t he c ore ha de xactl
y one p at
ht oe ach
dest i
nati
on.Howe v
er,t he c ores ystem a nd i tssuc c
e s
sor (call
edt he routing
arbiters ystem)ha veb e enr emov e d.I ronica l
ly,no s ingl
eme chanism ha sb een
deviseda sar e
placementt oha ndlet het askofr outingr ational
ization t he
curr entI nternetdoe snotha veac entra lme chanismt ov ali
dater outesa nd
gua rante
eg lo-balconsi
ste ncy.
Tounde rstandt hec urrentr outinga rchi
t e
ct ure,wene edt oe xaminet he
physicalto-pology.Ap airofI SPsc aninterc
onne ctp ri
vately(e.g.,b ya g
r eei
ngt o
l
e a
s eac i
rcui
tb etweent wor out e
rs),orc ani nterconne cta tInt ernetExc hange
Points(IXPs),whi charea ls
ok nowna sNe twor kAc cessPoi nts(NAPs ).Wes ayt hat
theI SPse ngagei np r
ivatepeeringort hatthe ye nt e
ri ntoap eeringagr eement.
Int ermsofr outing,ap ri
vatep eer-i
ngr epr
es e
nt st heb oundaryb etweent het wo
autonomouss ystems.Thet woI SPsdefinethe i
rr elationship
,whi chc a
nb ev iewed
asup stream (alar geISPa gr
eest ot aketrafficfrom as ma ll
erI SP),downs tream,
(alargeI SPp a
ssest r
affictoas ma l
l
e rISP),ort ransit( anISPa greestoa ccept
andf orwa rdt r
aff i
ctoot herISPs )
.
Toa ss
istinassuringthatroutesa
rev a
lid,I
SPsuseser
v i
cesknowna sRout
ing
Reg-i
s t
ries
.I ne ss
e nce,aRout ingRegi
stryma i
nta
insinformation a
boutwhich
ISPsownwhi c
hb l
oc ksofa ddre
sses
.Thus,ifISPAsendsana dverti
sementtoISP
Bc l
aimingt ohaver e
a c
habil
i
tyt onet
workN,I SPBc anus einformati
onfrom a
Routing Re gi
str
y t o v e
rify tha
ta ddress N hasb een a s
sign to ISP A.
Unfortunately,ma nyRout i
ngRe gi
stri
ese xi
st,andt hereisnome chani
smi npla
ce
tovali
datet heda tainar e
gis
try.Thus,t em-porar
yr out
ingp rob
lemsoc cur
,such
asb l
ackhol es,inwhi chag i
vena ddr
essi snotr eachabl
ef rom a l
lp ar
tsoft he
Inter
ne t
.Ofc ourse,ISPsandmos tRout i
ngRe gi
str
iesa t-
temp ttof i
nda ndrepai
r
suchproblemsqui ckl
y,b utwithoutac entral
i
zed,a uthori
tati
ver egis
try,Inter
net
routi
ngi snotf la
wl es
s.

1
3.1
8BGPNOTI
FICATI
ONMe
ssa
ge

I
naddi
ti
ont
otheOPENa
ndUPDATEme
ssa
get
ype
sde
scr
ibe
dab
ove
,BGPs
up
-portsaNOTI
FICATION mes
sagetypeusedforcontr
olorwhenane r
rorocc
ur s
.
Errorsarepe
rmanent onc eitde te
ctsap r
oble
m,BGP sendsanotif
ica
tion
me s
sageandt
henc l
ose
st heTCPc onne
cti
on.Fi
gure13.
11i
ll
ust
rate
stheme s
sage
format.
S
ec.1
3.1
8 BGPNOTI
FICATI
ONMe
ssa
ge 281

0 8 1
6 31
ERRCODE ERRS
UBCODE DATA

Fi
gur
e13.
11BGPNOTIFICATI
ONme s
sagefor
mat
. The
seoc
tet
sfol
l
ow
thes
tandar
dme ss
ageheade
r.

The8-bi
tfi
el
dla
bel
edERRCODEs
pec
ifi
esoneoft
hep
oss
ibl
ere
asonsl
i
ste
din
Fi
gur
e13.1
2.

ERRCODE Meaning
1 Err
orinme ssa
gehe ader
2 Err
orinOPENme s sage
3 Err
orinUPDATEme ssage
4 Hol
dt i
mere xpi
red
5 Fi
nitesta
tema chinee rror
6 Ceas
e(terminatec onnecti
on)

Fi
gur
e13.
12Theposs
ibl
evalue heERRCODEf
soft iel
dinaBGPNOTI
FI-
CATI
ONme ss
age.

For eac
hp os
sib
le ERR CODE, t
he ERR SUBCODE f
iel
dcont
ains a f
urt
her
exp
lana
tion.Fi
gure13.1
3li
ststhep
oss
ibl
eva
lues.

1
3.1
9BGPMul
ti
prot
ocolExt
ens
ionsForI
Pv6

BGPwa sor i
ginallydes i
gne dt oconveyIPv4r outi
ngi nformation.By2000,i t
hadb ecomea pparentt hata ut onomouss yst
emsne ededt oe xchang ea ddi
t i
onal
typesofr out -i
ngi nf orma t
ion.Att het i
me,t het womos tp r
essingne e
dswe re
IPv6andMPLS ,whic hisde scribedinCha pter16.Ra t
he rthanc reat eonev er s
ion
ofBGPf orI Pv6a nda nothe rv ersi
onf orMPLS ,ag roupi nt heI ETFc reated
multi
protoc olext ensions.Thei deaisthatwhe na dver
t i
si
ngde sti
na tions,ase nder
canspecifyt hatt hede stinationa ddres
sesareofap a rti
culra
a ddr essfamily.To
sendIPv 6i nf ormationas ende rspeci
fi
est heI Pv6a ddressfami l
y,a ndt os end
MPLSinf orma ti
onas enders pec i
fi
estheMPLSa ddres
sf amil
y.

Onlythreeit
e msc ar
riedinBGPme ssag
e sus
eI Pv
4a ddr
esses
:theaddres
sof
ade st
inati
on tha
ti sa dverti
sed,thea ddressofane xthopus edtoreacht he
dest
inati
on,a ndthea ddres
sofa na ggr
egatorthathasaggreg
atedpre
fixe
s.The
extens
ionsa r
ede sig
ne dt oa l
low any oft hethreeite
mst ous eana rbi
trary
addres
sf a
milyratherthanI Pv4.
282 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

S
ubc
ode
sForMe
ssa
geHe
ade
rEr
ror
s
1 Connect
ionnotsync
hr oni
zed
2 Incor
rectmess
agelength
3 Incor
rectmess
agetype

S
ubc
ode
sForOPENMe
ssa
geEr
ror
s
1 Ver
sionnumb e
runs upport
ed
2 Pee
rASi nval
id
3 BGPi denti
fi
eri nv al
id
4 Uns
up portedopt ionalpar
amete
r
5 Deprecated(nol ongerused)
6 Hol
dt i
meuna ccep ta
b l
e

S
ubc
ode
sForUPDATEMe
ssa
geEr
ror
s
1 Attri
butelistma lformed
2 Unrecogni
ze da ttr
ibute
3 Missi
nga ttribute
4 Attri
butef lagserror
5 Attri
butele ngthe rr
or
6 Inval
idORI GI Nattribute
7 Deprecate
d( nolongerus e
d)
8 Nexthopi nv al
id
9 Errorinop tionalattrib
ute
1
0 Inval
idne twor kfiel
d
1
1 MalformedASp a
th

Fi
gur
e13.
13Theme a
ningoftheERRS
UBCODEf
iel
dinaBGPNOTI
FI-
CATI
ONme ssa
ge.

Thede
sig
ner
schos
etwok
eyp
rop
ert
iesf
ort
hemul
ti
prot
ocole
xte
nsi
ons
:

Opti
onal
.Multi
prot
ocolex
tens
ionsa
renotr
equir
ed.
Non-tr
ansi
ti
ve.Aroutermaynotpasst
heext
ensi
onst
oot
herAS
es.

Thede ci
sionsa reimp or
tantf ortwor eas
ons.Makingthee xtensi
onsop ti
onal
gua r
ant eesb ack war
dc omp a
tibi
li
ty( i.
e.,old BGP softwar e wil
lc ontinue t o
function) .I
fa ni mpl
eme ntati
onofBGPdoe snotunde r
standt hee xtensions,it
willsi
mp l
yignoret heex tensi
onsandt heroutestheyadvert
ise.Thep r
ohi b
it i
onon
forwa rdingext ensi
onske epsInter
ne trouti
ngf r
om bei
ngv ulnera
bletoa t
t ack.If
bli
ndf or wardi
ngwe rep ermit-t
ed,a nASt hatdidnotund ersta
ndt hee xte nsi
ons
mighti nadv
e r
t entl
yf orwa rdincorrectinfor
ma ti
on,whicht hene xtASwoul d
trust.
S
ec.1
3.1
9 BGPMul
ti
prot
ocolEx
tens
ionsForI
Pv6 283

Themul tiprotocolext
ensionsareca r
r i
edi nBGPsPathAt tri
butes.Twone w
att
ri-butet ypeswe recreate
dt oall
ow as endertos pe
cifyal i
stofnon- IPv4
des
tinati
onst hata rer eac
hab l
ea nd a lis
tofnon- IPv4 dest
inati
onst hata re
unreacha
b l
e.Ra thert ha
nus et hetermr eachabledest
inat
ions,theex t
e ns
ionsuse
theterm Net wor kLayerReachabil
i-t
yI nformation(NLRI)
.Consequently,thet wo
att
ributestyp esa r
e:

Mul
ti
prot
ocolRe
acha
bleNLRI(
Typ
e14)
Mul
ti
prot
ocolUnr
eac
hab
leNLRI(
Typ
e15)

1
3.20Mul
ti
prot
ocolRe
acha
bleNLRIAt
tri
but
e

Ar outer use
st he Mul t
iprotoc
olReachabl
e NLRI attri
but
et oa dverti
se
r
eachab
le dest
inat
ions
,e ither withi
ni tsautonomous sys
tem or des
tinat
ions
r
eachab
lethrought heautonomouss ystem.Eachdesti
nati
onint heat
tribut
ei s
c
all
edaS ubnetworkProtocolAddress(SNPA)
.Figure13.
14list
sthefie
ldsint he
a
ttri
bute:

0 7 1
5
Addr
essFa
mil
y Fa
mil
yExt
ens
ion Addr
.Le
ngt
h
Ne
xtHopAddr
ess(
var
iab
le)
...
Num.ofS
NPAs
,N
Le
ngt
hofS
NPA1
S
NPA1(
var
iab
le)
...
Le
ngt
hofS
NPA2
S
NPA2(
var
iab
le)
...
.
.

. .

.
.
Le
ngt
hofS
NPAN
S
NPAN(
var
iab
le)
...
Ne
twor
kLa
yerRe
acha
bil
it
yInf
orma
tion(
var
iab
le)
...

Fi
gur
e13.
14TheformatofaBGPMul
tipr
otoc
olReachabl
eNLRI
a
ttr
ibuteuse
dforI
Pv6andothernon-
I Pv4de
sti
nat
ion
a
ddres
ses.
284 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

Ast hef i
gureshows,t heatt
rib
utestart
swithfie
ldst
hatg i
vet headdre
ss
f
amil
ya nda ddressl
ength.Theattri
but
et he
ns p
eci
fi
esanext-
hopa ddres
sanda
s
etofde s
tina
tions(SNPAs)rea
chabl
ethroughthenexthop
.Ea c
hde sti
nati
onis
p
rec
e de
db ya1 -octe
tl e
ngth.

1
3.21I
nte
rne
tRout
ingAndEc
onomi
cs

Alt
houg hr es
earchonr o
utingfocusesonfindi
ngme c
hanis
mst hatcompute
s
hortes
tp a
t hs
,s horte
stpathsare not the p
rimaryc once
rn of Tier
-1I SPs;
e
conomicsis.Beforetheyi
nterc
onnectthei
rnetworksandb eg
inp a
ssi
ngtraff
ic,a
p
airofI SPsnegotiat
esabusine
sscontra
ct.Typi
calconta
c t
sspecif
yoneoft hr e
e
p
ossi
bi
li
ties:

I
S sac
P1i ust
omerofI
SP2.
I
S sac
P2i ust
omerofI
SP1
.
Thet
woI
SPsa
rep
eer
s.

Thec ustomerr el
a ti
onshi
pi sde f
inedbyt hef l
owofda ta:anI SPt hatreceiv
es
moreda tat ha ni ts endsisde finedt obeac ustome ra ndmus tp a yaf ee.The
defi
niti
oni se asyt ounde rstandi fwec onsi
de ras mallISP.Whe nar esi
dential
userbecome sac ustome rofal ocalI SP(e
. g
.,ac ab l
ep rovid
er )
,theus ermustp ay
afeeb ecauset heus erwi l
ldownl oadmuc hmor eda tat hant heyse nd( e
.g.
,e ach
ti
meaus erb r owsest heWe b
,da tamus tb es e
ntf rom thep rovi
dert ot heus er)
.
Thea mountt hec ustome rpaysde pendsonhowmuc hda tathec ustome rwant sto
download.Att hene x tleve
loft heI SPhierarc
hy,al ocalISPb ecome sac ust
ome r
ofal ar
g e
rI S P b e causei
tdownl oadsmor eda t
at ha nitg enerate
s,t helocalISP
mustp ayt hel argerIS P.
Wha
tab
outt
woTi
er-
1IS
Psa
tthet
opoft
hehi
era
rchy?I
fthe
yar
etr
uly
peer
s,t
het
woI
SPswi
l
lea
chha
vet
hes
amenumb
ero
fcus
tome
rs.Thus
,on
av
erage,theye xpec
tt he sa
me a mount of datat otrav e
li neach dire
ction
be
tweent hem.So,t heywr i
teac on-tr
actinwhi c
ht heya greetope er
,whi ch
meansthe
ywi l
lspli
tt hecostofac onnect
ionbetweenthem.Howe ve
r,t heyalso
ag
reet omonit
ort heda tathatp ass
esacrossthecon-nec
tion.Ifduringag iven
monthmor edat
ap assesfrom IS
P1t oISP2,t hecontrac
ts tip
ula
test ha
tI SP2
wi
llpayISP1ana mountt hatdependsont hedi
ffere
nceint heamountofda ta.
Oncecontractshaveb eens etup ,ISPst r
yt oa r
ra ngeroutingt og enerat
e
themos tr ev
enue.Us uall
y,c ust
ome rspayt hemos tf orda ta
.The r
e f
ore,i fa
cust
ome radverti
sesreachabil
i
tyt oag iv
ende sti
nat
ion,a nISPwi l
lp refe
rt osend
datathrought hecustomerr atherthanap e
er.Furthermo r
e,ifa nI SPwa ntsto
avoi
dt aki
ngda tafrom ap eer,theIS Pcana rra
ngeBGPme s
sagest ha
tc ausethe
peertos t
ops endi
ng( e.
g.,ifa nISPp ut
st hep e
er
sASnumb eront hep a
thina n
advert
ise
me nt,thep e
e rwillreje
ctt hepatha shavi
ngar outi
ngl oop).Thep oi
nt
is
:
S
ec.1
3.21 I
nte
rne
tRout
ingAndEc
onomi
cs 285

At the center of the Internet,routi


ng isbas ed l
argely on
economic
sr at her than shortes
t paths
. Maj or ISPs arrange
poli
ci
es,pref
er enc
es,andBGPadv er
tis
ementstof orcedatagrams
al
ongr outest hatgen-eratet hemostrevenue,independentof
whetherther outeisshor
t es
t.

1
3.22S
umma
ry

Inalargeinternet,rout ersmus tbep arti


ti
onedint ogroupsort hevolumeof
routi
ngt raf
ficwo uldb eintolerabl
e.Theg l
obalInt
er netiscomposedofas etof
autonomouss ys
tems ,whe ree acha utonomouss yst
e mc onsis
tsofr outersa nd
networksunde ronea d-minist
r a
t i
vea uthori
ty.Ana utonomouss ystem usesa n
Exteri
orGa teway Pr otoc
olt oa dvert
iser outestoot hera utonomouss ystems.
Speci
fic
all
y,ana utonomouss ys
t e
m mus ta dvert
isereachabi
li
tyofi tsnetworkst o
anothersystemb e
f oreitsne twor k
sa rer eac
hablefrom sourceswithintheot her
syste
m.
The Bor der Gatewa y Protocol
,BGP,i st he mos t widel
y used Exter
ior
Gatewa y Protocol
.BGP c ontai
nsf i
veme s
saget ypest hata reusedt oiniti
ate
communi c
a ti
on( OPEN),s e
ndr eachabi
li
tyinforma ti
on( UPDATE) ,re
porta nerror
condi
tion( NOTIFI-CATION) ,reval
ida
tei nf
orma t
ion( REFRESH) ,andensurepeers
remaini nc ommuni c
a-tion (KEEPALIVE).Ea c
h me ssages tar
t swith astandard
header.BGPus e
sTCPf orc ommunicati
on.
Alt
houghorigi
nal
lycrea
tedforIPv4,BGPha sb
eenextende
dt ohandl
eot
her
p
ro-toc
ols.I
np a
rti
cula
r,as etofmul ti
prot
ocolext
ens
ionsall
ow BGPt opas
s
i
nfor
ma ti
onaboutMPLSa swel
lasIPv6.
Int heg l
ob alInternet,e a
chlargeISPisas ep a
ratea ut onomouss ystem,a nd
the bounda ryb etweena ut o
nomouss ystemsc onsis
tsof a p ee
ring a gre
e ment
betweent woI S Ps.Physica
ll
y,p eeri
ngc a
noc c
uri na nInter netEx c
ha ngePoi ntor
overap r
ivatele a
sedc ir
cuit.AnI SPusesBGPt oc ommuni catewi thitsp eer
,b oth
toa dv
e rti
sene t-wor ks(i
.e.,addres
sp re
fix
es)thatc anb er eachedt hroughita nd
tolearna boutne twor ksthatc anber e
achedbyf orwa r
dingt othep eer.Although
ser
v i
cesk nown a s Rout ing Re gi
str
iese xi
st t hat a i
d I SPs i n v a
li
da ti
ng
adverti
seme nts,prob l
emsc anoc c
urb eca
usetheI nternetd oe snotc urrentl
yha ve
ana uthori
ta t
ive,c entra
li
zedr egi
stry.
Atthecente
roftheInternet
,r out
ingisb
asedoneconomic
sratherthan
shor
t e
stpat
hs.Ma j
orI
SPschooseroutestha
twillmax
imi
zet he
irre
ve nueand
mini
mizethe
ircost
s.

EXERCI
SES

1
3.1 I
fyours
iter
unsa
nEx
ter
iorGa
tewa
yPr
otoc
ols
ucha
sBGP,how ma
nyr
out
esdo
youa
dve
rti
se?Howma
nyr
out
esdoyoui
mpor
tfr
oma
nIS
P?
286 Rout
ingAmongAut
onomousS
yst
ems(
BGP) Cha
p.1
3

1
3.2 Somei mp l
ementati
onsofBGPuseaholddownmecha
nis
mt hatc a
usestheprot
ocol
tode l
aya ccept
inganOPENfrom ap
eerforafixe
dtimefol
lowingtherece
iptofa
ceaser equestmessag
ef r
om tha
tneig
hbor.Fi
ndoutwha tp r
oblem aholddown
help
ss olve.
1
3.3 Thefor
ma lspe
cif
ica
tionofBGPi
ncl
udesafi
nitest
atemac
hinethatexpl
ai
nshow
BGPopera
t e
s.Drawadi a
gra
mofthest
atemachi
neandl
abe
lt r
ans
iti
ons
.
1
3.4 Whatha p
pe nsifar outerina na utonomoussyst
ems e
ndsBGProut
ingupdat
e
mess
agestoar out
erina nothe
ra utonomoussys
tem,c
lai
mingt
oha
v erea
cha
bil
i
ty
foreve
ryp oss
i-bl
eInter
ne tdest
inat
ion?
1
3.5 Ca
nt woautonomoussys
temse
sta
bli
shaf
orwa
rdi
ngl
oopb
yse
ndi
ngBGPup
dat
e
mes-
sag
estoonea not
her
?Whyorwhynot
?
1
3.6 S
houl
dar out
ert hatusesBGP toa dv
erti
seroutestrea
tt he setofr outes
a
dver
tis
eddif-
fer
entlythanthesetofroutesi
nt hel
ocalforwa r
dingt a
ble
?For
e
xampl
e,shoul
dar oute
reveradve
rti
sereac
habi
li
tyifithasnoti nstal
l
edar oute
t
othatnetworki
ni t
sfor-
wardi
ngtabl
e?Whyorwhyno t
?(Hint :readRFC1 771.
)
1
3.7 Withreg
ardtot heprev
iousques
tion,e
xami
net heBGP-4sp
eci
fi
cati
oncar
eful
l
y.
I
si tl
egalt
oa dv
e r
tis
ereacha
bil
i
tyt oadest
ina
tionthati
snotli
ste
di nt
helocal
for
wardi
ngtab
le?
1
3.8 I
fyouworkforalar
gecor
pora
tion,fi
ndo utwhe
t he
ri ti
ncl
ude
smor et
hanone
a
utono-
mouss
yst
em.Ifs
o,howdot he
ye x
changerouti
nginf
ormati
on?
1
3.9 Whatist
hec hi
efa dva
ntageofdi
vi
dingalarge
,multi
-na
tiona
lcor
por
ati
oni
nto
mul
ti
pl
eautonomoussyste
ms?Whatisthec
hie
fdisa
dva
ntage
?
1
3.1
0 Corporat
ionsA a nd B useBGP toe xc
hangerouti
ngi nf
ormati
on.Thene t
work
admini
s-trator a
t Corp or
aton A c
i onfi
gures BGP to omit networkN from
advert
ise
me ntssentt o B,whichisintende
dt op re
ventcomp ut
e r
si nBfrom
reac
hingma chi
nesonne tworkN.Isnet
wor kNsecur
e?Whyorwhynot ?
1
3.1
1 Beca
useBGPusesarel
ia
bletra
nspor
tp ro
tocol
,KEEPALI
VE mess
agesca
nnotbe
l
ost.Doe
sitmakese
nsetospec
ifyak e
epali
veint
erv
alasone-
thirdofthehol
d
ti
merval
ue?Whyorwhynot?
1
3.1
2 Cons
ultt
heRFCsforde
tail
softhePa
thAt
tri
but
esf
iel
d.Wha
tist
hemi
nimum
si
zeofaBGPUPDATEmes
sage?
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
Chapt
erCont
ent
s
1
4.1 Int roduc ti
on,289
1
4.2 Sta ticVs .Dyna mi cInt eriorRout es,289
1
4.3 Rout ingInf orma t i
onPr ot oc ol(RI P),293
1
4.4 SlowConv erge ncePr ob l
em,294
1
4.5 SolvingTheS lowConv e r
g enc ePr oblem,296
1
4.6 RI PMe ssageFor ma t( IPv 4) ,297
1
4.7 FieldsI nARI PMe ss
ag e,299
1
4.8 RI PForI Pv 6( RI Png),299
1
4.9 TheDi s
advant a geOfUs i
ngHopCount s
,301
1
4.1
0 De layMe tri
c( HELLO) ,301
1
4.1
1 De lay Me tric
s ,Os ci
llation,And Rout e Flap
ping,
302
1
4.12 TheOp enS PFPr ot ocol(OS PF),303
1
4.13 OS PFv 2Me ssageFor ma ts( I Pv4) ,305
1
4.14 Cha ng esI nOS PFv 3ToS up p ortI Pv 6,310
1
4.15I S- ISRout ePr op ag a
t i
onPr otoc ol,312
1
4.16 Tr ustAndRout eHi j
ac ki
ng ,31 3
1
4.17 Ga te d:ARout ingGa tewa yDa emon,31 3
1
4.18 Ar ti
f ici
alMe t
r icsAndMe tricTr a nsformation,314
1
4.19 Rout ingWi thPa rt i
alI nfor ma tion,31 5
1
4.20 Summa ry,31 5
1
4

RoutingWithi
nAn
AutonomousSystem( RI
P,
RIPng,OSPF,IS-
I S)

1
4.1I
ntr
oduc
tion

The previ
ous chapt
e rintroduce
st he autonomous syste
m c onc
epta nd
examine
sBGP,a n Exte
riorGa t
e wayProt oc
olt hatar out
e rusestoa dv
erti
se
networkswithi
nitssystemtoot herautonomouss yste
ms.Thischap
tercomple
tes
ourov e
rviewofinternetrouti
ngb yexamininghow ar out
e rinana ut
onomous
sys
teml ea
rnsaboutothernet-wor k
swithi
ni tsautonomoussyst
em.

1
4.2S
tat
icVs
.Dyna
micI
nte
riorRout
es

Twor oute
rswi thi
nana utonomouss
ystemaresai
dtob einter
iortoone
a
nother.Forexampl
e,tworoutersonaunive
rsi
tycamp
usareconsi
der
e di
nte
rior
t
oonea not
hera slongasma c
hinesonthec amp
usarecol
le
ctedintoas i
ngle
a
utonomoussyst
e m.
How canroutersi
na na utonomoussysteml e
ar na b
outne twork swithi
nt he
autono-moussyst
em?I nt hesma l
les
tintranets
,ne tworkma nage
rsc ane st
a b
li
sh
andmodi f
yr out
esma nua
lly.Thema na
gerk eepsal is
tofne tworksa ndup date
s
thef or
wardi
ngt abl
eswheneverane w networkisa ddedt o,ordeletedfrom,t he
autonomoussyst
em.Fore xample,consi
dert hesmallcorporateintranetshowni n
Fig
ur e14.
1.
28
9
290 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

Ne
t1

R1
Ne
t2

R2
Ne
t3

R R
3 4

Ne
t4 Ne
t5

Fi
gur
e14.
1Anexampl
eofas malli
ntra
netcons
ist
ingoff
ivene
tworks
a
ndfourroute
rs.Onlyonepos
sibl
er out
eex
ist
sbetwe
en
a
nyt
wohos t
sintheexampl
e.

Routi
ngf ort heint r
ane tint hefigurei strivi
albeca
useonlyonep at
he xi
sts
betwe ena ny two p oints.I fane twor k orr outerf ai
ls
,t hei nt
ranetwi l
lb e
dis
c onnec
te db ec
auset herea renor edundantp a
ths.Therefor
e,ama nagerc an
conf i
gurerout e
sina llhostsa ndr oute
r sma nuall
y,a ndneverneedstoc ha
nget he
rout es
.Ofc ourse
,i ft heint ra
ne tcha nges(e .
g.,ane w networkisa dded)
,t he
ma nagermus treconfiguret her outesac c
ord-ingl
y.

Thedi sadv
ant a
g esofama nuals ystema r
eob vi
ous:ma nua lsystemsc annot
accom-moda tera pi
dg rowtha ndr elyonhuma nstoc hang er outeswhe nevera
networkf ai
lur
eoc curs.I n mos ti ntranets
,huma nssimp lyc annotr espond to
changesf astenoug ht oha nd l
ep r
ob l
ems ;automa
tedme t hodsmus tbeus ed.To
underst
a ndhowa utoma tedr outingc anincreas
ereli
abi
li
ty,c onsiderwha thappens
i
fwea ddonea dditionalrout ert ot heintra
netinFig ure1 4.1,p r
oducingt he
i
ntr a
nets howni nFigur e14.2.
Int hef igure,mul tip
lep athse xis
tb etwe e
ns omehos ts.Ins uchc a
ses,a
mana gerusuall
yc hoose
sonep atht ob eap ri
mar ypat h(i
.e.,thepa tht hatwillbe
use
df oralltraffi
c).Ifar outerorne twor kalongt heprimaryp athf ail
s,routes
mustb ec hangedt os end t ra
ff i
ca long a na l
ternatep ath.Aut oma tedr oute
changeshe l
pint wowa ys.First
,b ecausec omp utersc anrespondtof ail
uresmuc h
fas
t erthanhuma ns,aut omatedr outec hangesa rel e
sstimec onsumi ng.Second,
bec
a use huma ns c a
n ma kes ma l
le r r
or s whe ne nter
ing ne t
wor ka ddresse
s,
automa te
dr outi
ng i sl esse rror-p
r one . Thus,e venins malli nternets
,a n
automa te
ds ystemisus edt ochanger oute squickl
ya ndr el
iabl
y.
Stat
icVs.Dyna
micI
nte
rior
S
ec.1
4.2 Routes 291

Ne
t1

R1
Ne
t2

R2 R5
Ne
t3

R R
3 4

Ne
t4 Ne
t5

Fi
gur
e14.
2 Thea ddi
ti
on ofr out
e r R5 i
ntroduce
sa nalter
natepath
b
etwee
nne t
wor s2 a
k nd 3.Rout i
ngs of
twar
ec anquic
kly
a
dapttoaf ai
lureanda utomati
call
ys wi
tchroutestothe
a
lte
rna
t epath.

To a ut oma tet he task ofk ee p


ing r out i
ng i nf orma t i
on a c
cur ate,int eri
or
route r
sp e ri
odic ally c ommunic ate wi t
h one a not he
rt o e xchange r out i
ng
informa ti
on.Unl ikee x t
eriorr out erc ommuni cat i
on,f orwhi ch BGP p rovidesa
widelya c
ce pteds t andard,no s i
ng lep rotocolha se mer gedf orus e wi t
hina n
autonomouss yste m oras it
e.Pa r toft her eas onf ordi v ersi
tya risesfrom t he
diversi
tyi na ut onomouss yste
ms .S omea ut ono- mouss ys temsc or r
espond t oa
l
a r
g ee nterprise( e.g.,ac orporation)a tas ing l
es i
te,whi leot hersc orrespondt o
anor gani
za ti
onwi thma nys i
te sc onnectedb yawi dea re ane twor k.Ev eni fwe
consideri ndividua lI nternets i
tes ,t he ne t wor kt op
ol ogies( e.g., degree of
redunda ncy),s ize s,a ndne t
wor kt echnologiesv ar ywi de ly.Anot he rr eas
onf or
diversi
tyofi nte riorr out i
ngp rotoc ol
ss temsf rom t het ra deoffsbe tweene aseof
configuration,f unc tional
ity,andt r a
ffict hep rot ocolsimp oseont heunde rl
ying
networ ks p rot ocolst hataree a
s yt oins tal
la ndc onf i
gur ema ynotp r
ovidet he
funct i
onali
t yne e de dorma yimp osei ntolerablel oadont hene twor ks.Asar esul
t,
aha ndf ulofp rot ocolsha veb e-comep op ular,b utnos ing l
ep r
ot ocolisa lways
optimal.
Althoughmul ti
pl
ei nteri
orp rotocolsa reus e
d,ag ivenaut onomouss ystem
oftenc hoosestol i
mitt henumb erofp rotoc
olst hata redeployed.As mallAS
tendst oc hooseas ingl
ep rotoc
ola ndus eite xcl
usive
lyt op ropaga t
er outi
ng
informationinter
nall
y.Ev enlargera ut onomouss ystemstendt oc hoos eas mall
set.The rea r
et wor easons
.First,oneoft hemos tc omplexas pec
tsofr outi
ng
ari
s e
sf rom theinterac
tionofp roto- c
ols.Ifp rotocolAisus e
dons omer oute
rs
andp rotocolBisusedonot herroute rs,atleastoner outerbetwe ent hetwos e
ts
mustc ommunic
a t
e using bothp rotocol
sa nd must have a wa yt otransfer
i
nformati
on betweent hem.S uchi nte
racti
onsarec omplex,a nd caremustb e
ta
keno rdiff
erencesinp rotoc
olsc anlea
dt oune x
pecte
dc onsequenc
es.Se
c ond,
bec
auserouti
ngp rot
ocolsarediff
iculttounder
standandc onfig
ur e,eac
hauton-
292 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

omoussyst
em musthaveas t
affthatistr
a i
nedtoins
tal
l,confi
gur
e ,andsuppor
t
eac
hi n-
divi
dualprot
ocol
,a swellassoftwarethathandl
esinteract
ionsamong
the
m.Tr ai
ningca
nb ee x
pensi
ve,soli
mit
ingt henumberofp r
otocol
sc anre
duce
cos
ts.
Weus et het e
rmI nteri
orGat ewayPr otocol(IGP)asagener icdesc
r i
ption
tha
tr e
ferstoanyp rotocolthatinteriorrouter
sus ewhent heyexchangerouting
i
nforma ti
on.Figure1 4.
3i l
l
ustr
atest heg e
neralidea:twoa utonomoussyste ms
eac
hus easpeci
ficIGPt opropag
a t
er outinginformati
ona monginter
iorroute rs
.
Thes yst
emsthenus eBGPt osumma rizeinformati
ona ndcommunicateittoot her
autonomoussystems.

Autonomous BGP Autonomous


System1 us
ed System2

IGP1 IGP2
used used
R1 R2

Fi
gur
e14.
3Conc e
ptua
lvie
w oft woa ut
onomoussys
tems
,ea
chusi
ngits
own IGP i
nte
r na
ll
y,a ndthen us
ingBGP t
ocommuni
cat
e
rout
estoanothersys
tem.

Int he figure,IGP1 r e
ferst ot he i
nte r
iorr outing protocolus ed wit
hin
a
utonomouss ystem1 ,a ndIGP2 referstot hep rotocolusedwi thina utonomous
s
ystm 2.Rout
e erR1 wi lluseI GP1 t
oob ta
inr outesinternall
y,s umma ri
zet he
i
nfor
ma t
ion,a p
p l
yp ol
ic
ies,andt henuseBGPt oe xp
ortt her es
ulti
ngi nformati
on.
S
imil
arl
y,r outerR2 willuseI GP2 t
oob ta
ini nformati
ont ha tite xports.Wec an
s
umma r
izet hek e
yc oncept:

I
fmul
ti
pl
er outingpr
otocol
sareused,as inglerout
ermayr
un
t
woormorer outi
ngprot
ocolss
imultaneously.

I
np arti
cul
ar,rout
ersthatrunBGPt oadvert
isereac
ha b
il
ityusua l
l
ya l
sonee
dt o
r
una nIGPt oobtai
ninfor
ma t
ionfromwi t
hintheirautonomouss yst
e m.Thenext
s
ect
ionsdescri
bespeci
fi
cinter
iorgatewayp r
otocol
s;latersec
tionsc onsi
dersome
c
onsequenc
esofusingmulti
pl
ep rot
ocol
s.
Sec
.14.
3 Rout
ingI
nfor
mat
ionPr
otoc
ol(
RIP)
293

1
4.3Rout
ingI
nfor
mat
ionPr
otoc
ol(
RIP)

1
4.3.
1Hi
stor
yofRI
P

TheRout i
ngI nformationProtoc ol(RIP)hasr e
ma inedinwi desp
readus es i
nce
ear
- l
yi ntheI nternet.Origi
nal
ly,RI Pwa sk nownb yt henameofa na pp
licat
ion
thatimple-
me ntsit,routed.Ther outeds oftwarewa sde si
gneda ttheUni versi
ty
of Ca l
i
forniaa t Be rke
leyt op r
ov ide consistent routing information among
machinesonl ocalnetworks.Thep r otocolwa sb asedone arl
ie
rr es
earchdonea t
XeroxCor porati
onsPa l
oAl t
oRe sea rchCe nter( PARC) .TheBe r
keleyv er
s i
onof
RIPg eneral
izedt hePARC v ersi
ont oc ove rmul ti
p l
ef amil
iesofne tworks.RI P
rel
i
e sonp hysi
c a
lne tworkb r
oadcastt oma ker outinge xc
hange squick
ly,a ndwa s
notor i
ginal
lyde si
gnedt ob eus e
donl arge,wi dea reane twor k
s.Ve ndorslater
devel
opedv ers
ionsofRI Psuitab
lef orus eonWANs .

De s
pitemi nori mpr
ov ementsov eritspredece
ssors
,thep op
ulari
tyofRI Pas
anI GPdoe snota risef
r om it
st echni
calmerit
sa l
one.Inst
ead,itistheres
ultof
Berkeley dis
tri-buting routed softwarea l
ong wi t
ht hei
rp opul
ar 4BSD UNIX
syst
e ms.Ma nye arl
yTCP/ IPs i
tesa dopte
da ndinstal
ledRIPwithoutconsi
deri
ng
i
t stechnic
alme ritsorlimi-tati
ons.Onceinstal
l
eda ndrunni
ng,itbecamethebasi
s
forlocalrouting,a ndvendorsb eganofferi
ngp r
oductscompat
ibl
ewi t
hRIP.

1
4.3.
2RI
POp
era
tion

Theunde rl
yingRIPp rotocolisastr
aightf
orwardi
mplementati
onofdi st
ance-
v
ect
orr outi
ngf orloc
alne tworks.RIPsupportstwotyp
eofp ar
tici
pants:acti
ve
nd p
a assi
ve. Activ
ep a
rtici
pantsa dver
tiset hei
rroutest o others;p assi
ve
p
art
ici
p antslis
tent oRI P me ss
agesandus et hemtoup da
tet heirf or
wa rdi
ng
t
abl
e,b utdonota dvert
ise.Onlyar outercanr unRI
Pina cti
vemode ;ifahos t
r
unsRI P,thehos tmustusep assi
vemode.
Arout e rr unningRI Pi na c ti
vemodeb roa dcastsar out ingup da t
eme ss
age
every 30 s econds.The up datec ontainsi nforma ti
on t a k
e nf rom t he routers
currentFI B.Ea chup datec ont ainsas e tofp airs,whe ree achp airsp ecif
iesa nIP
ne t
wor ka ddr essanda nint egerdi stanc etot hatne twor k.RI Pus esahopc ount
met ri
ct ome asuredi s
tance s.I nt heRI Pme tric,ar out erisde finedt ob eonehop
from adi re ctl
yc onne ct
edne twor k,t wohop sf r
om ane twor kt hati sreachabl
e
throughoneot herr outer,a nds oon.Thus ,t henumb erofhopsort hehopc ount
alongap athf rom ag i
vens ourcet oag i
vende s
t i-nationr efer stot henumb erof
ne t
wor kst ha tada tagrame ncount er
sa l
ongt hatp ath.I ts houldb eob viousthat
usinghopc ount stoc a
lcula tes hortestp at hsdoe snota l
wa ysp ro-duc eop ti
ma l
results
.Fore xample,ap athwi thhopc ount3t ha tc rosse
st hreeEt hernetsma y
bes ubstant i
a l
lyf as
t ertha nap athwi t hhopc ount2 t hatc rossest wos atell
i
te
con-nections . To c ompe ns at
e f or di ffer e
nc esi n t echnolog i
es, ma ny RI P
i
mp l
ement ationsa l
-low ma na g
e r
st oc onfigur ea r
t i
ficial
lyhi ghhopc ountswhe n
advertis
ingc onnecti
onst os lowne twor ks.
Bothact
iveandpas
siv
eRIPpar
tic
ipantsl
is
tentoa l
lbroa
dcas
tme ss
agesand
up-
datethei
rf orwa
rdi
ng ta
ble
sa cc
ording t
ot he di
sta
nce-v
ector al
gor
ithm
de
scri
bedi
n
Thena mec omesfrom theUNI
Xconv
enti
onofa t
t a
chi
ng
dtot
hename
sofda
emonproc
esse
s;
iti
sp ronouncedrout
e-d.
Otherr out
ingp r
otocol
sdefi
neadire
ctconne
ctiontobeze
rohop
s;wesa
ythatRI
Pus es1-
ori
gi
nhopc ounts
.
294 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

Chap ter12.Fore xampl


e,i fther oute r
si nt hei ntraneto fFi gure1 4.2onp age
291us eRI P,r outerR1wi l
lb r
oadc a
stame s
sag eonne twor k2t hatc ont ai
nst he
pair( 1
,1 )
,me an-i
ngt hatitcanr eachne twork1a tdis
tance( i
.e.,c ost)1.Rout ers
R2 andR5 wi llrec
eivetheb roadcasta ndinsta l
lar outet one twor k1t hroughR1
(atc ost2) .La te
r,r outersR2 a nd R5 wi l
li ncludet hep a i
r( 1,2)whe nt hey
broadc a
stt he i
rRI Pme ssagesonne t
wor k3.Ev entual
ly,a l
lr outerswi llinstalla
routet one t
wor k1.
RIPsp ecifi
esaf ewr ul
est oimprov eperfor ma nceandr eli
abil
ity.Fore xamp l
e,
oncear oute rlearnsar outef rom a notherr outer,itmus ta pply hys t
eresis
,
me aningt hati tdoe snotr epl
acet her outewi tha ne qualc ostr out e.I nour
examp le,ifr outersR2 andR5 botha dv er
tisene twor k1a tc ost2,r outer sR3 and
R4 wi l
linstallar outet hrought heonet hatha pp e
nst oa dvertisef i
rst .Wec an
summa ri
ze:

Topr eventos
cil
l
ati
onamongequalcos
tpaths
,RIPspec
ifi
esthat
ex-i
stingrout
esshoul
dberet
ainedunti
lanewrout
ehass tr
ict
ly
lowerc os
t.

Whatha ppe
nsi far out e
rf a i
ls(e.
g.,t heroute
rcrashes)?RIPspe
c i
fi
est ha
t
whenar outerr e
ceiv
esa ndi nst a
ll
sar outeinitsforwardingtabl
e,ther oute
r
muststa
r ta time rf ort he e ntry.The t i
meri srese
twhe nev
ert he route
r
re
cei
vesa not
herRI Pme ss
agea d-vert
isingthes a
mer oute.Ther out
eb e
c omes
i
nval
idi
f1 80secondspa s
swi thoutt herouteb ei
ngadve
rtisedagai
n.
RI Pmus tha ndl
et hreek i
ndsofe rror sc ause
db yt heunde rlyi
nga lgorithm.
Firs
t,b eca usethea l
g orithm doe snote x p
li
c i
tlyde tec
tf orwardingl oops,RI Pmus t
ei
the ra s-sumep art
icipantsc anb etrus tedort akep r
e c
a uti
onst op revents uch
l
oop s
.S ec ond,t oprev entins tabi
li
ti
e s
,RI Pmus tus ealowv al
uef ort hema ximum
possi
bledi stance(RIPus es1 6).Thus,f orint ranetsinwhichl egit
ima tehopc ounts
approach1 6,manager smus tdividethei ntrane tintosec
t i
onsorus ea na l
te r
na ti
ve
protocol.Thi rd,thedi s
t a
nc e-vect
ora lgorithm usedb yRI Pc anc reat eap roble
m
known a ss l
ow c onvergenc e orc ountt oi nf i
nityin whic hincons i
stenci
e sa ri
se
becauser out i
ngup dat eme ss a
gesp ropagates lowlya c
rossthene t
wor k.Choos i
nga
smallinfinity(16)help sli
mi ts l
owc onve rgence,b utdoesnote li
mi na t
ei t.

1
4.4S
lowConv
erge
ncePr
obl
em

Forwa r
dingt abl
ei ncons i
stenc i
esa ndthes l
ow c onvergenc
ep roblemarenot
uniquet oRIP.The ya ref unda me ntalprobl
emst hatc a
noc curwit ha nydist
ance-
vectorp r
oto-colinwhic hup da t
eme ssa
g esca
rryonl ypairsofdestinationnetwork
and distancet ot hatne two rk.To unde r
stand the p r
oblem,c onsiderusing a
dis
ta nc
e-vectorprotocolont her outersinFigure1 4.2(page291 ).Tos impl
yt he
examp l
e,wewi l
lonlyc onsidert hreer outer,R1,R2,a
s ndR3,a ndonl yconsi
der
ther outestheyha veforne t
wor k1 .Tor eachne t
wor k1,R3 forwa rdstoR2,a nd
R2 forwardst oR1.Part( a)ofFi gur e14.4ill
us-t
r at
e stheforwarding .

Not
etha
tthehopc
ountus
edi
nRI
Pme
asur
e hes
st panoft
hei
ntr
ane
t t
hel
ong
estdi
sta
nce
b
etwee
nt wo r
outer
s r at
hertha
nt hetota
lnumb
erofne
twor
ksorr
out
ers
.Mos
tcor
por
ate
i
ntr
anetshav
eas p
ant ha
tismuc
hsmall
ertha
n16.
Sec
.14.
4 S
lowConv
erg
enc
ePr
obl
em
295

Ne
twork
R1 R2 R3
1
(
a)

Ne
twork
R1 R2 R3
1
(
b)

Ne
twork
R1 R2 R3
1
(
c)

Fi
gur
e14.
4I l
lust
rati
onoft heslow convergenceprobl
em with(a )t
hree
router
stha tha
vear out
et onetwork1 ,(b
)t heconnecti
on
tonet-work1ha sfai
ledandR1ha sl
ostitsrouter
,a nd(c)a
routi
ng loop caus
edb e
c ause R2 adverti
sesa r outet o
network1.

I np art( a),wea ssumea llr out er sarer unni ngadi stance-ve ctorp rotocol
.We
willa s
s umeRI P,b utt hei deaa pp l
iest oa nyd is
ta nc e
- vectorp r otocol.Rout erR1
hasadi rectc onne ctiont one twor k1 .The ref ore,whe nitb roa dcastst hes etof
destinat ionsf rom i tsFI B,R1 i nc lude sa ne nt ryf orne twor k 1a tdi s
tance1 .
Rout erR2 ha sl ear nedt her out ef rom R1,i ns tall
e dt her outei ni tsf orwarding
table,a nda dver ti
se st her out ea tdi stance2.Fi na ly,R3 ha
l sl earnedt herout e
from R2 a nda dver tis
est her out ea tdi st
anc e3.
I np art( b)oft hef igur e,wea s
s umeaf a il
ur eha soc curreda nddis connected
R1f rom ne t work1 .Pe rha pst hec onne ct
ionb et we enr oute rR1a ndne twor k1wa s
un- p
lug g edorne twor k1l ostp owe r.Thene twor ki nte rf
a ceinR1wi l
lde tectt he
l
ossof c onne ctivity,a nd I P wi llr emov et he r out et o net wor k 1f rom t he
forwa rdi ngt abl
e( orl ea vet hee nt r y,b uts e tt hedi stanc et oinfinitys ot herout e
willnotb eus ed).
Re me mb ert hatR2 b roa dcast si tsr out ingi nf orma tionp e riodica
ll
y.S uppose
thati mme diatelya fterR1 de tectst hef ail
ur ea ndr emov est her outef rom its
table, R2 b r
o ad-ca stsi t sr out i
ng i nforma tion. Among ot he ri tems i nt he
broadc as t,R2 wi l
la nnounc ear out et one twor k1a tdi stance2.Howe v er,unless
thep rot ocoli nc l
ude se xtrame cha -nismst op reventi t,t her ulesf ordi sta
nc e-
vectorr out ingme a nt ha tR1wi lle x aminet heb roa dc astf rom R2,f indar outet o
networ k1 ,a nda ddane wr out et oi tst ab l
ewi thdi s-tance3( thedi sta eR2
nc
adver t
is edp l
us1 )a ndR2 a sthene xthop .
Unf or tuna tel
y,p art( c)oft he f igures howswha tha sha ppene d:R1 ha s
install
edar out ef orne t work1t hatg oest hr oughR2,a ndR2 ha sar outet hat
goest hr oug hR1.Att hisp oint ,ife i
the rR1orR2 r e ceivesada tag ram de sti
nedf or
net
work1,theywil
lroutet
hedat
agr
amb
acka
ndf
ort
hunt
ilt
heda
tag
ram
shop
l
imi
tisre
ached.I
not he
rwords
:
296 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

Ac onventi
onaldis
tance-v
ectoralgor
ithm c
anf or
m arout
ingloop
afteraf ail
ureoccursbecauserouti
nginformati
onthatarouter
sentcanr eachtherouteragain.

The p roblem p e rs
ist
sb eca uset he t wo r outers wil
lc ontinue tor emai
n
confuseda boutr outing.I nthene xtr oundofr out i
nge xchanges,R1wi l
lbroadca
st
ana dv ert
ise-mentt hatincl
ude st hec urrentc ostt or eac
hne t work1 .Whe nit
recei
v esthea dvertise-mentf rom R1,R2 wi lll
ear nthatt hene w dist
ancei s3.R2
update sitsdi s
tancet or ea
c hne twor k1,ma kingt hedi s
tance4.I nt het hi
rd
round,R1r e
c ei
vesar outi
ngup da t
ef rom R2 whichinc l
udestheinc reas
eddi s
tanc
e.
R1wi llincr
ea s
esi t
sdi s
tancet o5a nda dver-t
iset hehi g
he rdis
t anceint henext
update .Thet wo r out e
rsc ont i
nues ending rout i
ng updateme ssagesba ckand
forth,a ndt hedistanc eincr
e asesb y1one ache xchange.Up -
dat esconti
nueunt il
thec ountr eachesinf i
nity(1
6f orRI P).

1
4.5S
olv
ingTheS
lowConv
erge
ncePr
obl
em

At e
chniquek nown a ssplithor i
zon updat e hasbeen i nventedt ha
ta l
lows
dis
tance-
vectorp rot ocol
s,s ucha sRIP,t osolvet hes l
ow c onverge
ncep r
oblem.
Whe nusi
ngs pli
thor izon,ar out e
rdoe snotp rop agat
ei nforma t
ionaboutar oute
backoverthes a mei nterfacef rom whicht her outea rr
ived.I noure xample,spli
t
hori
zonp re
ve ntsr out erR2 f rom adverti
s i
ngar outetone twor k1b acktor outer
R1,soifR1los esc onne cti
v i
tyt one twork1 ,itwi llst
opa dvertisi
ngar out e
.Wi th
spl
ithori
zon,nof or wa rdingloopa p-pearsint hee xamplene twork.Instead,after
af ewr oundsofr outingup dates,a l
lr out
e rswi l
la greet hatt hene tworki s
unreac
hable.Howe v er,t hes pli
thor izonhe uristi
cdoe snotp rev
entf orwa r
ding
l
oopsina l
lpos s
iblet opolog i
esa soneoft heexer ci
sessuggests
.
Anot her wa yt ot hi
nk of t he sl
ow c onv ergenc ep roblem isi nt ermsof
information f l
ow.I far outera dv
ertis
e sas hortr out et os omene t
wor k,all
recei
ving r outersr espond qui cklyt oi nsta l
lt hatr oute .I far outers top
s
adverti
singar oute,thep rotocolmus tde pendonat ime outme chani
smb e
f orei
t
consi
de r
st her outeunr eachab l
e.Onc et het imeoutoc curs,t herout e
rf indsan
alter
na t
iver outea nd s t
a rtsp ropagati
ng t hati nfor ma -tion.Unf ortunate l
y,a
routerc a nnotk now ift hea l
ternater outede pende don t her outet hatj us
t
dis
a p
p e
ar ed.Thus ,ne gativei nformation doe snota lwa ysp r opaga
tequi ck l
y.A
shorte pi
g ramc apt
ur e
st hei deaa nde x
p l
ainst hephe nome non:

I
nr outi
ngpr
otoc
ols
,goodnewst
rav
elsqui
ckl
y;badnewst
rav
els
s
lowly.

Anot
herte
chni
queuse
dtosol
vethes
low c
onv
erg
e nc
eprobl
emempoyshol
l d
down.Holddownf or
cesapa
rti
ci
pat
ingr
outertoignorei
nfor
mat
ionabouta
ne
twor
kforafi
xedpe
riodoft
imefoll
owi
ngre
cei
ptofame
ssa
getha
tcl
ai
mst he
ne
twor
kisun-
reac
habl
e.ForRIP,thehol
ddownperi
odi
ssett
o60s ec
onds,
t
wiceaslongasanor-malupda
tep
eri
od.Thei
deai
stowa
itl
onge
noug
hto
e
nsuret
hatallma
chi
nesre
cei
ve
Sec
.14.
5 S
olv
ingTheS
lowConv
erg
enc
ePr
obl
em
297

thebadne wsa ndnotmi stakenl


ya cc
ep tame ssa
get ha tisoutofdate.Itshould
benot-edt hata llma c
hine
sp a r
tici
p a
tingi naRI Pe xchangeneedtouseidentica
l
noti
onsofhol ddo wn,orf orwardingl oopscanoc c
ur .Thedisadv
anta
geofahol d
downt echni
quei st hatiff or
wa rdingl oop
soccur,t heywi l
lbepres
ervedfort he
durati
on oft hehol ddown p eriod.Mor eimportant,t heholddown technique
pres
ervesa l
lincorrectroutesdur i
ngt hehol ddownp eriod,eve
nwhena l
ternat
ives
exi
st.
Af
ina
lte
chni
quet
hathe
lpss
olv
ethes
low c
onv
erg
enc
epr
obl
emi
sca
ll
ed
poi
son r
ever
se. Onc
eac
onne
cti
on di
sap
pea
rs,t
he r
out
era
dve
rti
si
ng t
he
connectionr et
ainst hee ntryf ors e
veralup datepe r
iods,andi ncl
ude saninfi
nit
e
costrout eini tsb r
oa dc
a st
s.Toma kep oisonr eve
r s
emos te ffecti
v e,i
tmus tbe
combinedwi tht ri
ggeredupdat es.Thet rigg
e re
dup dateme chanismf orce
sar oute
r
tob r
oa dcastroutingi nf
or mationi mme diat
e -l
ya fterrecei
v i
ngb adne ws.Thatis,
therout erdoe snotwa i
tunt i
li t
sne x
tp e
r i
odicbroadcast.Bys endinga nupdat
e
i
mme diat e
ly,ar oute rmi ni
mize st hetimei ti svulner-abl
e( i
.e.,thet i
medur i
ng
whichne ighborsmighta dv er
tises hortr outesb ec
auset heyha venotr e
ceiv
edthe
badne ws )
.
Unfortunately,whi l
et r
iggere
dup da tes
,p oisonre vers
e ,holddown,a ndspl
it
hor-i
zont echniquesa l
lsolvesomep robl
e ms,t heyi nt
r oduceot her
s.Fore xa
mp l
e,
consi
derwha tha ppenswi thtrig
geredup dateswhe nma nyr outersshar
eac ommon
network.As i
ng l
eb roadcas
tma ychangea llthe i
rf orwa r
dingt abl
es,tri
ggeri
nga
newr oundofb r oadcas
t s
.Ift hesecondr oundofb roadcastschangestabl
es,itwil
l
tri
ggere v
enmor eb roadcas
ts.Ab roadc
asta val
a ncheca nr esul
t.
Theuseofb roadcast,p otentialforforwa rdingl oop s
,a ndus eofhol ddown
top rev
entslow conv erge
nc ec anma keRI Pe xtreme lyi neffi
cientinawi dea rea
network.Broa d
casti
nga l
wa yst ak
ess ubst
ant i
alb andwi dth.Ev eni fnoa v al
anche
probl
emsoc c
ur ,havi
nga l
lma chinesbroadcastp eriodic a
llyme ansthatt het raffi
c
incr
easesasthenumb e
rofr outersincrea
ses.Thep ot entialforf orwardi
ngl oops
cana l
sobede adlywhe nlinec apac
ityislimited.Onc el inesb ecomes aturatedb y
l
oop i
ngp a
ckets,itma yb edi ffi
cultori mp ossi
blef orr outerst oe xc
ha nget he
routi
ngme ssagesnee dedt ob reakthec ycl
e.Al so,i nawi dea re
ane twor k,hold
downp eri
odsa resolongt ha tt het i
me r
sus e
db yhi ghe r-levelprotocol
sc a
ne xp
ire
andleadtob rokenconne ctions.

1
4.6RI
PMe
ssa
geFor
mat(
IPv
4)

RIPmessag
esc anbeb roadlyc l
ass
ifi
edintotwot yp
es:routi
nginf
orma t
ion
mes-sa
gesandme ssa
gesus e
dt or equesti
nformat
ion.Bothusethesa
mef ormat,
whichcon-
sis
tsofaf ixedhe aderf ol
l
owedb yanop ti
onalli
stofnetworka nd
dis
tancepai
rs.Fig-
ure14. 5showst heme ss
ageformatus e
dwi t
hRIPv er
sion2
(RIP2)
,thecurrentver
sion.
Inthefi
gure
,fie
ldCOMMANDspec
ifi
esa
noper
ati
on;onl
yfiv
ecomma
ndsa
re
de
-fi
ned.Fi
gur
e14.6li
stst
hecomma
ndsandtheme
ani
ngofeach.
Tohel
pavoi
da na
val
anc
he,RI
Pre
qui
rese
achr
out
ert
owa
itas
mal
lra
ndom t
imeb
efor
ese
ndi
ng
at
rig-g
ere
dupdate.
298 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

0 8 1
6 24 31
COMMAND(
15) VERS
ION(
2) MUS
TBEZERO
FAMI
LYOFNET1 ROUTETAGFORNET1
I
PADDRES
SOFNET1
S
UBNETMAS
KFORNET1
NEXTHOPFORNET1
DI
STANCETONET1
FAMI
LYOFNET2 ROUTETAGFORNET2
I
PADDRES
SOFNET2
S
UBNETMAS
KFORNET2
NEXTHOPFORNET2
DI
STANCETONET2
...

Fi
gur
e14.
5Theformatofa nIPv4vers
ion2RIPme ssa
ge.Aft
ert he32-
b
ithea
der,theme ss
agecontai
nsasequenceofpai
rs,where
e
achpai
rs p
ecifi
esanIPv
4p r
efi
x,ne
x thop,anddi
stanceto
t
hedesti
-nati
on.

Command Meaning
1 Requestforp a
rtialorf ullrout i
ngi nformation
2 Responsecontai
ningne twork- dis
ta ncep ai
rsf r
om
sender
sforwa rdinginforma tionb ase
9 Up
da teRequest(use dwithde ma ndc i
rcuits
)
1
0 Up
da teResponse(usedwi thde mandc ircui
ts)
1
1 Up
da teAcknowledge( usedwi thde ma ndc i
rcuits)

Fi
gur
e14.
6Thec ommandsus
edwithRI
P.I
ntyp
ica
limp
leme
nta
tions
,
onl
yc ommand2isus
ed.

Althoughweha v
ede scri
be dRIPa ssendingr outingup datespe
riodi
cal
l
y,t he
pro-
t ocolincl
ude scomma ndst hatpermi tque ri
est ob es ent.Forexampl
e,ahos t
orrout erc a
ns endar equestc omma ndt or equestr out i
ngi nf
ormati
on.Routers
canus ethe responsec omma ndt or e pl
yt or eque st
s .Inmos tcas
es,ar outer
peri
odi c
all
yb r
oa dcast
suns oli
ci
t e
dr es
p onseme ssag
e s.FieldVERSIONinFigure14.5
containsthep rotocolversi
onnumb er( 2int hiscase),a ndisusedbyt herecei
ver
tover if
yitwi l
linterprett heme ss
agec orrectl
y.
Sec
.14.
7 Fi
el
dsI
nARI
PMe
ssa
ge
299

1
4.7Fi
el
dsI
nARI
PMe
ssa
ge

Bec ausei twa siniti


all
yus edwi t ha ddre s
sesot hert hanI Pv4,RI Pus e
sa1 6-
bitFAMI LYOFNETf i
e l
dt osp e
cifyt het ypeoft hea ddr e
sst hatf ol
l
ows .Values
fort hef iel
dwe readop tedvaluesfr om 4. 3BS DUni x;I Pv4a ddr e
sse
sa rea s
signed
famiy2.Twof
l iel
dsine ache ntrysp ecifya nI Pv4p refi
x :IPADDRESSOFNETand
SUBNETMASKFORNET.Asexpec t
ed,t hema skspec i
fi
eswhi c
hb i
tsint headdr e
ss
correspondt othep refix.TheNEXTHOPFORNETf i
elds peci
fiesthea ddres
sofa
routert ha tist hene xthopf orther oute .Thel astf i
e l
dofe ache nt
r yinaRI P
me s
sage ,DI STANCETONET,c ontainsa ni ntegerc ounto ft hedistancet ot he
speci
fiedne twork.Asdi s-cus
s eda bove ,RI Pus es1 -ori
g i
nr out es
,whi chme ansa
direc
t l
yc onne ct
e dnetwor kisonehopa wa y.Fur thermor e,b ecauseRIPi nt
erprets
16 asi nfinity( i
.e.,nor outee xis
t s),a l
ldi stancesa rel imitedt ot her ange1
through1 6.Sur p r
isi
ngly,thedi s
tancei sa s-signe
da32- bitfiel
d,e ve
nt houghonl y
thelow- orde rfivebitsa r
eus ed.
RIP2a tta
chesa1 6-btROUTETAG FORNET f
i i
el
dt oe ache ntry.Ar outer
musts endthes ametagitr e
ceiveswhenitt rans
mitst her oute.Thus,ther oute
tagp r
ov i
desawa yt opropaga
tea ddi
ti
ona li
nformati
ons uchast heor i
ginoft he
rout
e .Inp ar
ticul
ar,ifRIP2learnsar outefrom anothera utonomouss yst
em,i t
canuset heroutetagt opropa-
gatethea utonomoussys t
e msnumb e
r.
Inadditi
ont ouni cas
tI Pv
4a ddress
e s
,RI Pus esthec onvent
iontha taze ro
addres
s(e .
g.,0.0.0.0),denotesade f
aultr oute.RI Pattachesadista
nc eme t
r i
c
toe ve
ryr outeita dverti
ses,i
ncludingt hede f
a ultroute.Thus,itisp oss
ibl
et o
arra
ng efortwor out e
rstoa dver
tiseade f
aultr oute(e.
g.,ar out
et other es
tof
theinter
ne t)atdifferentme tri
cs,ma kingoneoft he
m ap r
imarypatha ndt he
otheraba c
kup.
Top reventRIPf rom inc
reasi
ngtheCPU l oa dofhostsunne c
ess
ari
ly,the
des
ignersa ll
ow RI P2 to mul t
ica
st update
si nste
ado fbroadca
sti
ng them.
Further
mor e,RIP2isas-si
gnedaf i
xedmult
icasta ddr
ess
,224.0.0.
9,whichmeans
thatma chi
nesus i
ngRIP2donotne edtor unI GMP.Fi na
ll
y,RIP2mul t
ica
stis
res
tric
tedt oas i
nglene
t work.
Notet hataRI P messagedoe snotc ontainane xpl
ic
itl e
ngthf iel
dora n
expl
ici
tc ountofe nt
ries
.I nst
e ad,RI Passumest hatt he underlyi
ng deli
very
mechanis
m willtel
ltherecei
vert helengthofa nincomingme ssa
ge.I nparti
cul
ar,
when used with TCP/I
P,RI P me ss
ag e
sr el
y on UDP t ot e
llthe recei
vert he
messagelength.RIP operate
son UDP p ort 520.Although aRI Pr e
questc an
ori
ginateatot herUDPp orts
,t hede sti
na-
tionUDPp ortf orrequestsisalways
520,asist hesourc
eportf r
omwhi c
hRI Pbroad-cas
tme s
sagesorig
inate.

1
4.8RI
PForI
Pv6(
RIPng)

Itma ys eemthatt heFAMI LYOFNET f iel


di ntheor i
gi
nalde s
ignpermi
ts
ar
bit
rarypr otoc
oladdr
e ss
est ob eused.However,inst
eadofme re
lyusingthe
ex
ist
ingdesi
g n,anewv ersionofRI Pwa scre
atedf orIPv
6.Ca ll
edRIPng,the
newp r
otocolha sane n-tire
ly new messa
gef ormata nd eve
n operate
son a
dif
fer
entUDP porttha
n RI
P(p
ort521a
sop
pos
edt
op t520)
or .Fi
gur
e14.
7
il
l
ustr
ate
stheformat
.

Chap
ter15des
cri
be heI
st nter
netGroupManagementProtocol
.
Thesuf
fixngsta
ndsfor
nextgene
rati
on
;IPv6wa si
niti
all
yna dI
me Png.
300 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

0 8 1
6 31
COMMAND(
1-2) VERS
ION(
1) MUS
TBEZERO
ROUTETABLEENTRY1
(20OCTETS
)
. .
. .
. .
ROUTETABLEENTRYN
(
20OCTETS)

Fi
gur
e14.
7Theover
allfor
matofaRI
Pngme
ssa
geus
edt
oca
rryI
Pv6
r
out
-inginf
ormat
ion.

Li
keRIP2,aRI Pngmess
agedoesnotincl
udeas izefi
el
d,nordoe si
ti ncl
udea
countofi te
mst hatfol
l
ow;ar e
cei
verc omp ut
est henumb erofr out etabl
e
entri
esfrom thesizeofthepac
ket(whichisob tai
nedfrom UDP).Ast hefigur
e
indi
cat
es,eachROUTETABLEENTRY oc cupie
s20oc t
ets(i
.e.
,t hefig
ur eisnot
drawnt osca
le).Fig-
ure14.
8ill
ust
ratesthef ormatofa nindi
vidua
lr outetabl
e
entry.

0 1
6 24 31

I
Pv6PREFI
X

ROUTETAG PREFI
XLENGTH METRI
C

Fi
gur
e14.
8Thefor
matofe
achROUTETABLEENTRYi
naRI
Pngme
s-
s
age

Observantreader
sma yha venotic
edthatRI Pngdoesnotincl
udeaf i
eldthat
stor
est hene xthopf oraroute.Thede s
ignerswe reawarethatincl
udingane xt
hopi ne achr out
et a b
leentry wouldma ket heme ss
agesi
zee x t
reme l
yl ar
ge.
Therefore,theychosea nalter
native
:ar outet ab
leentrywithame t
ricf i
el
dof
0xFFs peci
fiesane x
thopr at
hert hanade s
tinati
on.Thenex thopa ppli
estoa l
l
ther outeta bl
eentri
e stha
tf oll
ow unti
lanotherne x
thope ntryort hee ndof
theme ssa
g e
.
Othe
rt hanthenew me
ssa
g efor
mat
,t heuseofIPv6addr
ess
es,andthe
s
pec
ialpro-
vis
ionforane
xthop,RI
Pngres
emble
sRIP.Mes
sag
esaresti
l
lsentvi
a
UDP,a
nd
S
ec.1
4.8 RI
PForI
Pv6(
RIPng
) 301

RIPngs ti
lltransmi
tsar outi
ngup dat
eevery30s ec
ondsandusesat
imeoutof180
se
c ondsbe f
or econs
ider
ingar outeexpi
red.RIPngals
op r
ese
rvesthetec
hni
ques
ofs pl
ithorizon,poi
sonr e
verse
,a ndtri
ggeredupda
tes.

1
4.9TheDi
sadv
ant
ageOfUs
ingHopCount
s

UsingRI PorRI Pnga sa ninter


iorg at
e wa yprotocolrestri
ctsrouti
ngt oahop
-countme t
ric.Evenint heb estcas
e s
,hopc ountsprov i
deo nl
yac r
udeme a
sur eof
networkc apa
c i
tyorr esp
ons i
veness
.Wek now thatus i
nghopc ountsdoe snot
alwaysyi el
dr outeswithle a
stde l
ayorhi g hestcapacity.Furthermore,c omp uti
ng
routesont heb asi
sofmi ni
mum hopc ount sha sthes everedi s
advant
ag et hatit
ma kesr outi
ng r el
ati
velys tati
cb ecauser outesca nnotr espond toc hang esin
networkl oad.The ref
ore,i tma yseem oddt hatap rotocolwouldb ede si
gne dto
useahop -countme tr
ic.Thene xts ec
-tionsc onsi
de ra na l
ternati
veme t
rica nd
explai
nwhyhopc ountme tricsremainpopula rdespi
tet heirli
mitati
ons.

1
4.1
0De
layMe
tri
c(HELLO)

Alt
houghnow ob sole
te,t heHELLOp r
otocolp r
ov idesa ne xampleofa nIGP
t
hatwa soncede pl
oyedintheI nternetandus esar out i
ngme tri
cotherthanhop
c
ount.Ea ch HELLO messag
ec arr
iedt i
mestampi nforma tion aswe llasrouti
ng
i
nfor
ma ti
on,whi chall
owe dr outersusing HELLO t os ynchroni
ze thei
rc l
ocks
.
I
nteres
tingl
y,HELLOus edt hes ynchr
onize
dc l
ock
st of i
ndt hede l
ayont heli
nk
b
etweene achp ai
rofr outerssot hateachr oute
rc ouldc omp ut
es hor
testdel
ay
p
athstoa l
ldesti
nati
ons.
Theb a
sici de ab ehindHELLO i ss i
mp l
e:us eadi s
t a
nce-vectora lgori
thm t o
pr opa-gater outingi nf orma ti
on.I nsteadofha vingr outersr eportahopc ount,
howe v
e r
,HEL- LO r epor tsa ne sti
ma teoft hede l
ayt ot hede stinati
on.Ha v
ing
sync hronize
dc loc ksa l
-lowsar oute rtoe sti
ma tedelayb yp l
acingat i
me st
ampon
ea chp acket
.Be f ores endingap a
c ket,thes e
nde rpla
ce sthec urrentc l
oc kval
uei n
thep acketasat ime st
a mp ,andt her eceiv
ers ubtr
actst hev a
luef rom thec urrent
clockv al
ue.Ha ving sync hr
onizedc locksa l
lowsde l
ayt ob ec omp uted without
relyingonr ound- tri
ps amp l
es,whi chme anst hede l
a yi nea c
hdi r ec
tionc anb e
est i
ma tedinde pe ndently( i
.e.
,c onge s
tion i
n onedi re ct
ion wi l
lnota ffectt he
est i
ma teddelayi nt heot herdirect
ion).
HELLO us est he st
andard di
stanc e-v
ector a p
p r
oachf or updat
es .Whe na
messagearriv
esf rom mac neX,t
hi her e cei
vere x
a mineseac
he ntryint heme ss
age
andc hangesthene xthopt oXi ft her outet hroughXi slessexpens
ivet ha
nt he
cur
re ntroute( i
.e.
,t hedel
a ytoXp l
ust hedelayf rom Xtot hedesti
nationisles
s
tha
nt hecurrentde l
aytot hedest
ination).
302 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

1
4.1
1De
layMe
tri
cs,Os
cil
la
tion,AndRout
eFl
app
ing

Itma yseemt hatusingde l


aya sar out
ingme t
r i
cwouldp roducebet
ter
routesthanusi
ngahopc ounta ndthatal
lrouti
ngprotocol
sshoul
da dop
tade l
ay
me t
ric
.I nfact,HELLO workedwe l
lint heearl
yInternetb a
ckbone.However
,
therei sanimportantreason why del
ayisnotus eda same tri
ci ncur
rent
protocol
s:i
nst
abil
i
ty.
Eveni ftwop athsha vei de
nt i
ca lc haracteristic
s,a nyp rotocolt hatc hanges
routesquicklyc a
nb ecomeuns t
a bl
e.I nstabi
li
t ya ri
sesb e
causede l
ay,unl ikehop
counts,isnots t
atic.Mi norv aria
tionsi nde layme a s
urement soc c
urb ecauseof
hardwarec l
ockdr i
ft,CPUl oaddur i
ngme asure me nt,orb itdelaysc ausedb ylink-
l
e v
els ynchronizat
ion. Thus ,ifar outing p r otocolr eac
ts qui cklyt os l
ight
dif
ferencesinde l
ay,i tcanp r
oduceat wo- s
tag eos ci
lla
tioneffecti nwhi cht raffi
c
switc
hesb acka ndf orthb etweent hea l
ter-na tep aths.Int hef i
rsts tage,t he
routerfindsthede l
ayonp ath1s l
ightlyl essanda bruptlyswitchestr aff
icont oit.
Int he nex tround,t he r oute
rf indst hatc hanging the loadt op a h 1ha
t s
incr
easedt hede l
aya ndt hatp ath2 now ha ss lightl
yl es
sde lay.S o,t her outer
switc
hest raff
icbackt op ath2a ndt hes i
tuationr epeat
s.
To he lpa void os cil
la
t io
n, p rotocol
st hat use de l
a yi mplement s everal
heuri
s t
ics
.Fi rst
,t heye mp loyt hehol ddown t ec
hniquedi s
cussedp reviousl
yt o
prev
e ntrout esfrom c hangingr api
dly.S ec
ond,inst
eadofme asuri
nga sa ccurate
ly
aspos s
ibl
ea ndc omp ar-i
ngt heva l
uesdirectl
y,thep r
ot ocolsroundme asurements
tolargemul tipl
esori mp le
-me ntami nimum thres
holdbyi gnori
ngdi fferencesle
ss
than t he t hreshold. Thir d,i n-stead of c ompari
ng e ach i ndiv
idua l del
ay
measureme nt,the yk e
e par unninga verageofr ec
entv aluesora lternati
ve l
ya pp
ly
a K-out -
of -Nr ulet hatr equi
r e
sa tl eat K of t
s he mos tr ecent N de l
ay
measureme ntsbel essthant hec urrentde l
ayb e
forether outec anbec hang e
d.

Ev en withhe uri
sti
cs,p rotocolst hatus ede layc anb ec
omeuns tabl
ewhe n
comp ar-i
ng de l
ays on p aths t hat do not ha vei dent i
calc har
a c
teris
tics. To
unde r
st a
ndwhy,i tisnecessaryt ok now t hatt r
afficcanha veadr amaticeffect
onde lay.Wi thnot raffi
c,t hene twor kde l
ayi ssi
mp lyt het i
mer equire
df ort he
hardwa ret otransferbit
sf rom onep oi
ntt oanother.Ast het raffi
cloadi mposed
ont hene t
worki ncr
eases,de l
aysb e
gint orisebecauserout ersinthes ystem need
toe nque uepacketsthata r
ewa i
t i
ngf ort ransmis-
sion.Ift heloadise vens l
i
ght l
y
mor et han100%oft hene t
wor kc apacity,theque ueb ecome sunbounded,me aning
thatt hee ffe
cti
v edela
yb ecome sinfi
ni t
e .Tos umma ri
ze:

Theeffec
tiv
edelayac
ros
sanetwor
kdependsontraf
fic
;asthe
l
oadapproaches1
00%ofthenet
workc
apacit
y,del
aygrows
rapi
dl
y.

Be
caus
ede
laysa
ree
xtreme
lysens
iti
vet
ochang
esinl oa
d,prot
ocol
sthatus
e
de
layasametricc
aneas
il
yf al
li o ap
nt osi
ti
vefeedbackcyc
le.Thec yc
lei
s
tr
igge
r edbyas mal
lexter
nalc
hangeinl
oad(e.
g.,onec
ompute
rinje
cti
ngab urst
ofadditi
onaltraf
fic
).Theincre
asedtr
affi
crais
esthedel
ay,whic
hc aus
est he
pr
otocoltochangeroutes
.How-eve
r,bec
ausearoutec
hangeaff
ect
stheload,it
ca
np roduceanevenlar
gercha
ngein
S
ec.1
4.1
1 De
layMe
tri
cs,Os
cil
l
ati
on,AndRout
eFl
app
ing 303

de
lays
,whi c
h meansthe p
rotoc
olwil
la g
ainre
comput
er outes
.Asa re
sul
t,
pr
otocol
sthatus
edel
aymustcontai
nmecha
nis
mstoda
mp enos
cil
l
ation.
Wede scribedhe ur i
stic
st ha tc ans olves i
mp lec asesofr outeos cil
lationwhe n
pathsha vei denti
c a
lt hroug hputc ha racterist
icsa ndt hel oa di snote xcessive.The
heuris
ticsca nb ecomei ne ffecti
ve,howe v er,whe na l
ter nativep a
thsha vedi fferent
del
a ya ndt hroug hputc haracteris
t i
c s
.Asa ne xamp l
ec onside rt hede layont wo
paths:oneov eras atell
itea ndt heot herov eral ow- ca pacitydi gitalcircuit( e.g.
,
af racti
ona lT1c ircuit).I nt hef i
r sts tageoft hep r
ot oc olwhe nb othp athsa re
idl
e,t hedi g i
talc i
rcuitwi l
la p p
ea rt oha ves igni fi
cant l
yl owe rde l
ayt ha nt he
satel
li
te,a ndwi l
lb ec hosenf ort ra ffic
.Be -
caus et hec ircuitha sl ow c apa c
ity,it
wil
lqui ckl
yb e c
omeov erl
oa ded,a ndt hede l
aywi l
lr is es ha rp
ly.I nt hes econd
stage,thede l
ayo nt hec i
rcuitwi llb emuc hgr eate rtha nt ha toft hes ate ll
ite,so
thep rotocolwi l
ls witcht r affi
ca wayf rom t heov erloade dp ath.Be -ca uset he
satel
li
tep athha slargec a
pa ci
ty,t ra f
f i
cwhi chov erloade dt hes eriall
inedoe snot
imposeas ignificantloa dont hes at el
lit
e ,me aningt hatt hede l
ayont hes atel
li
te
pathdoe snotc hang ewi tht raffic
.I nt hene xtr ound,t hede layont heunl oaded
dig
italc i
rcuitwi llonc ea ga i
na p
pe art ob emuc hs mallert hant hede layont he
satel
li
tep ath.Thep rotocolwi llrev erset her outing ,a ndt hec yc lewillc ont i
nue.
Wes ayt hatt her out esf l
apbac ka ndf orth.S uchos cil
lationsdo,i nf act,oc curin
practi
ce.Ast hee x a
mp les hows ,t heya redi f
f i
c ultt oma nageb ec
aus et raffi
c
whichha slittl
ee ffectononene t-wor kc anov erloa da not her .Thep oi
nti s:

Alt
houghintui
ti
ons ugges
tsthatrout
ingshoul
dus
epathswith
l
owest del
ay,doing so makes r
outi
ng s
ubjec
tto os
cil
l
ati
ons
knownasroutefl
apping.

1
4.1
2TheOp
enS
PFPr
otoc
ol(
OSPF)

InCha pt
e r12,wes a
idthatali
nk-s
tateappr
oacht or outing,whiche mpl
oys
a
nS PFg r
apha lgor
ithm tocomput
eshortes
tp a
ths
,s ca
lesbe tt
e rthanadi sta
nce-
v
ectoralgo-
rithm.Toe ncourag
etheadopti
onoflink-s
tatet echnology,awor ki
ng
g
roupoft heI ETFde s
ignedanint
eri
orgatewayprotocolthatus est heli
nk-st
ate
a
lgori
thm.Na medOp enSPF(OSPF)
,theprotoc
oltack
lesseverala mbit
iousgoal
s.

Open St
andar
d.Ast
he na
me i
mpl
i
es,t
he s
pec
ifi
cat
ion i
sav
ail
abl
eint
he
publ
is
hedl
iter
ature.Maki
ngitanopensta
ndardthatanyonecanimple
ment
wit
houtpa
yingli
censef
eesha
sencour
age
dma nyve
ndorstosupp
ortOSPF.

Type OfSer
vic
e Rout
ing.Manager
sca
nins
tal
lmul
ti
pl
erout
est
oag
ive
n
dest
ina-t
ion,oneforeachp r
ior
ityortypeofser
vic
e.Ar out
err
unni
ngOSPF
can useb ot
ht hedes
tina
tion addr
essandtyp
eofs e
rvi
cewhenchoos
inga
route.

LoadBal
anc
ing.I
fama
nag
ers
pec
ifi
esmul
ti
pl
erout
est
oag
ive
nde
sti
nat
iona
t
t
hes
amec
ost
,OS
PFdi
str
ibut
est
raf
ficov
era
llr
out
ese
qua
ll
y.
304 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

Hi
erar
chi
calSubdi
vi
si
onI
ntoAr
eas
.Toha
ndl
ela
rgei
ntr
ane
tsa
ndl
i
mitr
out
ing
overhead,OSPFa llowsas i
tetop a
rtiti
onitsnetwor k
sa ndr outersint
os ubs
ets
cal
leda reas.Ea c
ha re
ai sself-c
ontaine
d;k nowl edge ofa na rea
st opol
ogy
remainshiddenf rom ot herare
as.Thus,mul t
ipl
eg roupswi thi
nag i
vensitecan
cooperateint heus eofOS PFforr outi
nge ve
nt houg he a
chg roupr et
ainsthe
abil
i
t ytoc ha
ng eit sint
e r
nalnetworktopolog
yi ndep endentl
y.

SupportForAuthenti
cat
ion.OSPFall
owsa
llex
c hang
esb e
tweenr
out
e r
stobe
au-thent
icat
ed.OSPFsuppor
tsav a
riet
yofauthenti
cat
ionsc
heme
s,andal
l
ows
onea
reat
ocho
oseadi
ffe
rents
che
met
hana
not
hera
rea
.

Ar
bit
rar
yGr
anul
ari
ty.OSPFi
ncl
ude
ssup
por
tforhos
t-s
pec
ifi
c,s
ubne
t-s
pec
ifi
c,
ne
twor
k-s
pec
ifi
c,a
ndde
faul
trout
es.

Suppor
t For Mul
ti
-Ac
ces
s Net
wor
ks. To a
ccommoda
te ne
twor
kss
ucha
s
Ethernet,OS
PFe xtendstheS PFalgor it
hm.Nor ma ll
y,SPFrequir
e se achp ai
rof
routerst obroadcastme ssagesa boutt helinkb etweent he
m.I fK r outers
2
attac
ht oa nEt hernet,theywi llb roadcastK s ta
tusme s
sages.I nstea
dofa
grapht hat usesp oint-
t o-poi
nt c onne ct
ions, OSPF reducesb roadcastsb y
all
owingamor ec omp l
exg ra
pht opolog yinwhi che ac
hnoder epr
ese ntseithera
routerorane twork .A desi
gnatedgat eway( i.e
.,ade s
ignatedr outer)s ends
l
ink-sta
tusme ss
ag e
sonb e hal
fofa llr outersattachedtothene t
wor k
.

Mul
ti
cas
tDel
i
ver
y.Tor
educ
ethel
oadonnonp
art
ici
pat
ings
yst
ems
,OS
PFus
es
har
dwa re mul
tica
stc a
pabi
li
ti
es, wher
et heye xi
st,t o del
iverli
nk-st
atus
messages
.OSPFs endsme s
sagesviaIPmult i
cas
t,anda l
lowst heIPmultica
st
mechanis
m to ma pt he mult
ica
stintot he underl
ying net
wor k;two IPv4
multi
castaddr
essesa repreas
sig
nedt o OSPF 224.
0.0.5f ora l
lroute
rsa nd
224.0.0.
6forallnodes.

Vi
rtualTopol
ogy.A manager c
anc
rea
teav
irt
ualne
twor
ktop
olog
y.For
e
xampl
e,ama na
gerc anconfi
gureav ir
tua lli
nkb et
we entworoute
rsinthe
r
outi
ng gra
phe ve
ni ft he phys
ica
lc onne c
tion bet
we enthe two r
out
ers
r
equi
resc
ommunicat
ionac
r os
smul-ti
pletransi
tne t
wor ks
.

Rout
eImpor
tat
ion.OSPF c
ani
mpor
tand di
sse
mina
ter
out
ing i
nfor
mat
ion
l
earnedfrom e xt
ernalsi
tes(i.
e .
,from rout
e r
st ha
td onotuseOSPF)
.OSPF
messa
gesdis
tin-guis
hb et
wee ninfor
mati
ona cquir
edf r
om e
xte
rnals
ource
sand
i
nformati
onac qui
redfromr out
e rsi
nte
riortot hesi
te.

Di
rectUse OfIP.Unl i
ke RIPa nd RI
Png,OSPF mess
agesareencaps
ula
ted
di
rec
tlyi
nIPda t
a g
r a
ms.Thevalue89isusedinthePROTOfi
el
d(IPv4)orthe
NEXTHOPfiel
d(IPv6)inthehea
de rtoi
dent
ifythedat
agra
miscar
r yi
ngOSPF.
S
ec.1
4.1
3 OS
PFv
2Me
ssa
geFor
mat
s(I
Pv4) 305

1
4.1
3OS
PFv
2Me
ssa
geFor
mat
s(I
Pv4)

Cur r
ently,t hes tandardv ers
ionofOSPFi svers
ion2.Versi
on2wa screated
forI Pv4a ndc annotha ndl
eI Pv6.Unl
ikeRIP,whe r
et heIETFchosetoc
reatea n
entir
e l
yne wp rotocolf orI Pv6,a nIETFwor ki
ngg rouphaspropos
edthatt he
changesinOS PFv2f orI Pv6me r
elybeincorpor
atedi nanewv e
rsi
onofOS PF,
versi
on3.Wewi llfi
r ste xaminetheversi
on2me ss
agef o
rmatsusedwi
thI Pv4,
andt henc onsi
de rthev er-si
on3me s
sageformatsusedwithIPv6.Todi
sti
nguish
betwe enthem,wewi llwr i
te
OSPFv 2andOSPFv 3.
Ea
ch OSPFv2 mes
sag
ebe
ginswi
th af
ixe
d,24-
oct
ethe
ade
r.Fi
gur
e14.
9
i
l
lus
tra
testheformat
.

0 8 1
6 24 31
VERS
ION(
2) TYPE MES
SAGELENGTH
S
OURCEROUTERI
PADDRES
S
AREAI
D
CHECKS
UM AUTHENTI
CATI
ONTYPE
AUTHENTI
CATI
ON(
oct
ets03)
AUTHENTI
CATI
ON(
oct
ets47)

Fi
gur
e14.
9Thef
ixe
d24-
oct
etOS
PFv
2he
ade
rtha
tap
pea
rsi
nea
chme
ssa
ge.

FiedVERS
l I
ONspe
cif
iest
hevers
ionoft
heprotoc s2.Fi
ola e
ldTYPEi
dent
ifi
es
t
heme ssag
etypea
soneoft hef
oll
owingt
ype
s( whi
charee
xpl
aine
dinthenext
s
ec-
tions)
:

Type Meaning
1 Hel
lo(usedt
ot estreachabi
li
ty)
2 Data
basedes
c r
ipti
on( top
ology)
3 Li
nk-sta
tusrequest
4 Li
nk-sta
tusupdate
5 Li
nk-sta
tusacknowledgement

The fieldlabeldS
e OURCE ROUTER IP ADDRESS givest he addres
soft he
s
ender,andt hef iel
dlabel
edAREAI D gi
vest he32-bi
ti denti
fic
ati
onnumb erof
t
hea rea
.Byc onventi
on,Area0ist hebackbonearea
.Be c
ausee ac
hme ssa
gecan
i
ncl
ude a uthenti
ca-ti
on, fie
ld AUTHENTI CATI
ON TYPE s peci
fi
es which
a
uthenti
cations c
hemei sused(e.
g.,0 me ansnoa uthentica
tiona nd 1meansa
s
impl
ep ass
wor disused).
306 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

1
4.1
3.1OS
PFv
2He
ll
oMe
ssa
geFor
mat

OSPFv 2s endshe ll
omes sagesone ac
hl i
nkp eri
odical
lytoe st
abli
sha ndt es
t
neigh-borr eachabi
lit
y.Fi gure1 4.10s howst heme ss
agef ormat.Fi edNETWORK
l
MASKc ont ai
nsa na ddressma skf orthene tworkov erwhicht heme ssageha sbeen
sent.Fi e
ld ROUTER DEAD I NTERVAL gi vesa t i
me ins econdsa ft
e r whi cha
nonr espondingne ighborisc onsi
de redde ad.Fie dHELLOI
l NTERVALi st henor ma l
period,i ns econds,b etween he ll
o me ss
a ges
.Fi ed GWAY PRI
l Oi st he int e
ger
priorit
yoft hisrouter,a ndisus edins ele
c t
ingab ac
kupde sig
na t
e dr out er.The
fi
e l
dsl abeldDES
e IG-NATEDROUTERandBACKUPDESI GNATEDROUTERc ontainIP
addr es
se st hatg i
vet he s e
nder sv i
ew of t he desi
gnatedr outera nd b ackup
designatedr out erfort hene t-
wor kov erwhi cht heme ss
ageiss ent.Fina ll
y,f i
el
ds
l
a beledNEI GHBORI PADDRESSgi vet heI Pa ddresse
sofa l
lne i
ghborsf r om which
thes ende rha srecentlyreceiv
edhe l
lome ssages.

0 8 1
6 24 31

OS
PFHEADERWI
THTYPE=1

NETWORKMAS
K
HELLOI
NTERVAL OPTI
ONS GWAYPRI
O
ROUTERDEADI
NTERVAL
DES
IGNATEDROUTER
BACKUPDES
IGNATEDROUTER
NEI
GHBOR1I
PADDRES
S
NEI
GHBOR2 I
PADDRES
S
...
NEI
GHBORn I
PADDRES
S

Fi
gur
e14.
10TheOSPFv2hell
omessag
efor
mat.Apai
rofnei
ghb
or
router
se xc
hangeshe
ll
omess
age
sper
iodi
cal
l
ytotest
reac
habil
i
ty.

1
4.1
3.2OS
PFv
2Da
tab
aseDe
scr
ipt
ionMe
ssa
geFor
mat

Routersexc ha
ng eOSPFv2databasedescr
ipt
ionmess
agestoi
nit
ial
izet hei
rnet
-workt opolog
yda t
a ba
se.Inthee xchange,onerout
ers e
rvesa
sama s
ter,whil
e
theot herisas la
ve .Theslaveacknowledgeseac
hda t
abasede
scri
ptionme ssa
ge
wit
har esponse.Figure14.
11showst heformat.
S
ec.1
4.1
3 OS
PFv
2Me
ssa
geFor
mat
s(I
Pv4) 307

Becauseitc anb elarge


,at opol
ogyda taba
sema ybedivi
dedintomultipl
eme s
-s
agesusingt heIa ndM b its.BitIissett o1i ntheini
tia
lmessage;btM i
i sset
to1ifadditi
ona lmessa
g esfoll
ow.BitSi ndic
ateswhetherame s
sagewasse ntbya
mast
er( 1)or b yas l
ave( 0).Field DATABASE SEQUENCE NUMBER number s
mess
agess equen-tia
ll
ys ot he recei
verc ant el
lifone i smissi
ng.The i ni
ti
al
mess
agec onta i
nsar andom integer R;s ubs
equentme ss
agescontai
ns equenti
al
i
nteger
ss ta
r t
inga tR.
FiedI
l NTERFACEMTUgi vest
hes izeofthelar
g es
tI Pdatagr
amt ha
tcanbe
t
ransmitt
edov ertheinter
facewithoutf r
agment
ation.Thef i
el
dsfrom LSAGE
t
hroughLSLENGTHde s c
ribeoneli
nkint henet
wor ktopol
ogy;theya
r erep
eat
ed
f
ore ac
hl i
nk.

0 8 1
6 24 29 31

OS
PFHEADERWI
THTYPE=2

I
NTERFACEMTU OPTI
ONS Al
l0
s IM S
DATABAS
ESEQUENCENUMBER
LSAGE LSOPTI
ONS LSTYPE
LI
NKI
D
ADVERTI
SINGROUTER
LI
NKS
EQUENCENUMBER
LI
NKCHECKS
UM LSLENGTH
...

Fi
gur
e14.
11OS 2da
PFv tabas
edes
cri
pti
onmessa
geforma
t.Thefie
lds
s
tarti
nga tLSAGEarerepe
ate
df ore
achli
nkbei
ng
s
peci
fied
.

Fi
eldLSTYPEde
scr
ibe
sthet
ypeofal
i
nk.Thep
oss
ibl
eva
lue
sar
egi
venb
ythef
ol
-l
owingta
ble
.

LSTyp
eMe
ani
ng1Rout
erl
ink

2 Networkli
nk
3 Summa r
ylink(
IPnetwork)
4 Summa r
ylink(
linkt
ob or
derrouter
)
5 Exter
nalli
nk(l
inktoanothe
rsite
)

Fi
edLI
l NKI
Dgi
vesa
nide
nti
fi
cat
ionf
ort
hel
i
nk(
whi
chc
anb
etheI
Paddr
essofa
r
out
erorane
twor
k,de
pendi
ngont
hel
i
nkt
ype
).
308 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

Fie
ldLSAGEhe l
psorderme ssa
g es itgivesthetimeins ec
ondss incethe
l
ink wa se s
t a
bli
shed.Field ADVERTISING ROUTER spec
ifi
e sthea ddres
soft he
routera d-verti
si
ngt hisli
nk,a ndLI NKSEQUENCENUMBER c onta
insa ni nte
ger
generatedb ythatr outertoe ns
uret hatmess
ag e
sa r
enotmi sse
dorr e
ceivedout
of order . Fi
eld LINK CHECKSUM pr ovi
desf urthe
ra ssura
ncet ha
tt he li
nk
infor
ma ti
onha snotb eencorrupt-e
d.

1
4.1
3.3OS
PFv
2Li
nk-
Sta
tusRe
que
stMe
ssa
geFor
mat

Aft
ere xchangingda t abasedescri
pti
onme s
sageswi thaneighbor,ar out erhas
ani nit
ialdescripti
onoft hene twork.Howe ver
,ar outermaydi s
c ove
rt hatp a
rts
ofi tsda ta-
bas eareoutofda te.Tor e ques
tt ha tthene i
ghbors uppl
yup dated
information,t her out
e rs endsal i
nk-s
t atusr equestmessage.Theme s sa
g elis
ts
specifi
cl i
nksf orwhi chi nforma ti
on isne e
ded,a sshown in Fi
g ure1 4.12.The
neighborr es
pondswi tht hemos tc urre
nti nf
orma ti
oni thasaboutt helinksint he
reque s
tme s
sage.Thet hr eef i
el
dss howni nthef igurearerepeate dfore achlink
aboutwhi chs tatusisre que s
ted.Mor et ha noner equestmessagema yb ene ededif
thel i
stofr eque s
tsislong .

0 1
6 31

OS
PFHEADERWI
THTYPE=3

LSTYPE
LI
NKI
D
ADVERTI
SINGROUTER
...

Fi
gur
e14.
12OS 2l
PFv i
nk-s
tatusrequestmes
sagefor
mat.Aroute
rsends
theme s
sagetoane ighbortoreque
stcur
renti
nforma
tion
aboutaspeci
ficse
tofl i
nks.

1
4.1
3.4OS
PFv
2Li
nk-
Sta
tusUp
dat
eMe
ssa
geFor
mat

BecauseOSPFusesali
nk -
statealgor
ithm,r outer
smus tp e
riodic
all
ybroadcas
t
mes-sage
st hatspeci
fythes t
atusofdi rect
ly-connect
edl inks.Todos o,routers
useat yp e4 OSPFv2me s
saget hatisna medal i
nk-statusupdat e.Eachup dat
e
message consi
sts of a c ount of a dvertis
eme nt
sf o l
lowed b y a l i
st of
adve
r t
ise
me nts
.Figure1
4.13showst heforma toflink-s
t a
t usupdateme ss
ages.
Inthe fi
gur
e,eahl
c i
nk-s
tat
usadver
tis
ement (LSA)hasa for
ma tthat
s
pec
ifi
esi
nfor
-mati
ona
boutthenetwor
kbei
nga dv
ert
ised.Fi
gur
e14.
14showsthe
f
orma
toftheli
nk-s
tat
usa dv
erti
seme
nt.Thev
alue
sus
edi
nea
chf
iel
dar
ethe
s
ameasi
ntheda
tab
asedes
crip
tionmes
sag
e.
S
ec.1
4.1
3 OS
PFv
2Me
ssa
geFor
mat
s(I
Pv4) 309

0 1
6 31

OS
PFHEADERWI
THTYPE=4

NUMBEROFLI
NKS
TATUSADVERTI
SEMENTS

LI
NKS
TATUSADVERTI
SEMENT1

...

LI
NKS
TATUSADVERTI
SEMENTn

Fi
gur
e14.
13OSPFv2li
nk-st
atusupdat
emes s
ageformat
.Ar oute
rs ends
suchame ss
aget obr
oadcas
tinfor
ma t
ionaboutitsdir
ectly
con-nec
tedli
nkstoallot
herrouter
s.

0 1
6 31
LSAGE LSTYPE
LI
NKI
D
ADVERTI
SINGROUTER
LI
NKS
EQUENCENUMBER
LI
NKCHECKS
UM LSLENGTH

Fi
gur
e14.
14Theformatofa
nOS PFv2l
i
nk-
stat
usadv
ert
isementus
edi
n
alink
-sta
tusmess
age.

Fol
lowing t he li
nk- statushe aderc omesone of f our possibl
ef or matst o
desc
ribet helink sfrom ar outert oag iv
ena rea,t
hel inksf r
om ar outert oa
spec
ifi
cne twor k,thel i
nk sfromar outertot hephys
icalnetworkst hatc onst
itute
asingle,subnet tedI Pne t-work( seeCha pte
r5) ,orthel inksf rom ar outert o
networksa tot hers i
tes.I na l
lc a
ses,theLSTYPEf i
eldi nt heli
nk -s
tatushe ader
spec
ifi
eswhi choft hef orma tshasb ee
nus ed.Thus,arout erthatr eceiv
e salink-
sta
tusup dateme ss
a gek nowse xactl
ywhi choft hedes
cribedde s
tinati
onsl iei
nside
thesiteandwhi cha r
ee x te
rna l
.
31
0 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

1
4.1
4Cha
nge
sInOS
PFv
3ToS
upp
ortI
Pv6

Althoug ht heb a si
csofOS PFr e maint hes amei nv er s
ion3,ma nyde tail
sha ve
changed.Thep rotoc olstil
luse sthel i
nk-statea pp roach.Al la ddressi
ngha sb een
re-move df rom t heb asi
cp rotocol,ma ki
ngi tp rot ocol-inde pendente x
ce ptf orI P
addressesi nlink -statusa dvertis
eme nts.Inp arti
c ular,OS PFv 2us eda32- bi
tI P
addresst oi de nti
f yar out er;OS PFv 3us esa32- btr
i out erI D.Si milar l
y,a rea
identi
fi
e rsr ema i
na t32b it
s,b uta renotr ela
tedt oI Pv 4a ddr ess
e s(event hough
dottedde cima lisus edt oe xpresst hem) .OSPFv 3honor sI Pv 6r outings copes:l i
nk-
l
oca l
,a rea-wide ,a ndAS -wide,me an-ingt ha tbr oadc astswi llnotb ep r
op agated
beyondt hei nt e
nde ds etofr eci
pient s.OS PFv3a ll
owsi nde pendenti ns tancesof
OSPFt or unonas e tofr oute r
sa ndne twor ksa tt hes amet i
me .Ea chi nstance
hasauni queI D,a ndp a c
ke t
sc arr yt hei nstanceI D.Fore xamp l
e ,itwoul db e
possi
blet oha vea ni nstancep ropaga ti
ngI Pv 6rout ingi nfor -ma ti
onwhi lea nother
ins
t a
ncep r
op agat e
s MPLS r outing i nforma ti
on. Fi nall
y, OS PFv3r emov esa l
l
authentication f rom i ndivi
dualme ss
ag es
,a nd inst e
a d,r e li
eson t he I Pv6a u-
thentic
a t
ionhe ader.
Themos tsigni
fi
cantc hang ebetwee nOSPFv2a ndOS PFv3a ri
sesfrom theme s
-sa
gef ormats,whicha l
lchang e.The r
ea retwomot i
vations.Fir
st,me ssa
gesmus t
bec hangedt oaccommodat eI Pv6a ddress
es.Second,b ecauseIPv6a ddress
esa re
muchl arger
,t hedesigner
sd eci
dedt hatme rel
yr epl
acinge achoc cur
renceofa n
IPv4a ddres
swi tha nI Pv
6a ddresswoul dma keme ssagest oolarge.The ref
ore,
whenev e
rp ossi
bl
e,OS PFv3mi nimizest henumberofI Pv 6a ddre
ssescarrie
di na
messagea ndsubsti
tutes32- bi
ti dentif
iersforanyi dent i
fi
ert hatdoe snotne e
d
tobea nI Pv6addres
s.

1
4.1
4.1OS
PFv
3Me
ssa
geFor
mat
s

Ea
chOSPFv
3me s
sag
ebe
ginswi
thaf
ixe
d,1
6-oc
tethe
ade
r.Fi
gur
e14.
15i
l
lus
-
t
rat
esthef
ormat.

0 8 1
6 24 31
VERS
ION(
3) TYPE MES
SAGELENGTH
S
OURCEROUTERI
D
AREAI
D
CHECKS
UM I
NSTANCEI
D 0

Fi
gur
e14.
15Thefi
xed1
6-oc
tetOS
PFv
3he
ade
rtha
tap
pea
rsi
nea
chme
s-
s
age
.

Notetha
tt heve
rsi
onnumbe
roccup
iesthefi
rstoct
et,e
xact
lyasi
nOS PFv2.
The
refor
e,OSPFv3mess
age
scanbes
entusingthesameNEXTHEADERval
uea s
Unf
ortuna
tely,theter
minol
ogyhasbecomesomewhatambiguousbec
aus
eIPv6use
sthetermlink
i
nplaeofI
c Psubnet( t
op e
rmitmult
ipl
eI Pv6prefi
xestobea s
signe
dt oagiv
ennetwor
k).Inmos t
c
ase
s,theIPv6concep
ta ndOSPFv
3concep
ta li
gn,butthedi
sti
ncti
onc anbei
mport
anti
nspeci
alca
se s
.
S
ec.1
4.1
4 Cha
nge
sInOS
PFv
3ToS
upp
ortI
Pv6 31
1

OS
PFv
2withnoambi
gui
ty.Als
onot ethatthefixe
dheade
ri ss
mal
lert
hant
he
OS
PFv
2he
aderbe
caus
eauthe
ntica
tioni
nformat
ionhasb
eenremov
ed.

1
4.1
4.2OS
PFv
3He
ll
oMe
ssa
geFor
mat

The OS 3 he
PFv l
lo message hel
psill
ustra
tet he bas
icc hangef rom IPv4
a
ddres
singto32-bitident
ifie
rs.Theg oalistok eepthep ac
ke tsi
zes mallwhil
e
s
epa
ratingthep r
o-tocolfrom IPv4.AsFi g
ure1 4.16il
l
ustrates,rea
der sshoul
d
c
omparetheversi
on3f or-
ma ttot hever
sion2f ormatshownonp a
ge306.

0 8 1
6 24 31

OS
PFv
3HEADERWI
THTYPE=1

I
NTERFACEI
D
ROUTERPRI
O OPTI
ONS
HELLOI
NTERVAL ROUTERDEADI
NTERVAL
DES
IGNATEDROUTERI
D
BACKUPDES
IGNATEDROUTERI
D

NEI
GHBOR1I
D
NEI
GHBOR2 I
D
...
NEI
GHBORn I
D

Fi
gur
e14.
16TheOS
PFv3hel
l
omessageformat.Al
lIPv
4addr
ess
esha
ve
b
eenrep
lac
edby32-
bitident
ifi
ers
.

1
4.1
4.3Ot
herOS
PFv
3Fe
atur
esAndMe
ssa
ges

OS
PFv 3comb i
nesa ndg enerali
zesma nyoft hefa c
il
iti
esa ndf ea turesthat
havebeende f
inedforOS PFv 2.Cons equentl
y,OS PFv3de fi
nesseveralt ypesoflink
-sta
tusa dver
tis
eme nt( LSA).Fore xampl
e,OS PFv3s upport
sr out e
rLS As,link
LSAs,i
nte r
-areap r
e f
ixLS As ,inter-arearout e
rLS As
,AS -externalLS Aa,intra-
areapref
ixLS As
,a ndNotS oSt ubbyAr ea(NSSA)LSAs .Ea c
hl i
nk -
stat usme s
sage
begi
nswithahe adert hati st hes amea stheOS PFv2he aderill
ustratedi nFigure
14.1
4onp age309,a ndus est het ypefiel
dt oidentif
yt her e
ma i
ningc ont e
nts.
Thep ointofpr
ovi
dingmul
tipl
eLSAt
ypesist
os up
por
tlargeaut
onomous
sys
temst hathaveacomple
xtop
ologya
ndcomp
lexr
ule
sforare
as.Inpar
tic
ula
r,
Tie
r-1provid-
31
2 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

er
suseOSPFasanIGPacr
ossani
ntr
anett
hati
ncl
ude
sab
ack
bone
,ma
nyr
egi
ona
l
net
-wor
ks,andmanyat
tache
dnet
works
.

1
4.1
5IS
-ISRout
ePr
opa
gat
ionPr
otoc
ol

Aboutt hes a
met i
met heI ETFde fi
nedOS PF,Digi
talEqui pmentCorporation
devel
opeda ninteri
orroutep ropagat
ionp rotocolnamedIS-IS.I S-
ISwa spartof
Dig
ital
sDECne tPhaseVpr ot ocolsui
te,a ndwa slat
erstandardizedbyISOi n1992
forusei nt henow- defunctOS Iprotocol
s.Thena mee xp
a ndst oIntermediate
Syst
em -I n-termedi
ateSys tem,andi sequiv
a l
enttoourde finiti
onofanI nterior
GatewayPr otocol
.
IS-I
Sa ndOSPFa r
ec oncep
tuall
yqui teclose;onl
yt hedetail
sdiffe
r.Bot huse
thelink-s
tateal
gori
thm,b ot
hr equireeachp art
ici
pati
ngro ut
e rtopropag
a teli
nk-
sta
tusme s-s
agesfordirectl
y-connectedr outers,and both useincomingl i
nk-
sta
tusme ssa
gestob ui
ldat opol
og y dat
a base.Bothp rotocol
sp ermi
ts ta
tus
messagest o be mul ti
castift he unde rl
ying networks uppor
ts mul ti
cast
.
Furthermore,bothprotocol
sus et heShorte s
tPa thFirstalgori
thm toc ompute
shortes
tp at
hs.
Unli
keOS PF,IS-I
Swa snotorigi
nall
ydesi
gnedt ohandleIP.The refor
e,itwa s
l
a t
ere xtended,andthee xtendedvers
ionisknowna sIntegrat
edI S-ISorDualI S-
IS.Bec a
us ei
twa sextendedt ohandl
eI P,IS-I
Sha sthea dvantageofnotb ei
ng
integ
ra t
edwi thIPv4.Thus ,unli
keOS PF,whic
hr e
quiredane wv ers
iont ohandle
IPv6,Dua lI
S-ISa c
commoda tesIPv6a sye
ta notheraddr es
sf amil
y.I S-I
Sa lso
dif
fersf romOS PFbe-causeIS-ISdoesnotuseI Pforcommuni ca
tion.Instead,IS-
ISp acketsa ree ncap
sulatedi n net
wor kframesa nd s e
nt directly ove
rt he
underlyi
ngne twork.
Lik
eOS PF,I S-I
Sa ll
owsma nagerst os ubdi
vider out ersintoa re
a s
.Howe ver,
thede f
ini
tionofa na readiffe
rsf rom OS PF.Inp articul
a r,IS -
ISdoesnotr equire
anI S
Pt ode fineArea0t ob eab ackbonene tworkt hroug hwhi challtraff
icflows.
Inste
ad,I S-ISde fi
nesar outera sLe vel1( i
ntra-area ,Le
) vel2 (i
nter-area
),or
Level1-2( bothi ntra-a
reaa ndi nter-area).ALe v
el1r out eronlyc ommunicates
withotherLe vel1routersint hes amea r e
a.ALe vel2r outeronlyc ommunicates
withLe ve
l2r oute
rsi nothera reas.ALe vel1-2r out e
rc onnect
st heot hertwo
sets
.Thus ,unl i
keOS PFwhi chimp osesas tar
-shapedt opology,IS-ISa l
lowst he
centertob eas etofLe ve
l2ne tworks.
Prop onentsofOS PFp oi
ntoutt hatOS PFha sb e
ene xtende dt ohandlema ny
spe-
c i
alc ase
st hata r
isei
nal argeI SP.Fore xample,OS PFhasme chani
smst ode al
withst ubne tworks,not-
so-stubbyne tworks,andc ommunicationwi thot herIETF
protocols
.Pr oponentsofI S-ISp oi
ntoutt hatI S-ISislessc hat
t y(i.
e .
,sends
fewerme ssagesperunittime),andc a nhandlelarg
e rareas(i.
e .,areaswi t
hmor e
routers).Thus,IS-ISisconsi
de r
edas uit
abl
ea lt
ernativetoOS PFf ors pe
cialca
s e
s.
Thena
mei
ssp
ell
edout
I-S
-I-
S.
S
ec.1
4.1
6 Tr
ustAndRout
eHi
jac
king 31
3

1
4.1
6Tr
ustAndRout
eHi
jac
king

Weha vealreadyob serve


dt hatas ing
ler out e
rma yus eanI nteri
orGa teway
Proto-colt og at
he rr outi
ngi nformati
onwi thinitsa utonomouss ystema nda n
Ext e
riorGa te
-wa yPr otocoltoa dv
e r
tis
er oute stoot herautonomouss ystems.In
pri
nc i
ple,itshouldb ee asytoc onstr
uctas i
ng l
ep i
eceofs of
twa rethatc ombi
nes
information from t het wop rotocol
s,ma k i
ngi tp ossi
blet og atherr outesand
advertis
et hem wit houthuma ni nter-
vention.I np ra
c t
ice
,t echnica
la ndp ol
it
ica
l
obstacle
sma kedoings oc omplex.
Techni
cal
ly,IGPp r
ot ocol
s,lik
eRI PandHe l
l
o,areroutingp r
otocols
.Ar outer
usess uchp r
otoc ol
st o up datei tsforwarding ta
bleb a
se d on information it
acquir
esf r
om ot herr out e
r sinsi
dei t
sa utonomoussystem.Thus ,RI PorOS PF
softwarechange sthel ocalf orwardi
ngt ablewhenne wr outi
ngup da t
esa rr
ive
carryi
ng new inf ormation.I GPst r
ustr outerswithi
nt he same a utonomous
systemt opas
sc orrectda ta
.
Inc ontrast,e xte
r i
orp rot ocol ss uc hasBGPdonott rus tarbitraryr outers
and do notr evea
la llinfor ma tion f rom t he loc alforwa rding t abl
e .Instead,
exte ri
orp r
ot ocol
sk eepad atab ase ofne twor kr ea
chab i
l
ity,a nd a ppl
yp oli
cy
cons t
r ai
nts whe n sending or r e cei
v -i
ng i nfor mati
on. I g nori
ng s uch p oli
cy
cons t
r ai
ntsca na ffec
tr outingi nal arg ersens e s omep artsoft heI nternetc an
beb e
c omeunr eac
hable.Fore xamp l
e ,ifar out erina na utonomouss yst emt hatis
runni nga nI GPha ppe
nst op rop ag ateal ow- costr outet oane tworka tPur due
Univ e
r si
ty whe n it ha s no s uc h r oute, ot he rr outerst ha tr e ce
ivet he
adve rti
sementa cceptandi nst allt her oute.Cons equentl
y,r out erswi thint heAS
whe ret hemi stakeoc curre
dwi llf or wa r dPur duet raffi
ci ncor re
ctly;Pur duema y
becomeun- r
e achabl
ef rom ne twor kswi thi
nt heAS .Thep roblemb ecome smor e
seriousi fExte ri
orGa tewayPr ot oc olsp ropagatei ncorrectinfor mation i fa nAS
i
nc orr e
ctlyc l
a i
mst o haver out et o ag i
ven de stinati
on,t hede st
ination ma y
become unr ea c
hablet hroug hout t he I nterne t
.We s ayt ha tt he de sti
nation
addr esshasb eenhijacked.

1
4.1
7Ga
ted:ARout
ingGa
tewa
yDa
emon

Ame chanism ha sb eenc reatedt op rovi


dea ni nt erfacea mongal a r
ges etof
rout ingp rotocols
,s ucha sRI P,RI Png,BGP,HELLO,a ndOS PF.Theme c hani
sma lso
i
nc lude srout i
ngi nforma ti
onl earnedv iaICMPa ndI CMPv 6.Knowna sg ated,t he
me cha nis
m und erst
a ndsmul t i
plep rotocols(bothi nteriora nde x t
eriorg atewa y
prot ocols,includi
ngBGP) ,ande nsurest hatp olicyc onstrai
nt sar ehonor ed.For
examp le,g ated c ana ccept RI P me ssagesa nd modi fyt he loc alc omput er
s
forwa rdi
ngt a bl
e.Itc a nalsoa dverti
ser outesf rom wi thinitsa utonomouss ystem
usingBGP.Ther ulesg atedfollowsa ll
owas yst
e ma dministra
t ortos pecifyex a
ctly
whi chne twor ksg atedmayandmaynotadv er-ti
s ea ndhowt or eportdi st
ancest o
thos ene twor ks.Thus ,a l
thoughg atedi snota nI GP,i tp l
aysa nimp ortantr ol
ei n
rout ing b ecausei t de monst r
a t
e st hati ti sf easibl
et ob ui
lda na utoma ted
me
cha
nis
mli
nki
nga
nIGPwi
thBGPwi
thouts
acr
ifi
ci
ngp
rot
ect
ion.
Gatedhasani
nte
rest
inghi
story.I
twasori
gi
nall
ycreat
edbyMarkFe
dorat
Cor
-nel
l
,a ndwasa
dopt
edb yMERITforus
ewit
ht heNSFNETba
ckb
one
.Acade
mic

Thena
mei
sshor
tforg
atewaydaemon,andi
spr
onounc
ed
ga
ted.

31
4 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

r
esea
r c
herscont
rib
uted newide
as,a nindus
tryc
ons
ort
ium wa
sfor
med,a
nd
e
ventual
ly,MERI
Ts dg
ol atedt
oNexthop.

1
4.1
8Ar
tif
ici
alMe
tri
csAndMe
tri
cTr
ans
for
mat
ion

Thep rev
iousc hapters aidt hatI SPsof tenc hoos er outesf ore c
onomi cr at
her
thant e
chnicalr eas
ons.Todos o,ne twor kma nag ersc onfi
gur er out ingp rotocols
ma nuall
y,a nda s
signar t
ificialwe i
g htsordi stanc es,whi cht hep rot oc olsoftwa r
e
usesi np l
aceofa ctualwe ight sordi stanc es.Cons iderane twor kus ingRI P.I fa
ma nagerwa nt stodi r
ectt ra ffi
cov e rap atht ha tha smor ehop st hant heop ti
ma l
path,t hema nagerc anc on- figurear out e rt os pe ci
fyt hatt heop tima lpathi s
severalhop slong er.Fore xamp le,oner outerc anb ec onfiguredt oa dvertis
ea
directl
y-conne ctedne t
wor ka sdista nce5.S imi-larly,whe nus i
ngOS PF,e a
chl i
nk
mus tb ea ss
igne dawe i
ght .Ra thert ha nb a set hewe ightont hec ap acityoft he
unde rl
ying ne twork,a ma nage rc a nc hoos ea rtifi
cialwe ightst ha t ma ket he
protocols oftwa rep refer one p a th ov era not he r
.I nt he lar gestI SPs,t he
assig
nme ntofa rt
ifi
cialwe ightsisi mp ort antb eca usei thasadi r ecta nds i
gnifi
-
cantr elat
ionshipt orevenue .The re fore ,l a
r geI SPsof t
e nhiret al
e nte di ndiv
iduals
whos ee ntir
ej obi stoa na l
yzer out inga ndc hoos ewe i
ghtst ha twi l
lop ti
mize
revenue .
S
of twarel i
keg ated helpsne twor k ma nagerscontrolrouting by offer
ing
metr i
ct ransf orma ti
ons.Ama nage
rc anp lac esuchsoftwarebetwe entwog roups
ofr outerst ha tea chusea nI GPa ndc onfiguret hesoftwaretotra ns
formme tri
cs
sor outingp roc eedsa sde s
ired.Fore xa mple,therema yb ealow- costrouteused
withinoneg r oupt hati sr e
ser v
edf ori nt
e rnaluse.Toa voi
dhavingout si
dersuse
ther eservedr out e
,s oftwa r
eont heb orderb etweeng r
oupsa r
t ifi
ci
all
yinfla
tes
thec ostoft her outeb eforea dverti
singi te xt
e r
nall
y.Thus,outs i
dersthi
nkt he
routei se x
pe nsivea ndc hoosea nalt
e r
na ti
ve.Thep oi
ntis:

Althoughwehav edes c
ribedrout
ingpr otoc
olsasf i
ndingshortest
paths,pr otocolsoftwareusuall
yincludesc onfi
guration opt
ions
thatal l
ow anet wor kmanagert oover r
ideac t
ualc ostsandus e
artifi
ci
alv aluest hat willc
auset r
af fi
ct of oll
ow r outest he
managerpr efers.

Ofc ourse,ama nage


rc oul
da chie
vethes amere s
ultbyma nual
lyconfi
guri
ng
t
hef orwardingtablesina l
lrout ers
.Usi
nga rt
ifi
cia
lme tri
cshasas i
gni
fica
nt
a
dva
nt a
g e:ifane tworkfai
ls,thes of
twa
r ewillautomati
cal
lysel
ectana l
ternat
e
r
oute. Therefore, manage
r sf oc
us on c onf
iguri
ng me tr
icsr a
thert han on
c
onf
iguringfor wa
rdingtabl
es.
S
ec.1
4.1
9 Rout
ingWi
thPa
rti
alI
nfor
mat
ion 31
5

1
4.1
9Rout
ingWi
thPa
rti
alI
nfor
mat
ion

Web e
g a
n ourdi scuss
ion ofi nternetr outera rchi
tectur ea nd routing by
dis
c uss
ingt hec onceptofp artialinforma t
ion.Hos tscanr outewi t honlyp a
r t
ial
informationb e-causet heyr elyonr out er
s.I tshouldb ec l
earnow t hatnota ll
rout e
rsha vec ompletei n-forma t
ion.Mos ta utonomouss ystemsha veas ingl
e
rout e
rt hatc onnectst heaut ono-mouss ys
temt oot heraut onomouss ystems .For
examp l
e,i fthes iteconne ctst ot heg lo-balInternet,atl eas
toner out ermus t
haveac onne c
tiont ha tleadsf r
om t he sit
et oa nI SP.Rout erswi thint he
autonomouss ystemk now a boutde s
tinati
onswi thint hata ut on-
omouss ystem,
butt heyus eade faultr outet osenda llothert r
aff i
ctot heI SP.
How todor outingwithp art
ialinfor
ma tionbecomesobvi
ousi fweexaminea
router
sf orwardi
ng t a
bles
.Rout ersa tt he center of t
he I nte
rnet ha
vea
complet
es etofr outest oa llpossi
ble de
s ti
nat
ions;suchr outersdo notuse
defaul
tr outi
ng.Rout e
rsb eyondt hoseinIS Psatt hecent
eroft heInt
ernetdo
notusuallyhaveac omplet
es etofr outes;theyrelyonade faultroutetohandl
e
networka ddre
sse
st heydonotunde rst
and.
Usingde faultr out esformos troutersha st woc onsequences.Fi rst,i tmeans
thatloc alr out inge r r
or scang ounde tected.Fore xamp l
e,i fama chinei na n
autonomouss ystemi ncor rec
tlyr out esap ackett oa ne xternalaut onomouss ystem
ins
teadoft oal o-c alr outer,t hee xternals yst
e m ma ys endi tbac k( p
e rhapstoa
dif
ferente nt ryp oint )
.Thus ,c onne ct
ivi
tyma ya ppeart ob ep re s
ervede venif
routi
ngi si nc or rect .Thep rob- l
e m ma ynots eems ever
ef ors ma l
la ut onomous
syste
mst ha tha ve hi gh-speedl ocala re
a ne t
wor k
s.Howe v er
,i n a wi de area
networ k,inc orr ectr outesc anb edi s
astrousb ec auset hep athp ac ket
st akema y
invol
vemul tip l
eI S Ps ,whi chinc ur sal ongde l
a y,a ndI SPsa l
ongt hep athma y
chargef ort r ansi
t ,whi chr esult sin nee dles
sl ossofr e v
enue .S e
cond,on t he
posi
tives ide,us i
ng de faultr out eswhe ne verp oss
ible me a
nst ha tt he r out
ing
updateme ssag ese xc hang e
db ymos trouter swillb emuc hs ma l
le
rt hant he ywould
beifc omp l
et ei nfor ma tionwe rei ncluded.

1
4.20S
umma
ry

Theowne rofa na utonomouss ystem( AS)isfreetoc hoosep rotocol


st hat
passrouti
ngi nformati
ona mongr outerswi thi
nt heAS.Ma nua lmaintenanceof
routi
ngin-forma t
ionsuf f
icesonlyf orsma l
l,sl
owlychanginginterne
t sthatha ve
mini
ma li
ntercon-necti
on;mos trequirea utomate
dp roc
edure sthatdiscovera nd
updateroutesa utomati
cal-l
y.Weus et het ermInter
iorGat ewayPr otocol(I
GP)
torefertoap r
otocolthati suse
dt oe xchangerouti
nginforma t
ionwi t
hina nAS .
An I GP i
mp l
ementsei
thert hedi sta
nce-vect
ora l
gorithm ort heli
nk- s
tat
e
a
lgori
thm,whi c
hi sknownb ythena meS hort
estPa thFi rs
t( SPF)
.Wee xamine
d
t
hreeI GPs:RIP,HELLO,a ndOS PF.RI Pisadi stanc
e -vect
orp rotocolt
hatus es
s
pli
t hor i
zon, hol
d-down, and p oi
son r e
verset echniquest o he l
pe l
iminate
f
orwardingloopsandtheprob-l
emofc ounti
ngt oinfi
nity.Al t
houghitisobsol
ete,
Hel
loisint
eres
tingbeca us
eitil
lus
- t
ratesadista
nce
-vec
torpr
otocoltha
tuses
del
ayins
teadofhopc ountsasadistanc
eme tr
ic.Wedis
cuss
edthedis
adva
nta
ges
ofusi
ngdel
ayasar outingmetr
ic,andpoint
ed
31
6 Rout
ingWi
thi
nAnAut
onomousS
yst
em(
RIP,RI
Png
,OS
PF,I
S-I
S) Chap.1
4

outthata l
thoughhe uri
sti
cscanpreventinst
a b
ili
tie
sf roma r
isi
ngwhe npathshav
e
equalthroughputc harac
teri
sti
cs,long-termi ns
t a
b i
l
itie
sa ri
sewhe np at
hsha v
e
dif
ferentcharac-
terist
ics
.OSPFimpleme ntstheli
nk -s
tatusalgor
ithmandc omesi
n
twov e
r s
ions:OSPFv2f orIPv4andOS PFv
3f orI Pv6.IS-ISisana l
terna
tivetha
t
handl
essomes pe-ci
alcasesbe
tterthanOS PF.
Al
thoug hr outi
ng p rotocolsa re de
scr
ibeda sc omputi
ng shor
testp aths,
protoc
ols oftwa reinclude sco nfi
gurati
onoptionsthatall
ow manager
st oinflat
e
costsartifi
ci
a ll
y.Byc onfig
ur ingcostscaref
ully,ama nagercan di
rectt r
affi
c
alongpathst hati mple
me ntc orpora
tep ol
i
cyorg e
nerat
et hemostrevenue,whil
e
stil
lhavi
ng t he a b
il
ityt or outea l
ong al
ternativ
ep at
hsa utomati
cal
ly when
ne t
worke qui
p me ntfails.

EXERCI
SES

1
4.1 Wha
tne
twor
kfa
mil
i
esdoe
sRI
Psup
por
t?Why?
1
4.2 Considerala
rgeautonomouss
yste
mus i
nga nI
GPthatbas
esroute
sonde
lay.Wha
t
dif
-ficul
tydoesthea ut
onomoussys
tem ha
veifasubg
roupdeci
dest
ouseRIPon
it
sr outer
s?Expl
ain.
1
4.3 Withi
naRI Pmes
sag
e,eachIPaddres
sisal
i
gnedona32-
bitb
oundary.Wi
lls
uchad
-dres
sesb
ea l
i
gnedona32-bitboundar
yiftheIPda
tagr
amc a
rryi
ngtheme s
sag
e
s
t a
rtsona32-bi
tbounda
ry?Whyorwhyno t
?
1
4.4 Ana ut
onomoussystemcanbeassmal
lasas i
ngleloc
ala
reanet
workora
slarg
eas
mul-ti
pl
ewi deare
ane twor
ks.Whydoesthev ar
iati
oni
nsizemak
eitdi
ffi
cul
tto
de
fineas i
ngleI
GPt hatworkswe
lli
nalls
itua
tions?
1
4.5 Chara
cte
rize the ci
rcumst
anc
es unde
r whi
cht
he s
pli
t hor
izon t
echni
que wi
l
l
pre
ventsl
owc onve
rgence.
1
4.6 Consi
dera
ninter
netc ompos
edofma nyl
ocala
reanetwor
ksr unningRIPasa nI
GP.
Findanex
ampl
et ha
ts howshowaf orwa
rdi
ngloopcanres
ulte ve
ni fthecodeuse
s
hol
ddownaf
terre c
eivi
nginf
orma ti
ontha
tane tworki
sunr eac
hable
.
1
4.7 Shoul
dahosteve
rr unRI Pi
na ct
ivemode?Whyorwhynot ?
1
4.8 Unde
rwha tc
ircums
tance
swi
l
lahopc
ountme
tri
cpr
oduc
ebe
tte
rrout
est
hana
metri
ctha
tusesdel
ay?
1
4.9 Can you i
magi
ne a s
ituat
ion i
n whic
hana utonomouss
yst
emc
hoos
es not t
o
adv
ertis
eal
lit
snetworks?(Hi
nt:thi
nkofauni
versi
ty.
)
1
4.1
0 Inb r
oa dt e
rms,wec oul
ds aytha
ta nIGPdistri
but
est heloc
alforwardi
ngtable
,
whil
eBGPdi str
ibut
esat a
bleofnetwork
sa ndroute
rsus edtoreac
ht hem(i.
e.,a
routerca nsendaBGPa dver
tis
ementthatdoesnotexac
t l
yma t
chitemsinit
sown
forwardingtabl
e).Whataretheadva
ntagesofeachapp
ro a
ch?
1
4.1
1 Cons
iderafunc
tionusedtoc onve
rtbetweende
layandhop-
countme
t r
ics
.Ca n
youf i
ndpr
oper
tiesofsuchfuncti
onsthatares
uffi
ci
enttopreve
ntforwardi
ng
l
oops
?Ar et
hepro-per
tie
snec
es s
aryaswell
?
1
4.1
2 Arethe
rec i
rcumsta
ncesunde
rwhichanS
PFp
rot
ocolc
anf
ormf
orwa
rdi
ngl
oop
s?
(Hi
nt:t
hinkofb e
st-ef
for
tdeli
ver
y.)
Ex
erc
ise
s 31
7

1
4.1
3 Bui
ldana p
plic
ati
onprogr
amt ha
tse
ndsar
eque
stt
oar
out
err
unni
ngRI
Pand
di
spl
ayst
her oute
sre
turned.
1
4.1
4 ReadtheRI
Pspe
c i
fi
cati
onc a
reful
l
y.Canrout
esrepor
tedinar
esp
onset
oaque
ry
di
fferfr
omtheroute
sr ep
ortedbyarout
ingupda
teme s
sag
e?I
fsohow?
1
4.1
5 ReadtheOS
PFv
2sp
eci
fi
cat
ionc
are
ful
l
y.Howc
anama
nag
erus
eOS
PF
svi
rtua
lli
nk
fa
cil
it
y?
1
4.1
6 OSPFv2a l
l
owsma nag
erstoas
signmanyofthei
rownidenti
fi
ers
,pos
sib
lyl
eadingt
o
dupl
ic
ationofv al
uesatmulti
pl
esit
e s
.Whichide
nti
fi
er(s
)ma ynee
dt ochangei
f
twosite
sr unni
ngOSPFv2de
cidetomerge
?
1
4.1
7 Canyouus
eICMPredi
rectme
ssa
gest
opa
ssr
out
ingi
nfor
mat
i mongi
ona nter
ior
rout
ers
?Whyorwhynot?
1
4.1
8 Readthes pe
cif
ica
tionforOS PFv
3.Wha tisas t
ubarea,andwhatisanots
o
st
ubbyarea(NSSA)?Whya rethet woimp
ortant
?
1
4.1
9 WhattimeoutdoestheOSPFv3standar
dreco
mme ndforaHell
oint
erv
al?
1
4.20 Writ
eap rog
ramthatt
akesa
sinputades
crip
tionofyourorga
niza
tion
sinter
net,
us
esS NMP toobt
ainfor
wardi
ngtabl
esfrom alltherout
ers,andr epor
tsa ny
i
nconsi
ste
nci
es.
1
4.21 Ifyourorg
aniza
tionrunssof
twar
es uc
hasgat
edorZebr atha
tma na
gesmulti
pl
e
TCP/I
Prouti
ngp rot
ocol
s,obt
ainacopyoft
hec onf
igur
ati
onfil
esa
nde xp
lai
nthe
meani
ngofeachitem.
Chapt
erCont
ent
s
1
5.1 Introduction,31 9
1
5.2 Hardwa r
eBr oadca st,319
1
5.3 Hardwa r
eMul ticast,320
1
5.4 EthernetMul ti
cast ,321
1
5.5 TheConc eptualBui l
dingBl oc ksOfI nternetMul t
ica
st,
321
1
5.6 TheI PMul ticastS cheme ,322
1
5.7 I Pv4AndI Pv6Mul ticastAddr esses,323
1
5.8 Mul ticas
tAddr essS ema ntic
s ,326
1
5.9 Ma pp i
ngI PMul ti
c astToEt hernetMul ti
cas t,327
1
5.10 HostsAndMul t
icastDe l
ivery,328
1
5.11 Multicas
tS c
op e,3 28
1
5.12 HostPa rtici
pationI nI PMul ti
casti
ng ,329
1
5.13I Pv4I nternetGr oupMa nag ementPr otocol( IGMP),330
1
5.14I GMPDe tail
s,331
1
5.15I GMPGr oupMe mb ers
hipS ta t
eTr ansiti
ons,332
1
5.16I GMPMe mbershipQue ryMe ssageForma t,333
1
5.17I GMPMe mbershipRe portMe s
sageFor mat,334
1
5.18I Pv6Mul t i
castGr oupMe mbe r
shipWi thMLDv 2,335
1
5.19 Multicas
tFor wardingAndRout i
ngI nforma tion,337
1
5.20 Basi
cMul ti
castFor wardingPa radigms,339
1
5.21 Conseque ncesOfTRPF,341
1
5.22 Multicas
tTr ees,342
1
5.23 TheEs senceOfMul tic
a stRout ePr opagati
o n,343
1
5.24 ReversePa thMul ticas
t i
ng,344
1
5.25 Examp l
eMul ti
castRout ingPr otocols
,345
1
5.26 Reli
ableMul ticastAndACKI mp l
osi
ons,347
1
5.27 Summa ry,349
1
5

I
nter
netMul
ti
cas
ting

1
5.1I
ntr
oduc
tion

Earl
ierchapte
rsdefinetheme chani
smsI Pus estoforwardandde l
i
veruni
cas
t
da-tagrams.Thischa
pt erexp l
oresanothe
rf eatureofI P:multi
pointdatag
ram
del
ivery.Web egi
nwithab ri
efr evi
ewoft heunde r
lyi
nghardwaresupport
.Late
r
sect
ionsde sc
rib
eI Pa ddres
singf ormulti
p ointde l
ive
rya ndthep rotoc
olstha
t
routersusetop ro
paga
t enecessar
yr out
ingi nfor
ma ti
on.

1
5.2Ha
rdwa
reBr
oadc
ast

Ma nyha rdwa ret echnologiesc ontai


nme chanismst os endp ac
ketst omult i
ple
desti
-na ti
onss imultaneously( orne arl
ys i
mul tane ous
ly).InCha pter2,wer e
v i
ew
severalt e
chnolog i
esa nddi s
cus sthemos tc ommonf orm ofmul tip
ointde l
ivery:
hardwar ebroadc as
t.Br oadc astde l
iver
yme a nst ha tthene tworkde l
i
versonec op y
ofap ackettoe ac
hde stina t
ion.Thede tai
l
sofha rdwa r
eb roadcas
tv ary.Ons ome
technologi
es,t heha rdwa res endsas i
ngl
ec op yofap acke
ta nda rra
ng esfore a
c h
attachedc omp ut e
rt or e -ceiveac opy.On ot her ne t
wor ks
,t he ne tworki
ng
equipme nt imp l
eme ntsb roadc a
stb yf orwa rding a ni ndependent c op
y of a
broadcastp a
cke ttoe achi ndividualcomputer .
Mostha rdwaret e
chnol
ogiesprovideas p ec
ial
,r eserveddesti
na t
iona ddres
s
c
all
edab roadcas
taddress
.Tos p
eci
fyb roadca
s tdel
ivery,a l
las e
nderne edst odo
i
sc r
eateaf ramewhe ret hede s
tinati
on addressf ie
ldc ontai
nst heb roadca
st
a
ddress
.Fore xa
mp l
e,Ethernetusest hea l
l1sha rdwa readdressasab roadca
st
a
ddress
;e ac
hc omputerat-t
a c
hedt oanEt hernetne t
wor ka cc
eptsframess entto
t
heb roadcas
ta ddre
ssa swe l
la spa c
k e
tssentt ot hec omputer
suni c
a stMAC
a
ddr
ess
.

31
9
320 I
nte
rne
tMul
ti
cas
ting Chap.1
5

Thec hie
fdi sadvantageofha rdwar ebr oadc asta r
isesfromi tsdema ndon
res
our ces
i n a ddition t o us i
ng ne twork b a ndwi dt h, e ach b roadcast consumes
computationalr e
s ource
sont hec omp utersa tta che dtot hene twor k
.I nprinci
ple
,
itmi g
htb ep os
siblet o desig
ni nt ernets oftwa ret ha tus edb roadcas
tf ora ll
datagra
mss enta c r
ossane twork.Ev e ryc omp ut erwoul dr ecei
v eac opyofe ach
datagra
m,a ndI Ps of
twa reo nt hec om- p ut e
rc oulde xaminet heI Pde s
tinati
on
addres
sa nddi scardda t
ag r
amsi nte ndedf orot he rma chi
nes.Inp r
actic
e,howe ver
,
suchas chemei snons enseb ecaus ee achc omp ut erwoul ds p
e ndCPU c ycle
st o
dis
cardmos toft heda tagramst hata rriv
e d.Thus ,t hede si
gne r
sofTCP/ I
Pde vis
ed
addres
sb i
ndingme c
hanis
mst hatallowda ta gramst ob edeli
v er
edv iaunicas
t.

1
5.3Ha
rdwa
reMul
ti
cas
t

Someha rdwa retechnologi


essup portas econdf orm ofmul ti
-pointde l
i
very
cal
ledha rdwaremul ti
cast.Unli
keha rdwareb roadcast,hardwa remult i
cas
ta ll
ows
eachc om- putert oc hoose whethe rit wi l
lp artic
ipateinr ecei
ving a g i
ven
multi
cast.Typ ical
ly,aha rdwa r
et echnol
ogyr eservesal ar
ges etofa ddre
ssesfor
usewi thmul t
icast.Whe nag r
oupofa ppl
ic
ationswa nttous eha rdwaremul ti
cast
,
theyc hooseonep arti
cular mult
i-castaddresst ous ef orc ommuni cati
on.The
appl
icati
onr unningonac omputermus ta skt heop erati
ngs ystemt oc onfi
gure
thene tworki nte rf
acec ardt or e
cog ni
zet hemul ti-ca
sta ddresstha tha sbeen
sel
ected.Af tert heha rdwareha sbe enconfigured,thec om-p uterwi l
lrecei
vea
copyofa nyp a c
ke tsenttot hemulticastaddress.
Weus ethet erm mult
icas
tgr oupt ode not
et hese tofc omp uterstha
ta re
l
iste
ningtoap art
icul
armul ti
cas
ta ddres
s.I fappl
i
cati
onsons ixc omputer
sa re
l
iste
ningtoap ar-t
icul
armul ti
cas
ta ddress,themulti
castg roupissaidtohavesix
members.Inma nyhardwaret e
chnologie
s,amul ti
cas
tg roupi sde
f i
nedonlybyt he
setoflis
tener
s a na r-
bitrar
yc omp utercansendap a c
ke ttoag i
venmultic
ast
addres
s(i.
e.,thesenderdoesnotne edt ob eamemb eroft hemul t
icastgr
oup).
Atac onceptuallevel
,mul t i
cas
ta ddr
essing canb ev i
eweda ss uffi
ci
e ntl
y
generaltoincl
udea l
lotherfor msofa ddres
sing.Fore xample,wec anima g
inea
conv
e nti
onaluni-castaddresst ob eamul ti
ca s
ta ddre
sst owhi chex a
ctly one
computeri sliste
ning.S i
mi-l
arly,we c ant hink of a b r
oadcas
ta ddressa sa
multi
castaddre s
st owhi c
ha llc omputersonap art
icul
arne tworkarel i
stening
.
Othermul t
icas
ta ddresse
sc anc orresp
ondt oa rbi
-tr
arys ubse
tsofc omputerson
thene t
work,p oss
ibl
yt heempt ys et
.
Despit
ei tsa p
parent g ene r
ali
ty, mul t
icasta ddress
ing will not r epl
ace
conventi
ona lformsofa ddr es
singb ec
auset her
eisaf undamentaldiffer
enc einthe
wayt he unde rl
ying hardwa re me chanis
ms imp l
e ment pack
etf orwarding and
deli
very.I nste
ad ofa s ingl
ec omput e
rora llc omputers
,a mul ti
casta ddr
e s
s
ident
ifie
sa na rbi
trarys ubsetofc omp ut-er
s,a nd me mbersoft heg roupc an
changea ta nytime.The refore,ha r
dwa recannotde termi
nee xact
lywhe r eag i
ven
comput e
rc onnectst othene t
wor k,a ndmus tfloodp ack
etst oallcomp utersand
l
etthe
mc hoos
ewhethe
rt oa
cce
ptt hepack
et.Floodi
ngi sexpens
iveb
eca
usei
t
p
rev
entsp
ackettr
ans
fersi
npa
ral
lel
.Ther
efore,wecanc oncl
ude
:
S
ec.1
5.3 Ha
rdwa
reMul
ti
cas
t 321

Althoughiti si
nteres
tingt othi
nkofmul ti
castaddr
essi
ngasa
gen-eral
izat
ionthats ubsumesunic
astandbr oadc
astaddres
ses
,
theunder -l
yingforwar di
nganddeliv
ery mechani
smscan make
mul t
icas
tlessef
fici
ent.

1
5.4Et
her
netMul
ti
cas
t

Et herne
tp r
ov i
desa ne xa
mp l
eofha rdwar emul t
icas
ting,a nd i
se spe
cial
ly
p
ert
ine ntt oI Pmul ti
cast
ingb eca
useEt herneti swidel
yde p
loyedint heg l
ob a
l
I
nte
r ne t
.One -hal
foft heEt her
neta ddres
ss pa
c eisreser
vedf ormulti
cast t he
l
ow-or derbi
toft hehigh-or
deroc t
etdisti
ng ui
shesconventi
onalunicas
ta ddres
ses
0)f
( r om mul t
ica
sta ddres
ses(1).Inda s
hedhe xadeci
malnot ati
on,themul ti
cast
b
iti
sg iv
enb y:

01
-00-
00-
00-
00-
0016

Whena nEtherne
ti nter
faceboardisini
tial
ized,itbeg
insa c
cepti
ngp ack
ets
dest
inedfore i
thert he unic
asthardwarea ddressort he Ether
netb roadc
ast
addres
s.However,de-vi
cedrivers
oftwarecanr econfig
urethedevicetoa l
l
ow it
toa l
sor e
cogni
zeoneormo remultica
sta ddress
e s
.Fore xampl
e,s upp
oset he
dri
verconfi
gure
st heEthernetmul
tic
astaddress:
01
-5E-
00-
00-
00-
011
6

Afte
rc onfi
gura
tion,theinterfacehardwarewi l
lacce
pta nyp ac
ketsentt othe
computer
sunicastMAC a ddr
e s
s,t hebroadcastMAC a ddres
s,ort hee xampl
e
multi
cas
tMAC a d-dres
s( theha r
dwa r
ewi llconti
nuet oignorepac
ke t
ss entto
othe
rmul ti
cas
ta ddre
sses
).Thene x
ts ec
tionsexpla
inIPmul ti
casts
ema nt
icsand
howI Pusesba
sicmulti
cas
tha rdware.

1
5.5TheConc
ept
ualBui
ldi
ngBl
ocksOfI
nte
rne
tMul
ti
cas
t

Thr
eec once
ptua
lbui
l
dingb
loc
ksa
rer
equi
redf
orag
ene
ralp
urp
osei
nte
rne
t
mul
ti
-cas
tingsyst
em:

Amul
ti
cas
taddr
ess
ings
che
me
Ane
ffe
cti
venot
ifi
cat
iona
ndde
li
ver
yme
cha
nis
m
Ane
ffi
ci
enti
nte
rne
twor
kfor
war
dingf
aci
l
ity

Ma nydetail
sa ndconstr
aintspresentchal
lengesf ora novera
lldesi
gn.For
exa
m- ple,ina ddit
ion toprovidi
ng s
uff i
ci
enta ddr
e s
sesf orma ny gr
oups,the
multic
as ta
d-dressi
ngschememus taccommodatet woc onfl
i
c t
inggoal
s:all
ow l
ocal
autonomy ina s-si
gni
ng addresse
swhi l
e defi
ning addres
sest ha
tha ve meani
ng
gl
ob a
ll
y.S i
mil
arly,hos
ts
Das
hed he
xadec
imalnotat
ion r
epre
sentseach oct
etastwo he
xadec
ima
ldigit
swi t
h oc
tet
s
s
epa
rate
db yadash;thes
ubsc
rit1
p 6c a
nb eomit
tedonlywhe
nthec
ontexti
sunamb
iguous
.
322 I
nte
rne
tMul
ti
cas
ting Chap.1
5

needanot if
icati
onmec hanismt oi nformrout ersaboutmul ticas
tg roupsinwhi ch
theya r ep artic
ip a
ting,a nd r outers need a de l
ivery mec hanis
m t ot r
ansfer
multi
c a
stp a
ck e
tst ohosts.Ag aint herea r
et wop oss
ibil
iti
es:internetmul ti
cast
shoul
dma kee ffecti
veus eofha r dwaremul t
icastwhe nitisa vail
abl
e,b utitshould
als
oa l
low de li
ver y over ne t
wor k sthat do not ha ve hardwa res upportf or
multi
c a
st.Fi nall
y,a mul tic
astf orwardi
ng f aci
li
ty presentst heb iggestdesign
chal
lengeoft het hree:theg oalisas chemet hatisb ot
he ffi-ci
enta nddyna mic
itshouldf orwardmul ti
castp ac
k etsa l
ongshor te
stp aths,shouldnots e
ndac opy
ofada ta
gr ama longap at
hi ft hep athdoesnotl eadt oame mberoft hegroup,
andshoulda ll
owhos tstoj oi
na ndl eavegroupsa tanyt ime.
Wewi l
ls eethatt heI Pmul ti
castingme c hani
s mi ncl
ude sallt hreeb uil
ding
blocks.I t de fi
nesmul ti
casta ddr ess
ing f or b othI Pv4a nd I Pv 6,p rovide
sa
me chanis
mt hata l
-l
owshos tst oj oi
na ndl eaveI Pmul ticas
tg r
oups,s peci
fi
e show
mul ti
castda t a
gramsa ret ransferreda c r
os sindivi
dua lha rdwa rene tworks,a nd
providesa s et of protoc
olsr outersc a
n us et oe xc hang e mult i
castr outing
i
nf orma t
ion a nd constr
uctf orwa r
ding t abl
esf or mul ti
cas tg roups .The ne xt
sectionlistsp ropert
iesoft heI Pmul t
icasts cheme ,a ndt her ema inderoft he
chapt e
rc onsiderseachaspec
ti nmor edet ai
l,beg i
nningwi tha ddre
s s
- i
ng .

1
5.6TheI
PMul
ti
cas
tSc
heme

IPmul ti
casti
ngi sa nab s
tracti
onofha r
dwa r
emul t
icas
ting
.I tf ol
lowst he
paradig
m ofa l
lowingt r
ansmissi
ont oasub s
etofhos tcomputers
,b utg e
nerali
zes
thec oncepttoa ll
ow thes ubse
tt os p
re a
da crossarbi
trar
yp hysica
lne tworks
throughouta nint er
net.Thei deaisthatwhe neverposs
ibl
e,as ingl
ec opyofa
mul t
icas
tda tagr
a mi stransmitte
dunt i
lar outermustf orwardt heda tag
ram
alongmul t
ipl
ep aths.Atthatp oi
nt,onec opyoft hedatagr
ami ssentdowne ach
path.Thus,theg oalistoavoidunneces
sarydup l
i
ca-ti
on.

I
nI Pt e
rminol
ogy,as ubs
etofc ompute
rsli
ste
ningt oag i
venIPmulti
cast
a
ddr
essisknowna sa nIPmul t
icas
tgroup.IPmulti
cas
tingi
sa vai
l
abl
ef orboth
I
Pv4a nd I
Pv6.The de f
ini
ti
on isincr
edi
blyambit
ious
,a nd hasthe f
oll
owing
g
ener
alcharac
teri
sti
cs:

OneI
PMul
ti
cas
tAddr
essPerGr
oup.Eac
hIPmul
ti
cas
tgr
oupi
sas
sig
neda
unique IP mult
icas
ta ddres
s.A f ew I P multicas
ta ddr
ess
e sa r
e
permanent
lyas-s
ignedb yt he Int
erneta uthori
ty,a nd corr
espond t
o
groupsthatal
wayse xi
ste v
eni ftheyha v
enoc urrentme mbers
.Ot her
addres
sesaret
emporary,anda reavai
l
ableforp r
ivat
eus e.
28
NumberOfGr
oups
.IPv
4pr
ovi
desa
ddr
ess
esf
orupt
o2 s
imul
tane
ous
multi
-cas
tg roups;IPv6prov
ide
sma nymor e.Inap rac
tic
alsense
,t he
l
imitona d-dres
sesdoesnotposear es
tri
cti
ononI Pmulti
cas
t.Inst
ead,
pra
ctic
alr e
stri
c-ti
onsont henumb e
rofs imul
tane
ousmultic
astgroups
ari
sefrom constra
intsonforwar
dingtabl
esizeandthenetworktraffi
c
ne
ede
dtop
rop
aga
ter
out
esa
sgr
oupme
mbe
rshi
pcha
nge
s.
S
ec.1
5.6 TheI
PMul
ti
cas
tSc
heme 323

Dynami
cGr
oupMember
shi
p.Anar
bit
rar
yhos
tca
njoi
norl
eav
eanI
P
mul
ti
-cas
tg r
oupatanyt
ime.Fur
the r
more,ahostmaybeame
mbe
rof
anar
bit
rarynumb
erofmult
ica
stgroupss
imul
tane
ousl
y.
Us
e Of Har
dwar
e. I
fthe unde
rlyi
ng ne
twor
k ha
rdwa
res
upp
ort
s
mult
ica
st,IPuseshar
dwaremult
ica
sttodel
iv
era nI Pmul
ti
castda
tag
ram
onthene twork
.I fthehardwa
redoesnots upportmul
tic
ast,IPuse
s
br
oadcastoruni
casttode
li
verIPmult
ica
stdatag
ra ms.
I
nternet
workForwardi
ng.BecausemembersofanIPmulti
cas
tgroupc a
n
a
t-tachtoarbi
trar
yne tworksthroug
houtaninte
rnet,sp
eci
almult
icast
r
outersarere
quiredtof or
wa r
dI Pmulti
cas
tdatagr
ams.Inmostcases,
i
nst
ead of usi
ng se
par
ater
out
ers
, mul
ti
cas
tca
pab
il
it
yisa
dde
dto
c
onvent
iona
lroute
rs.
Del
i
ver
y Semant
ics
.IP mul
ti
cas
t us
est
he s
ame b
est
-ef
for
t de
li
ver
y
se
ma nti
csas otherIP datag
ram del
iv
ery, meani
ng tha
t mul
tic
ast
data
g r
amsc
anb elos
t,de
laye
d,dup
li
cat
ed,ordel
iv
eredoutofor
der
.
Member
shi
pAndTr
ans
mis
sion.Anar
bit
rar
yhos
tma
yse
ndda
tag
ramst
o
any mul
ti
cas
tg roup;g r
oup memb
ershi
pis onl
y usedt
o de
ter
mine
whet
herthehos
tr ec
eiv
esdat
agra
mssenttot
heg roup
.

1
5.7I
Pv4AndI
Pv6Mul
ti
cas
tAddr
ess
es

Wes ai
dt hatI Pmul t
icastaddr e
ssesared i
videdi ntot wot ypes
:t hosethat
arep er-
ma nentl
ya s
sig
neda nd thoset hata rea v ai
labl
ef or temp orar
y use.
Permanenta ddre
s s
esarec all
edwe l
l-known;t heya rede finedf orma jorserv
ices
ont heglobalInternetaswe llasf orinfras
tructurema intenanc e(e.
g .
,wes a
w
that RIPa nd RI Png use a we l
l-known mul ti
casta ddress).Ot her multi
cast
addres
sescorrespondtot ransi
entmul ti
castgroupst hata recr e
a tedwhe nneeded
anddisca
rdedwhe nthecountofg r oupme mbersr e
ac hesze r
o.
Li
keha r
dwa remulti
cas
ting,I Pmulticas
tingusesthedatagr
amsde s
tinati
on
a
d-dr e
sst ospeci
fythatap a r
ticulardatagram mustbedeli
veredv i
amul ti
cast
.
I
Pv4r es
erve
sc la
ssD addres
sesf ormul ti
cast:thefir
st4 bit
sc ontan1
i 1
10and
i
dentifythea ddr
essasamul ti
casta ddres
s.InI Pv
6,amul t
icas
ta ddres
sha sthe
f
irst8b it
ssett o1asFigur
e1 5.1il
lustr
ates.

0123
I
Pv4: 1 110 Gr
oupI
D(28b
its
)

01234567
I
Pv6: 1 1111111 Gr
oupI
D(1
20b
its
)

Fi
gur
e15.
1Thef
orma
tofI
Pv4a
ndI
Pv6mul
ti
cas
taddr
ess
es.Ap
ref
ix
i
den-
tif
iest
hea
ddr
essa
smul
ti
cas
t.
324 I
nte
rne
tMul
ti
cas
ting Chap.1
5

Ine a
chc ase,therema i
nderofanaddressfollowingthep r
efi
xc ons
istsofan
i
dent
i-fi
erf orap a r
tic
ularmultic
astgroup.IPv4a l
l
oca t
es28b itstomul ti
cas
t
8
g
roupIDs,whi chme ans10g roupsareposs
ibl
e.I Pv6a l
locat
es120b i
tsforg r
oup
3
6
I
Ds,giv
ing10 p os
sibl
eg r
oups!Themult
icas
tg roupI Disnotp art
iti
onedintobit
s
t
hatidenti
fyt heori-gi
norowne roftheg r
oup.

1
5.7.
1IPv
4Mul
ti
cas
tAddr
essS
pac
e

Whene
xpr
ess
edi
ndot
tedde
cima
lnot
ati
on,I
Pv4mul
ti
cas
taddr
ess
esr
ang
e
fr
om

224.
0.0.
0thr
oug
h 239.
255.
255.
255
Ma nyp artsoft hea ddres
ss paceha v
eb eenassi
gne dspe
cialmeaning.Fore x
amp l
e,
thel owesta ddress
,224. 0.0.0,i sreserv
ed;itc annotbea ss
ignedt oa nygroup.
Addre ss
esupt hroug h224. 0.0.255a rer e
stri
ctedt oas i
ngl
ene twork(i.e
.,a
route risp rohibi
tedf rom f orwardingada tagrams entt oa ny addressint he
range ,andas enderi ssupposedt os ettheTTLt o1 )
,a ndaddr e
sses239.0.0.0
throug h 239.255.255.255 a rer estri
ctedt o one or-gani
zation (i.
e.,rout e
rs
shouldnotf or wardt hema crosse xt
e r
nalli
nks)
.Fi gur
e1 5.2showshow t heI Pv4
mul t
icastaddressspaceisdivided.

Addre
ssRa
nge Meani
ng
224.
0.0.0 Bas
eAddres
s(Reserv
ed)
224.0.
0.1224.0.0.
255 Sc
operes
tri
ctedtoonenet work
224.0.
1.0238.255.
255.
255 Sc
opei
sglobalac
rosstheInternet
239.
0.0.0239.255.
255.
255 Sc
operes
tri
ctedtooneorganizat
ion

Fi
gur
e15.
2Thediv
isi
onoft
heI
Pv4mul
ti
cas
taddr
esss
pac
eac
cor
dingt
o
s
cop
e.

Fig
ure1 5.
3l i
stsa f ew exampl
es of s
peci
ficIPv4 mul
ti
casta ddr
ess
a
ssi
gnments
.Ma nyothe
ra ddre
sseshavebee
na s
sig
ned,andsomevendor
sha ve
c
hosenaddr
esse
stousewit
ht hei
rsyst
ems.

Addr
ess Assi
gnedPur pose
224.
0.0.
1 AllSyst
emsont hi
sS ubnet
224.
0.0.
2 AllRoutersont hi
sS ubnet
224.
0.0.
5 OSPFIGPAl lRouters
224.
0.0.
6 OSPFIGPDe signat
edRout ers
224.
0.0.
9 RIP2Rout ers
224.
0.0.
12 DHCPS erver/Re layAgent
224.
0.0.
22 IGMP

Fi
gur
e15.
3Ex
amp
lesofI
Pv4mul
ti
cas
taddr
essa
ssi
gnme
nts
.Al
lthee
xam
-
ple
sha
veas
cop
ere
str
ict
edt
oonene
twor
k.
S
ec.1
5.7 I
Pv4AndI
Pv6Mul
ti
cas
tAddr
ess
es 325

InFigure15.3,a ddres
s224.0.
0.1isp e
rmanentlyass
ignedt
ot heallsys
t ems
group,andaddr e
s s224. 0.
0.2ispermanentl
ya s
signedtot hea
llrout
ersgr oup.
The allsyst
emsgr oup incl
ude
sa l
lhostsa nd router
son ane tworkt hata re
parti
ci
patinginI P mul t
icas
t,whereasthe allroutersgroupi
ncl
udesonl yt he
router
st hata r
eparti
ci
pat
ing
.Bot h of t
hes
eg roupsare us
edf or cont
rol
prot
ocolsandmustbeonthesameloca
lnetwor
ka sthesende
r;the
rea r
enoI P
multi
castaddr
ess
est
hatrefe
rtoallsys
temsintheInte
rne
tora l
lroute
rsi nthe
Inte
rnet.

1
5.7.
2IPv
6Mul
ti
cas
tAddr
essS
pac
e

Li
keIPv4,IPv6spe
cifi
esthesc
opea s
soci
atedwithmulti
castaddre
sse
s.Rec
all
t
hatthef i
rstoct
etofa nI Pv6mult
icas
ta ddre
sscont
ainsall1s
.I Pv6usest
he
s
econd oc
tet of the addres
stos p
ecif
yt he s
cope
. Figure1 5.4lis
tsthe
a
ssi
gnments
.

S
econdOc t
et Meaning
0x?0 Res
erv
ed
0x?1 Sc
opeisrestr
ictedtoac omp uter(loopbac
k)
0x?2 Sc
opeisrestr
ictedtothel ocalnetwork
0x?3 Sc
opeisequiva
lenttoI Pv4localscope
0x?4 Sc
opeisadminis
trat
ivel
yc onfigured
0x?5 Sc
opeisrestr
ictedtoas i
ngles it
e
0x?8 Sc
opeisrestr
ictedtoas i
ngleor ganiza
tion
0x?E Sc
opeisglob
ala c
rosstheI nternet

Fi
gur
e15.
4Theuseofthesec
ondoct
etinanaddr
esst
osp
eci
fyt
he
s
cop
eofa nIPv
6multi
cas
taddr
ess
.

Int hefi
gur
e,c ons
tantssta
rti
ngwith 0x ar
ehexade
cimal
.Thequesti
onma
rk
denote
sanarbi
trarynib
ble
.Thus,0x
?1refersto0x
01,0x11
,0x21
...0x
F1.
Usi
nga noc t
ett ospeci
fyt hes c
opea l
lowsas ervicet ob ea c
cessedwit
ha
vari
ety of scope
s.For e xamp l
e,t he Network Time Pr otocol(NTP)hasbeen
ass
ignedt he multi-cas
tg r
oup I D 0x 1
01. The s c
op e of t he assi
gnment i
s
unrestr
ict
ed,me aningt ha
tas e
nderc anc hoosethes cop eofamul ti
cas
t.For
example,i
tisp os
sib
let osendamul ti-
castda ta
gramt oa l
lNTPs e
rversonas i
ngl
e
l
ink( a
ddressFF02::101
)ora llNTPs erv
ersina norganization(addres
sFF08::1
01)
.
Onl
yt hesecondocte tofthea ddres
sdiffer
s.

S
omes erv
icesareas
sig
ne das pecif
ics c
opeoras pec
ifi
cse tofs copes,be
cause
theIETFc anforeseenor easont os endamul t
ica
sttot heg roupg l
obal
l
y.For
exa
mp l
e,theAllNodesmultic
as tgroupi sli
mite
d onec annotspe ci
fyamul tic
ast
dat
agramf orallnodest
hroug houtt heI nt
ernet.Mostroutingp rotocol
sarea l
so
l
imit
edt oas i
ngleli
nkbecauset heintendedcommunicat
ionisb etwee nrouter
son
t
hes a
meunder
lyi
ngnet-
work.Fig
ure1
5.5l
i
stsaf
ewe
xamp
lesofp
erma
nent
ly
a
ssi
gnedI
Pv6mult
ica
sta
d-dr
esse
s.
326 I
nte
rne
tMul
ti
cas
tingCha
p.1
5

Address Ass
ignedPur pose
FF02:
:1 Al
lnode sont hel ocalnetworks egment
FF02:
:2 Al
lr outersont helocalnetworks e
gme nt
FF02:
:5 OSPFv3Al l
SPFr out er
s
FF02:
:6 OSPFv3Al l
DRr out ers
FF02:
:9 RIPr outers
FF02:
:a EIGRPr outers
FF02:
:d PIMr outers
FF02:
:1:2 DHCPs erversa ndr el
a yagentsont heloc
alne
twor
k
FF05:
:1:3 DHCPs erversont helocalnetworks i
te
FF0x:
:FB Multicas
tDNS
FF0x:
:101 Networ kTimePr otocol
FF0x:
:108 Networ kInforma tionS e
rvice
FF0x:
:114 Avai
lablefore xp er
ime nt
s

Fi
gur
e15.
5Ex ampl
esofafewp er
manentIPv6multi
cas
ta ddre
ssa ssi
gn-
mentsusi
ngcol
onhexnotati
onandabbrevi
ati
ngze r
oe swith
doubl
ecol
ons
.Ma nyothe
raddres
sesha
ves pec
ifi
cme anings
.

AswithI Pv
4,v endorshavec hosencert
ainIPv
6mul t
icas
ta ddr
ess
esforuse
wit
ht hei
rproducts.Althoug
hnota l
lchoi
cesareoffi
ci
all
yr eg
iste
redwiththe
Int
er netau-
thorit
yt hatcontrol
sa ddr
essi
ng,the
ya r
egeneral
lyhonore
d.

1
5.8Mul
ti
cas
tAddr
essS
ema
nti
cs

The r ule
sI P follows whe n f or warding a mul tic
ast da t
ag ram di ff
er
drama t
ical
l
yf r om ther ulesus edt of or war
duni ca s
tda tagrams.Fore xa
mp le,a
mul t
icas
ta ddre s
sc anonl yb eus eda sade s
t i
nati
ona ddres
s.Thus ,ifar outer
findsamul ti
casta ddr
essi nt hesourcea ddr
essf i
eldofada tagra
mori na nop ti
on
(e.g.
,sourcer oute),ther out e
rdr opst heda t
a gra
m.Fur ther
mor e,noI CMPe rror
me ss
agescanb eg ene
rat eda boutmul ticastda t
agra ms.Ther estri
cti
ona p
pli
e sto
ICMPe c
ho( i
.e.,p i
ngr equests)aswe lla sconven-tionalerrorssucha sdesti
na ti
on
unr e
achabl
e.The refore,ap ings e
ntt oamul ticas
ta d-dresswillgouna nswered.
Theruleprohi
b i
ti
ngI CMPe rrorsissomewha tsurpri
sing,beca
useI Pr outers
dohonort hehoplimitfi
eldinthehe aderofamul ti
cas
tda tagra
m.Asus ua
l,e ac
h
routerdecrementsthec ount,anddi sca
rdst heda tagrami fthec ountr eaches
zero.Theonlydisti
ncti
oni sthatar outerdoesnots e
nda nICMPme s
sagef ora
multi
castdatag
ram.Wewi lls
eetha tsomemult i
castprotocolsus
et hehoplimita s
awa ytolimitdata
g r
amp ropaga
tion.
S
ec.1
5.9 Ma
ppi
ngI
PMul
ti
cas
tToEt
her
netMul
ti
cas
t 327

1
5.9Ma
ppi
ngI
PMul
ti
cas
tToEt
her
netMul
ti
cas
t

Althoughthe
ydonotc overal
ltypesofnetworkhardware
,theIPmult
icast
stan- dardsdo spec
ify how to mapa nI P multi
castaddr
esstoan Ether
ne t
mult i
c astaddr
ess
.ForI Pv
4,t hemappi
ngi seffic
ienta
nde asytounde
rstand:
IANAownst heEtherne
ta d-dr
esspre
fix0x01005E.Amappinghasb
eendefi
ne d
asf ollows:

TomapanI Pv4mul t
icas
taddresstot hecor
r es
pondi
ngEthernet
mul
-tic
ast address
,pl ac
et he l
ow-order 23 bitsof the IPv4
mul
ti
cast ad-dressintot he l
ow-order 23 bit
sof t he s
peci
al
Et
hernetmul t
icas
tad-dress01-
00-5E-00-00-0016.

Fore xampl
e,t heIPv4mul tic
a s
ta ddress224.0.0.
2b e
comesEthe
rnetmulti
cas
t
address01
-00-5E-00-00-0216.
IPv6doesnotus ethes a
mema ppinga sIPv4.Infac
t,thetwov e
rsi
onsdo
note vensharet hesameMAC p r
e fi
x.I nst
ead,IPv6usestheEthe
rnetp r
efi
x
0x3333ands e
lects32bit
soft heIPmul tica
stgroupID:

TomapanI Pv6mul t
icas
taddresst ot hec or
r es
pondi
ngEthernet
mul
-tic
ast address
,pl ac
et he low-or der 32 bitsof the IPv6
mul
ti
cast ad-dressintot he l
ow- order 32 bi t
sof t he s
peci
al
Et
hernetmul t
icas
tad- dr
ess33-33-00-00- 00-0016.

Fore x
ampl
e,I
Pv 6multi
casta ddr
essFF02:09:
09:
1949:
:DC:
1woul
dma
ptot
he
Ethe
rnetMACaddre
ss33-33-00-DC-00-
01.
I
nteresti
ngly,neithert heI Pv 4norI Pv6ma ppingsareuni que .Be causeI Pv4
mul ti
-cas
ta ddressesha v
e28s ignific
antb it
st ha tidenti
fyt hemul ti
castg roup,
mor et han one mul ti
castg roup ma y ma p ont ot he same Et he rnetmul ti
c a
st
addressa tthes amet ime.S imilarly,ma nyI Pv6mul t
icas
tg roupI Dsma pt ot he
sameEt hernetmul ti
cast.Thede si
g nersc hoset hes c
hemea sac omp romise.Onone
hand,us i
ng23( IPv4)or32( IPv6)oft heg roupI Db it
sf oraha rdwar ea ddr es
s
mea nsmos toft hemul ti
casta ddr e
ssi si ncl
ude d.Thes etofa ddr es
sesi sl arge
enoug hsot hec hance
soft wog roup sc hoosi
nga ddress
eswi tht hel ow- orderb i
ts
i
de nti
calissma l
l.Ont heot he rha nd,a rrangingf orI Ptous eaf ix edpa r
toft he
Ethe r
netmul ticastaddr es
ss pacema ke sde bug ging muc he asi
era nd eli
mi na t
es
i
nt erfere
nceb e
t weenI nter netp rotocolsa nd ot herp rotocolst hats ha rea n
Ethe r
net.Thec onsequenceoft hede s
igni stha ts omemul ticas
tda t a
g r
amsma yb e
re-ceive
da tahos ttha tarenotde s
t i
ne dfort ha thost.Thus ,t heI Ps oftwa re
mus tc aref
ullyc hecka ddre sses on a lli ncomi ng da tagr
ams ,a nd disca r
da ny
unwa ntedmul t
icastda-tagrams .
TheIEEE a
ssi
gnsan Or
gani
zat
ionalUni
queI
dent
ifi
er(
OUI
)pr
efi
xtoe
achor
gani
zat
iont
hat
c
rea
tesEther
netaddre
sse
s.
328 I
nte
rne
tMul
ti
cas
ting Chap.1
5

1
5.1
0Hos
tsAndMul
ti
cas
tDe
li
ver
y

Wes ai
dt hatI Pmul ticas
tingc anb eus edonas inglep hysica lnetwor kor
throughouta ni nternet.I nt he f or merc a se
,a hos tc ans end di rec
tlyt oa
desti
nationhos tme relyb yp l
acingt heda t agrami naf r
amea ndus ingaha rdwa re
multica
sta ddre sst owhi c ht her ece iverisl i
s t
ening.Int helatte rc ase,mul ti
cast
routersar ene ede dt of or-war dc op iesofmul ti
castda tagramsa crossmul ti
p l
e
networkst oa l
lhos tsp ar ti
cip
at i
ngi namul ti
castg roup.Thus ,i fahos tha sa
datagram wi t
hs copeot hert ha nt hel oc alne t-work,t hehos tmus tsendt he
datagramt oamul ticastr outer .S ur pri
singly,ahos tdoe snotne e dtoi nstal
la
routet oamul ticastr out er,nordoe sI Ps oftwareus eade faultr out etor eacha
multica
str oute r.I nstead,t het echni queahos tus est of orwa rdamul ti
castda -
tagramt oar out eri sunl ikethef or wa r
dingf oruni casta ndb roadc astdat a
grams
a hos t me rely us est he localne twor k hardwa re
smul ticastc apabi
li
tyt o
transmit t he da - t
ag ram. Mul t
ica st r out ers lis
te n f or a llI P mul ti
cast
transmis
s i
ons;ifamul tica s
tr out eri sp resentont hene twork ,itwi llre
ceivet he
datagram a nd f o rwardi t on t oa nothe r net-wor ki f necessar y.Thus ,t he
pri
ma rydiffere nc ebe twe enloca landnonl ocalmul t
icastliesinmul t i
cas
tr outers,
notinhos ts.

1
5.1
1Mul
ti
cas
tSc
ope

Thet erm multicasts c


ope isus edf ort woc oncepts.Weus et het er
mt o
cl
ari
f ythesetofhos tsthata reli
steningt oag iv
enmul tic
astg rouport ospeci
fy
ap ropert
y ofa mul ti
casta ddres
s.I nt he c as
e ofs pecif
ying how hos tsa re
l
ocated,weus et het e
rmt oc l
ari
fywhe thert hec urrentme mb ersoft heg roup
are on one networ k,mul tipl
e ne tworkswi thin as it
e,mul tiple networksa t
multi
ple s i
tes wi thin a n or ganizati
on, mul tipl
e ne t-wor ks wi thi
n a n
adminis
trati
vel
y-definedb oundary,ora rbi
t r
ar yne twor ksint heg l
ob alInte
rnet.
Inthes ec
ondc ase,wek now thatt hes ta
nda rdss pec i
fyhow f arada tag
rams ent
to as peci
fi
ca ddresswi llp r
op aga
t e( i
.e.,t hes e tofne twor ksov erwhi cha
data
g ramsentt ot hea ddresswi l
lb ef orwarde d).I nformall
y,wes ome ti
mesus e
thetermr angeinp l
a ceofs c
op e.
IPus est wot echniquest ocont rolmul ti
castscope.Thef irs
tt echniquer el
ies
ont heda tag ra
mshopl imitf iel
dt oc ontr olit
sr ange.Bys ettingt hehopl i
mitt o
as mallva l
ue ,ahos tc a nlimi tthedi stanc etheda tagram willbef or warded.For
examp l
e,t he standa rds pecifi
est ha tc ont rolme ss
a ges,whi cha re us e
df or
communi cationb etwe enahos ta ndar out eront hes amene twork ,mus tha vea
hopl i
mitof1 .Asac onseque nce,ar out erne verforwa rdsanyda t
a gramc arrying
controlinf orma t
ion b ecauset hehopl imi tha sreachedz e
ro.S i
mi l
ar l
y,ift wo
appli
cati
onsr unningonas ing l
ehos twa ntt ous eI Pmul ti
ca stfori nt erp
rocess
communi cation( e.
g .
,f ort est i
ngs oftwa re),theyc anc hooseaTTLv al
ueof0t o
preventt heda tagramf rom l eavingt hehos t.I tisp ossi
blet ous es uc -c
essi
vely
l
a r
gerv a l
ue soft heTTLf ieldt of ur the re xte
ndt heno ti
onofs cope.Fore x-
amp l
e,s omer oute rv endor ss ugg estc onf ig
ur i
ngr oute r
sa tas itet or est
rict
multicas
tda -tagramsf rom le avi
ngt hes i
t eunlesstheda ta
gr am ha sahopl imit
greatert han1 5.Thep ointis:t hehopl i
mi tinada t
agram he aderpr ovidescoarse-
g
rai
ncont
rolov
ert
heda
tag
ram
ssc
ope
.

Inpra
ctic
e,s it
est ha
t useIP mul
tic
ast usua
ll
yconf
igur
econv
ent
iona
lrout
erst
o ha
ndl
e
mul
ti
cas
tfor-
wa rdi
nga swel
lasuni
cas
tfor
wardi
ng .
Sec
.15.
11 Mul
ti
cas
tSc
ope
329

Thesecondt ec
hnique,whi chi sknowna sa dminis
trat i
ves copi
ng,c onsi
stsof
choosi
ngmul t
icas
ta ddressesthatha vel i
miteds cope.Acc ordi
ngt ot hes tandard,
routersi
nt heInternetar eforbiddenf rom forwa r
dinga nyda ta gr
amt hatha sa n
addres
sc hosen f rom t he res t
ric
te d space. Thus ,t o p revent mul ti
cast
communicat
ion amongg roupme mbersf rom a cci
dentall
yr eachingout s i
ders,a n
organi
zat
ionc anassi
gnt heg roupa na ddres
st hatha sloca lsc
op e(e.g.,r est
rict
e d
toas i
teorr est
ric
tedt oa nor ga
ni-zation)
.

1
5.1
2Hos
tPa
rti
ci
pat
ionI
nIPMul
ti
cas
ting

Ahos
tc a
npa
rti
ci
pat
einI
Pmul
ti
cas
tatoneoft
hre
ele
vel
sasFi
gur
e15.
6
s
hows:

Le
vel Mea
ning
0 Hos
tca
nneit
hersendnorrecei
veI
Pmul ti
cas
t
1 Hos
tca
nsendbutnotrecei
veIPmult
icas
t
2 Hos
tca
nbothsendandrecei
veIPmult
icas
t

Fi
gur
e15.
6Thet
hre
ele
vel
sofhos
tpa
rti
ci
pat
ioni
nIPmul
ti
cas
t.

Ex tendi
ngI Ps of
twa ret oa ll
ow ahos tt os endI Pmul ti
cas
ti snotdiffic
ult;
provid-i
nghos ts oftwaret hatcanr ecei
veIPmul ti
castdatagramsismor ecomp l
ex.
Tos endamul t i
castda tag ram,a na ppl
i
cationmus tbea bletos uppl
yamul ti
cast
addre s
sa sade sti-nati
on.Tor ecei
vemul ticast,ana p
plic
ati
onmus tb eablet o
decl
a ret hatitwa ntstoj oinorle a
veap articul
armul ti
castg r
oup,a ndp r
otocol
softwa remus tf orwa r
dac opyofa na rr
ivingda tagramt oe ac
ha ppl
icati
ont hat
joi
ne dt heg roup .Fur t
he r more
,mul ti
cas
tda -tagramsdonota rri
vea tahos t
automa tical
l
y:l a
t ersect i
onse xplai
nt hatwhe nitj oi
nsamul ticas
tg roup,ahos t
mustus eas pecialp r
otoc olt oinform aloc almultica
str outerofitsme mb e
rship
status.Muc h oft hes oft warec omplexi
tya ri
sesf rom a nIP multicas
tde sign
deci
s i
on:

Ahos
tjoi
nss
pec
ifi
cIPmul
ti
cas
tgr
oupsons
pec
ifi
cnet
wor
ks.

Thatis,ahostwi thmulti
pl
ene t
wor kconnecti
onsmayjoinaparti
c ula
rmul ti
cast
groupononene tworka ndnotona nother
.Tounde r
standthereasonf orkeepi
ng
groupme mbers
hipa s
soc
iate
dwi thnetworks,rememberthatitisp ossi
bl
et ouse
IP multi
cas
t-i
nga monglocalset
sofma c
hines
.Thehos tma y wa ntt o us
ea
multic
astappl
icati
ont ointer
actwi t
hma c
hinesononene twork,b utnotwi t
h
ma c
hinesonanother.
Be
caus
egr
oup me
mbe
rshi
pisa
ssoc
iat
ed wi
thp
art
icul
ar ne
twor
ks,t
he
sof
twa r
emus tkeepsepara
telis
tsofmul tic
asta ddres
sesfore achnetworkt o
whichthehos ta t
-tac
hes.Furt
he r
more,ana ppli
cati
onp rog
ram mus tspec
ifya
part
icul
arne tworkwheni tas
kst ojoinorl ea
veamul ti
cas
tg roup.Ofcour s
e,
mosta ppli
cat
ionsdonotk now (orcare)aboutt hene tworkstowhi c
hahos t
att
aches,whi c
hme anstheydonotk now whic
hne t
workt os p
ecif
ywhe nt hey
needtoj oi
namul ti
cas
tgroup.
330 I
nte
rne
tMul
ti
cas
ting Chap.1
5

1
5.1
3IPv
4Int
erne
tGr
oupMa
nage
mentPr
otoc
ol(
IGMP)

We sai
dt ha
tt os end orr ecei
vei nI Pv4 mul t
icasta c
rossa s ingl
el ocal
network,ahos tonlyneedss oft
wa r
et hatal
lowsi tt ouset heunderl
yingne twork
tot r
ansmita ndr e -
cei
veI Pmul ti
castdatagrams.Howe ver,top arti
cipatei na
multi
castthats p
a nsmult i
plenetworks,thehos tmus ti nforma tleas
tonel ocal
multi
castrouter.Thel ocalroutercon-tact
so the
rmul t i
castrouters
,p a
ssingon
theme mbers
hipinf ormat
iona ndestabl
is
hingr outes
.Wewi llseethatt hec onc e
pt
i
ssimil
artoc onvent i
ona
lr outepropagat
ionamongI nternetrouters
.
Multi
castrouter
sdonota c
tunt i
latleastonehostonag ive
nne tworkjoi
ns
amul-ti
castgroup.Whe nitdeci
destoj oi
namul ti
c a
stg roup,ahos tinf
ormsa
l
ocalmulti
castr out
er .An IPv4 host usesthe Inter
net Gr oup Management
Pr
otocol(
IGMP) .Becausethecurr
entv e
r s
ionis3,thep rotoc
olde s
cri
bedhereis
of
fic
ial
lyknowna sIGMPv 3.
I
GMPi sas tanda
rdf orIPv
4;itisrequiredona l
lma chi
nesthatrec
eiveIPv4
multi
-cas
t(i.
e.,a l
lhostsandroutersthatpa rt
ici
patea tl e
vel2).IGMPus esIP
dat
agramstoc a
rr yme s
sage
s.Further
mor e
,wec onside
rI GMPt ob eas e r
vic
e
tha
ti si
ntegr
atedwi thIP,anal
ogoustoICMP.The r efore,weshouldnotthinkof
IGMPa saprotocolusedbyarbi
traryappl
i
cations:

Alt
houghi
tusesIPdatagramst
ocarr
ymess
ages,wet hi
nkof
IGMPasanintegr
alpartofIPv
4,notani
ndependentpr
otoc
ol.

Conc e
p tual
ly,I GMPha st wop hases
.Pha se1 :Whe nitj oinsane w multic
ast
group ,ahos ts endsa nI GMPme ssagetot heg roup
smultica sta ddressdeclari
ng
it
s me mbership
. Loc almul ti
castr outersr eceivet he me ssa g
e,a nd e s
tabli
sh
necessaryr out-ingb yp r
op agati
ngt heg roupme mbershi
pi nf orma ti
ont oot her
multicastr outerst hroughout the Interne t
.Pha se 2:Be caus e me mbershi
pi s
dyna mic,localmul ticastrout e
rsp eri
odic
allyp ollhostsont hel ocalne tworkt o
determinewhe the ra nyhos tsstil
lre mai
nme mb ersofe achg roup .Ifa nyhos t
respondsforag iv eng r
oup,t herouterk eepstheg r
oupa c
tive .Ifnohos tre p
orts
me mb er
shi
pi nag r
oupa fters e
veralpoll
s,themul ti
cas
tr o
ute ra ssume sthatnone
oft hehos tsont hene tworkr ema i
ni ntheg roup,a ndstop sa dvertis
ingg roup
me mb er
shi
pt oot hermul t
icastrouters.
Tof urthercomp l
icat
eg roupme mbe rshi
p,I GMPp ermitsa na ppli
cati
onona
hostt oinstala s
l ourceaddr essf i
lt
ert hats pecifi
eswhe the rt hehos tshould
incl
udeore x-cl
udemul ticas
tt ra
fficf rom ag ivens ourcea ddr es
s.Thus,iti s
possi
bl
et oj oi
namul ti
-castg roup,b utt oe xc
ludeda tag
ramss entt otheg roup
byag ivensource.Thep rese
nceoff i
ltersisimp ortantb ec
auseI GMPa ll
owsahos t
top assthes etoff il
ters pec
ificati
onst ot hel ocalmul ti
cas
tr outera l
ongwi th
groupme mb er
shi
pi nformati
on.I nt hec asewhe retwoa ppl
ic
at i
onsdi sag
ree(i.e.
,
onea ppl
i
cationexcl
ude sag i
vens ourcea nda notheri nc
ludesthes our ce
),soft
wa re
ont hehostmus tr ati
onali
zet het wos pecifi
ca-ti
onsa ndt henha ndl
et hedeci
s i
on
aboutwhi c
ha ppl
ica
t i
onsreceiv
eag ivenda tagra
ml ocal
ly.
S
ec.1
5.1
4 I
GMPDe
tai
l
s 331

1
5.1
4IGMPDe
tai
ls

I
GMP i sc aref
ull
y desi
gnedtoa v
oida ddi
ng overhe
adt hatcancongest
networks
.I np ar
tic
ular
,b ec
auseag i
venne t
wor kcanincl
udemul ti
pl
emulti
cast
router
sa swellasmulti
pl
ehoststha
tp ar
tic
ipateinmult
icas
ting,IGMPmustavoid
havi
ngp arti
ci
pantsgenera
teunneces
sarycontroltr
affi
c.The r
ea resev
era
lwa ys
IGMPmi nimi
zesitseffe
ctont henet
work:

Allcommunicati
on between hos
tsa ndmulti
castroute
rsus esIP
multi
-cas
t.Thatis,whe nsendi
ngme ss
ages
,IGMPa l
waysusesIPv4
multi
-cas
t.The refor
e,da tagra
ms c a
rryi
ng IGMP me s
sage
sa re
trans
mittedusingha rdwar
emul ti
castifitisa v
ail
abl
e,me ani
ng
that a host whic
hi snot p arti
ci
pati
ng inIP multi
cast nev
er
recei
vesIGMPme ssage
s .

Whenp o
lli
ngt odeter
mineg roupme mber
shi
p,amul t
icas
tr outer
se
ndsa s i
ngle que
ryt or equestinfor
ma t
ion ab
out al
lg roups
i
nstea
dofs end-i
ngas ep
arat
eme s
sagetoeach.Thedef
aultpoll
ing
rat
ei s125s ec
onds,whichme ansthatIGMPdoe snotg enerate
muchtraffi
c.

Ifmultipl
emulti
cas
tr outer
sa tt
achtot hes a
mene t
work,they
quic
klya nd e
ffi
cie
ntl
yc hoos
eas i
ngl
er outert opollhost
memb e
rshi
p,whi
chme a
nst heIGMPt raf
ficonane t
workdoesnot
inc
reasewhenmoremultic
astrouter
sareadded.

Hostsdonotr espondtoar outer


sIGMPque rys i
multaneousl
y.In-
stead,e ac
hque rycontai
nsav a l
ue,N,t hatspeci
fiesama xi
mum
responsetime(thede f
aultis1
0s econds
).Whe naque rya rri
ves,a
hostc hoos
esar andom de
laybetween0a ndNt hatitwa it
sb e
fore
sendingar esp
onse.Ifahos tisame mbe
rofmul ti
pl
eg roups,the
hostc hoosesadiffe
rentr a
ndom numb e
rf orea c
h.Thus ,ahos t
s
responsetoar outer
squerywillbespac
edov r1
e 0seconds.

Ifahostisame mb
erofmulti
pl
emult
icas
tgroup
s,t hehos
tca
n
se
ndr e-
port
sformult
ipl
egr
oupmemb
ershi
psi
nas ing
lepack
etto
mini
mizetr
affi
c.

Al
thoughsuchc aref
ula tt
ent i
ont odet
ailmays e
e m unnec
essa
ry,t hedynamic
na-t
ur eofIPmul tic
astme anstha tt hemessagesexchangedoverag i
ve nnetwor
k
depe
ndona ppl
ic
ations.So,unlik
er outingprot
ocol
swhe rethetraffi
cde pe
ndson
thep r
otocol
,IGMPt raffi
cde pendsont henumb e
rofmul ti
castgroupstowhi c
h
appl
i
c a
tionsareli
steni
ng.
332 I
nte
rne
tMul
ti
cas
ting Chap.1
5

1
5.1
5IGMPGr
oupMe
mbe
rshi
pSt
ateTr
ans
iti
ons

Onahos t
,I GMPmus tr e
me mbert hes ta
tusofe achmul ti
castgr ouptowhi c
h
thehos tb elongsa l
ongwi tht hes ourcef i
ltersassocia
t edwi t
he achg r
oup.We
think of a hos ta sk eeping a t a
b l
ei n whi c
hi tr ecords group me mb e
rshi
p
i
nf orma ti
on.I ni
tial
ly,a l
le ntri
e sint het abl
ea reunus ed.Whe nevera na pp
li
cati
on
prog ra
m ont hehos tj oinsane wg roup ,IGMPs oftwa r
ea ll
ocatesa ne ntryand
fi
llsini nforma t
iona boutt heg roup,includi
nga ddr e
ssf i
lte
r sthatt hea pp
li
cati
on
hass p
ec i
fied.Whe na na p pl
i
c ation leav
e sag r
oup ,t hec orres
pondi ngentryi s
remov edf rom t het able.Whe nf ormingar e
port,t hesoftwa reconsultsthet a
ble,
rationali
zesa l
lf i
lt
ersf orag roup ,andf ormsas inglere p
ort.
Theact
ionsI
GMPsoft
wa r
etake
sinres
pons
etovar
iouse
vent
sca
nbe
stb
eex
-
pla
inedb
yt hest
atet
rans
iti
ondi
agrami
nFigur
e15.
7.

anot
herhos
tres
ponds/c
anc
elt
ime
r

j
oingr
oup/s
tar
tti
mer t
imerexpi
res/s
endr
espons
e

NON- DELAYI
NG
MEMBER
MEMBER MEMBER

l
eavegr
oup/c
anc
elt
ime
r quer
yar
rives/s
tar
tti
mer

r
efer
enc
ecountbec
omeszer
o/l
eav
egr
oup

Fi
gur
e15.
7Thet hre
ep os
sib
lestate
sofa ne nt
ryi nahos t
smul ti
cast
g
roup tabl
ea nd t r
ansi
ti
ons among t he
m, whe r
ee ac
h
t
ransi
ti
onisla-
bele
dwi t
ha neve
nta ndana ct
ion.Thes tate
t
ransi
ti
onsdo nots how mes
sagess e
ntwhe nj oining a
nd
l
eavi
ngag r
oup.

Ahos tmaintai
nsa nindepende nttabl
ee ntryforeachg roupofwhi chitis
currentl
yame mber.Ast hef i
gures hows,whe nahostf i
rstj oi
nstheg r
oupor
whenaque ryar-r
ivesfrom amul t i
cas
trouter,thehostmov estheentryt othe
DELAYING MEMBER s tatea ndc hoosesar andom del
ay.Ifa notherhostint he
groupr es
pondstot heroutersque rybeforethet i
mere x
pir
es ,thehostcancel
s
i
tst imerandmov estotheMEMBERs t
ate.Ifthet i
merexpir
es ,thehostsendsa
respons
eme ssagebeforemov i
ngt ot heMEMBER s tate
.Be causear outeronly
generatesaque rye ve
ry1 25 s econds,onee x-pe
ctsahos tt oremainint he
MEMBERs ta
temo stofthet ime.
Thedia
gramin Fi
gure1
5.7omitsaf ew de
tai
ls
.Forexa
mp l
e,ifaquery
a
rri
veswhil
ethehos
ti si
ntheDELAYING MEMBER s
tat
e,t
hep r
otoc
olr
equi
res
t
hehosttores
eti
tstimer
.
Thea
llsys
temsgr
oup,224.
0.0.
1,i
sane
xce
pti
on ahos
tne
verr
epor
tsme
mbe
rshi
pin
tha
tgroup.
S
ec.1
5.1
6 I
GMPMe
mbe
rshi
pQue
ryMe
ssa
geFor
mat 333

1
5.1
6IGMPMe
mbe
rshi
pQue
ryMe
ssa
geFor
mat

I
GMPv3 defi
nest wo mess
aget ype:a me
s mbershi
pquer y mess
aget hata
r
outersendstoprobeforg r
oupme mbers
,andame mbershipr
eportmessag
et ha
t
a hostgen-er
atestor e
portt he gr
oupsthata pp
lic
ationson the hosta r
e
c
urrentl
yusing
.Figure15.
8ill
ustra
testhememb
ershi
pque ryme s
sagefor
ma t.

0 8 1
6 31
TYPE(
0x1
1) RES
PCODE CHECKS
UM
GROUPADDRES
S
RES S QRV QQI
C NUM S
OURCES
S
OURCEADDRES
S1
S
OURCEADDRES
S2
.
.
.
S
OURCEADDRES
SN

Fi
gur
e15.
8Thef
orma
tofa
nIGMPme
mber
shi
pquer
ymes
sag
e.

Asthefi
gur eshows,ame mbe
rshi
pque r
yme s
sag
ebeg
inswit
haf i
xed-
size
headeroftwel
veoc t
ets.Fi
edTYPEi
l denti
fi
esthetypeofmes
sag
e,wit
hthetypes
forvari
ousve
rsionsofIGMPlis
tedinFig
ure15.9.

Type Pr
otoc
olVe
rs. Meaning
0x11 3 Members
hipque r
y
0x22 3 Member
shipreport
0x12 1 Member
shipreport
0x16 2 Member
shipreport
0x17 2 Le
avegroup

Fi
gur
e15.
9IGMPmess
agetype
s.Forb
ack wa
rdcomp
ati
bi
li
ty,ve
rsi
on3
oft
hep
rotoc
olinc
lude
sver
sion1and2messa
getypes
.

When ar outerp ol
lsf org roupme mb e
rship
,t hef i
eldlabeled RESP CODE
specifi
esama ximum interv
alf ort herandom de l
ayt hatg roupme mb er
sc omp ute.
Ift hef i
el
ds t
a rt
swi tha0b it,thev alueist akent ob ea nintegerme a
s uredi n
tenthsofs econds;i fthef ieldb egi
nswi tha1 ,t hev aluei saf loati
ngp oint
numb erwi tht hreebitsofe x-ponenta ndf ourb i
tsofma ntis
sa.Ea c
hhos tint he
group de l
ays a r a
ndom t ime b etween ze roa nd t he specif
iedv alue b e
f ore
responding.Aswes aid,thedef aul
tv al
uei s10s econds,whichme ansa l
lhos t
si na
groupc hoosear a
ndom v al
ueb e t
we en0a nd1 0.I GMPa l
lowsr outerstos e ta
ma x
imumv alueine achqueryme ss
a g
et og i
vema na gers
334 I
nte
rne
tMul
ti
cas
ting Chap.1
5

controloverI GMPt raffi


c.I fane t
wor kc ontainsma nyhos ts
,ahi gherde l
ayv alue
furthers preadsoutr e
spons et i
me s,andt herebyl owe rsthep r
ob abi
li
tyofha ving
mor et han one hos tr espond t ot he que ry.The CHECKS UM f iel
dc ontai
nsa
checksum fort heme s
sage( IGMPc hecksumsa r
ec omp utedovert heIGMPme ssage
only,a ndus et hes a
me1 6-b i
tone
sc omp l
eme nta lgori
thm asI P).TheGROUP
ADDRESSf ie
ldi seitheruse dt os peci
fyap a
rticularg rouporc ont ai
nsze rof ora
generalque ry.Tha ti s
,whe ni ts endsaque r
yt oas pe
cifi
cg rouporas pecifi
c
groupa nds ourcec omb i
nation,ar outerf ill
sint heGROUPADDRES Sf i
e d.TheS
l
fie
ldi ndic
ateswhe therar out e
rs houlds upp r
e sst henor malt i
me rup datest hat
arep erformedwhe na nup dat earrives
;t heb itdoe snota ppl
yt ohos t
s.Fi edQRV
l
controlsrobus t
nessb ya l
lowi ngI GMPt os endap acketmul ti
plet i
mesonal ossy
networ k.Thede faultvaluei s2;as ende rt ransmi tstheme s
sageQRV1t i
me s
.
Fied QQI
l Cs pecif
iest he Que rier
s Que ryI nt erval( i.
e.,t he time b etwe en
me mbershipque ri
es).QQICus est hesamer epresent ati
ona sfiedRES
l PCODE.

Thel astpartofa nI GMPque ryme ssagec onsi


stsofze roormor esource s
;
fied NUM S
l OURCESs pecifi
est henumb e
rofe ntr
iest ha
tf ol
low.EachS OURCE
ADDRESSc onsi
stsofa32- bitI Pa ddress.Thenumb erofs ourcesi
sze roina
generalquer y(i
.e.
,ar eques
tf r om ar out erf orinformationaboutal
lmul ti
cast
groupsinus eo nthene twork)a ndi nag r oups peci
ficquery(i.
e.,arequestfrom
ar outerf orinformati
ona boutas peci-fiedmul tic
as tgroup.Forag
) r
oupand
sources peci
ficquery,t heme s
s agec onta i
nsal is
tofoneormor esources;a
routerus essuchame s
saget or eque s
tr eceptions tatusforac ombi
nati
onoft he
multica
stg roupanda nyoft hes p e
cifi
eds ource s.

1
5.1
7IGMPMe
mbe
rshi
pRe
por
tMe
ssa
geFor
mat

Thes econdt yp eofme ss


ageus e
dwi thIGMPv 3isame mbershipr epor tt hat
hostsus et op assp arti
cipat
ions tatust oar outer.Fig ure1 5.10i llust
ra t
est he
forma t.Ast hef i
gures hows,ame mb ershi
pr epor tmes s
a gec onsi
st sofa n8- octet
headert hats peci
fi
e stheme ssaget ypea nda ni ntege
rc ountofg r oupr ecords,K,
fol
lowe db yKg roupr ecords.Fi gur e1 5.1
1i l
lustrate
st hef or matofe achg r
oup
record.Thef ormati sstrai
ghtfor wa rd.Thei nitialfi
eld,l a
be ldRECTYPE,a
e ll
ows
these ndertos pecifywhe thert hel is
tofs ourc esinther ecordc or r
e sp
ondst oa n
i
nc l
usivefil
t er,a ne xcl
usivefilter,orac hang einap reviousr eport( e.g.,a n
addit
ionals ourcet ob ei ncl
ude d or e x-c
lude d).The f i
el
dl abeled MULTI CAST
ADDRESSs pecif
iest hemul ti
casta ddr e
s stowhi chtheg roupr e
c ordr ef
e rs
,a nd
the fieldlab el
ed NUM OF S OURCES s peci
fie
st he numb erofs our cea ddresses
containedint heg roupr ec
ord.
Itisimport
antt onotethatIGMPdoe snotprovideallp oss
ibl
eme ss
agesor
faci
li
-ti
es.Forexample,IGMPdoesnotincludeame chani
smt hatall
owsahos tto
dis
covertheI Paddres
sofag r
oup a ppl
i
c at
ionsoftwaremus tknow thegroup
addres
sb efor
eitc anus eIGMPtoj ointheg roup.Thus,s omea p
pli
cati
onsuse
permanentl
ya ss
igne
dg r
oupaddre
sses,somea l
l
ow ama na
g ert oc onf
igurethe
a
ddres
swhe nthesoft
wa reisins
tal
led,andothe
rsobt
aintheaddr
essdynami
cal
ly
(
e.g
.,from aserv
er)
.S i
mila
rly,IGMPv3doesnotprov
ideexp
li
citmessa
gesahost
c
aniss
uet ole
aveag rouport oli
ste
nf oral
lcommuni
cati
ononag roup.I
nst
ead,
t
oleaveagroup,ahostsendsa
S
ec.1
5.1
7 I
GMPMe
mbe
rshi
pRe
por
tMe
ssa
geFor
mat 335

me mbers
hipreportmessa
get ha
tspec
ifi
esaninc
lus
ivefil
terwit
ha ne mptyIP
sourceaddres
sl i
st.Toli
ste
nt oal
lsource
s,ahostsendsame mbers
hiprepor
t
me ss
agethatspeci
fi
esanexcl
usi
vef
il
terwitha
nemptyIPs our
ceaddr
essli
st.

0 8 1
6 31
TYPE(
0x22) RES
ERVED CHECKS
UM
RES
ERVED NUM GROUPRECORDS(
K)

Gr
oupRe
cor
d1

Gr
oupRe
cor
d2
.
.
.

Gr
oupRe
cor
dK

Fi
gur
e15.
10Thef
orma
tofa
nI 3me
GMPv mber
shi
prepor
tmes
sag
e.

0 8 1
6 31
RECTYPE ZEROES NUM OFS
OURCES
MULTI
CAS
TADDRES
S
S
OURCEADDRES
S1
S
OURCEADDRES
S2
.
.

.
S
OURCEADDRES
SN

Fi
gur
e15.
11Thefor
ma tofea
chgroupr
ecor
dwi
thi
nanI 3me
GMPv mber
-s
hiprepor
tmess
age
.

1
5.1
8IPv
6Mul
ti
cas
tGr
oupMe
mbe
rshi
pWi
thMLDv
2

IPv6doesno
tus eI
GMP.I ns
tea
d,i
tdefi
nesaMulti
cas
tLi s
tenerDisc
overy
Pr
oto-c
ol.Thecurr
entver
sion i
s2,and t
hep r
otoc
olisa b
brevi
ated MLDv2.
Desp
itethec hang
es,IPv4andIPv
6usee
sse
nti
al
lyt
hes a
mea ppr
oach.I
nf a
ct,
theMLDv2s tandards
t a
testha
tMLDv
2ismere
lyatra
nslat
ionofIGMPt ouse
IPv
6s emant
ics.
Ahostus
esMLDv
2t oinf
orm mul
ti
cas
trout
ersont
hel oc
alnet
workofthe
hos
tsg
roupmemb
ers
hip
(s)
.AsinI GMP,onc
eahostannouncesmemb
ers
hip
,a
r
out
eront
he
336 I
nte
rne
tMul
ti
cas
ting Chap.1
5

networ kusesMLDv 2t op ollthehos tperiodical


lyt ode te
rminewhe therthehost
i
ss til
lame mbe roft heg roup(s)
.As e
tofmul tic
astr outersonag ivennetwork
cooperatet oc hooseoneque r i
err outert hatwi lls endp er
iodicque r
ies;ifthe
currentque ri
err outerf ai
ls,anothermul ticas
tr out eront hene tworkt a
kesover
ther esp
onsibi
lity.
MLDv 2de finesthreet ypesofque ryme s s
agest hatrout e
rss end:General
Quer i
es,
Mul t
icas
tAddr essSpecifi
cQuer ies,and Mul t i
castAddr essand Sour ceSpecifi
c
Quer i
es.Aswi thI GMP,at ypi
c a
lmul ti
castr outers endsgeneralque ri
eswhichask
hostst or espond bys p
ec i
fying multi
c a
stg roupst o whicht heya relist
eni
ng.
Figure15.12il
lus -
tratesthef orma tofa nMLDv 2que ryme ssage.

0 8 1
6 31
TYPE(
130) CODE(
0) CHECKS
UM
MAXI
MUM RES
PONS
ECODE RES
ERVED

S
PECIFI
CMULTI
CASTADDRES
S
ORZEROFORAGENERALQUERY

RES
V S QRV QQI
C NUMBEROFS
OURCES(
N)

S
OURCE1ADDRES
S

. .
. .
. .

S
OURCENADDRES
S

Fi
gur
e15.
12Thefor
matofanMLDv 2querymessage
.Amult
icas
trout
er
sendssuc
h mes
sagest o de
ter
mine whet
her hos
tson a
networkar
epa
rtic
ipa
tinginmulti
cas
t.

Asme nt
ione
de ar
li
e r
,t heQQICfie
ldspeci
fi
esaqueryinte
rval
.I nagene
r a
l
query,thereisnos peci
ficmulti
cas
ta ddr
ess,sothefie
ldissett ozer
o,a nd
beca
uset her
ea renos ources
,theNUMBEROFS OURCESfie
ldcont
ainsze
roa nd
theme s
sagecontansnoS
i OURCEADDRESSfiel
ds.
S
ec.1
5.1
8 I
Pv6Mul
ti
cas
tGr
oupMe
mbe
rshi
pWi
thMLDv
2 337

Whenaque rya rr
ives
,ahos tfoll
owst hesameste p
sa sinI GMP:thehos
t
del
aysar andom t
imea ndanswer
sb ysendingar e
plythats pe
cif
iesthemul
ti
cas
t
addres
sestowhi c
ht hehosti sst
il
llis
tening.Thereplyc ons
issofaMul
t ti
cas
t
Lis
tenerReportmes-
sage.Fig
ure15.1
3s howsthegener
a lformat.

0 8 1
6 31
TYPE(
143) RES
ERVED CHECKS
UM
RES
ERVED NUMBEROFRECORDS(
N)

MULTI
CAS
TADDRES
SRECORD1

. .
. .
. .

MULTI
CAS
TADDRES
SRECORDN

Fi
gur
e15.
13 Theg
ene
ralf
ormofaMul
ti
cas
tLi
ste
nerRe
por
tme
ssa
ge.

Inste
adofme rel
ylist
ingmul ti
casta ddresse
st owhicht hehos tisl is
teni
ng,
theMul ti
castListenerRe ports peci
fiesal is
tofmul ti
cas
ta ddressr ec
or ds.Each
recordont hel i
sts p
ecif
iest hemul tic
asta ddressofag roupf ol
lowedb yas eri
es
ofuni c
astad-dre s
sesonwhi c hthehos tisl i
steni
ng.Itma ys e em oddt hatahos t
speci
fiesmor et han oneuni cas
ta ddressb ec
a usemosthos tsa resingly-homed.
Thus,wewoul de xpectahos ttoha veonlyoneuni c
asta ddr es
s.Howe ver,IPv6
all
owsahos tt oha vemul t
iplea ddress
eson as i
ngl
ene twor k.The re fore,the
Lis
tenerRe porta l
l
owsmul tipleaddressespere ntry.

1
5.1
9Mul
ti
cas
tFor
war
dingAndRout
ingI
nfor
mat
ion

Alt
houg hIPsmult
ica
staddressi
ngs chemea l
lowsahosttos e
nda ndrecei
ve
l
ocalmul t
icast
sa ndIGMPorMLDv 2a ll
ow ar outertokee
pt rac
kofhos tsona
l
ocalne t
-wor kthatareli
ste
ningt omulticastgroups
,weha venotspeci
fi
edhow
mult
icastr outer
se x
changeg r
oupme mbe r
shipinfor
mat
ionorhow t her out
ers
ens
ur ethatac opyofeachmultic
astdatag r
amr eache
sal
lgroupme mb
ers.
Inter
est
ingl
y,s ever
alp r
otocol
shaveb eenp r
oposedt hata ll
ow r outersto
e
xchangemulti
castrouti
nginformati
on.However,nosingl
es t
anda rdha se mer
ged
a
st heleade
r.I nf ac
t,a l
thoughmuc hefforthasb eene xpended,t hereisno
a
greementona noveral
ldesi
gn e xi
sti
ngprotoc
olsdif
ferint he i
rg oal
sa ndbasi
c
a
pproac
h.Consequentl
y,multic
asti
ngisnotwidel
yus e
di ntheg lobalInternet
.
338 I
nte
rne
tMul
ti
cas
ting Chap.1
5

Whyi smul ti
cas
tr outingsodif f
icult
?Whynote x t
endc onve nti
onalrouti
ng
schemest o handl
e mul t i
cast
? The a nswerist hatmul ti
castr outing pr
otocols
diff
erf r
om conventiona lrouti
ngp rotocol
sinfundamentalwa ysbe ca
usemul ti
cast
forwardi
ng differsf rom c onvent
iona lforwar
ding.To a pprec
iates ome oft he
diff
erences
,c onsi
dermul t
icas
tf or
wa rdingove
rt hear
c hi
tecturet hatFig
ure1 5.1
4
depic
ts.

ne
twor
k1

R B C D E
ne
twor
k3
ne
twor
k2

F G

Fi
gur
e15.
14As impl
einternetwitht hreenetworksc onnec
tedbya
route
rthatil
lustr
atesmulti
cas
tforwa r
ding.Hostsmarke
d
withadotp a
r t
ici
pat
einonemul ti
castg roup,whil
ethose
markedwit
ha nXparti
ci
p a
teinanother.

1
5.1
9.1Ne
edForDyna
micFor
war
ding

Evenf orthes imp l


et opol
ogys howni nFi gure1 5.14,multi
castforwarding
diff
ersf rom unica s
tf orwa r
ding.Fore xamp l
e,t hef ig
ur eshowst womul ti
cast
groups:theg r
oupde notedb yadotha sme mb e
rsA,B,a ndC,a ndt heg roup
denotedb yac rossha sme mbersD,E,a ndF.Thedot tedg rouphasnome mb e
rson
network2.Toa voidne edles
st r
ansmissi
ons,r outerR s houl
dne ve
rs e
ndp a
ckets
inte
ndedf orthedot t e
dg r
oupa cr
ossne twork2.Howe ver,ahostc anjoina ny
groupa ta nyt i
me i ft hehostist hef irs
toni tsnet worktojointheg roup,
multic
astf orwardingmus tb echangedtoi n-cl
udet hene twork.Thus,wec omet o
ani mporta ntdiff
e renceb etwee
nc onvent i
onalrout ep ropag
ati
ona ndmul ti
cast
routep r
op agat
ion:

Unli
keunicastforwardingi
nwhic hrouteschangeonl
ywhent he
to-pol
ogy changes or equi
pment fail
s, multi
cas
tr out
es can
changesim-pl
ybec auseanappl
icati
onpr ogr
am joi
nsorleav
esa
multic
astgroup.
S
ec.1
5.1
9 Mul
ti
cas
tFor
war
dingAndRout
ingI
nfor
mat
ion 339

1
5.1
9.2I
nsuf
fic
ienc
yOfDe
sti
nat
ionFor
war
ding

The ex amp l
ei n Fi g
ure1 5.14 il
lustra
t esa not hera s
pect of mul ti
cast
forwardi
ng.I fhostFa ndhostEe ac
hs endada tagramt ot hecrossgroup,router
R willrece
iv ea ndf or
wa rdt hem.Be ca
useb ot hda tag r
amsa r
edi rec
t e
da tt he
same group,t hey havet he s ame des
t i
nati
on a ddr ess
.Howe ver,t he c
orrect
forwardi
nga c
tionsdiffe:Rs
r endstheda tagr
a mf r om Et onetwor k2,a ndsends
theda ta
gramf rom Ft one twork1 .Interes
t- ingl
y,whe nitr ec
eivesada tagr
am
desti
natedf ort hecrossgroups entb yhostA,t her outerus esat hi
rda ct
ion:it
forwardstwoc opie
s,onet one twork1a ndt heot he rt one t
-wor k2.Thus ,we
seethes econdma j
ordi f
ferenceb etweenc onv entionalf orwardi
nga ndmul ti
cast
forwardi
ng:

Unl
ikeunicas
tfor
wardi
ng,multic
astfor
wardi
ngr
equi
resar
out
er
toexaminemorethanthedes
tinati
onaddr
ess
.

1
5.1
9.3Ar
bit
rar
ySe
nde
rs

Thef i
nalf e
atur
eofmul ti
cas
tforwa rdi
ngil
lustra
tedb yFigure15.1
4a ri
ses
becauseIPa l
lowsana rbi
trar
yhost,onet hatisnotne ces
sar
il
yame mberoft he
group,t os e
ndada tagramt otheg roup.Int hef i
gure,hos tG cans enda
datagramt othedottedg r
oup,eventhoughG isnotame mberofa nyg r
oupa nd
therearenome mber
soft hedottedgrouponG snetwork.Mor eimpor
tant,asit
travel
sthroug htheinte
rnet,thedat
a gram maypa s
sa c
rossothernetworksthat
havenog roupme mbersattac
hed.Weca nsum-marize:

Amulti
cas
tdat agr
am mayorigi
nateonac omputert hatisnot
par
t of t
he mul t
icas
t gr
oup,and may be forwarded acr
oss
net
worksthatdonothaveanygroupmembersatt
ached.

1
5.20Ba
sicMul
ti
cas
tFor
war
dingPa
radi
gms

Wek nowf rom thee xamp l


ea b ovet hatmultica
str out
e r
smus tus emor etha n
ade s-ti
nation addresswhe np roc essi
ngada t
agram.Ex actl
y wha ti nformation
doesamul ti-cas
tr outerus ewhe nde ci
dinghow t of orwardada tagram?The
answerl i
esi nunde r-sta
ndingt hatb ec
a useamul tic
astde st
inati
onr e p
resentsa
setofc omp uters,anop ti
ma lfor wa rdi
ngs ystem wil
lreacha l
lme mbersoft hes et
withouts ending ada tagrama c rossag i
ven networkt wice.Althoug h as i
ng l
e
multic
astr out e
rs ucha st heonei n Figur
e1 5.14c ans i
mp l
ya voids endi
ng a
datagramb a c
kov ert heinte r
fa ceonwhi chita rr
ives
,us i
ngt heint e
r fac
ea l
one
wil
lnotp r
e ventada t a
gramf rom b ei
ngf orwardeda mongas etofr out e
rst hat
area r
rangedi nac ycle.Toa voids uchfor wardi
ngloops,multicas
tr outersrelyon
t
heda
tag
ram
ssour
cea
ddr
ess
.
340 I
nte
rne
tMul
ti
cas
ting Chap.1
5

Oneoft hef i
rs tide astoe mergef ormul ticas
tf orwa rdingwa saf orm of
broadc as
t-ingde sc
ribede arl
ie
r.Knowna sRe versePat hFor war di
ng (RPF),the
s
c hemeus esada tagram ssourcea ddresstop r
e ventt hed atagramf rom tr
a v
eli
ng
around a l oop repeat- edl
y. To us e RPF, a mul t i
cas
tr out er must havea
conve nti
ona lunica
stf orwa rd
ing t ab
lewi ths hor t
estp athst oa l
ldesti
na t
ions
.
Whe nada t agr
ama r ri
ves,t her outere xtr
actst hes ourc
ea ddress,l
ooksitupi n
i
t suni cas
tf orwardingt ab l
e,andf indsI,t heint erf
a c
et hatl eadstothes ource
.
I
ft heda tagrama rrivedov erint er
faceI ,ther outerf orwar dsac opytoe achof
theot he
ri nterf
aces;ot herwise,ther outerdis
c ardsthec opy.
Beca
us eitens uresthatac opyofe ac
hmul ti
castdatag
ra mi sse
nta c
ross
everynet-workina ninter
net,theb a
sicRPFs chemeg uara
nteesthateveryhos
t
i
namul ticas
tg roupwi llrec
eiv
eac opyofe a
c hda ta
grams entt othegroup.
Howe v
er,RPF a l
o ne isnotus edf ormul ti
castf orwardi
ng becauseitwastes
networkc ycl
esbys e
ndingmulti
cas
tda tagramsov erne t
workst ha
tne i
the
rha v
e
groupme mbersnorl eadtogroupmemb ers
.
To a voidp rop aga ti
ng mul t i
ca s
tda tagr
amswhe ret he ya renotne eded ,a
mod i
fiedf ormofRPFwa sinv ented.Knowna sTrunc atedRev ersePat hFor war di
ng
(TRPF)orTr uncatedRev ersePat hBr oadcasti
ng( TRPB) ,t hes chemef ol
lowst he
RPFa l
gorithm,b utf urtherr e st
r ic
tsp ropagati
onb ya voidingp athst hatdonot
l
e adt og roupme mb ers.Tous eTRPF,amul ticastr oute rne edst wop ie
cesof
i
nf ormation:a c onv ent i
onaluni castf orwarding t abl
ea nd a l i
stofmul ticast
groupsr ea chabl
et hroug he achne t
wor ki nter
-face.Whe namul ticastda tagram
arriv
e s
,t her outerf i
r stappliestheRPFr ule
.I fRPFs peci
fiesdi scardingt hecop y,
the route rdoe ss o.Howe ver,i fRPF s pe
cifi
ess endi
ng t he da tagram ov era
partic
ulari nterface ,t her outerma ke
sa na dditi
ona lcheckt ov er
ifyt hatoneor
mor eme mb e r
soft heg roupde si
g natedint heda tagr a
m sde stinationa ddressa re
reachabl
ev iathe i nt er
face .I f no g roup me mb ersa rer eacha b
le ov ert he
i
nt erfac
e,t her out ers ki
pst hati nterface,andc ont i
nue sex ami ni
ngt hene xtone .
Inf act,wec annow unde r
s t
a ndt heor i
ginoft het ermt r uncated ar out er
truncatesf orwardingwhe nnog r
oupme mb ersli
ea longt hep a th.
Wec
ans
umma
rize
:

Whenmaki ngaf orwardi


ngdecis
ion,amul ti
castrout
erusesboth
the datagram
ss our
ce and destinat
ion addres
ses
. The basi
c
mechani
sm i s known as Truncated Revers
e Path Forwardi
ng
(
TRPF) .
Revers
epa
thf
orwa
rdi
ngi
ssome
time
sca
ll
edRe
ver
sePat
hBr
oadc
ast
ing
(RPB)
.
S
ec.1
5.20 Ba
sicMul
ti
cas
tFor
war
dingPa
radi
gms 341

1
5.21Cons
eque
nce
sOfTRPF

Al
thoughTRPFg uarante
estha
te ac
hme mberofamul ti
castgr oupre c
eivesa
copyofe achdatagrams enttotheg r
oup ,itha stwos urpri
singc onsequences.
Fir
st,becausei
tr e
li
e sonRPFt opreventloops,TRPFde li
versa ne xtr
ac opyof
datagr
amst osomene t-worksj
ustli
kec onvent
ionalRPF.Figure1 5.15il
lustra
t e
s
howdup l
icat
escanaris
e.

ne
twor
k1

R R
1 2

A
ne
twor
k2 ne
twor
k3

R3 R4
ne
twor
k4

Fi
gur
e15.
15Atopol
ogyt
hatcaus
esa
nRPFs c
he metodel
i
vermul
ti
pl
e
copi
esofadat
agr
amtosomede
stinat
ions
.

Int hef i
gure,whe nhos tAs endsada tagram,r outersR1a ndR2 e ac
hr ecei
ve
ac opy.Be causet heda t
a g
rama rrivesov ert hei nt e
rfac et ha tl iesa l
ong the
sho
r t
estp atht oA,R1f orwardsac opyt one twork2,a ndR2 f or wardsac op yto
network3.Whe ni tre c
e i
vesac opyf r
om ne twork2( t
hes hortestp at
ht oA) ,R3
for
wa rdst hec opyt one twor k 4.Un- fort
una t
ely,R4 a l
sof orwa r
dsac op yto
network4.Thus ,a l
thoughRPFa l
lowsR3 a ndR4 t op re
ve ntal oopb ydiscardi
ng
the copyt hata rri
vesov er networ k 4,hos tB r ecei
ve st wo c opiesof t he
datagram.
As econds urpri
singc onsequencea r
isesbe c
aus eTRPFus esb oths ourc eand
des
t i
-nation addresses whe nf orwa rdi
ng da tagrams : de li
very de pends on a
datagramss ource.For e xample, Figur e15.16s hows how mul tica
str oute
rs
for
wa rdda tagramsfromt wodi ffe
r entsourcesa crossaf ixedt op ology.
Int
ernet
342 Multi
cas
ting Chap.1
5

ne
t1

R1 X R2
ne
t2 ne
t3

R3 Y R4 R5 Z R6
ne
t4 ne
t5 ne
t6

(
a)

ne
t1

R R
1 X 2

ne
t2 ne
t3

R R R R
3
Y 4 5 Z 6

ne
t4 ne
t5 net6

(
b)

Fi
gur
e15.
16Exa mpl
e sofpat
hsamul ti
cas
tdata
gramf oll
owsunde
rTRPF
as
s umingthesourceis(a)hostX,and(b )hostZ,andt
he
groupha same mberone achofthenetwor ks
.Thenumbe
r
ofc op
iesrec
eiveddep
e ndsonthesour
ce.

Asthefig
ures hows
,t hesourc
ea ffe
ctsboththepathadatagr
a mfoll
owsto
re
achag i
vennetwor ka
swe llasthedeli
verydeta
il
s.Forexampl
e,inp ar
t(a)of
Fi
gure1 5.
16,at ra
nsmis
sionb yhostXc aus
esTRPFt odeli
vertwoc op
iesofthe
dat
ag r
amt one t
wor k5.I npart(b),onl
yonec opyofat rans
miss
ionb tZ
yhos
re
achesnetwork5,b uttwoc opi
esreac
hne t
wo r
ks2a nd4.

1
5.22Mul
ti
cas
tTr
ees

Re
sea
rche
rsus
egr
apht
heor
yte
rmi
nol
ogyt
ode
scr
ibet
hes
etofp
athsf
rom
ag i
vensour c
et oallmembe
rsofamult
ica
stgroup
:t hepat
hsde
fineag r
ap h-
the
oretct
i ree,whichi
ssomet
ime
sca
ll
edaf or
wardi
ngt r
eeoradeli
ver
yt ree.
Eac
hmul ti
castrout
er

Agrap
hisat
reei
fitdoe
snotc
ont
aina
nyc
ycl
es(
i.
e.,ar
out
erdoe
snota
ppe
aronmor
etha
n
onep
ath).
S
ec.1
5.22 Mul
ti
cas
tTr
ees 343

corres
pondst oanodei nt het ree,a ndane tworkt ha tc onnectst wor outers
corres
pondst oa nedgei nthet r ee
.Thes our c
eofada t a
gr a
mi sther ootorr oot
nodeoft het ree .Fi
na l
ly,thel astrout eralonge achoft hep athsf r
om t hes ource
iscal
ledal eafr outer.Thet erminolog yissome timesapp li
edt one twork saswe l
l
rese
archersc al
lane tworkha ngingof fal eafr outeral eafnet work.
Asa ne xa
mp leoft het erminology,c onsiderFigur e1 5.16.Pa r
t( a )showsa
treewi t
hr ootX,a ndl eavsR3,R4,R5,a
e ndR6.Te chni cal
ly,p art(b )doe snot
showat re eb ec
a userout rR3 l
e i
esa longtwop aths.Inf ormally,researchersof ten
overl
ookt hede -tail
sa ndrefert os uc hgraphsa strees.
Theg rapht erminologyallowsust oe xpressanimp or tantp ri
ncipl
e:

Amul ticastfor
war di
ngtreeisdefinedasas etofpat hsthr
ough
multi-
c astrouter
sf rom asourcet oallmembersofamul ti
cas
t
group.For a gi ven multi
cas
t gr oup,each pos
siblesourc
e of
datagramsc andeter-
mineadifferentforwardi
ngtr ee.

Oneoftheimmediat
ec onsequencesoftheprinc
ipl
econc
ernsthesi
zeof
t
abl
esusedtofor
wardmul ti
cas
t.Unl i
keconv
enti
onaluni
cas
tforwar
dingt
abl
es,
e
achentr
yinamulti
cas
tt ab
leisidenti
fi
edbyapair:
(
mul
ti
cas
tgr
oup
,sour
ce)
Conceptua y,s
l
l ourceident i
fi
esas i
nglehostt hatc ansendda tagramstot he
group(i.e
.,a nyhos ti nthei nterne t
).Inp ra
c t
ice,ke ep
ingas epa
ratee nt
ryf or
eachhostisun- wisebecauset hef orwardi
ngtr e
e sdefinedbya llhostsonas ingl
e
networka rei dentic
al.Thus,t osa v
es pac
e,f orwardingp r
ot oc
olsuseane twork
prefi
xa sas ource.Thati s,eachr outerdefine
sonef orwardinge ntr
yt hatisused
forallhostsont hesameI Pne t-wor k.

Ag
gr e
gat
ingentri
e sbyne twor kp
refixinst
e adofb yhos ta ddr
essreduc
est he
ta
bles i
ze drama
t i
cal
ly.Howe ve
r ,multi
castf orwarding t a
blescang row muc h
l
argerthanconventi
ona lforwardingtab
les.Unlik
eac onve nti
onalunic
asttabl
ei n
whichthes i
zeisp roport i
onalt othenumb erofne t
wor ksi ntheunde rl
ying
i
nternet,amulti
castt a
b l
eha ssizepr
oportionaltothep roductoft henumberof
networksint
heinterneta ndt henumberofmul t
ica
stg r
oup s.

1
5.23TheEs
senc
eOfMul
ti
cas
tRout
ePr
opa
gat
ion

Observ
antreadersmayha venotic
edani nconsi
stencyb et
we e
nt hef eat
uresof
IPmul ti
cast
ingandTRPF.Wes ai
dt hatTRPFi sus edinsteadofc onventi
onalRPF
toa voi
dunne ces
sar
yt raf
fic:TRPFdoe snotf orwardada tag
ramt oane t
work
unle
sst hatnetworklea
dst oatlea s
toneme mb e
roft heg r
oup.Cons equentl
y,a
multi
c a
stroutermustha v
ek nowledgeofg r
oupme mb ers
hip.Wea l
sosaidthatIP
al
lowsa nyhosttojoinorleaveamul ti
cas
tg roupa tanyt ime,whichc anresulti
n
r
api
dme
mbe
rshi
p
344 I
nte
rne
tMul
ti
cas
ting Chap.1
5

chang
es.Mor eimp orta
nt,memb e
rshi
pdoe snotfol
l
ow l
ocalscop
e ahos tthat
joi
nsma yb efa rf r
om amul t
icas
tr out
ert ha
tisfor
wardingdatagr
amst othe
group.S o, group me mbe
rshi
pi nformati
on mustbep ropagate
da c
ros
st he
underl
yingint
er ne
t .
Thei ss
ueofdyna micg roupme mb ershipisc entraltomul tica s
tr outing;a l
l
mul t
i-cas
tr outing s chemesp rov
ide a me chanism f or propa g
at ing me mb ers
hip
informati
ona swe lla sawa yt ouset hei nforma ti
onwhe nf orwar dingda tagrams.
Ing eneral
,becauseme mbershipcanc hanger a
pidl
y,t heinfor mationa v
ailab
lea ta
giv
e nr outerisi mp erfec
t,s orout e up datesma yl agc ha nges.The ref
or e,a
mul t
icas
tde si
gnr epresentsat radeoffb e t
we ent heov erhe adofe xtrar outing
traffi
ca ndineffici
e ntda tat rans
mission.Ont heoneha nd,i fg r oupme mb ers
hip
informati
oni snotp ropagatedr api
dly,mul ti
castr outerswi llnotma keop t
imal
decisi
ons (i.e.
, t he y e ither f orwa r
d da tagrams a c
ros s s ome ne t- works
unne c
essari
l
yorf ailtos endda tagra
mst oa llgroupme mbers).Ont heot herha nd,
amul tic
astroutings c
he met hatcommuni catese ve
ryme mbe rshi
pc hanget oe very
routerisdoome db ecauset her es
ultingt rafficcanov er
whe l
ma ni nternet.Ea ch
designchoosesac omp romiseb etweent het woe xt
reme s.

1
5.24Re
ver
sePa
thMul
ti
cas
ting

One oft he e arl


ies
tf ormsofmul ticastr outing wasde r i
vedf r
om TRPF.
Knowna sRe ver
sePat hMul ti
cast(RPM),t hes chemee xtendsTRPFt oma keit
moredyna mic.Thr eeassumpti
onsunderl
iet hede si
gn.Firs
t ,itismor eimport
ant
toensuret hatamul -
ticas
tda t
agramreachese achme mberoft heg rouptowhich
i
ti ssentt hant oe li
minateunneces
saryt r
a nsmiss
ion.Second,mul ti
castrouter
s
each cont ai
n a c onventi
onal uni
cas
t f or wardi
ng t abl
e t hat hasc orrec
t
i
nformat i
on.Thi rd,mul ti
castrouti
ng shouldi mprovee ffic
iency whenp oss
ibl
e
(i
.e.
,e l
iminatenee dl
esstrans
missi
on)
.
RPM use
sat wos tepprocess
.Whe nitb egi
ns,RPM us estheRPFb roadcast
sc
he metos endac opyofe achdata
grama crossa l
lnetworksint hei nternet.
Doingsoe ns
uresthata l
lg roupmemb e
r srecei
veac op
y.S imul
taneously,RPM
procee
dstoha v
emul ti
cas
tr outer
sinform onea notheraboutpathst ha
tdonot
l
ea dtogroupme mbers
.Onc eitlear
nst hatnog r
oupme mb e
rsli
ea longag iv
en
path,arouterst
opsforwardi
nga l
ongthatpath.

How domul tic


as troute r
sl earnaboutt hel ocationofg roupme mbe rs
?Asi n
mostmul ti
ca s
tr outings c
he me s
,RPM p ropagatesme mb e
rshipinformati
onb ot t
om-
up.Thei nforma ti
ons t
artswi thhos tsthatc hooset oj oinorl eaveg r
oup s
.Hos ts
communi cate me mbe rs
hipi nforma ti
on witht heirl ocalr outerb y us i
ng l ocal
protocolsIGMPorMLDv 2.Thel ocalprotocolsonl yi nform amul ti
castr outer
aboutl ocalme mb ersone a
chofi tsdirectl
y- atta
c hedne t
wor ks;ther outerwi ll
notle a
r nab outdi s
tantg roupme mbers.Asac onseque nce,amul ti
castroutert hat
attachesal eafne twor kt ot her es
toft heI nterne tc a
nde c i
dewhi c
hmul ti
c a
st
datagramst of orwardov ert hel eafnetwork.I fal eafne tworkdoe snotc ont ai
n
memb er
sforgroupG,therouterconne
c t
ingt helea
fne tworktot heres
toft he
Int
e r
netwillnotforwar
dda t
a gr
amsf org roupG.Ass oon a
sa nyhostona
networkjoi
nsg r
oupG,t hele
afr oute
rwi llinformt hene xtrouteral
ongt he
pat
hb acktothesour
ceandwillbegi
nf orwardingdata
g r
amst hatarri
vedes
tined
for
S
ec.1
5.24 Re
ver
sePa
thMul
ti
cas
ting 345

groupG.Conve
rsel
y,ifal
lhostsbeyondagi
venr
oute
rle
avegroupG,therouter
in-f
ormsthenextrout
eralongthep at
htothes
our
cetostopsendi
ngda
tagra
ms
desti
nedf
orG.
Usingg ra
ph-the oreti
ct er
mi nol
ogy,wes aythatwhe nar outerlearnst hata
groupha snome mb e rsalongap atha nds topsforwarding,itha sp runed( i.
e .
,
remov e
d)t hep at
hf rom t heforwa r
dingt ree.Infact,RPM i scall
edab roadcast
andpr une s t
rategyb ecausear outerb roadcas
ts(usingRPF)unt ilitr e
c e
ives
informati
ont hata l
lowsi tt opruneap at
h.Re sear
chersalsousea notherte r
mf or
theRPM a l
g ori
thm:t he
ys a yt
ha tthes yst
e misdata-dri
venbec ausear outerdoe s
nots endg roupme mb ers
hi pinformationt oa nyotherr out
ersunt ildatag r
ams
arriv
ef orthatg roup .
Int heda ta-dri
venmode l,amulti
ca stroutermus talsohandlethecasewhe re
ahos tde c
idestoj oi
nap arti
cul
argroupa f
tert herouterhasp r
une dthep athfor
thatg roup.RPM us esab ot
tom-upa pproacht oa cc
ommo dater ej
oini
ngag roup
thatha sb eenpruned:whe nahostinfor msal ocalmulti
castrouter,M1,tha tthe
hostwa ntst or ejoi
nap arti
cul
argroup ,M1c onsult
sitsr ec
ordoft hegroupa nd
obtainsthea ddressoft hemul -
tica
str outer,M2,t owhi chitha dprevi
ouslysent
ap runer equest.M1s endsane wme s-
sa gethatundoe sthee ff
ectoft hep revi
ous
prunea ndc aus
e sdatagramst of l
ow a gai
n.S uchme ssagesarek nowna sg r
aft
requests,a ndthea lgorit
hm issai
dt og ra
ftt hep rev
i-ousl
yp runedb r
anchb ack
ontot het ree.

1
5.25Exa
mpl
eMul
ti
cas
tRout
ingPr
otoc
ols

TheI ETFhasinve
sti
g a
tedmanymul t
ica
stp rotoc
ols
,incl
udingDi
stanc
eVec t
or
Multicas
t Routi
ng Protocol(DVMRP), Core Based Trees (
CBT),and Protocol
Indepen-dentMult
icas
t( PIM)
.Althoug
ht heprotocol
sha vebeenimp
lemente
da nd
ve
ndorshaveoffe
r e
dsomesuppor
t,noneofthe
m hasbec
omewi
del
yus
ed.The
nexts
ect
ionspr
ovideabri
efde
scri
pti
onofea
chprot
ocol
.

1
5.25.
1Di
sta
nceVe
ctorMul
ti
cas
tRout
ingPr
otoc
olAndTunne
li
ng

Ane a r
lyp r ot
ocol,k nowna stheDis
t anceVect orMul ticastRout i
ngPr otocol
(DVMRP) ,a l
lows mul ti
c a
str outerst op as
sg roup me mb ershi
pa nd r outing
informationa mongt hems elve
s.DVMRPr ese
mb lest heRI Pp rotocolde scr
ibedi n
Cha p
ter1 4,b utha sb eene xtendedformul tica
s t
.I ne s
senc e
,t hep rotocolpasses
informationa b outc urrentmul ti
cas
tg roupme mb e rs
hipa ndt hecostt ot ransfer
datagramsb etwe ent he r outers.For e ac
hp ossibl
e( gr o
up ,s ource)p air,t he
routersimp oseaf orwa rdi
ngt reeontopoft hep hysicalinterconnections.Whe na
routerr ecei
v esada tagram de s
tinedfora nIPmul tica
stg roup ,itsendsac opyof
theda tag r
am outov e rt hene tworklink stha tc orrespondt ob ranchesi nt he
forwa r
dingt re e.DVMPRi simp l
ementedb yaUni xp rogram na medmr outedt hat
usesas pecialmul ti
castker nel.
Mrout
edusesmult
ica
sttunnel
ingtoa l
low s
ite
stoforwardmulti
castac
ross
t
heI n-
ter
net.Ateac
hs i
te,ama nagerconfi
guresanmroutedtunneltoothe
r
s
ite
s.Thetunne
luse
sI P-i
n-I
Pe nc
a p
sul
ati
ont osendmul
tic
ast.Thatis,whe
nit
r
ece
ive
samul
ti
cas
tda
-

DVMRPcha
nge
dsub
sta
nti
al
lyb
etwe
env
ers
ion2a
nd3whe
niti
nco
rpor
ate
dtheRPM a
lgor
ithm
de
scr
ibe
dabov
e.
346 I
nte
rne
tMul
ti
cas
ting Chap.1
5

tagr
am g enerat
edb y alocalhos
t,mr outed enca
psula
test he data
gr a
m i na
conve
nti
ona lunica
stda t
agram,andforwardsac opyt omrout edateac hoft he
othersi
te s
.Whe nitr ec
eiv
esauni c
astda ta
gramt hroughoneofi tst unnel
s,
mrouted extra
ctst hemultic
astdata
gram,a ndt henforwardsa cc
ordingt oits
multi
cas
tf orwardi
ngt ab
le.

1
5.25.
2Cor
eBa
sedTr
ees(
CBT)

The Cor e Based Tr ees (CBT) mul ticastr out i


ng protocolt akesa nother
approacht ob ui
ldi
ngamul tica
stf orwardings ystem.CBTa voi
dsb roadcast
inga nd
all
owsa lls ourcestos haret hesamef orwa r
dingt reewhe neverpossibl
e.Toa v
oid
broadcasting,CBTdoe snotf orwa rdmul ticas
t salongap at
hunt iloneormor e
hostsalongt hatpathj oi
nt hemul ti
castg roup.Thus ,CBTr everse
st heflood-and-
prunea ppr oachusedb yDVMRP i nst
e a
doff orwardingdatagramsunt i
lne gati
ve
information ha sb ee
np ro-pagated,CBT doe snotf orwarda l
ong ap ath unti
l
posit
iveinf orma ti
onha sb eenr e
-c e
ived.Wes a ytha tinst
eadofus i
ngt heda ta-
drivenpar adigm,CBTus sade
e mand-drivenpar adig
m.

Thede mand- driv


enp aradigmi nCBTme anst hatwhe nahos tusesI GMPt o
joi
n ap art
icularg roup,t he localroutermus ti nform otherr outersb efor
e
datagramswillb ef or-warded.Whi chrouterorr out e
r sshouldbeinforme d?The
questioniscri
t i
calina l
ldema nd-dri
venmultic
a s
tr outingschemes.Recallthatina
data-dri
vens cheme,ar outerus esthea r
riva
lofda tat raffi
ctok now whe reto
sendr outi
ngme ssa
g es(i
tp ropagatesrouti
ngme ssagesbackov e
rne twor ksfrom
whicht hetraf f
ica rri
ves).Howe ver,inade ma nd-dri
v enscheme,not raffi
cwill
arri
vef orag roupunt iltheme mb er
shi
pinforma -ti
onha sb eenpropaga
te d.
CBTus esac omb i
nati
onofs tati
ca nddynamicalgori
thmst ob uil
damul ti
cast
f
or-wardi
ng t ree.To ma ket he scheme scal
abl
e,CBT di videst he unde r
lying
i
nte
rneti ntor egi
ons,whe ret hes i
zeofar egi
on isde te
r minedb y networ k
a
dmini
strator
s .Withine ac
hr egi
on,oneoft her outersisde sig
natedasac ore
r
outer
,a ndot herr oute
rsint hereg i
onmus teit
he rbec onfiguredtok now t he
c
orerouterf ortheirregi
ono rt ouseadyna micdis
coverymec hanismtof indt he
c
orerouterwhe nt heyboot.
Knowl edgeofac orer outeri simportantb ecausei tall
owsmul t i
castr outers
inar e- giont of orm as haredt r
eef ort her egion.Ass oona sahos tj oinsa
mul t
icastg roup,alocalr out er,L,r ec
e i
vesthehos treque s
t.Rout erLg ene rates
aCBTj oinr equest,whichi ts e
ndst ot hecorer out erusingc onvent i
onaluni cast
forwa rding .Eachintermedi ater outera l
ongthep at htot hec or erout erexa mines
ther eque st.Ass oonast her equestreachesar oute rRt hatisa lreadyp artoft he
CBTs hare dt ree,R retur nsa na cknowl-edgement,p as
sest heg r
oupme mb e
r s
hip
informa tionont oitsp arent ,andb eginsfor-wardingt r
afficf ort hene wg roup.
Ast hea c knowledgementp assesb ackt ot hel e
afr outer,i nterme di
ater outers
examinet heme s
sage,andc onfigurethe i
rmulticastf orward-ingt ablestof orwa rd
datagr amsf ortheg roup.Thus ,r outerLi slinkedi ntot hef or-wa rdi
ngt reea t
routerR.
Wec
ans
umma
rize
:
S
ec.1
5.25 Ex
amp
leMul
ti
cas
tRout
ingPr
otoc
ols 347

Because CBT us es a demand-driven paradigm, it di


vides an
i
nt ernet i
ntor egi
onsand designat esa cor erout rf
e or each
region; other router
si n the r egi
on dynamic al
ly buil
d a
forwar di
ngtreebysendingjoi
nr eque sst
t ot hecore.

1
5.25.
3Pr
otoc
olI
nde
pende
ntMul
ti
cas
t(PI
M)

Inreal
ity,PIMc onsi
stsoft woi nde pe
ndentp r
otocolst hatsharel
it
tlebeyond
thena mea ndb as
icme ssag
ehe aderf orma t
s:ProtocolI ndependentMulti
cast
DenseMode( PI
M- DM)andPr ot ocolIndependentMul ti
cast Spar seMode( PIM-
SM).Thedi sti
ncti
ona ri
sesbecaus enos ingl
ep rot
ocolwor kswe l
linal
lsit
uations.
Inpartic
ular,PIMsdensemodei sdesi
g nedforaLANe nvironme ntinwhic
ha ll
,or
nearl
ya l
l,net-workshavehostsl ist
eningt oe a
chmult i
castg roup;wherea
s,PI Ms
spar
semodei sdesigne
dt oa ccommoda teawi dea reae nvironmentinwhi c
ht he
memb ersofag ivenmul t
icas
tg roupa respreadwidea ndi nvolv
eonlyas ma l
l
subs
etofa llposs
ibl
ene t-
wor k
s.
Thet ermp rot
ocolindependence ar
ise
sb ec
ausePI Ma ss
ume sat radi
ti
onal
unic
a s
tf orwardi
ng tabl
et hatc ontai
nsa s hort
estp athtoe ach dest
inati
on.
BecausePI Md oesnotsp e
cify how suchat ableshoul
db eb uilt
,a na rbi
trary
routi
ngp rot
ocolcanbeus e
d.Thus ,wes aythatPIM ope
ratesindependent
lyfrom
theunica
str outi
ngupdateprotocol(
s)thatarouteremploys
.
To accommodate ma ny lis
tener
s, PI M-DM usesa b r
oadcast-
and-p
rune
a
pproa
chi n whi
ch datagramsa reforwa rde
dt oa l
lroutersusi
ngRPF unt ila
r
outersendsane xpl
ictp
i runer e
quest
.Byc ontra
st,PIMsspar
semodec a
nb e
v
iewedasa ne x
tensi
onofb a
sicconc
ept sfrom CBT.Spars
emodede sig
natesa
r
outer
,call
edaRe ndezvousPoint(RP)
,t hatisthefunc
tionale
quiva
lentofaCBT
c
orerout
e r.

1
5.26Re
li
abl
eMul
ti
cas
tAndACKI
mpl
osi
ons

Thetermr eli
abl
emul t
icastrefer
st oanysyst
emt hatusesmul t
icas
tde l
i
very,
buta l
soguarant e
est ha
ta llgroupme mb e
rsrecei
veda tainor derwit houta ny
l
oss,dup l
i
ca-t
ion,or c or
ruption.Int he
ory,reli
abl
e multic
as tcomb i
nest he
adva
nt a
geofaf orward-
ings c
hemet hatismoreeffi
ci
entt ha
nb roadcas
twi t
ht he
benefi
t of ha
v ing al
lda t
aa r-ri
veintact.Thus,reli
abl
e mult i
cast hasg reat
pote
nt i
albenefita nd appl
icabi
li
ty( e.
g.,a stocke xc
hangec ould user el
ia
b l
e
multi
casttodelive
rs t
ockp r
icestoma nydesti
na-t
ions
).

Inprac
tice
,r e
lia
blemulticas
tisnota sg eneralorstra
ightforwar
da sit
sounds
.Fir
st,ifamul ti
cas
tg rouphasmulti
plesende
rs,thenotionofde l
iv
eri
ng
datagr
amsins e-quencebecomesme a
ning
less
.S e
cond,weha vese enthatwidel
y
usedmult
icas
tf or-wardi
ngs c
he mess
ucha sRPFc anproduc
edup li
cat
ionevenon
s
mal
li nt
ernets
.Third,i
na ddi
ti
on t
ogua
rant
eest
hata
llda
tawi
l
lev
ent
ual
l
y
a
rri
ve,appl
ic
ationsl
i
keaudi
oor
348 I
nte
rne
tMul
ti
cas
ting Chap.1
5

vi
deoe xpe
ctr e l
i
abl
es ystemst obound thede l
aya nd ji
tter
.Four th,b ecause
rel
ia
bil
ityrequi
r e
sacknowl e
dge ment
sa ndamul tica
stg roupcanha v
ea nar b
itrary
numberofme mbers
,t ra
di t
ionalrel
iabl
ep rotoc
olsr e
quireas endertoha ndlea n
arbi
trar
ynumb erofacknowl edgements.Unfortunatel
y,noc omp ut
erha senoug h
proc
essi
ngp owert odos o.Wer efert othep robl
ema san ACKi mplos
ion;t he
probl
emhasb ecomethef ocusofmuc hrese
a r
ch.
Toov er
comet heACKi mplos
ionprobl
em,r el
iabl
emul t
ica
stp rotocol
st a
kea
hi
erar
chic
ala p
proachin which mult
ica
sti
ng i
sr e
stri
c t
edt oas i
ng l
es ourc
e.
Bef
oredataissent,aforwardi
ngt re
eise s
tab
lis
hedf rom t
hes our
c etoa l
lgroup
membersandacknowl
edgementpoint
smus tbeidenti
fied.
An a
cknowl
e dg
eme nt p
oint
,whi chisa l
sok nown a
sa na
cknowl
edgement
aggr
ega-t
or or desi
gnatedrouter (
DR),consi
stsofar out
eri
nt hemul t
ica
st
f
orwa r
ding treet hata g
r ee
st o ca
che copi
es of the dataand proc
ess
a
cknowledgementsf r
om r outer
s or hostsf ur
ther down the t
ree
.I fa
r
etransmis
sionisre
quire
d,t heacknowl
edg
eme ntpoi
ntob-ta
insacopyfrom i
ts
c
ache.
Mostr eli
abl
emul tic
as tscheme susene g
ativerathe
rt hanp osi
tivea cknowledge
-ments ar ecei
vinghos tdoe snotr espondunlessada t
a g
r ami slost.Toa l
l
ow a
hosttode te
ctloss,e ac
hda t agra
m mus tb ea ssi
gnedauni ques eque ncenumb er.
Whe nag a
pa ppear
si nsequenc enumb ers,ahos tdetec
tslossa nds endsaNACKt o
reques
tr e-
transmissi
onoft hemi ssi
ngda tagr
am.TheNACKp ropa
g atesa l
ongt he
forwardingt reetowa rdt hes ourceunt ilitreachesana ck nowledgementp oi
nt.
Thea cknowledgeme ntpointp rocessestheNACK,a ndr e
t r
a nsmitsac opyoft he
l
ostdat agrama l
ongt hef or-
wa rdingtree.
How doe sa na cknowl edgeme nt p oi
nt e nsuret hati t hasa c op y of a l
l
datagramsint hes eque nce?I tusest hes ames c hemea sahos t.Whe nada tagra m
arri
ves,thea c-knowl edgeme ntp ointc heckst hes e
quencenumb er,pla
cesac opyi n
it
sme mory,a ndt henp roceedst op r opagatet hedata gr
am downt hef orwa rding
tree.Ifitf indstha tada - tagr
a mi smi ssi
ng,t hea c
knowl edgementp ointse ndsa
NACK up t he t r
e et owa rdt he s our c
e. The NACK e i
t he
rr eac
he sa not her
acknowledge
me ntp ointt hatha sac opy oft hedat agr
am( in whichc aset he
acknowledge
me ntpointt r ansmitsas e condc opy),ort heNACKr eachest hesour ce
(whichretransmitst hemi ssingda tagra m).
Thec hoiceofab ranchingtopologya nda cknowl edgementp oi
nt si scruci
alt o
thes uccessofar el
i
ablemul ti
casts c
heme .Wi thouts uffi
cientack nowledgeme nt
points,ami ssi
ngda t
agramc ancausea nACKi mp losi
on.I np arti
cular,i fag iv
e n
routerha sma ny de s
cendants,a lostda ta
g ra
mc anc a
uset hatr outert ob e
overrunwi thr etr
ansmis-si
onr equests.Unf ortuna te
ly,a utomatings el
ecti
onof
acknowledgeme ntp oi
ntsha snott urnedoutt ob es i
mp l
e.Cons eque ntl
y,ma ny
rel
iablemult i
castprotocol
sr equi
rema nu-a lconfiguration.Thus,r el
ia b
lemul ti
cast
isb ests ui
t e
dt o:s er
v i
cest hatt end t op ersi
st ov erl ong periodsof t i
me ,
topol
og i
est hatdonotc hang erapi
dly,ands ituationswhe reinter
me di
a t
er outers
agreet oservea sacknowledgementp oints
.
Ist he
r ea na l
ternati
vea pproacht or el
iab
il
ity? S
ome resea
rcher
s have
expe
r i
mentedwi t
hp rotoc
olsthatincorp
orateredundanti
nfor
ma t
iontoreduceor
el
iminatere t
ransmi
s-si
on.Ones c
he mes endsredundantdata
grams.Inste
ad of
se
ndingas ingl
ec op
yofe ac
hda ta
g ram,thesourcesendsN c
opie
s(typi
cal
ly2or
3)
.Re dundantdatagramswor k
Notethatasi
ngl
esourc
edoe snotli
mitf
uncti
ona
li
ty,be
caus
ethes
ourcec
anagr
eet ofor
ward
a
nyme s-
sageitre
cei
vesvi
aunica
st.Thus,anarb
itr
aryhostca
nsendapac
kettot
hes our
ce,whi
ch
t
henmulti
cast
sthepac
kettothegroup.
Sec
.15.
26 Re
li
abl
eMul
ti
cas
tAndACKI
mpl
osi
ons
349

e
spe
cia
llywel
lwhenrout
ersimpl
ementaRandomEarl
yDis
car
d(RED)s
tra
teg
yb e
-
c
ausethepr
obab
il
it
yofmor ethanonecop
yb ei
ngdi
sca
rde
disex
treme
lysma
ll
.
Anot he
ra pproacht or e
dundancyi nvolvsf
e orwarder r
or -corr
ectingc odes.
Analo-goust ot he er r
or- c
orrect
ing codesus e
d wi thaudio CDs ,t he scheme
requiresas endert oincorporateerror-
c orrect
ioninformati
oni ntoeachda tagram
inada tas t
r ea
m.I foneda -tagr
ami sl ost,thee rrorcorr
e cti
ngc odec ontains
suffic
ientr e
dunda nti nformationtoa l
-low ar ecei
vert oreconstructthemi ssi
ng
datagramwi thoutr eque s
tingar etra
nsmi s
sion.

1
5.27S
umma
ry

I
Pmul ti
cast
ingisa na bs
tract
ionofhardwaremulti
cast
ing
.Ita l
lowsdel
ive
ry
ofada ta
g r
amt oana r
bitrar
ys ubsetofc
omp ut
ers.BothIPv4andI Pv6de
finea
se
tofmul ti-
casta ddres
ses.IPv6 usesthe sec
ond octe
tt or ep
re s
entscope,
al
lowi
ngt hescopetob ei ndepe
nde ntoftheservi
ce.IPmulti
cas
tus eshar
dwa r
e
multi
cas
t,ifavai
labl
e.
IPmulti
castgroupsa redyna mic:ahos tcanj oi
norl ea v
eag r oupa tany
ti
me .Forl
ocalmulti
cast
,hos t
sonl yne e
dt heabi
li
tyt osenda ndr ec
eivemul ti
cast
datagr
ams.ForIPmul ti
casttha tspansmulti
plenetworks,multicas
tr outersmus t
propaga
teg roup membershi
pi nformati
on and arranger outing sot ha
te ac
h
me mberofamul tica
stg roupr e
c e
ive
sac opyofe ve
ryda tagrams entt othe
group.TheIPmul ti
casti
ngs chemei scomp l
ic
atedbyt her ulet hata na r
bitrar
y
hostcansendtoamul ti
castgr oup,evenifthehostisnotame mb er
.
Hos
tscommuni
catet hei
rgr oupme mber
shiptomultica
str out
ersus
ingIGMP
(
IPv
4)orMLDv 2(I
Pv6).Thep rotocol
sareclos
elyre
lat
e d,andha v
ebeendes
igne
d
t
obee f
fic
ienta
ndtoa voidusi
nge xces
siv
ene t
workresources
.
Av ari
etyofp rot
ocol
sha vebeende si
gnedtop r
op a
g a
temul ti
castrouting
inf
orma -
tiona cros
sa ninter
net.Thet wob as
icapproachesa redata-dri
vena nd
demand-driv
en. I ne i
therc as
e,the a mount of information i
n a mul ti
cast
forwardi
ng t a
b l
ei smuchl argertha
ni n a uni
castf orwardi
ng tablebecause
multi
casti
ngr equi
resentri
esforeac
h( group
,source)pair.
Notallroutersintheglo
ba lInternetprop
a g
a temulti
castroute sorforwa r
d
multi
-cas
tt raffi
c.Tunneli
ngc anb eusedt oconnectmul t
icati
s s
landst hata r
e
sep
aratedb yp a
rtsofa ninternett hatdonots upportmulti
castr outi
ng.Whe n
usi
ngat unne l
,ap r
o-g
r amenc ap
s ul
atesamul ti
c a
stda t
agrami nac onvent
ional
uni
castdatagram.There -
cei
vere xtrac
t sandhandlesthemulti
castda tagr
am.
Rel
i
ablemulti
cas
tr ef
erstoas chemet hatusesmultic
astforwa r
dingb ut
off
er srel
i
-ab
ledeli
verysemant
ics.Toa voi
dt heACKimplosi
onp r
oblem,r e
li
ab l
e
multi
cas
t des
ignseithe
r use a hi
era
r c
hy of acknowl
edg
e ment poi
ntsor s e
nd
re
dundantinfor
ma-ti
on.
350 I
nte
rne
tMul
ti
cas
ting Chap.1
5

EXERCI
SES

1
5.1 TheIPv
4s t
andards ugge
stsus i
ng23b i
tsofanIPmulti
cas
taddres
st of or
ma
har
dwaremulti
cas
ta ddress
.I nsuchas c
heme
,how ma
nyI Pmult
icas
ta ddres
ses
maptoasi
nglehardwaremul t
icas
taddr
ess?
1
5.2 Ans
werthequesti
ona b
ovef orIPv6.
1
5.3 ArguethatIPmulti
cas
tg r
oupIDsdonotne eda
sma nybi
tsasha
vebeenal
l
ocat
ed.
SupposeagroupIDus ed23b i
tsanda nal
yzethedis
adv
ant
ages
.(Hi
nt:whatare
thep r
act
ica
lli
mitsont henumberofg roup
stowhichahostcanbe
longandthe
numb e
rofhostsonas i
ngl
enetwork?)
1
5.4 IPsoftwa
r emus
ta l
wayscheckthedes
tina
tionaddress
esonincomingmul
tic
astda
-
tag
ramsa nddi
sca
rddatagra
msi fthehostisnotint hespec
ifi
edmulti
cas
tg r
oup.
Ex-pl
ai
nhowt hehostmig
htr ec
eiv
eamul ti
castdes
tinedforag r
ouptowhichtha
t
hos
tisnotame mber.
1
5.5 Multica
stroutersne edtok now whet
herag rouphasme mber
sonag iv
enne t
work
be-causether outerne edstok now whi
chmul t
ica
stt ree
st ojoi
n.Isthereany
advantagetoro ut
er sknowingtheexactsetofhostsonane tworkthatbe
longto
ag i
venmultic
as tgroup?Ex pl
ai
n.
1
5.6 Findthreeappl
icati
onst hatcanbenef
itfromI Pmulti
cas
t.
1
5.7 The standa
rds aysthatI Psoftwar
e musta rr
a ng
et o de
li
v e
rac op
y of any
outgoi
ng multi
-cas
tda ta
gramt oa ppl
i
cat
ion progra
mson t he s
ame hos
tt hat
bel
ongt othespeci
fi
edmul-ti
cas
tg r
oup.Doesthede s
ignmakeprogr
ammingeasi
er
ormoredi f
fic
ult
?Ex pl
ai
n.
1
5.8 Whent he underl
ying har
dwa r
e doe
snotsuppor
tmul t
ica
st,IP mul
ti
cas
tuses
har
dwarebr oa
dcastf ordel
ive
ry.How ca
ndoi
ngsoc a
useprobl
ems
?I sthe
rea
ny
adv
ant
ag etousingI Pmulti
cas
toversuc
hnet
works?
1
5.9 DVMRPwasde
riv
edfr
om RI
P.Re
adRFC1075onDVMRPa
ndc
omp
aret
het
wop
ro-
toc
ols
.Howmuchmor
ecompl
exi
sDVMRPthanRI
P?
1
5.1
0 Ver
sion 3 ofIGMP a nd MLDv 2b othinc
ludeame a
sureofr ob
ustnessthatis
i
ntendedtoaccommoda tepacke
tl os
sbya l
l
owingtr
ansmiss
ionofmulti
pl
ec opi
esof
ame ssa
ge.How doe
st hep r
otocolarri
veata ne
stimateoft herob
ustnessval
ue
nee
de donag i
vennetwor k
?

1
5.1
1 Exp
lai
n why a mul
ti
-homed hos
tma y needtojoi
n a mult
icas
tg roup on one
ne
twork,butnotonanothe
r.(Hi
nt:c
onside
ranaudi
otel
econfe
rence
.)
1
5.1
2 Supposeanappl
ic
ati
onprogr
ammermakesachoi
cetosi
mpli
fypr
ogramming
:whe n
joi
ningamulti
castg
roup,si
mpl
yjoi
none a
chnetwor
ktowhichthehos
ta t
tache
s.
Show thatj
oini
ngona l
lloc
ali
nter
fac
escanlea
dt oar
bit
rarytra
ffi
conr emote
networks
.
1
5.1
3 Esti
matethesizeoft hemultic
astfor
wardi
ngt
a b
lene
ededt
ohandl
emult
ica
stof
audiofr
om 100radi
os tat
ions,i
fe a
chsta
tio
nhasatot
aloft
enmil
li
onl
i
stener
sat
randomloc
a-ti
onsaroundt heworl
d.
1
5.1
4 Cons
iderac abl
eTVp rovi
derusi
ngIPtechnol
ogy.Assumee a
chs e
t-topboxuse
sI P
and dev
iseas c
hemei n whi
cht hecab
lep rovi
derb roa
dcast
sa llcha
nnelstoa
nei
ghbor-hooddi
str
ibuti
onpoi
nta ndt
henus e
smul t
icas
tt odel
ive
rt ores
ide
nces
.
Ex
erc
ise
s 351

1
5.1
5 Arguet hatonl
yt wot ype
sofmul ti
castarep ra
cti
cali
nt heI nterne
t:s t
ati
call
y
confi
guredcommercia
lservi
cesthatmul t
icasttolar
genumb e
rsofs ub
scri
bersand
dynamical
l
yc on-f
iguredservi
cest hatinclude a fe
wp arti
cip
a nts(e.g
.,f amil
y
me mber
sinthreehousehol
dsparti
ci
p a
tinginas i
ngl
eI Pp
honec al
l).
1
5.1
6 Consi
derr
eli
abl
emul t
ica
stachi
evedthroughredundanttra
nsmis
sion.Ifag i
venli
nk
hashighproba
bil
it
y ofc or
rupti
on,isi tb e
ttertos e
ndr edundantc op
iesofa
data
gramortos e
ndonec opythatuse
sf orwarderr
or-cor
recti
ngc ode
s?Ex p
lai
n.
1
5.1
7 Theda t
a-dr
ivenmultic
astr outi
ngparadi
gmwor ksbes
tonl ocalnet
workstha
thave
l
ow de l
ayande xces
sc ap
a c
ity,whil
et hedemand-dr
ivenparadigm wor
ksbesti
na
widea r
eae nvi
ronmentt hatha sli
mit
e dcapa
cit
ya ndhigherde l
ay.Doesitmake
sensetodevis
eas i
ngleprotocolthatcombi
nesthetwos c
he mes?Whyorwhynot ?
(Hint
:consi
derMOS PF.
)
1
5.1
8 ReadthePI M-SMp r
otoc
olspeci
fi
cat
ion tofind how theprot
ocoldef
inesthe
not
ionofspars
e.Fi
nda nexa
mp l
eofa nint
ernetinwhichthepopul
ati
onofgroup
member
sisspars
e,butforwhic
hDVMRPi sab e
ttermulti
cas
trouti
ngprot
ocol
.
1
5.1
9 Dev
iseaqua
nti
tati
vemeas
uretha
tc anbeus
edt ode
cidewhe
nPI
M-S
Mshoul
d
swi
tchf
romashar
edtre
etoashorte
stpa
thtr
ee.
Chapt
erCont
ent
s
1
6.1 Introduc t
ion,353
1
6.2 SwitchingTe c hnology,353
1
6.3 FlowsAndFl owS etup ,355
1
6.4 LargeNe twor ks,La belSwa p
p i
ng,AndPa ths,355
1
6.5 UsingS witchingWi thI P,357
1
6.6 IPS witchingTe chnologiesAndMPLS ,357
1
6.7 Lab e
lsAndLa b elAssignme nt
,359
1
6.8 HierarchicalUs eOfMPLSAndALa belStack
,359
1
6.9 MPLSEnc ap s
ul ati
on,360
1
6.1
0 Lab e
lS ema ntics,361
1
6.1
1 Lab e
lS witchingRout er,362
1
6.1
2 Cont rolProce ssi
ngAndLa belDist
rib
ution,363
1
6.1
3 MPLSAndFr a gme ntation,364
1
6.1
4 Me shTop ologyAndTr afficEngineeri
ng,364
1
6.1
5 Summa ry,365
1
6

LabelSwi
tchi
ng,Fl
ows
,
AndMPLS

1
6.1I
ntr
oduc
tion

Earl
ierc hapter
sde s
cri
beI Pa ddr
essi
nga nddesc
rib
ehow hos tsandr outers
useaf orwa rdi
ngt abl
eandt helonges
t-pref
ixmatchalgori
thm tolookupane xt
hopa ndf or
-wa rdda t
agra
ms .Thi
sc hap
terconsi
dersana l
terna
tiveappr
oacht hat
avoidst heov er-headoflongestprefi
xma tchi
ng.Thechapterp r
esent
st heba s
ic
i
de aofl abe
ls wi
t c
hing,expl
ainsthetechnol
ogy,anddescri
besitsusefort r
af f
ic
engine e
ring.
Thene x
tc ha
ptercont
inue
st hedi
scus
sionbycons
ide
ringsoft
war
ede f
ine
d
net-worki
ng,ande x
pla
inshow thebas
icide aoff
low l
abelsc
a nbeuse
di na
sof
twa r
e-defi
nednet
work.

1
6.2S
wit
chi
ngTe
chnol
ogy

I
nt he 1
980s,a st he Internetg rewi np opularity,r esea
rchersb egant o
e
xplorewa ystoi ncr
easet hep erformanceofp acketp r
ocessi
ngs yste
ms .Ani dea
e
me rgedt hat wa se ve
ntua l
lya dopt
edb yc omme r ci
alv endors:r epl
aceI P
s
c
onne c
tionl
essp acke
ts wit c
h- i
ng a pp
roacht hatr equiresl onges
t-prefi
xt abl
e
l
ookupwi thac onnecti
on-orienteda p-p
roacht hata c
c ommoda tesaf ast
erl ookup
a
lgori
thm.Theg ener
alconc ep
t ,whichisk nowna slabels witc
hing,ledvendor sto
c
reateane tworkingtechnologyk nowna sAs ynchronousTr ansferMode( ATM) .In
t
he1 990s,ATM ha dashort-li
vedp opul
arit
y,b utt hef a dfaded.
35
3
354 La
belS
wit
chi
ng,Fl
ows
,AndMPLS Cha
p.1
6

Therewe r
es eve
ralr easonsf orATMse ventualdemis
e.Thema i
nr easonwa s
economic:Ether
ne tswitchesa ndI Pr out
erswe remuc hlessexpensiv
et hanATM
switche
s,a nd onc e t he I ETF c reate
d l a
b e
ls wi
tchi
ng t e
c hnol
ogi
e s using
conventi
onalIProuters,ITde pa
rt mentsdidnotf i
ndcomp el
l
ingr eas
onsf orATM.
Onceweunde r
standtheg eneralconcepts
,wes eehow itispos
sibletoimp le
me nt
switchi
ngwithac onven-tionalrout e
rt ha
tdoe snotr e
lyone xpensi
ve,conne c
tion
-ori
entedhardware.
Att heheartofswitchi
ngli
esab as
icob se
rvati
onaboutlookup:iftherea r eN
ite
msi naf orwardi
ngt ab
le,acomputerr equi
resona ver
agea p
proximateyl
l og2 N
stepstop er
-form alonge
s t
-pr
efi
xma tch.Thep ropone
ntsoflabelswitchi
ngp oint
outt hathardwarecanper f
ormana rr
ayi ndexinones t
ep.Furthermore,index ing
cant r
ansla
te dire
c t
lyi ntocombinator
ialha rdware
, whiles earc
hing us ua l
ly
invol
vesmultipl
eme moryr e
fer
-enc
es.

Switc
hing technologi
ese x pl
oitindexi
ng t oa chi
evee xtremel
y high-sp
eed
for
wa rd-i
ng.Tod os o,e a
chp acketcarri
esas mallintegerk nowna salabel
.Whe n
apacketa r-r
ivesatas wit
ch,t heswitchextractst helabelandus esthev a
luea s
anindexintot hetablethats p
e ci
fi
esthea p
propriatea cti
on.Ea chswit
chha sas e
t
ofout putinterfa
ces,a ndt hea cti
onusuall
yc onsi
s tsofs endingthep acketout
oneoft heinterfac
es.Figure1 6.
1ill
ustr
atesthec onc ep
t.

S
2

0
S1
0

S
1 3
0
1
2
(
a)

Label Ac
tion
0 s
endoutinterf
ace1
1 s
endoutinterf
ace1
2 s
endoutinte
rface0
3 s
endoutinterf
ace1
.
.
.

(
b)

Fi
gur
e16.
1Il
lus
trati
onofbas
icswit
chingwi
th(a
)anetwor
kofthr
e e
i
nter-
conne
cte
ds wi
tches
,a nd(
b)atab
lef
romswi
tchS.
1

Inthefi
gur
e,thetab
lee
ntri
esspeci
fyhow s
witchS1f
orwar
dsp a
cketswi
th
l
abe
lsinther
ange0thr
ough3.Accor
dingtothetab
le,apack
etwit
hl ab
el2wil
l
befor
war
d-e
doutint
erfae0,whi
c c
hleadstoswi
tchS2;ap
ack
etwithal
abe
lof
0,1
,or3wil
lbef
orwarde
doveri
nterf
ace1,whi
chlea
dstos
wit
chS3.
S
ec.1
6.3 Fl
owsAndFl
owS
etup 355

1
6.3Fl
owsAndFl
owS
etup

Thechie
fdr awba
ck oft heb asicswit
ching s
che
mede s
cri
beda b
ovea ris
es
b
ecausee
achlab
elconsi
stsofas mallint
eger
.Howc anthes c
hemebee xtende
dt o
a net
workthat hasma ny desti
nati
ons? The keytoa nsweri
ng the questi
on
i
nvol
vesr
ethi
nki
ngoura ssumpt
ionsa b
outinter
netsandforwardi
ng:

I
nst
eadoff
ocus
ingonde
sti
nat
ions
,fo
cusonp
ack
etf
lows
.
I
nstea
dofass
umi
ngt
hatf
orwar
dingtab
lesre
mai
nstat
ic,i
ma g
ine
asys
-temt
hatca
nse
tuporchangef
orwardi
ngt
abl
esquic
kly.

Wede fnea p
i acketf low t
ob eas e
quenceofp acket
ss entfrom ag i
ven
s
ourcetoag ivende stinati
on.Fore x
ample,al
lthep ac
k e
tsonaTCPc onnect
ion
c
onsti
tut
eas i
ng l
ef l
ow.Af l
ow al
somightcorre
s p
ondt oaVoIPp honec al
lora
l
ong
er-ter
m i nteract
ion,s uc
ha sa llthe pac
ke t
ss ent fr
om a r outeri na
c
ompany
se as
t -
c oa
stof fi
cetoar outerinthec ompa
nyswe s
t-coa
stof fi
ce.We
c
ansumma ri
zet hek e
yi de
a:

Swi
tchi
ngtec
hnol
ogi
esusethefow a
l bs
trac
tionandcr
eat
e
for
ward-i
ngforf
lowsrat
herthanfordest
inati
ons
.

Int er
msofp acketf l
ows,wewi l
la ss
umeame chanisme xi
stst ocreate
entri
esins witc
heswhe n af l
ow i ss e
tup a nd removee ntri
e swhe n af l
ow
ter
minates.Unlikeac onvent
ionalinternetwhe r
ef orwardingt ablesre mainstati
c,
thetable
si ns wit
chesa r
ee xpecte
dt ochangef requentl
y.Ofc our se,thes ys
tem
tosetupf lowsne edsme cha
nismst hatunde r
standde st
inationsa ndhow t oreach
them.Thus ,f l
ow setupma yne edt ounde r
standc onventionalf orwa rdi
ngt hat
use
sde sti
nations.Fornow,wewi l
lconcen-trateont heop erationofs witc
hes,
andwillpostponethediscuss
ionoff lows et
upunt i
llaterint hec ha p
ter .

1
6.4La
rgeNe
twor
ks,La
belS
wap
ping,AndPa
ths

Inthes i
mp l
is
t i
cde scr
ipti
ona bove,eac hflowmus tb eassi
gnedauni quelab
e l
.
Ap ack
etc arri
esthel abelass
ignedt oitsflow,a ndate veryswitc
ht heforwarding
mecha-nism usest helab e
lt os el
ecta nout goingi nte
rface.Unfor tunatel
y,t he
si
mp l
is
ticschemedoe snots caletol a
r gene t
wor ks
.Be foreauni quel abelcanb e
ass
ignedt oaf l
ow,s oftwarewoul dnee dtov erifythatnoot herflowa nywhe r
ei n
theinternetisusingt helabel.Therefore,b e
for eaf l
ow couldbee stabli
she
d,t he
set
ups ystemwoul dha vetoc ommuni c
a t
ewi the ver
ys witchinthei nternet.
Des
igne
rsf ound a
ni ngeni
ouswa yt osol
vet he pr
ob l
em of s
ca l
e whil
e
p
res
ervi
ngt hes peedofs wi
tchi
ng .Thes ol
uti
on al
l
owst hel ab
eltob ec hos
en
i
nde
pendent
lyf ore a
chswitchalongthep at
h.Thatis,i
nsteadofauni quelabel
f
orag i
venflow,ane wl a
belcanb echos
ena teac
hswitc
ha longapat
h.Onl yone
a
ddi
ti
ona
lme
cha
nis
mis
356 La
belS
wit
chi
ng,Fl
ows
,AndMPLS Cha
p.1
6

neededt o makei ndep


endentla
belsel
ect
ion wor
k:a swit
c h mustb eabl
et o
rewrit
et he l
abelon p a
cket
s.The s
ystem i
sk sl
nown a abelswappi
ng, l
abel
switc
hing,orlabelrewri
ti
ng.
Tounde rst
andl a
belswappi
ng,wemus tf oc
usont hep athagivenflow wi
ll
f
oll
ow throught henetwork.Whenlabelswappi
ngisused
,t hel
abelonap acket
c
anc hangea sthep acketpas
sesfrom swit
cht oswit
ch.Tha tis,thea ct
iona
s
witchp e
r f
ormsc anin-cl
uderewri
tingthelabel
.Fig
ure1 6.2il
lust
rate
sap at
h
t
hrought hrees
wi t
ches.

S2

S S S
0 1 3

0
0 0
1

Label Ac
tion La
bel Ac
tion La
bel Ac
tion
0 l
abe
l 1
;se
ndout0 0 l
abe
l 2;s
endout1 0 l
abe
l 2;s
endout0
1 l
abe
l 0;s
endout0 1 l
abe
l 0;s
endout1 1 l
abe
l 4;s
endout0
2 l
abe
l 3;s
endout0 2 l
abe
l 2;s
endout0 2 l
abe
l 1
;se
ndout0
3 l
abe
l 2;s
endout0 3 l
abe
l 3;s
endout1 3 l
abe
l 3;s
endout0

Fi
gur
e16.
2Il
lus
tra
tionoflab
elswapp
ing
,inwhi
cht
hel
abe
linap
ack
et
c
anbere wr
itt
enb yea
chswitc
h.

Int hef ig ure,ap ackettha tentersS0 withl


a bel1ha st helabelre wri
tten
beforeb e -i
ngf orwarded.Thus,whe nswitc
hS 1rec
e i
vest hepa ck
et,t helabelwil
l
be0.S imi l
ar-ly,S 1repl
acesthel abelwith2b efor
es endingt hep ackettoS 3.S3
repl
a c
et hel ab elwith1 .Labelswa ppi
ngma kesiteasi
e rt oconfigureas witched
networ kb ecaus eita l-
lowsama nagertode fi
neap atht hroug ht hene twork
withoutf orcingt hesamel abe
lt ob eusedate ac
hp oi
nta longthep ath.Inf act,a
l
ab elonlyne e dst ob ev a
li
da crossonehop t het wos wi
tchest hatsha r
et he
physic
a lc onne cti
onne edt oa gr
e eont helabeltob ea ss
ignedt oe achflow that
crossesthec onne cti
on.
Thep ointi s:

Swit
chingus esac onnec
tion-
orientedapproach.Toav oidt
heneed
forglobalagreementont heuseofl abel
s,thet echnol
ogyallowsa
managert odef i
neapat hofs witcheswithoutr equi
ringthatthe
samelabelbeus edalongtheent i
repath.
S
ec.1
6.5 Us
ingS
wit
chi
ngWi
thI
P 357

1
6.5Us
ingS
wit
chi
ngWi
thI
P

Theque st
iona ri
ses
,canwec r
eat eat echnol
ogyt ha
tha st
headva ntag
esof
l
abels witc
hing and theadvantage
sofI P
sd est
inat
ion-ba
sedfor
wa rding? The
ans
we risye s.Althoughthec onne
ction-ori
entedp a
radigmsuse
dwi t
hs witc
hing
app
ea rtoc onf
lic
twi thIP
sconnecti
onles
sp aradi
gm,thet wohaveb
eenc ombi
ned.
Therea r
et hreeadvan-t
ages:

Fa
stf
orwa
rdi
ng
Ag
gre
gat
edr
out
einf
orma
tion
Ab
il
it
ytoma
nag
eag
gre
gat
efl
ows

FastForwarding.Thepoi ntiseasytounder
stand:switchi
ngall
owsr outer
sto
p
er-formf orwarding faste
rb e c
auset herout
erc an usei nde
xing i
np l
aceof
f
orwa r
dingtabl
el ookup.Ofc ourse,hardwa
reimplementa
t i
onsofc onve
ntionalI
P
f
orwa r
dingareex -tr
e melyfast(i.
e.,canforwar
dma nyinputseachoperati
ngat
1
0 Gb pswithoutdr opp i
nga ny packet
s).So,thec hoi
ceb e
tweens witc
hingor
f
orwa r
dinglar
gel
yde p endsont hecost.
Aggr
egat
ed Rout
eInf
ormat
ion.Lar
ge Ti
er-
1IS
Psa
tthe c
ent
er of t
he
Interne
tus es witc
hinga sawa ytoa v oi
dha vi
ngc ompleter outingt abl
esine ach
oft hei
rr out e
r s
.Whe nap acketfirstr eac
hest heI S
P,a ne dg erout e
re xamines
thede s
tinationa ddressa ndc hoos
esoneofs everalpaths.Fore xample,onep ath
mightleadt oap eerI SP,as e
condp a thmightl eadtoa notherp eerISP,a nda
thi
rdmi ghtl eadt oal a
r gec us
tome r
.Thep acketisa s
signedal a b
e l
,andr outers
ont heIS P
sb a c
kboneus et helabeltof or-wardt hep acket.Ins uchc ase
sla bel
s
arec oar
s e-
g rain t hel abelonl
ys peci
fiesthene xtI SPt owhi cht hep acket
shouldbes enta ndnott heul ti
matede st
inati
on.The re
f ore,alltraffi
cg oi
ngt oa
giv
e nISPwi llha vet hes amel abel
.I not herwor ds,allp ackett r
av-eli
ngt ot he
samene xthopa reagg regatedintoas inglefl
ow.
Abi
li
t yToManageAggr egateFl
ows .I SPsoftenwr iteS ervi
ceLev el
Agr
eements
SLAs
( )reg
ardi
ngtr
aff
ict
hatc
anb
ese
nta
cros
sap
eer
ingp
oint
.Us
ual
l
y,s
uch
SLAsrefe
rtoa g
gr ega
tet r
affi
c(e.g
.,alltr
a f
ficforwarde
db et
wee
nt het
woI S
Ps
orallVoIPt
raffi
c )
.Ha v
ingalabelass
ignedtoe a
c haggrega
temakesite
asi
erto
impl
ementmecha-ni
smst hatmeas
ureore nforcet
heS LA.

1
6.6I
PSwi
tchi
ngTe
chnol
ogi
esAndMPLS

S
of ar
,weha v
ede scribe
dla be
ls wi
tchinga sag eneral
-purpose,connecti
on-
ori
entednetworkt echnology.Wewi l
lnow c onsi
derhow labelswitchi
ngha sbeen
com-bi
nedwi t
hI nterne
tt ec
hnology.Ips
ilonCor p
orati
onwa soneoft hef i
rst
compani
estop roducep roductsthatme rg
e dI Pa ndswitc
hingha rdware.Inf ac
t,
Ips
il
on used modi fi
ed ATM ha rdwares wi tche
s, namedt hei
rt ec
hnologyI P
s
witchi
ng,andcall
edthei
rde vi
cesIPswi
t c
hes.Si
nceIps
il
on,ot
hercompanieshave
p
roducedas e
r i
es of desi
gns and names,incl ng t
udi ag s
wit
ching, Layer 3
s
witchi
ng,andlabels
wit
c hi
ng.Sever
alofthe
358 La
belS
wit
chi
ng,Fl
ows
,AndMPLS Cha
p.1
6

idea
sha v
eb eenfol
dedintoas tandar
de ndors
edb ytheI ETFknowna sMulti
-
ProtocolLabelSwit
chi
ng (MPLS)
.Ast het em mul
r ti-
protocoli
mpl
ies
,MPLSi s
desi
gne dtocar-r
yarbi
trar
yp ayl
oads.Inpract
ice,MPLSisusedal
mostexcl
usi
vel
y
tot ra
ns p
ortIP.
How isMPLSus ed?Theg e
ne r
alideaiss t
raightfor
wa rd:al argeISP(ore ven
ac orpora
t i
ont hatha sal a
r geintranet)usesMPLSa tt hecenterofi tsnetwork,
somet i
mesc al
l
e da nMPLSc ore.Rout e
rsne arthee dgeoft heI SPsnetwork(i.e.
,
routersthatc on-nectt ocustome rs
)us econventi
ona lforwarding;onlyroutersin
thec oreunder s
ta ndMPLSa ndus eswitchi
ng.I nmos tc as
es,MPLSi snotus edt o
establ
ishpathsf orindi-vi
dua lfl
ows .Inste
ad,t heI S
Pc onfiguressemi-per
ma nent
MPLSp at
hsa crosst hecoret hats tayinp l
ace.Fore x
a mple
,a te achma i
ne ntry
pointt othecor e,theI S
Pc onfiguresap at
ht oe a
c hoft hee xi
tp oi
nts.
Rout ersne a
rt hee dgeofa nI SPsne tworke x
a minee ac
h dat ag
rama nd
choosewhe the rtous eoneoft heMPLSp athsorha ndlet heda tagram with
conventionalf or
-wa rding .For e x ample,i fac ustome ri n one c i
t ys ends a
datagramt oa notherc us tomerint hes amec i
ty,t hee dger outerc ande l
iv
e rthe
datagram wi thoutc rossingt heMPLSc ore.Howe v
er ,ift heda tagra
m mus tt ra
v e
l
toar emot el oca
tionort hedat agramr e -
quiressp e
cialha ndling,ane dgerouter
canc hooseoneoft heMPLSp athsa nds endtheda tagrama longt hep ath.Whe nit
reachest hee ndoft heMPLSp at h,t heda t
agrama r-rivesa ta nothere dgerouter,
whichwi llusec onventiona lfor
wa r
dingf ordeli
very.
Asme ntione dear l
i
er,oneoft hema inmot ivati
onsf orus i
ngMPLSi st he
a
bil
itytoa gg
r egateflowsa stheycrosstheI SPscore.Howe ver
,MPLSa l
lowsI SPs
t
oof ferspe-cialser
vicestoi ndi
vi
dua lc
ustome rsa swe l
l.Forexamp l
e,cons i
dera
l
argec or
poration wit h offi
cesin Ne w Yorka nd Sa n Franc
isc
o.S up poset he
c
orporati
onwa ntsas e
curec onnec
tionb e
t weeni tst wos i
teswi t
hp e
rfor mance
g
uarantees.Onewa yt oachievesuchac onnectionc onsi
stsofl eas
ingadi gita
l
c
irc
uit.Anothe ra l
ternativ
ei nvol
vesMPLS :a nI S Pca ne s
tabl
isha nMPLSp ath
b
etwe e
nt het woof fices,andc anconfi
gurer o
ute rsalongthep athtop r ovi
dea
p
erformanceg uarantee.
Whe nt woma j
orI SPsc onnecta tap eeringp oint,t herea ret woop ti
ons:
theyc a
ne ach ma intainas ep
a rate MPLS c ore or t heyc anc oopera t
et o
interc
onnectt hei
rMPLSc ores.Thedi sadvantag eofus ings eparatec oresa ris
es
whe nada tagram mus tt raver
seb othc ores
.Theda t
agramt r
avelsacrosst hef ir
st
ISPscoretoa ne dg er outert hatr e-movest hel abel
.Theda ta
g ramt henp ass
es
to ar outeri nt hes e
c ond ISP,whi cha ssignsane wl abeland f orwar dst he
datagrama crossthes econdMPLSc ore.Ift het woI SPsa greet oi nterconnect
theirMPLSc ores,al abelcanb ea s
signedonc e,andt heda tagrami sswi t
cheda long
anMPLSp athunt i
litr ea c
hest hee dgerouteri nt hesecondI SPt hatr emov e
st he
l
a belandde li
verst heda tag
ram.Thedi sa
dvant ageofs ucha ni nterconne c
-tion
aris
esf rom thene e
dt oc oordina
t e b othI SPsmus ta greeonl a b
ela ssi
gnme nts
useda cr
ossthec onne c
tion.
S
ec.1
6.7 La
bel
sAndLa
belAs
sig
nme
nt 359

1
6.7La
bel
sAndLa
belAs
signme
nt

Wesaidthatane dgeroutere x
aminese a
c hdatag
ramandc hooseswhetherto
se
nd the datagra
ma l
ong a n MPLS path.Be for
ea ne dg
er out erc a
ns end a
data
grama cros
sa nMPLSc ore
,t heda t
agram mus tbeass
ignedal abel.Beca
use
MPLSp e
rformslabelswapp
ing,t helab
ela s
sig
ne dtoadatagrami sonlytheini
tia
l
l
abelforap ath.Onec anthinkoft hema ppingfrom adatagr
a mt oal abelasa
mathemati
calfuncti
on:

l
abe
l=f(da
tag
ram)

wheel
r abeli
stheini
ti
all
abelforoneoftheMPLSp
athst
hatha
sbe
ens
etup
,
andfisaf unc
tiont
hatpe
rformsthemap
ping
.
Inpracti
ce,func
tion fdoesnotusua
llyexami
net heenti
redatag
ram.I n
mosti
n-s
tances,fonl
yl ooksats
ele
cte
dheaderf
iel
ds.Thene
x tcha
pte
rde s
cri
bes
pa
cketcl
ass
if-
icat
ioni
nde t
ail
.

1
6.8Hi
era
rchi
calUs
eOfMPLSAndALa
belS
tac
k

Cons i
dert heus eofMPLSi na nor gani
za ti
onwhe rene twor ksa rea rr
ang ed
i
ntoat wo-lev
elhie ra
rchy:a nout e
rr egiont hatus esconv e
nt i
ona lIPf orwarding
a
nda ni nnerregiont hatus esMPLS .Aswewi llsee,thep rotocolma kesaddi
tional
l
evel
sof hi er
ar-chy p ossi
ble.For e xa mple,s upposeac orporat i
on ha st hree
c
amp uses,wi th mul t
ipleb uildi
ngson e achc ampus.The c orpor a
t i
on can us e
c
onventionalforwar di
ngwi thinab ui l
di
ng ,onel evelofMPLSt oi nte r
connectt he
b
uil
dingswi thi
nac amp us,andas ec ondl eve
lofMPLSt ointerconne cts i
tes
.Two
l
evel
sofhi erarchya ll
owst hec or-porationt oc hoosep oli
ci
esf ort ra f
ficbetwe en
s
ite
ss e
p a
ratelyf rom t hep olici
esus edb etwe enb uil
dings( e.
g.,t hep atht hat
t
raffict ra
velsb et
we enb uildingsisde terminedb yt het ypeoft raffi
c,buta l
l
t
rafficbetwe e
nap airofs i
te sfoll
owst hes a
mep ath).
Top r ov
idef oramul ti
-le
v elhierarchy,MPLSi ncorpor at
esal abelstack.That
is
,insteadofa t
t a
chingas i
nglel a
be ltoap acket,MPLSa ll
owsmul tipl
el ab
elst o
bea t-t
a ched.Ata nyt ime,o nlyt het opl abelisus ed;onc et hep acketf i
nishes
traver
singal eve
l,thet oplabelisr emov eda ndp rocess
ingc onti
nue switht hene xt
l
abel.
Int hec aseofoure xamplec orporation,itisp ossi
blet oarr
a nget woMPLS
areas
one f ort raffi
ct r
ave l
i
ng b etwe enb uil
di
ng sa nd one f ort raffict rav
eling
betweent wos ites.Thus ,whe nada t
ag ramt r a
v el
sb etwe entwob uil
dingsa ta
gi
vens i
t e,t heda -tagr
am wi l
lha veonel abe
la ttached( thelabelwillber emov ed
whent heda tag
r a
mr eachest hec or r
ec tb uil
ding).I fada tagram mus tt rav e
l
betweens it
e sa nd thent ot he cor r
ec tb uil
ding att he desti
na t
ion site,t he
datagram wi llhavet wol abel
sa ttached.Thet opl abe
lwi l
lbeus edt omov et he
datagramb etweent hes i
tes,a ndwi llber e
mov edonc et heda t
a gramr eachest he
c
orre
ctsi
te.Whenthet
oplabe
lisremoved,t
hes
econdl
abe
lwi
l
lbeus
edt
o
f
orwardt
hedat
agr
amtothec
orrec
tbui
ldi
ng.
360 La
belS
wit
chi
ng,Fl
ows
,AndMPLS Cha
p.1
6

1
6.9MPLSEnc
aps
ula
tion

Interesti
ngly,MPLS doe snot r equiret he unde rl
ying ne tworkt o usea
connecti
on- ori
entedp a r
a di
gm or s uppor tl abels witchi
ng . But c onventional
networ k
sdonotp r
o-videawa ytop assal abelalongwi thap acketandt heI Pv 4
datag
r am he a
derdoe snotp rovi
des pacet os to
real a b
el.S o,theque sti
ona r
ise s
:
how ca na nMPLSl abe
la c c
om- panyada tag r
ama cros
sac onventi
onalne twork ?
Thea nswe rliesina ne nc apsul
ationt echnique:wet hinkofMPLSa sap a
c ket
formatt hatc ane ncapsulatea na r
bitraryp a
y- l
oad.The p ri
ma ry usei st he
encapsul
at i
on of I Pv4 da tagra
ms . Fi g
ur e1 6.3 ill
us t
r ate
st he c onceptual
encapsul
at i
on.

DATAGRAM
DATAGRAM PAYLOAD
HEADER

MPLS

HDR MPLSPAYLOAD

FRAME FRAMEPAYLOAD
HEADER

Fi
gur
e16.
3Thee nca
psula
tionus edwithMPLSt osenda
nI Pv
4da ta
gram
ove
rac onventionalnetwork,s
ucha sanEt
hernet.AnMPLS
hea
deri sv ar
iables i
ze,a nd de
pendson the number of
ent
riesi
nt helabelstac
k .

Asa ne xa
mple,consi
derusi
ngMPLSt os endadatagr
ama cros
sanEt her
net
.
When using MPLS,t he Ether
nettypef i
el
di ss e
tt o 0x8847 for uni
cas
t
tr
ansmiss
ion.Thus,thereisnoa mb
igui
tya bouttheconte
nt sofaf ra
me a
re
ceiv
erc anusethef r
amet yp
et ode
terminewhethertheframecarr
iesMPLSor
aconventi
onalda
tagram.
An MPLShe aderisvari
ableleng
th.Thehe ade
rc onsi
stsofoneormor e
entri
e s
,eachofwhichis32bit
slongands p
eci
fie
sal abelplusinf
orma
t i
onus
edto
controlla
belproc
e s
sing
.Fig
ure1 6.
4i l
lus
trat
est hef ormatofa nentryi
nthe
header.

0 20 22 24 31
LABEL EXP S TTL
Il
lustr
ati
onoft hef
iel
dsi
nanMPLShea
de r
Fi
gur
e16.
4e ntry. AnMPLS
headercons
ist
sofoneormoreoft
hes
ee ntri
es.
Al
thoughMPLSc a
nb eus
edforI
Pv6,thepr
ese
nceofaf
lowl
abe
lintheIPv6hea
derreduc
est
he
ne
edforMPLS .
Et
hernettyp
e0x 8848hasb
eenass
igne
dforus
ewhenMPLSi
smult
ica
st,butMPLSdoe
snot
ha
ndl
emul t
ica
stwell
.
S
ec.1
6.9 MPLSEnc
aps
ula
tion 361

AsFigure16.
4i ndi
cates
,the reisnof ieldtos pe
cifytheov erallsi
zeofa n
MPLShe ader,nordoe sthehe aderc ontai
naf ie
ldtos pec
ifyt het ypeoft he
payload. To under s
tand why, r ecallt hat MPLS i sa c onnec t
ion-ori
ented
technology.Bef
orea nMPLSf ramec anb es enta c
rossasingl
eli
nk,a nentirepath
mus tb esetup.Thel abe
lswitc
hingr outera longt hepathmustb ec onfi
g ur
edt o
know e xactl
yhow t oproces
sap ack
e twi thag ivenlab
el.Therefore,whe nt he
MPLSp athisconfi
gured,thetwos i
de swilla gr
eeont hes i
zeoft heMPLSl a
b e
l
stacka ndthecontentsofthepayloada re
a.
Ane nt
ryint heMPLShe aderb eginswithaLABELf i
el
dt hatther ec
eiveruses
top r
ocessthepack et.Ift her ec
e i
veri sani nt e
rme di
atehopa longanMPLSp ath,
ther e-
ceiv
erp e
rf ormsla belswitchinga ndc ont inues
.I fther ecei
verliesatt he
boundaryb e
tweent wole v
e l
sina nMPLShi er archy,ther ecei
verwillremovet he
fir
stlabelonthes tacka ndus et hene x
tl a
be l
.Whe nt hepacketreachesthef i
nal
hopa l
onga nMPLSp ath,t her ecei
ve rwi l
lre mov ethef i
nalMPLShe ade
ra ndus e
conventi
onalIPfor ward-i
ngt a b
lestoha ndl
et hee nca
psulat
edda tag
ram.
Thefiel
dla b
eledEXPi na nMPLShe a derentr yisreser
vedf ore x
perimental
us
e.TheSb itisse tto1t ode notetheb ottom oft hestack(i
.e.,thelaste nt
ry
i
na nMPLShe ader);inot here ntri
es,theSb i
ti s0.Finall
y,theTTLf ie
ld(Time
ToLive)isanalo-goust ot heTTLf i
eldina nIPv4da tagr
am header:eachs wit
ch
al
ongt hep at
ht ha tus est hel abeltof or war
dt hep a
cketde cr
eme ntstheTTL
va
lue.Ift heTTLr ea
che sze ro,MPLSdi sca r
dst hep a
cket.Thus,MPLSp reventsa
pa
ck etfrom c ycl
ing f ore
v er,e v
eni f a ma na g
e r mi
sconfi
guress witc
hesa nd
ac
cidenta
ll
yc reate
saf orwa rdingloop.

1
6.1
0La
belS
ema
nti
cs

NotethatanMPLSlabelis20b i
tswide.Intheory,a nMPLSc onf
igur
ation
20
canuseall20bi
tsofthelab
eltoa c
commodateupto2 s i
multaneousfl
ows(i.e.
,
1,
048,576 fl
ows
).Inp ra
cti
ce,howe v
er,MPLSi ns
tall
ationss e
ldom useal arge
numberoff l
owsbec
auseama nag
erisusua
llyre
quir
edt oa uthori
zea ndconf
igure
eachswit
chedpat
h.
Thedescr
ipti
onofs wi
tchi
nga bov eexpl
ainsthatal abelisuseda sani ndex
i
ntoa na r
ray.I ndeed,some s wi
t chi
ng imp l
ementati
ons,e s
pecial
ly hardware
i
mp l
ementati
ons,dous ealabelasani ndex.Howe v
er,MPLSdoe snotr equi
ret hat
eac
hl abe
lcorrespondt oana rr
ayi ndex.Instead,MPLSi mple
me ntati
onsallow a
l
abeltob eana rbit
rary20-bitinteger.Whe nitr ece
ivesanincomingp ac
ke t,an
MPLSr outere xt
r ac
tst helabeland p e
rformsal ookup.Typical
ly,thel ookup
mechani
sm usesaha shi
ngalgori
thm,whi chme a
nst helookupisa p
p r
oximatelyas
fa
sta sanarrayindex.
Al
l
owi nga rbi
traryva l
uesinlabel
sma kesi
tp ossi
b l
ef orma nagerst ochoos
e
l
abel
st hatma kemoni tor
ingandde buggi
ngeasi
er.Fore xamp l
e,iftherea rethre
e
mainpathst hroughac orporat
ene t
wor k,ea
chp a
thc anb ea ss
ignedap refi
x0,1 ,
or2,a ndt hep r
e-fixcanb eusedateachhopa l
ongt hep a
t h.Ifap robl
em occurs
andane twor kma nagercapturespack
ets,havi
ngb i
tsi nthel abelthatidenti
fya
pat
hma k
esi teasie
rt oassoci
atethepacketwit
hap a
t h.
Ona
v e
rag
e,ha s
hingonl
yre
qui
resonep
rob
etof
indt
hec
orr
ecte
ntr
yinat
abl
eift
hel
oad
f
act
orofthetabl
eislow.
362 La
belS
wit
chi
ng,Fl
ows
,AndMPLS Cha
p.1
6

1
6.1
1La
belS
wit
chi
ngRout
er

Ar outert hatimplement
sMPLSi sknowna saLabelSwitchi
ngRout er(LSR).
Typical
l
y,a nLS Rc onsi
stsofac onventi
onalr
outerthathasb eenaugmentedwi th
software( a
ndp os
sibl
yha r
dware)t ohandl
eMPLS .Concept
ua l
l
y,MPLSp roces
sing
andc onventionaldatagramp roces
singarec ompl
ete
lyseparate.Whe n ap acket
arri
ves,t heLS R usesthef ra
met ypetode ci
dehow top rocessthepa ck
et,a s
Fig
ur e16.5il
lus-trate
s.

MPLSModul
e I
PModul
e ARPModul
e RARPModul
e

De
mult
ipl
exi
ngBase
d
OnFrameTyp
e

Fr
ameAr
riv
es

Fi
gur
e16.
5Framedemulti
pl
exingi
nanLSRt
hatha
ndl
esb
othMPLSa
nd
c
onvent
iona
lIPf orwa
rdi
ng.

Inp ra
c ti
ce,havi
ngb othMPLSa ndI Pcapabi
li
tyi nas i
ngl
eLS Ra l
lowst he
routertos erveastheinter
facebet
we enanon-MPLSi nternetanda nMPLSc ore.
Thatis,anLS Rc anaccep
tada t
agr
amf rom aconventiona
lne twor
k ,cl
assi
fyt he
datagra
mt oa s-s
ignani ni
tia
lMPLSl abel
,andf orwa rdt hedatagra
m ov era n
MPLSp ath.S i
mil
arl
y,theLS Rcanacce
ptap ack
etov era nMPLSp ath,removet he
l
a b
el,andf orwardtheda-tagr
amoverac onve
ntionalnetwor k
.Thet wofunctions
areknowna sMPLSingres
sandMPLSegr ess
.
Thet
abl
eins
idea
nLS
Rtha
tsp
eci
fi
esa
nac
tionf
ore
achl
abe
lisk
nowna
sa
NextHopLabelForwardi
ngTabl
e,andeac
he nt
ryinthetab
lei
scal
ledaNextHop
LabelFor
warding Ent
r y(NHLFE)
.Each NHLFE s
peci
fi
estwo i
tems,and may
s
pec
ifyt
hre
emor
e:

Ne
xthopi
nfor
mat
ion(
e.g
.,t
heout
goi
ngi
nte
rfa
ce)
Theop
era
tiont
obep
erf
orme
d
S
ec.1
6.1
1 La
belS
wit
chi
ngRout
er 363

Thee
nca
psul
ati
ont
ous
e(op
tiona
l)
Howt
oenc
odet
hel
abe
l(op
tiona
l)
Ot
heri
nfor
mat
ionne
ede
dtoha
ndl
ethep
ack
et(
opt
iona
l)

An NHLFE contai
nsan ope
rati
on fi
eldthats p
e c
ifi
eswhetherthe pack
etis
cr
oss
ingat ra
nsi
t i
ont oorfrom onelev
eloft heMPLShi erar
chyt oanot
her,or
mere
lybei
ngswit
c hedal
ongapathwit
hinasing
lele
vel.Thepos
sib
il
it
iesar
e:

Repla
cet helabelatthetopofthes
tac
kwit
has pe
cif
iednew
l
a b
el,andc ont
inuetofor
wardvi
aMPLSatt
hecur
rentleve
lof
thehier
archy.
Popthelab
elsta
ckt oex
itonel
evelo
fMPLShi e
rar
chy.Ei
the
rus
e
thenextlabelon thesta
cktof or
wa r
dt hedatag
ram,orus
e
conv
enti
onalf
orwardi
ngifthef
ina
llab
elwasremov
ed.
Rep
lacethelabelont hetopofthesta
ckwithaspec
ifi
edne
w
l
abel
,a nd t
henp ush oneormorenewl a
bel
son t
hes ta
ckto
i
ncrea
sethelev
el(s
)ofMPLShier
arc
hy.

1
6.1
2Cont
rolPr
oce
ssi
ngAndLa
belDi
str
ibut
ion

The di
scus
sion ab ov
e hasf ocused on data path pr
ocess
ing (i
.e.
,f orwardi
ng
p
ackets
).Ina ddit
ion,e ng
ine
erswho de f
ined MPLS consi
dered mechani
smsf or a
c
ontrolpat
h.Con- trolp at
hp roces
singreferstoc onfi
gurat
iona ndma nageme
nt
c
ontrolpathprotocolsma keite asyf orama nagertoc reateorma na
g eap a
th
t
hroughanMPLSc ore ,whichi
sk nowna salabelswitc
hedpath(LSP).
The pri
ma ryf uncti
onali
typ rov
idedb y ac ontrolpathp rotocolisa utomatic
s
ele
cti
onofl abels
.Tha tis,thep r
otocol
sa l
low ama nag
ert oe s
tablis
ha nMPLSp at
h
b
ys pe
cif
yingwhe ret hepathshoul
dg owithoutma nual
lyconfi
guringt hel
abelstouse
a
te ac
hLS Ralongt hepath.Thep r
otocol
sall
owp airsofLSRsalongt hepathtoc hoos
e
a
nunus e
dl a
belfort heli
nkb etweenap ai
r,a ndfi
l
linNHLFEi nforma ti
onfort henew
p
athsot helab
e l
sca nbeswappeda teachhop.
Thep rocessofc hoos i
ngl abelsalongap athisk nowna slabeldis
tr i
bution.Two
proto-colsha veb e e
nc reatedt op er f
orm l abeldistributi
on for MPLS :t he Label
Dist
ributionPr oto-col( LDP),whi chi ss ometimesr eferredt oa sMPLS -LDP,andt he
Constraint-based Rout ing LDP ( CR- LDP) .La beldistributi
on ha ndl
est he task of
ins
ur i
ngt ha tlabe
lsa rea ss
ignedc on-sistentl
y;t hecons trai
nt-basedroutinge xte
nsion
of LDP ha ndlest he t ask of b ui
lding p at
hs a l
ong r outest hat ma tchas et of
administrati
vec onstraints.I na dditi
on,e xi
stingp rotocolssucha sOSPF,BGP,and
RSVPhav ea l
sob e
ene x
t endedt op rovidelabeldistr
ibution.Althoughitr ecognize
st he
needf oral abeldistri
but i
onp rotocol,t heI ETFwor ki
ngg roupt hatde velop
e dMPLS
hasnots pe
c i
fi
e danyoft hep rotocolsa sther equi
reds tandard.
364 La
belS
wit
chi
ng,Fl
ows
,AndMPLS Cha
p.1
6

1
6.1
3MPLSAndFr
agme
nta
tion

Ob servantr eade rsmayha verea l


i
ze dthatt hereisap otenti
alp robl
em withMPLS
andf ragme nt ati
on.I nf act
,MPLSa ndI Pf rag
me ntati
oni ntera
c ti
nt wowa ys.Fi
rst,
wes ai
dt hatwhe ni tsendsada tagram overala be
ls wi
tchedp at
h,MPLSa ddsahe ader
ofa tle a
s tf ouroc tets.Doingsoc anha vea ninteresti
ngc onse
quenc e,espec
ial
lyina
casewhe ret heund er-l
yingne t
wor ksha v
et hes ameMTU.Fore x
a mple,consi
dera n
ing
r e
ssLS Rt hatc onnectsanEt hernetusingc onventi
onalI Pforwa rdi
ngt oanMPLS
coretha tus e slabels wi
tchi
ng .I
fada tagrama rri
vesov eranon- MPLSp at
hwi thsize
exactl
ye qua lt ot heEt hernetMTU,a d-di
nga32- bi
tMPLShe aderwi l
lma ket he
resul
ting p ayl oade xceedt he Ethernet MTU.Asa r es
ult,t he ingres
sLS R mus t
fragme ntt heo r
igi
na ldatag
r a
m,a ddt heMPLShe adertoe achfragme nt,andtransmit
twop ac k
e tsa crosstheMPLSc oreinsteadofone .
As econdi nteracti
onb e t
we enMPLSa ndf rag
me ntationoc curswhe na ning res
s
LSRr ecei
vesI Pf ragment si nst
ea dofac omp le
t eda tagr
am.Whe nt heda tagrame xi
ts
theMPLSc or e
,ar out erma yne edt oe xami neTCPorUDPp ortnumb er
sa swe l
la sIP
address
est o de-ci
de how t op roce s
st he p acket.Unf or tunatel
y,onl yt he fir
st
fragmentofada t
a gramc on-tainst het ransportp rotocolhe a
de r
.Thus ,a ning res
s
LSRmus te ithercoll
e c
tf rag ment sandr ea ss
e mb l
et hedatag ramorr elyonlyont heI P
sourceandde sti
nati
ona ddre s
ses.Al a rg
eI S
Pt hatus esMPLSha stwoc hoices.Ont he
oneha nd,t heI SPc anr equirec ustomer st ous eas ma l
le rMTUt hant hene twork
all
ows( e.
g .,a n Etherne tMTU of1 492 oc te
t sleavesr oom f ort woMPLShe ader
entri
eswit houta nys i
gnificantde c r
ea s
einov erallthroughp ut).Ont heot herhand,a n
ISPc ansimp lydeci
det op rohibitt heus eofMPLSwi thf rag ments.Thati s,inc as
es
wheret hee gressr outermus te xaminet ransportl ayerf iel
ds,t heing re
ssr outer
examinese achda tagrama nddr opsa nyda tagramt hatist ool arg
et os endov era n
MPLSp athwi t
houtf ragme nt at
ion.

1
6.1
4Me
shTop
ologyAndTr
aff
icEngi
nee
ring

Interesti
ng l
y,ma nyI SPswhous eMPLSf oll
ow astra i
ghtforwardapproach:they
defneaf
i ul
lmes hofMPLSpat hs.Thatis,ift heI S
Pha sKs i
tesandp eer
swi thJ
otherI S
Ps ,theI SPdefi
ne sanMPLSp athfore achposs
ibl
ep airofp oi
nts.Asar esul
t,
traffi
cmov i
ngb etweena nyp ai
rofs it
estravelsoveras ingl
eMPLSp athbetwe enthe
si
tes.Ab enefici
alsidee ffec
tofde fi
ningseparatepathsa ris
e sfrom thea bil
i
tyt o
me as
ure( orc ontrol
)thet raf-fi
ct r
avel
ingfrom ones i
tet oanot her
.Fore xample,by
wa t
chingas i
ng l
eMPLSc onne c
tion,anI SPca ndeterminehow muc htraffi
ct ravel
s
fromoneofi t ssi
tesacrossap eeri
ngconnec-ti
ont oanothe rISP.
S omesite
se xtendtheideaofaf ul
lme shb ydefi
ningmul ti
pl
ep at
hsb et
we e
ne ach
pa
irofs itestoa cc
ommoda t
ev ari
oustypesoft r
affic.Fore xample
,a nMPLSp ath
wi
thmi nimum hop smightber e
servedforVoI P,whichne edsminimum dela
y,whilea
l
ongerp a
thmi ghtb eusedforothertraff
ic,suchase mailandwe btraff
ic.ManyLS Rs
pr
ovideame c
ha ni
smt og ua
ranteeag i
venMPLSp athap e
rcentageoftheunde rl
ying
net
wor k.There- f
ore,anI SPcans pec
ifyt hatanMPLSp athc a
rryi
ngv oic
et ra
ff i
c
a
lwaysre
cei
vesN p
erce
ntoft hene
twor
kca
pac
ity.MPLSc
las
sif
ica
tion ma
kesi
t
p
oss
ibl
etouseav
ari
etyofme
asure
s
S
ec.1
6.1
4 Me
shTop
olog
yAndTr
aff
icEng
ine
eri
ng 365

t
ochooseapat
hfordat
a,incl
udi
ngtheI
Psour
cea
ddr
essa
swe
lla
sthet
rans
por
t
p
rot
ocolpor
tnumber
s.Thepoi
ntis:

Becaus
eMPLSc l
assi
fi
cati
onc anus
earbit
r ar
yf i
eldsinadatagr
am,in-
cl
udingtheIPs ourceaddress
,theserviceadat agram r
ecei
vescan
dependonthecustomersendingthedatagram aswellasthetypeof
databei
ngcar
ried.

Asana lt
e r
nativetoassi
gni
ngas i
ngleMPLSpathfore achaggr
egatefl
ow,MPLS
al
-l
owsanI SPt ob al
ancetra
ffi
cbetweentwodisj
ointpaths.Fur
thermore
,toinsur
e
hi
ghrel
i
a- b
il
ity,theI SPca
na rr
angetousethetwop at
hsa smutualbac
kups i
fone
pa
thfai
ls,al
lt raf
ficcanbeforwar
deda l
ongtheotherpat
h.
Weus et het emt
r raf fi
cengineeri
ngt oc ha
ra c
terizet hep rocessofus ingMPLS
to di
re c
tt rafficalong r outest hata chie
vea n organizationsp oli
cies
.A ma nager
cre
atesas eto fMPLSp at hs,s pec
ifi
estheLS Rsa l
onge achp a th,andde s
ignsr ul
esthat
ass
ign ada tagramt ooneo ft hep at
hs .Ma ny traffi
ce ng i
ne e
r i
ngf acili
ti
e sal
lows
managerst ous esomeoft heQua li
tyofSer vi
ce( QoS)t echniquesde finedi nChapter
26t ocontrolther a
t eoft ra
f fi
cone achp ath.Thus,iti spos si
blet odefinet woMPLS
fl
owsov eras inglephysicalc onnect
ion,a ndus eQoSt e chnique st ogua r
a nteethatif
eachflowha st r
affi
ct os end ,75% oft heunde r-l
yingne twor kca pac
ityisde vote
dt o
oneflowa ndt herema i
ning25%t otheot herf l
ow.

1
6.1
5Summa
ry

Toachie
vehighs p
eed,swit
chi
ngt ec
hnol
ogi
esusei
ndexi
ngr athe
rt hanl
ong e
st-
pre
fixlookup.Asac onseque
nce,swi
tchi
ngfoll
owsaconnect
ion-ori
ent
e dpa
r a
digm.
Becauseswit
chesalo
ngap athcanrewritel
abel
s,t
helabe
la ss
ignedtoaf low can
cha
ng eal
ongt hep
ath.
Thestandardf orswitc
hingIPda t
agrams,whi c
hi sknownasMPLS ,wa screat
ed
byt heIETF.Whe ns endi
ngada tagr
ama l
ongal abe
lswitche
dpath,MPLSp rependsa
header,crea
tingas t
ackofoneormor el abe
ls;subse
quentLSRsalongthep athuse
thel a
bel
st of or-
wa rdthed ata
gram withoutp erf
ormingrouti
ngt ab
lelookups.An
i
ng res
sLSRc lass
ifi
ese ac
hda tag
ramt hata rr
ivesfrom anon-MPLShos torr outer,
anda ne g
ressLS Rc anpassda-tag
ramsf rom anMPLSp athtoanon- MPLShos tor
router.

EXERCI
SES

1
6.1 Cons
idertheIPv
6da
tag
ramf
orma
tde
scr
ibe
dinCha
pte
r7.Wha
tme
cha
nis
mre
lat
es
di
rec
t l
ytoMPLS?
1
6.2 Re
ada
boutMPLS
.Shoul
dMPLSa
ccommoda
teLa
yer2f
orwa
rdi
ng(
i.
e.,b
ridg
ing
)aswe
ll
a
sop
timi
zedI
Pfor
war
ding
?Whyorwhynot
?
366 La
belS
wit
chi
ng,Fl
ows
,AndMPLS Cha
p.1
6

1
6.3 I
fal
ltr
aff
icfrom hostXwil
ltrav
e r
seat wo-l
eve
lMPLShi
era
rchy,wha
tac
tionc
oul
d
b
eta
k-entoe
ns ur
et hatnof
rag
me ntat
ionwil
locc
ur?
1
6.4 Read mor
ea bout t
he La
belDis
tri
buti
on Pr
otocol
,LDP,and t
he Cons
tra
int
-ba
sed
Routi
ngex-t
ensi
on.Whataret
heposs
ibl
econs
trai
ntstha
tca
nbeused
?
1
6.5 Ifar oute
ra tyours it
es up p
or t
sMPLS ,enabl
eMPLSs witc
hing and me
asurethe
perf
ormanc
ei mprove
me ntov erc onventi
onalrouti
ngtablelookup.(Hint
:bes ureto
measur
ema nyp a
cket
st oag iv
e nde s
tinati
ontoa v
oidha
vingme asur
eme nt
saffec
tedby
thecos
tofha ndl
ingtheini-
tialpacket.)
1
6.6 I
sitpos
sib
letoconduc
ta nex
per
imenttodet
erminewhe
the
ryourI
SPus
esMPLS
?
(
Ass
umeitisp
oss
ibl
etotra
nsmi
tarbi
tra
rypa
cke
ts.
)
1
6.7 Cis
coS ys
tems
,I nc
.offe
rsaswi
tchi
ng te
chnol
ogyk sMul
nown a t
i-LayerSwi
tchi
ng
(MLS)
.ReadaboutMLS
.Inwha
twaysdoesMLSdiff
erfromMPLS
?
1
6.8 Ifyoursi
tehasaVLAN swi
tchthatof
f e
rsMLSs er
vic
e,e na
blethes
erv
iceandte
st
whathap-
pensifonesendsav al
i
d Etherne
tframet ha
tc onta
insaninc
orre
ctIP
dat
agra
m.Shoul
daLaye
r2s wit
chexami
neI Phea
ders
?Whyorwhynot ?
1
6.9 Ass
umet ha
titispos
sib
letoobtai
nac opyofal
lfra
mesthattr
a ve
lacros
sanEthe
rnet
.
How doyouknow whetheragive
nf r
a meisMPLS
?I fyouencounte
ra nMPLSframe
,
howc a
nyoudeter
minet hes
izeoftheMPLSheader
?
Thi
spagei
ntent
ional
l
ylef
t
bl
ank
Chapt
erCont
ent
s
1
7.1 Introduc ti
on,369
1
7.2 Mot i
va t
ionForCl a
ssi
fica
tion,370
1
7.3 Class
ificati
onI nsteadOfDe mul
tipl
exi
ng,371
1
7.4 LayeringWhe nCl assi
fica
tionI sUsed,372
1
7.5 Class
ificati
on Ha rdware And Ne t
workS wi
tches
,
372
1
7.6 SwitchingDe ci
sionsAndVLANTa gs
,374
1
7.7 Class
ificati
onHa rdwa r
e,375
1
7.8 High-Spe e
dCl a
s si
fi
cati
onAndTCAM,375
1
7.9 TheS izeOfATCAM,377
1
7.1
0 Class
ificati
on-Ena bl
ed Ge neral
i
zed For wa
rding
,
378
1
7.1
1 Summa ry,379
1
7

Pac
ketCl
ass
ifi
cat
ion

1
7.1I
ntr
oduc
tion

Earl
ie
rc hapte
r sdescri
bet r
aditi
onalp ac
ketp roces
singsystemsa nde xpl
ain
twof undament alconcep
ts.Fir
st,wes aw how e a
chl a
yerofp rotocolsoft warein
ahos torr out e
rus esat ypef i
el
di nap r ot
ocolheaderf ordemul t
ipl
e x
ing.The
typ
ef iel
dinaf ramei susedtos e
lectaLa yer3modul et ohandl
et hef rame ,the
typ
ef iel
dina nIPhe aderisus
edt oselec
tat ra
nsportlayerprot
oc olmodul e
,a nd
soon.S econd,wes a
w how IPp erformsda tagramf orwardi
ngb yl ookingupa
des
tinati
ona ddresstos el
ectanext-hop.

Thi
sc haptert a
ke sane nt
ire
ly di
ffer
entv i
ew ofp acketp rocessi
ng than
p
revi
ouschapters
.I np l
aceofdemult
ipl
exi
ng,wewi l
lcons
iderat echniquek nown
sc
a las
sif
ica-t
ion.Insteadofass
umingthatap ack
etp r
oceedsthroug hap rotocol
s
tac
konel ayeratat ime,wewille
xamineat e
chni
quethatc r
osse
sla yers.
Pac k
etc lass
ifi
cationi sperti
ne ntt ot hreet opicscov eredinot herc hapt ers
.
Fi
r s
t,t hep revi
ousc ha p
terde scribesMPLS ,a ndwewi lls eetha tr oute rsus e
cl
a s
sif
icationwhe nc hoosi
nga nMPLSp at
hov erwhi chtos e ndada tag ram.S econd,
earli
erc haptersde s
c r
ibeEt hernets witc
he s,a ndwewi lll earnthats wit
c hesus e
cl
a s
sif
ication ins
tead ofde multipl
e x
ing.Fi nall
y,Cha p
te r28 wi llc omplete our
di
s c
ussi
onofc lass
ifi
cationb yintroducingthei mp ortantt op cofS
i oftwar eDef ined
Networ ki
ng ( SDN).We wi l
ls eet hatc lassi
f i
cati
on f or ms the b a s
is of S DN
technol
og i
e s
,a ndunde rstandhow as oftware-de fi
nedne t worksub sume sc oncep t
s
fromMPLSa swe l
lasc onceptsf r
omEt hernets witches.
36
9
370 Pa
cke
tCl
ass
ifi
cat
ion Cha
p.1
7

1
7.2Mot
iva
tionForCl
ass
ifi
cat
ion

To unders
tand t
he moti
vat
ion f
or cl
ass
ifi
cati
on,co
nsideraroute
r wit
h
p
rotoc
ols of
twa r
ea rra
nge
di nat radi
ti
onallayere
ds ta
c k
,as Fi
gure17.1
i
l
lus
trate
s.

Rout
er

Ap
ps(
Laye
r5)

TCP(
Laye
r4)

I
P(La
yer3)
i
nte
r- i
nter
- .
..i
nte
r-
f
ace1 f
ace2 f
aceN

ne
t1 ne
t2 ... netN

Fi
gur
e17.
1Theprotoc
olst
a c
ki natra
diti
onalr
outerwi
thlayers
i
nvol
vedinforwardingatr
ansi
tdatag
ramhighl
i
g ht
ed.

Ast hef i
gur ei ndic
a t
es,d atag
ramf or wardingus uall
yonl yr equir
esp rotocols
upt hroughLa ye r3.Pa cketp roces
singr e l
ieso nde mul t
ipl
exingateac hlayerof
thep roto-
cols ta ck.Whe naf r
amea r
rive s,protoc ols oftwa r
el ooksatt het yp e
fi
eldt olea
rna b outt hec ontentsoft hef r amep ayloa d.Ift hef ramec ar
riesa nI P
datagram,t hep a yloadiss e
ntt otheI Pp rotocolmodul ef orp rocess
ing.IPus es
thede st
inati
ona ddr e
sst ose l
ectane xt-hopa ddress.I ft heda tagra
mi sint rans i
t
(i
.e.
,p assi
ngt hr oug ht her outeroni tswa yt oade sti
nation),IPf orwardst he
datagramb ys endi ngitb acko utoneoft heint er
-f ac e
s.Ada tagram onlyr e
a ches
TCPi ftheda tagr ami sdesti
ne dforther out e
ri ts
elf .
Tounde r
standwhyt ra
ditiona
ll ayeri
ngdoe snots ol
vea l
lp roblems ,consider
MPLSp rocess
ingasde scr
ibedi nthep revi
ousc ha pter.I np articular,c onsi
de ra
routeratt heborderb etweenat radit
iona linterneta nda nMPLSc or e.Suc ha
routermus tac-
ceptpacketst hatarrivefr om thet ra
diti
o nalinterneta ndc hoos
e
anMPLSp athoverwhi c
ht os endt hep ack et.Whyi slaye r
ingp e r
t i
ne ntt op at
h
sel
ecti
on?I nma nyc ase
s,ne tworkma nage rsuset ransportl ayerp rotocolp ort
numb e
rswhe nchoosi
ngap ath.Fore xample ,suppos eama nagerwa ntst os endall
webt raf
ficdownas p
ecifi
cMPLSp ath.Al lt hewe bt raffi
cwi llus eTCPp ort80,
whichme anstha
tt hesel
ectionmus te xamineTCPp ortnumb er
s .
Unf ortunate
ly,i nat r
adi
tiona
ldemul
ti
plexi
ngsche
me,ada ta
gram doe
snot
reac
ht het ransportlayerunl
essthedat
agra
mi sdesti
nedfortherouterit
sel
f.
Therefor e
,p ro-
t ocolsoft
ware mustb er eor
gani
zedt o ha
ndle MPLS pat
h
sel
ecti
on.Wec ans ummari
ze:
S
ec.1
7.2 Mot
iva
tionForCl
ass
ifi
cat
ion 371

At radit
ionalprotocolst
ackisinsuff
ici
entf orthetaskofMPLS
paths el
ection,becausepaths el
ecti
on often i
nvol
vestrans
port
layerinfor-mationandat r
aditi
onalstac
kwi llnotsendtrans
it
datagramst othet r
ansportl
ayer.

1
7.3Cl
ass
ifi
cat
ionI
nst
eadOfDe
mul
ti
ple
xing

How shoul
dp r
otocolsof
twareb est
ructur
edtohandletas
ksli
keMPLSp ath
s
ele
c-ti
on?Thea ns
we rli
esinatechnol
ogyknownascl
ass
ifi
cati
on.Acl
ass
ifi
cat
ion
s
ystemdif
f e
rsfromconventi
ona
lde mul
tip
lex
ingint
wowa ys:

Ab
il
it
ytoc
ros
smul
ti
pl
ela
yer
s
Fa
ste
rtha
nde
mul
ti
pl
exi
ng

Tounde rstandc l
assi
fi
c a
tion,imag i
neap a
c ke
tt ha thasb e
enr ec
eivedata
routera ndpla
ce dinme mory.Re cal
lthate nc
apsula
tionme ansthatthepacketwil
l
haveas etofc onti
guousp rotocolheadersattheb eg
inning.Forexample
,Figure
17.
2i l
lustra
test heheadersinaTCPp a c
ket(e.g.,ar equestse
ntt oawe bserv
er)
thatha sarri
vedov eranEt hernet.

Ethe
rne
t IP TCP
...TCPPa
yloa
d...
hea
der he
ader heade
r

Fi
gur
e17.
2Thea
rra
nge
mentofp
rot
ocolhe
ade
rfi
el
dsi
naTCPp
ack
et.

Giv
enap ack
e tinme mory,howc anwequi ck
lyde t
e r
minewhe t
hert hepacket
i
sde sti
nedf ort heWe b?As i
mp l
i
sticapp
r oachsimplylooksatonef i
eldint he
he a
de r
s:theTCPde s
tina t
ionportnumb er
.Howe ver
,itc oul
db ethatt hepacket
i
s n
taTCPp acketa ta ll
.Ma ybet heframei sca r
ryingARPi nstea
dofI P.Or
ma ybet hef ra
medoe si ndeedcontainanI Pda t
ag r
am,b utinstea
dofTCP,t he
transportlayerp rot
ocoli sUDP.Toma kecertai
nt hatitisdesti
nedf ortheWe b,
softwa r
ene edstov eri
fye ac
hoft heheaders:theframec ontai
nsanI Pdatagr
am,
theI Pda ta
g ramc ontainsaTCPs eg-ment,a ndtheTCPs eg
me ntisdesti
nedf or
theWe b.
Insteadofp arsi
ngp rotocolhe ade rs
,t hinkoft hep ack eta sana rray of
octetsinme mory.Asa ne xamp l
e ,cons i
derIPv 4.Tob ea nI Pv4da t
agram,t he
Ethernett ypef i
eld(loca
t edi na rrayp os
iti
ons1 2t hrough1 3)mus tc onta
in
0x0800.TheI Pv4p rotocolf i
eld,l oca te
da tp osi
ti
on 23mus tc ontan6(
i the
protocolnumberf orTCP) .Thede s
t i
- nati
onp ortfiel
di nt heTCPhe adermus t
contan80.Tok
i now thee xactp ositionoft heTCPhe a
de r
,wemus tk now the
si
zeoft heIPhe ader
.The refore,wec he
ckt hehe aderlengt hoc t
etoft heI Pv4
header.I ftheoc te
tc ont a
ins0x 45,t heTCP de s
tinati
onp ortnumb erwi llbe
foundi narra
yp osi
ti
ons36t hrough37.
Weus eIPv4tok e
ept
hee
xamp
less
mal
l
;al
thoug
hthec
onc
ept
sap
plyt
oIPv
6,e
xte
nsi
onhe
ade
rs
c
om-
pli
cat
et hedet
ail
s.
372 Pa
cke
tCl
ass
ifi
cat
ion Cha
p.1
7

Asa nothere xamp l


e,consi
derVoiceoverIP(VoI P)traff
icthatusest heReal
-
TimeTr ansportPr otocol(RTP).BecauseRTPi snota ss
ignedas peci
ficUDPp ort,
vendorse mp l
oy ahe urist
icto determinewhe t
herag ivenp acketc a
rriesRTP
traffi
c:c heckt heEt hernetandIPhe aderstov e
rifytha tap acke
tc arrie
sUDP,
andt hene xaminet heoct e
tsatak nownof fs
etint heRTPme s
saget overifytha
t
thev al
uei nthep acketma tchest
hev al
uee xp
ectedb yak nownc odec
.
Ob s
ervet hatallthechec
ksdescri
bedint hep re
cedingpara
g r
aphsonlyr e
quire
ar
-rayl ookup.Tha ti s,the l
ookup mechanism me relycheckstov e ri
fyt hat
l
ocation X c on-ta
insv aue Y,l
l ocat
ion Z containsv a
lue W,a nd so on t he
mecha ni
sm doe snotne edto underst
and any oft hep r
otocolheadersort he
meaningofoc tet
s.Fur t
hermore
,ob -
servethatt helookupschemecross
e smulti
p l
e
l
ayersoft hep r
otocolstac
k.
Weus et het ermc l
assi
fiert ode sc
ribeame chani
smt hatus e
st helookup
a
pproachdes
cribedabove,andwes a
yt hattheresultisap ac
ketc l
ass
ifi
cati
on.In
p
racti
ce,aclas-
sifi
cati
onme cha ni
sm usual
lytakesal i
stofc l
ass
ifi
catonr
i ul
esand
a
ppl
iesthem untilama tc
hi sf ound.Fore xa
mp l
e,ama nag
ermi ghtspeci
fyt hr
ee
r
ule
s:senda l
lwe bt r
affi
ct oMPLSp a
th1 ,sendallFTPt raff
ictoMPLSp ath2,
a
nds e
nda l
lVPNt raffi
ctoMPLSp ath3.

1
7.4La
yer
ingWhe
nCl
ass
ifi
cat
ionI
sUs
ed

Ifc l
assi
fi
ca t
ionc rossesp rotocollayers,how doe si tr el
atet ooure ar
li
er
l
ayeri
ngdiagrams?Wet hinkofac las
sifi
cati
onl ayera sa next ralayert hathas
b
eens queezedb etweent he Ne twor kI nterf
acel ayera nd IP.Onc eap ac
ket
a
rriv
es,t he p acketp asse
sf r
om t he Ne twork I nterface modul et o the
c
las
sif
icat
ionlayer.Allp acketsp roceedtot hec l
assi
fie
r ;node mult i
pl
exingoc c
urs
b
eforec l
assi
fi
ca t
ion.Ifa ny oft hec la
ssif
icati
on rulesma t
cht hep a
c ket
,t he
c
las
sif
icat
ion layerf ol
lowst he r ule.Ot her
wise,t he pa cke
tp rocee
dsup t he
t
radit
ionalprotocols t
a c
k .Fore xample
,Fi gure1 7.3i l
l
us tr
at e
sl ayering when
c
las
sif
icat
ionisus edtos ends omep acketsa c
rossMPLSp aths.
I
nteres
tingly, t
he c l
ass
ifi
cat
ion layerc ansubsume the f
irs
tl ev
el of
demulti
pl
exi
ng .Thatis,inste
adofonl yc l
ass
ifyi
ngpac
k e
tsforMPLSp a
ths,the
cl
assi
fi
ercanb econfi
g-uredwitha ddi
ti
onalrule
stha
tc hec
kt hetyp
efiel
dina
fr
a meforIP,ARP,RARP,a ndsoon.

1
7.5Cl
ass
ifi
cat
ionHa
rdwa
reAndNe
twor
kSwi
tche
s

Thedescri
ptiona bovede s
cribesac l
assi
fi
c ati
onme chani
smt hatisimplemented
insoftware a ne xtr
al ayerisa ddedt oas oftwar ep r
otocolstac
kt hatc l
ass
ifi
es
fra
me s oncet heya rri
vea tar outer.Cl as
sifi
cation isa l
soi mplementedi n
hardware.Inp a
rt i
cu-l
a r
,Et hernets wit
chesa ndot herp ack
etp roc
essi
ngha rdware
devic
escontainclassi
fi
c a
-tionha rdwa r
et hata l
lowsp acketf or
wa r
dingt oproceed
athi ghspeed.Thene xts ec-ti
onse xplai
n ha rdwa r
ec l
assi
fi
cati
on me chani
sms.
Cha
pte
r28c
ont
inue
sthedi
scus
sion
S
ec.1
7.5 Cl
ass
ifi
cat
ionHa
rdwa
reAndNe
twor
kSwi
tche
s 373

byshowinghowSoftwar
eDefi
nedNetwor
kingtechnol
ogi
esusethecl
ass
ifi
cat
ion
mec
ha ni
smsinswi
tchestoa
chi
evetr
affi
cengine
eringathig
hs p
eed.

Tr
adi
ti
ona
lSt
ack

Ap
ps(
Laye
r5)

TCP(
Laye
r4)
La
belS
wit
chi
ngCode

I
P(La
yer3) MPLSModul
e

Cla
ssi
fie
r
i
nte
r- inte- .
r .
.inter
-
f
ace1 face2 f
aceN

ne
t1 ne
t2 ... netN

Fi
gur
e17.
3La
yer
ingwhe
nar
out
erus
esc
las
sif
ica
tio
ntos
ele
ctMPLSp
aths
.

Wet hi
nkofne tworkdevic
e s
,suchasswi
tche
s,asbe
ingdiv
idedint
ob r
oad
cat
egor
iesbyt hele
velofp r
otocolhe
ader
stheyexami
nea
ndt hecons
equentl
eve
l
offunc
tional
it
yt heyprov
ide:

La
yer2swit
chi
ng
La
yer2VLANswit
chi
ng
La
yer3swi
tchi
ng
La
yer4swit
chi
ng

Chapte
r2de s
cribe
sLa yer2s wi
t c
hes.I nesse
nc e,suc
has wi t
che xami nesthe
MAC sourcea ddres
si ne achincomi
ngf ramet ol e
a rntheMAC a ddressoft he
computerthati sattac
hedt oe achport.Onc eas witchle
arnst heMACa ddres
ses
ofalltheat-tache
dc omputers,theswitchc anuset hedesti
nati
onMACa ddressin
eachframet oma keaf orwardingdecis
ion.I fthef rameisuni cas
t,t hes witch
onl
ys endsonec opyoft heframeont hep orttowhi chthes p
ec i
fi
edc omp uteris
atta
ched.Foraf ra
mede st
inedt ot heb roadc
astoramul ti
c a
sta ddre ss
,t he
swit
chde l
ive
rsac opyoft hef r
amet oa l
lports.

AVLANs wit
chpermitsthema nagertoassi
gneac
hp ortt
oas pec
ifi
cVLAN.
VLANs wi
tchesex
tendforwardi
nginonemi norway:i
nste
adofs e
ndingbroadc
ast
s
and mult
icas
tstoa l
lp ortson thes wit
ch,aVLAN switc
hc onsul
tstheVLAN
conf
igura
tionandonl
ys endstoportsonthesameVLANasthesource.
374 Pa
cke
tCl
ass
ifi
cat
ion Cha
p.1
7

A Layer3s witch ac
tslikeac omb i
nati
onofaVLAN s witcha ndar outer.
I
nst
eadofonl yusingt heEthernetheaderwhe nf orwardi
ngaf r
ame ,t heswitc
h
c
anlooka tf i
eldsint heIPhe a
der.Inp art
icul
ar,t heswitchwa tche st hesourc
e
I
Paddressini n-co
mi ngpacke
tst olear
nt heIPa ddressofthec omp ute rattache
d
t
oe achswi t
chp ort.Thes witchc a
nt henus estheI Pd esti
nati
ona ddres
si na
p
ackettof orwardt hepacke
tt oitscorre
ctde s
tinati
on.
ALayer4switc
hext e
ndsthee x
ami
nat
ionofap ac
ke tt
othet rans
portla
yer.
Tha
tis,theswi
tchcanincl
udetheTCPorUDPs our
cea nddes
tina
tionp or
tfiel
ds
whenmak-i
ngaforwardi
ngdeci
sion.

1
7.6S
wit
chi
ngDe
cis
ionsAndVLANTa
gs

Al
lt ypesof s wit
ching hardwarerely on cl
ass
ifi
cat
ion.Tha tis,switches
oper
a t
eonp ac
ketsa si
fap ac
k eti
smerel
ya na r
rayofoc t
etsa ndi
ndiv
idualfi
elds
inthep a ck
eta res peci
fiedb yg i
vi
ng offs
etsint hea rray.Thus,inst
e a
d of
demulti
pl
ex i
ngp a
c k
ets,as wit
c htre
atsap ac
ketsyntact
ica
llybya p
plyi
ngas etof
cl
ass
ifi
cationrulessi
mila
rt ot herul
esde
s c
ribedabove
.
Sur
pri
si
ngly,e v
enVLANp r
oces
singisha ndl
edinas ynta
cti
cma nner
.I nstea
d
ofme re
lykeepi
ngVLANi nformati
oni nas e
pa ra
tedatastruc
turethatholdsme ta
infor
ma-ti
on,t heswitchinsertsane xtrafiel
di nanincomi
ngp ac
ketandp l
aces
theVLAN numb eroft hep ack
etint heextraf i
el
d.Becauseitisjusta nother
fie
ld,thecla
ssifi
erc a
nr e
f e
rencetheVLAN numb erjustli
kea nyotherhe ader
fie
ld.
Weus etheterm VLANtagtorefert othee xtr
af i
eldinse
rtedinap ack
et.
Thet a
gc ontai
nstheVLANnumb erthatt hema nage
ra s
signedtot heportover
whichtheframearri
ved.ForEthe
rnet,I
EEEs tandard802.1Qspeci
fi
esplac
ingthe
VLAN tagf i
el
da f
tert heMAC sour
cea ddres
sf ie
ld.Fig
ur e17.4ill
ust
ratesthe
format.

De
stina
tion Source VLAN Frame
Addres
s Addr
ess Tag Type Fr
amePayl
oad(Data
)
461
500oct
e s ..
t
6oc
tet
s 6oc
tet
s 4oc
tet
s 2oc
tet
s .

Fi
gur
e17.
4Ill
ustra
tionofanIEEE802.
1QVLANtagfi
el
dins
ert
edinan
Ethe
rnetf r
ameaf
t ert
heframear
riv
esa
taVLANs wi
tch.

AVLANtagisonl
yus
edinter
nall
y onc
et heswi
tchhasse
lect
edanout
put
p
ortand i
sr e
ady totr
ansmitthe fr
ame,the tagisremoved
.Thus,when
c
ompute
rsatt
achedtoas wit
chs e
nda ndrec
eiv
ef ra
mes,thef ra
mesdonot
c
ont
ainaVLANtag.
Ane
xce
pti
onca
nbema d
etotherul
e:amana
gerc
anconfi
gur
eoneormore
p
ort
sonas wi
tchtol
eav
eVLAN ta
gsinfra
meswhense
ndingthefr
ame.The
p
urposei
st oal
lowtwoormoreswitc
hestobeconfi
gur
edtooper
ateasasi
ngl
e,
l
arg
es wi
tch.Thatis
,theswi
tchescanshar
eas etofVLANs ama na
gercan
c
onfig
ureeachVLANtoi
ncl
udeportsononeorb
ot hofthes
wit
ches.
S
ec.1
7.7 Cl
ass
ifi
cat
ionHa
rdwa
re 375

1
7.7Cl
ass
ifi
cat
ionHa
rdwa
re

Wec anthi
nkofha rdwar
einas witc
ha sbei
ngdividedintothre
emaincom-
ponents
:ac las
sif
ier,as e
tofuni tsthatperf
orma c
t i
ons
,a ndama nag
ement
componentthatcontrolstheovera
lloper
ati
on.Figur
e1 7.5il
lus
trat
estheover
all
orga
nizati
onandt heflowofp ac
kets.

ACTI
ON1

MANAGEMENT
ACTI
ON2
confi
gur
ati
on .
occur
s .
p
acket .
a
rri
ves
CLAS
SIFI
ER ACTI
ONN

Fi
gur
e17.
5Thec
onc
ept
ualor
gani
zat
ionofha
rdwa
rei
nas
wit
ch.

Asthef ig
ur eindi
cates
,t hec l
a s
sif
ierprovi
de sthehi
g h-speeddatapaththat
p
acket
sf ol
low.Ap ack
eta r
rives,a ndthec l
assi
fi
e rusesther ulesthathavebeen
c
onfi
guredt oc hoosea naction.Thema na
geme ntmoduleus ual
lyconsi
stsofa
g
eneral
-purposep r
o-cess
ort hatr unsma nagements of
twar e
.Ane tworkma na
ger
c
aninterac
twi t
ht hema na
ge mentmodul et oconf i
gur
ethes witc
h,inwhichc as
e
t
hema nageme ntmodul ecanc re
a teormodi f
yt hesetofr ul
esthec l
assi
fi
er
f
oll
ows.
AswithMPLSc l
assi
fi
ca ti
on,as wi
tchmus tbea bl
et ohandletwot ypesof
t
raffic
:t r
ansittraf
ficandt raff
icdest
inedfortheswitchit
sel
f.Fore xample,to
p
rovidema nage-mentorr outi
ngf unc
tions,aswitchma yhaveal ocalTCP/IP
p
rotocolstack,andp ac
ketsde st
inedfort heswi
tchmus tbep as
sedt ot heloca
l
s
tack.Therefore,oneoft hea cti
onsac l
assi
fi
ertak
esma yb epasspackett othe
l
ocalstac
kf ordemulti
pl
exing.

1
7.8Hi
gh-
Spe
edCl
ass
ifi
cat
ionAndTCAM

Modernswitc
hesc ana l
l
owe achinterfa
cet oop e
rateat1 0Gb ps.At10Gb ps
,
aframeonlyt a
kes1 .2 microsec
ondst oa rri
ve,a ndas wi t
chus ual
lyhasma ny
i
nterf
ace
s.Ac onventiona
lp rocess
orc annotha ndl
ec la
ssi
fi
c at
iona tsuchs p
eeds
.
Sothequesti
ona ri
ses:how doe saha rdwarec l
assi
fi
era chi
evehi g
hs pe
ed?The
ans
werliesin aha rdwaret e
chnologyk nown a sTe r
nary ContentAddr ess
abl
e
Memory(TCAM).
TCAM us
esp
aral
l
eli
smtoachi
evehig
hspee
d ins
tea
doft e
sti
ngonefi
eldof
ap
acke
ta tagiv
ent i
me,TCAM che
cksal
lfiel
dssi
mul
tane
ousl
y.Furt
her
more,
TCAM per
formsmulti
pl
ec he
cksatthesamet
ime
.To unders
tand how TCAM
work
s,thi
nkofap a
cketasastr
ingofb
its
.Wei
magi
neTCAM ha
rdwareashaving
twopar
ts:onepa
rt
376 Pa
cke
tCl
ass
ifi
cat
ion Cha
p.1
7

holdsthebi
tsf
rom apac
ketandtheot
herp
arti
sanarr
ayofv
alue
sthatwi
l
lbe
com-paredtothepac
ket.Ent
rie
sinthear
rayarek
nownassl
ots
.Fig
ure17.
6
i
llust
ratest
hei
dea.

b
itsf
romap
acke
t
c
heckr
esul
ts
pa
ral
le
lcompar
ison i
npar
all
el
wi
thalls
lot
s

p
att
erni
nsl
ot1 a
cti
on1
p
att
erni
nsl
ot2 a
cti
on2
p
att
erni
nsl
ot3 a
cti
on3 a
cti
on
.
.

.
p
att
erni
nsl
otN a
cti
onn

Fi
gur
e17.
6Theconcep
t ualor
gani
zat
ionofahi gh-
spe
edha
rdwa
re
c
las
sif
ierthatusesTCAM t
echnol
ogy.

Int he fi
g ure,e achs l
otcont ai
nst wo parts
.The f i
rstpartc onsi
stsof
hardwaretha tc omp a
restheb i
tsf rom thepackett ot
hep atter
ns t
or edinthe
sl
ot.Thes econdp artstoresavaluet hatsp
ec i
fi
esa nacti
ont obet akenifthe
patter
nma t
che st hep ack
et.Ifama tc
hoc curs,theslothardwarep as
sesthe
act
iont othec omp onentthatchec
k sallt
heresultsandannounc
esa nanswer.
Oneoft hemos ti mport
antde tai
lsconc e
rnst hewa yTCAM ha ndl
esmul ti
p l
e
ma t
ches.Ine sse
nc e
,t heout putc i
rcui
trys el
ectsonema tcha nd ignorest he
others
.Tha tis,ifmul ti
plesl
otse ac
hp assa na ct
iont ot heoutputc i
rcuit
,t he
ci
rcuitonlyacceptsonea ndpassestheactiona stheout putoft hec la
ssi
f i
cati
on.
Fore xampl
e,theha rdwarema ychoosethel owestslotthatma t
che s.Ina nyc a
se,
thea c
t i
onthatt heTCAM a nnouncescorrespondst othea ct
ionf rom oneoft he
ma t
chingsl
ots.
Thef i
gurei ndi
ca te
st hatas l
othol dsap atternr at
hert hana ne xactvalue.
Insteadofme relyc omp ar
ingeachb itint hep at
t e
rnt ot hec or
respondingb i
ti n
thep acket,t heha r dwarep er
formsap att
ernma tch.Thea djecti
vet ernaryi s
usedb ecausee achb i
tp o-si
ti
oni nap a t
terncanha vet hre
ep ossi
blevalues:aone ,
aze ro,ora dontc are.
Whe nas lotcomp ar
esi tspatternt othep a
cket,t he
hardwa r
eonl yc heck stheonea nd ze rob i
tsint hep att
ern t heha r
dwa re
i
g nor
e spa t
t e
rnb i
tst hatcontai
n dontcare.Thus ,ap atte
rnc ans peci
fye xact
value
sf ors omef iel
dsi nap ac
kethe aderandomi tot herfiel
ds.

Tounder
standTCAM p
atter
nma t
chi
ng,cons
ide
rapat
ter
nthati
denti
fi
esIP
p
ack
- e
ts.I
denti
fyi
ngsuchpac
ketsi
seasybec
auseanEt
her
netfr
amethatcar
rie
s
anI P da-
tagra
m wil
lha
vet
he v
alue 0x
0800 i
nthe Et
her
nett
ypef
iel
d.
Fur
thermore,t
hetyp
e
S
ec.1
7.8 Hi
gh-
Spe
edCl
ass
ifi
cat
ionAndTCAM 377

fi
eldoccupi
esaf ixedposi
tio
ni nt hef r
ame :bits96through1 1
1.Thus,wec a
n
createapatte
rnt ha
ts ta
rtswi th96 dontc a
rebi
ts( tocovertheEt hernet
desti
nat
ionands ourceMACa ddr
e s
ses)fol
lowedb ysi
xteenb i
tswitht hebinar
y
val
ue0000100000000000( theb inaryequival
entof0x 0800)toc ove
rt het ype
fi
eld.Al
lremai
ningb itposi
ti
onsi nt hepatter
nwi l
lbe don
tc ar
e.Figur
e1 7.7
il
l
us t
rat
esthepatternande xampl
ep acke
ts.

* * * * * * * * * * * * 08 00 * * * * .
..
(
a)Ap
att
erns
howni
nhe
xade
cima
l

00 24 e
8 3a b1 f
1 00 24 e
8 3a b
2 6a 08 0600 01 08 00 .
..
(
b)Af
ramec
arr
yinga
nARPr
epl
y

00 24 e
8 3a b2 6a 00 24 e
8 3a b
1f1 08 0045 00 00 28 .
..
(
c)Af
ramec
arr
yinga
nIPda
tagr
am

Fi
gur
e17.
7(a)Apa
tter
ninaTCAM wit
ha s
ter
isk
sindi
cat
ingdon
tca
re,
(
b)anARPpac
kettha
tdoesnotmatchthepatt
ern,and(
c)
a
nIPdatag
ramtha
tma t
chesthepat
tern.

Al
thoughaTCAM hardwaresl
otha soneposi
ti
onf orea
chbit
,t hefigur
edoes
notdispl
ayindi
vi
dualbit
s.Inste
ad,e achboxcorresp
ondstooneoc tet,andthe
val
uei n aboxisahe xadeci
malvaluet hatcorre
spondstoeightb i
ts.Weus e
hexade
cimalsi
mplyb
e c
ausebinar
ys t
r i
ngsaretoolongt ofi
tcomfortablyont
oa
pri
ntedpage.

1
7.9TheS
izeOfATCAM

A que
sti
ona r
ise
s:howl
arg
eisaTCAM?Theque
sti
onc
anb
edi
vi
dedi
ntot
wo
i
mpor
tantaspec
ts:
Thenumberofbi
tsi
nas l
ot
Thetot
alnumbe
rofslot
s

Bitspers l
ot.Thenumb erofbitsp erslotdependsont het ypeofEt her
net
switc
h.A b asicswitc
hus esthede s
tination MAC addresstoc l
ass
ifyap acket.
Therefore
,t heTCAM inab asi
cswi
t c
honl yne eds48b itposi
ti
ons.AVLANs wit
ch
needs128b i
tp osi
ti
onstoc ov
ertheVLANt a
ga sFi
gur e17.4il
lustr
ates.ALayer
3s wi
t c
hmus thavesuff
ici
entbitposi
tionst ocovertheI Phea de
ra swe l
lasthe
Ethernetheader.
Totals
lot
s.ThetotalnumberofTCAM s
lot
sdete
r mi
nesthemaxi
mumnumber
ofpat
ternsas wi
tchcanhold.TheTCAM i
nat yp
icalswit
chhas32,
000entr
ies
.
Whe
nas wi
tchlea
rnstheMACa ddre
ssofacomput
ert hathasbe
enpl
ugg
edintoa
por
t,t
hes
witchc
ans
tor
eap
att
ernf
ort
hea
ddr
ess
.Fore
xamp
le,i
fac
omp
ute
r
wit
hMACad-

Fig
ure1
7.4c
anb
efoundonp
age
374.
378 Pa
cke
tCl
ass
ifi
cat
ion Cha
p.1
7

dre
ssX i spl
ugg
edi ntopor
t29,t he s
wit
chc a
nc r
eat
eap at
ternin whi
ch
des
tina
tiona
d-dres
sb i
tsmathX a
c ndt heacti
oniss
endpac
kettoout
putport
29.
As wi
tchc anals
ous ep atter
nst ocont
rolb r
oadcast
ing.Whe n ama na
ger
confi
g-uresaVLAN,t hes wit
chc anadda nent
ryf ort heVLAN b r
oadca
st.For
exampl
e,ifama nag
erc onfi
guresVLAN 9,anent r
yc anb ea ddedinwhichthe
dest
inati
ona dd
ressbi
tsa reall1s(i
.e.
,theEthernetbroadca
sta ddr
ess)andthe
VLANt agis9.Theacti
ona ss
ocia
tedwiththeent
ryi sbr
oadcastonVLAN9.
ALa yer3switchc anlearnt heI Psourcea ddressofc omp utersa t
t a
chedt o
thes wit
c h,andcanus eTCAM t os toreane ntryf oreachI Pa ddress
.S i
milarl
y,it
ispossi
-b l
et ocrea
tee ntri
estha tma tchLayer4p r
otocolp or
tnumb ers(e.g.
,t o
dire
cta llwe bt r
affi
ct oas pecifi
c output).Cha pt
er 28 c onsi
dersa nother
inter
e s
tingus eofc l
assi
fic
a-ti
onha rdware:ama nagerc a
np l
a c
ep atternsint he
cla
ssi
f i
ert oesta
bli
shp athsthroughane t
wor ka nddirecttr af
f i
ca l
ongt hep at
hs.
Becauses uchcla
ssi
fic
ationr ul
esc rossmulti-p
lel a
ye r
soft hep rotocolstack
,t he
potentia
lnumb erofitemss tor
e dinaTCAM c anb elarge.
TCAM s eemsl i
kea nidealmechani
smb ec
auseitisbothex
t remelyfas
ta nd
vers
a-til
e.Howe v er
,TCAM ha sasignif
ica
ntdrawback
:cost
.Ina ddit
ion,because
i
top e
r at
esi np a
rall
el
,TCAM c onsumesmuc h moreener
gyt hanc onve
ntional
memor y.The r
e f
or e,des
igne
rsminimizet heamountofTCAM tok eepcostsa nd
powerc onsumptionlow.

1
7.1
0Cl
ass
ifi
cat
ion-
Ena
ble
dGe
ner
ali
zedFor
war
ding

Pe r
ha ps,t hemos ts ignifi
canta dva ntageofac l
a s
sifi
cationme chani s
ma ri
ses
from t he g ene ral
izat i
onsi te nabl
es.Be causec lass
ifi
c at
ion e xaminesa r
b i
trar
y
fi
e l
dsinap ack e
tb eforea nyde multi
ple xi
ngoc curs,c ross
-laye rcomb i
na t
ionsa re
possi
ble.Fore x-amp le,c l
assifi
cati
onc ans pec
ifyt hata l
lp a
cke tsfromag i
venMAC
addresss houldb ef orwa rde dtoas pec i
ficout p
utp ortr egar dl
essoft hep acket
typeort hep acketc ont ents.Ina ddition,classi
f i
cation can ma kef or wardi
ng
decis
ionsde pe ndo nt hes ourcea ddressi nap acke ta swe l
la st hede s
tination.An
ISPc anus es ourcea ddressest odist
ing uishamongc ustome rs
.Fore xamp le
,a nISP
canf orwa rda llpacke tswi thI Psourcea ddresXa
s longonep at hwhilefor wardi
ng
packetswi thI Ps our cea ddr esYa
s l
onga notherp ath,e venifa l
lthep acketsha ve
thes amede stinationa ddress.
I
SPsus et heg e
neral
itythatc l
ass
ifi
cati
onof fe
rst oha
ndletraffi
cengineeri
ng
tha
ti snot us uall
ya vai
lab
lein ac onventi
onalp r
otoco
ls ta
ck.I np arti
cula
r,
cl
ass
ifi
c a
tiona l
-lowsISPstoo ff
e rtie
redse r
vice
s.AnI SPcanarrangetous eboth
thetyp eoft r aff
icandt hea mountac ustomerp ayswhenc l
assi
fyi
ngp ackets
.
Oncethep acketha sbeenclas
sif
ied,allpac
k etswit
ht hesameclas
sif
icat
ionc a
nb e
for
wa rdedalongt heappropri
-atepath.
S
ec.1
7.1
1 S
umma
ry 379

1
7.1
1Summa
ry

Class
ifi
cat
ionisafundamentalpe
rformanceopti
miza
tiont ha
ta ll
owsap ack
e t
p
ro-cess
ingsystemtocrossl
ayersofthep r
otocols
tackwithoutde mult
ipl
exi
ng.A
c
las
sif
iertreatseachpac
ketasa narrayofb i
tsandchecksthec ontent
soff i
elds
a
ts p
ecifi
cloca
- t
ionsi
nthearray.
Cla
ssi
fi
cati
on i
sus e
d with MPLS aswel
la si n Et
her
netswitc
hes.Mos t
Ethernetswit
chesimp
lementcl
assi
fi
cati
oninhardwa r
e;aha r
dwar
et echnol
ogy
knowna sTCAM us
esparal
le
li
smtoperfor
mclas
sif
ica
tionatext
reme
lyhighspeed.

EXERCI
SES

1
7.1 Re
ada
boutEt
her
nets
wit
che
sandf
indt
hes
izeofTCAM us
ed.
1
7.2 I
fyoursi
teemp
loysMPLS
,ma
keal
i
stoft
hec
las
sif
ica
tionr
ule
stha
tar
eus
eda
nd
s
tat
ethepur
pos
eofe a
ch.
1
7.3 IfaLa ye
r2s wit
c hhasPp ortstha
tc onnecttoc
omp ut
ers
,whati
sthema x
imum
numberofMACde sti
nati
ona ddre
ssestheswitc
hneedstopl
acei
nit
scla
ssi
fi
er?Be
car
efulbe-c
aus
et heanswerisnotob v
ious.
1
7.4 Writec
las
sif
ica
tionr
ule
sthatse
ndal
lVoI
Ptraf
ficdownMPLSpath1,webtr
affi
c
downMPLSp ath2,s
shtra
ffi
cdownMPLSpa
th3,andallot
hert
raff
icdownMPLS
path4.
1
7.5 Ama nagerwantst
os e
nda l
lmult
ica
sttr a
fficdownMPLSp at
h1 7a ndallother
tra
f f
icdownMPLSpat
h1 8.Wha
tisthesi
mp le
stsetofc
las
sif
ica
tionrulestha
tc an
beused?
1
7.6 Doesyoura ns
wertothep r
evi
ousques
tionc ha
ngeifasiteusesbot hIPv4a nd
IPv6?
1
7.7 Thetextasse
rtsthatcl
ass
ifi
cat
ionisne
ededtop
roces
sp acke
tsthatarr
ivea
t1 0
Gbpsbe
-causeanEther
netf r
ameonlytake
s1.
2micr
osecondstoa
r r
ive
.Howma ny
bi
tsar
ei nthepayl
oadofsuchaf r
ame?
1
7.8 I
nthep
revi
ousprobl
em,howma
nyi
nst
ruc
tionsc
anahi
gh-
spe
edp
roc
ess
ore
xec
ute
i
n1.
2micr
osec
onds?
1
7.9 Onmostne
twork
s,thesma
ll
estpac
k e
tscont
ainaTCPACKtr
ave
li
ngi
nanI
Pv4da
-
ta
gra
m.Howlongdoesi
ttakeforsuchaframetoar
riv
e?
Chapt
erCont
ent
s
1
8.1 Introduc ti
on,381
1
8.2 Mobility,Addr e
s si
ng ,AndRout i
ng,381
1
8.3 MobilityVi aHostAddr essCha ng e,382
1
8.4 MobilityVi aCha ng esI nDa tag
r amFor war
d ing,383
1
8.5 TheMob ileIPTe chnol ogy,383
1
8.6 OverviewOfMob i
leI POp e r
ation,384
1
8.7 Overhe adAndFr eque ncyOfCha nge,384
1
8.8 MobileI Pv4Addr essing ,385
1
8.9 IPv4For ei
gnAg e ntDi scovery,386
1
8.1
0 IPv4Re gis
trati
on,387
1
8.1
1 IPv4Re gis
trati
onMe ssageFo rma t,388
1
8.1
2 Communi cati
onWi thAnI Pv4For eig
nAg ent ,388
1
8.1
3 IPv6Mob il
itySup p ort ,389
1
8.1
4 Datag r
a mTr ansmi ssion,Re cepti
on,AndTunne l
ing
,390
1
8.1
5 Asse
s sme ntOfI PMob i
li
t yAndUns ol
vedPr ob l
ems,391
1
8.1
6 Alt
er nativeI dentif i
er -Loc a
torS epa
rati
onTe chnolog
ies
,
395
1
8.1
7 Summa ry,396
1
8

Mobi
l
ityAndMobi
l
eIP

1
8.1I
ntr
oduc
tion

Pr
eviouschapte
rsde sc
rib
etheIPaddress
ingandfor
wa r
dingsche
mesus
ed
wi
thstat
ionarycomputersandanI
Paddres
singandfor
wardi
ngs c
hemetha
tuse
s
ne
twork-
b as
edaddres
sing
.
Thi
scha
pterc onsi
derst e
chnol
ogyt hata l
lowsap or
tabl
ec ompute
rt omove
fr
om onene tworkt oa nother
.Wewi l
ls eet hattheextens
ionc anworkwith
wir
edo rwir
eles
sne tworks,hasversi
onst hata p
plytoIPv4orI Pv
6,a ndre
tai
ns
bac
kwa r
dcompati
bili
tywi t
he xi
sti
nginte
r netrouting
.

1
8.2Mob
ili
ty,Addr
ess
ing
,AndRout
ing

Intheb r
oadestse
nse,t hetem mob
r il
ec omputingr efe
r st
oas yst
emt hat
a
ll
owsc omputer
st o movef r
om one locati
on t oa nother.Although wi
rel
ess
t
echnol
ogi
esall
ow rap
ida nde asymobil
i
ty,wi r
ele
ssa cce
s sisnotr equi
red a
t
ravel
ermightcarr
yal ap
- t
opc omput
era ndc onnecttoar emot
ewi rednetwor
k
(
e.g.
,inahotel
).
TheI Padd r
essi
ngs che
me ,whichwasdesigneda ndopti
mizedf orstati
onary
hos
ts,ma ke
smob i
li
ty diffi
cul
t.A p r
efi
x ofe a
c h hos
ta ddres
si dent
ifi
est he
net
wor kt o whicht hehos tattac
hes,and routersus ethep refi
xt of orward
dat
ag ra
mst ot hecorrectnetworkforfi
nalde
livery.Asar e
sult,mov i
ngahos tto
anewne t
wor krequi
r e
soneoft wop os
-si
bl
echa nges:

Thehos
tsaddr
essmus
tchange.
Data
gra
mf orwardi
ngmus
tc ha
nge.
381
382 Mob
il
it
yAndMob
il
eIP Cha
p.1
8

1
8.3Mob
ili
tyVi
aHos
tAddr
essCha
nge

Thea pproa
c hofc hangingahos t
sI Pa ddres
si swi delyus edint heg lob a
l
Internetandwor kswe l
lfors l
ow,s e
mi -perma nentmob i
lit
y.Fore xamp l
e,consider
aus erwhoc ar
r i
esac omp utert oac offees hopa nds taysf orawhi lesipping
coffeewhileusi
ngt heshopsWi -
Fic onne c
tion.Orc onsiderat ra
vele
rwhoc arr i
es
ac ompute
rt oahot elroom,wor ksa tt hehot elfort woda ys,andt henr e
tur ns
home .Aswewi llseeinCha pte
r22,s uchmob il
i
tyise nabl
e dwi thdynamicaddr ess
assi
gnment.I np arti
cul
ar,I Pv4 hostsus et heDHCP p rotocolt oob tai
na nI P
address
,andI Pv6hostsus etheI Pv6Ne ighborDi s
coveryp rotocoltog enerat
ea nd
verif
yauni quea ddr
ess.
Mostop eratingsys t
e msp erfor
ma ddressa ss
ignmenta utoma t
ical
lywithout
inform-ing the us er.The rea ret wo c ondit
ionst hatt ri
ggerdyna mica ddres
s
acquisi
tion.Firs
t ,whe nitb oots
,a nIPv4hos ta l
wa ysrunsDHCPa nda nIPv6host
gene rat
e sa uni cas
ta d-dres
sa nd val
idatesuni queness
.S econd,a n operati
ng
systemr eas
sig
nsa na ddresswhe nitde t ec
tst hel os
sa ndt henr eac
quisi
ti
onof
networ kc onnectivi
ty.Thus ,ifap ort
ab lecomp uterr e
ma i
nsr unningwhileitis
mov edf rom oneWi -Fihot s
pott oanot her,t heop era
ting syst
em wi l
lde t
ect
dis
c onnecti
onf romt hef i
r stWi-Finetwor kandr econnec-ti
ont othesecond.
Al
thoughi t work swe llf or casualus ers
,c hangi
ng a hos tsaddr e
ssha s
dis
advan-ta
ges.Ana ddr es
scha ngeb re
a ksallongoingt rans
p ortlayerconnecti
ons.
Fore x
amp l
e,at ra
ns portconne ct
ionisus edtowa t chas treamingv i
deoort ous e
aVPN.I ne ac
hc a s
e,c hangingahos t
sI Pa ddre s
sb reaksa lltransportlayer
connecti
onsandc a
us estheop eratingsystemt oinf orma ppl
icati
onsthata reusing
theconnecti
ons.Ana p pl
i
cati
onc anrecoverf rom connectionlossb yinf
or mi
ngt he
userorb yrest
artingt heconne cti
ona utomatical
l
y.Ev e
ni fa nappli
cati
onr est
arts
ac onnecti
on,r es
t a
rt i
ng ma yt a ket i
me ,whi ch me ansa us er ma y noticea
dis
rupti
onins er
vice.
Ifahos to f
fersne tworkservi
ces(i.
e.,runsservers),changi
nga nI
Pa ddress
hasmor esevereconsequences.Typi
c a
ll
y,eacha pp
li
cationt hatrunsaser
vicemust
ber e-s
tarted.Furthermor e,computersthatr uns e
r vi
cesa reusual
l
ya s
signeda
domain name.Thus ,whe nt hecomp ut
ersIPa ddressc hanges,thehost
sDNS
entrymus talsobeup -dated.Ofc ours
e,a narbi
traryc omputerisnotpermitt
ed
toc hange a DNS e ntry,whi ch meansa ddi
ti
ona linfrastr
uctureisneede dto
authenti
cateDNSup date s
.
Thepointis:

Although dynami caddres


sas s
ignmentenablesabas i
cform of
mobili
- t
yt hatallowsausertomov eahostfrom onenetworkto
another,c hanging a host
s addr es
s has t
he disadv
ant
age of
breakingtransportlayerc
onnections.
Chapte
r23e
xpl
ai heDoma
nst inNameSys
tem
(DNS)
.
S
ec.1
8.4 Mob
il
it
yVi
aCha
nge
sInDa
tag
ramFor
war
ding 383

1
8.4Mob
ili
tyVi
aCha
nge
sInDa
tagr
am For
war
ding

Canwea ll
ow ahosttore t
ainitsori
ginalIPaddresswhenitmov estoane w
net-
wor k?I ntheory,theanswerisyes a llweneedt odoisc hangeforwarding
tab
lesinr outersthroug
houttheI nt
ernets odatagr
amsde st
inedf orthehostwi l
l
beforwa rdedtot henew net
wor k.Wec oulde v
enc re
atenetwor khardwaret hat
dete
c t
st hep res
enceofne wI Paddress
esa ndinformst heroutingsyste
ma b out
thei
rp re
se nc
e.
Unfortunately,t hes i
mp l
is
ticschemede scr
ibedabovei simpr a
c t
icalbecause
host-s
pe c
ifi
cr outingdoe snots cal
et ot hes i
zeoft heg lobalInternet.Internet
routi
ng onl y wor ksb ecaus
er outi
ng p rotocolsexchangei nforma ti
on a b
out
networksr athert hanhos tsa ndb ec
ausene t worksares tat
ionary.Tha tis,t he
totalsizeofr out i
ng information i
sl i
miteda nd t
hei nformati
on i sr e
lati
vely
stat
ic.I frout i
ngp rotocolsareus edt oha ndlehostsinsteadofne tworks,t he
amountofr outingt r
a f
ficb e
come soverwhelming,evenifo nl
yas ma llfract
ionof
hostschangeloca ti
one achday.Thep ointis
:

Wec annotus ehost-s


peci
fi
cr outi
ngt ohandlemobi l
i
tybec aus
e
the gl obal I
nternet does not hav es uf
f i
ci
ent capac
ity to
propagatehost-s
pecif
icroutesthatchangefrequent
ly.

1
8.5TheMob
ileI
PTe
chnol
ogy

TheI ETFde visedat e


chnologyt op e
rmitIPmob il
i
ty;v er
sionsarea va
il
abl
e
forbothI Pv 4andI Pv6.Of fi
cia
llynamedI Pmobil
it
ys upportandpopularl
yc al
l
ed
mobil
eI P,t het echnol
og yprovide
sac ompr
omise
.Mob il
eI Pha sthea dv
antages
ofnotc ha ngingahos t
sI Pa ddres
sa ndnotr e
quiri
nghos t-
specif
icrouti
ng,but
the dis
adva n-tag
et hat datagram forwardi
ng ca
nb ei ne
ffic
ient.The g e
neral
char
a c
teri
s tic
sinclude:

Tr
ans
par
enc
y.Mobi
l
ityi
str
ans
par
entt
oap
pli
cat
ions
,tr
ans
por
tla
yer
proto-col
s,andr out
ers.Inp ar
tic
ula r
,aTCPc onnect
ioncansurvi
vea
changei nlocat
ion.Theonlyp rovi
soi sthatifthetrans
iti
ont a
kesa
l
ongt i
me( i.
e.,ahos tremainsdis
c onne
ctedfrom al
lnetworksfora
while)
,t he connect
ion cannot be used dur
ing t
he trans
iti
on.The
reasoni sthatTCPwi l
lti
me outt hec o
nnect
ionaftertwoma x
imum
segmentl i
fet
imes.
Bac
kwar
d Compat
ibi
l
ity.A hos
tus
ing mob
il
eIPv
4ca
nint
erop
era
te
withs t
a ti
ona
ryhoststha
tr unconventionalIPv
4s of
twa r
ea swe l
las
withot hermobil
eIPv4hosts.S
imil
arly,ahos tusi
ngmob il
eI Pv6can
i
nterope r
atewithst
ati
onaryhoststhatus eIPv6orothermob il
eIPv6
hosts
.Tha ti
s,amob i
lehostusest hes ameI Paddres
ss che
mea sa
sta
tionaryhost.
Sc
alabi
l
ity.Thes
olut
ionp
ermi
tsmob
il
it
yac
ros
stheg
lob
alI
nte
rne
t.
Sec
uri
ty.Mobi
l
eIPc
ane
nsur
etha
tal
lme
ssa
gesa
rea
uthe
nti
cat
ed
(i
.e.
,top
rev
enta
nar
bit
rar
ycomp
ute
rfr
om i
mpe
rsona
tingamob
il
e
host
).

Whe
niti
sne
ces
sar
ytodi
sti
ngui
sh,weus
ethet
ermsmob
il
eIPv
4and
mobi
l
eIPv
6
384 Mob
il
it
yAndMob
il
eIP Cha
p.1
8

Mac
roMobi
l
ity.Rat
hert
hana
tte
mpt
ingt
oha
ndl
econt
inuous
,hi
gh-
spe
edmov ement,sucha sace
llphoneinaca
r,mo b
il
eIPfoc
useson
theprob
lem oflong-dur
ati
onmov
e s(e
.g.
,auserwhotak
esapor
tabl
e
devi
ceonab usi
-nesstri
p).

1
8.6Ov
erv
iewOfMob
ileI
POp
era
tion

How can mob i


leI Pa ll
ow ahos tt oretai
ni tsaddresswi thoutr equi
ring
routerstolearnhost-speci
ficrout e
s?Mob i
leIPs olvesthep robl
emb yal
lowinga
hosttoholdt woaddressessimultaneous
ly:aperma nentandf ixedprimaryaddress
thatap p
li
cati
onsus e
,a ndas econdaryaddres
st ha tistemp oraryanda ssoci
ated
withap arti
cularnetworkt owhi cht hehostisatt ac
hed.At emporaryaddressis
onlyvali
dforo nelocat
ion;whe nitmov estoanothe rlocat
ion,amob i
lehostmus t
obtai
nane wt emporarya ddress
.
Amob i
lehostisa ss
ume dt oha veap ermane nthomei ntheI nter
net,a nda
mobilehostspri
mar ya ddressisthea ddresst ha
tt hehosthasb e
ena ssi
gnedoni ts
homene t
-wor k.Furt hermore,tos up portmob il
ity,ahos tshomene t
workmus t
i
ncludeas peci
alnetwor ks ystemk nowna sahomea gent
.Typ i
cal
ly,homea ge
nt
sof
t warer unsinac on- venti
onalr outer,b utt ha tisnots t
rictl
yne ces
sary.In
ess
enc e
,ahomea ge nta greest oint erc
epte a
chda tagra
mt hata r
riv
esf orthe
host
sp e
rma nent addr es
sa nd forwa rdt he da t a
gram t othe hos t
sc urre
nt
l
ocation(latersec
tionsdi sc
ussde tai
ls).
Howdoesahomea gentk nowthecurrentloca
tionofamob i
lehost?Afterit
movest oaf or ei
gn network ,a mobil
e host must obta
in as e
condary(i.
e .
,
temporar
y)ad-dress
,andmus tthe
nc ontac
titshomea g
entt oinformt heagent
aboutthecurrentloca-t
ion.Wes ayt hatthemob il
ehostr egi
stersas ec
ondary
addres
swithit
shomea ge
nt .
Thes econdarya ddres
sisonlyv a
li
dwhi l
eamob i
l
ehostr emai
nsa tag ivenl
oca
-ti
on.I ft hehostmov esa g
ain,itmus tobtai
nane ws e
condarya ddres
sf orthe
newl oca-tionandi nformt hehomea gentoft hechange.Fina
ll
y,whe namob il
e
hostr e
t urnshome ,i tmustc onta
ctt hehomea g
entt oderegi
ster
,me aningthat
thea gentwi l
lstopi n-ter
ceptingdatagrams
.Inf act,amo bi
lehostc a
nc hooseto
deregi
ste rbefor
ei tr et
urnshome( e.g.,whenitleavesaremotelocati
on).

1
8.7Ov
erhe
adAndFr
eque
ncyOfCha
nge

Wes ai
dt hatmob i
leIPt e
chnolog
yi sde si
gne
dt osupportmacromobil
i
ty.In
par-ti
cul
ar,mo bi
leIPi snotintendedf ort heconti
nuous,hi
gh-spe
edne twor
k
changeassoc
i-a t
edwi t
has martphoneb ei
ngus edinac a
ra sitmov e
sdowna
hig
hwa y.Thus,wet hinkofat ra
vel
erus ingmob i
leIPo ncetheyreachane w
desti
nati
onrat herthanateachp oi
ntalongt hetri
p.
Therea
sonthatmob
il
eI Pdoesnots
uppor
trap
idc ha
ngesshoul
dbeobv
ious
:
ov
er-he
ad.Networ
ksint he I
nte
rnetdo notmonit
orde v
ice
sort r
ackthei
r
movements
.Mostimpor
tant,networ
ksys
temsdonotcoor
dinatetoper
form ha
nd
-of
f.Inst
ead,e
achmob i
ledev
icemustmoni
tori
tsne
tworkc onne
cti
onanddetect
whenithasmovedfr
om
S
ec.1
8.7 Ov
erhe
adAndFr
eque
ncyOfCha
nge 385

onenetworkt oa nother.Whe ni tdoesde t


ectac hange,t hemob i
l
ede vic
emus t
com-munic
a t
ea cr
osst hef orei
gnne tworktor e
questas econdaryaddressfort he
network.Onc eit hasob tai
nedas econdar
ya ddress
,t he mob i
le devi
ce mus t
communica
te wi thi t s home a gent tor egis
tert he a ddres
sa nd esta
blish
forwar
ding.No tet hata mob i
le devi
cec anb earbitr
arilyf a
rf rom itshome
network, which me ans thatr egist
rati
on ma yinvolvec ommunic
a t
ion across
arbi
tra
rydistance
.Thep ointis:

Becauseitr equi
r esc ons
ider
able ov
erhead after eachc hange,
mobileIPi si nt
ended f or si
tuati
onsi n whic
h a hos t mov es
inf
requent
lyandr emainsatagi v
enlocati
onf orar elat
ivel
yl ong
peri
odoft i
me( e.g.,hoursordays).

Thede t
a i
l
sofa ddressi
ng,r e
gist
rati
on,andforwardi
ngwil
lbec
omec le
ara s
we unde r
stand the te
c hnol
ogy.We f i
rstcons
ider mobi
li
tyfor I
Pv4,whi c
h
i
llus
tratest he bas
icc oncepts,a nd thenconsi
der why so mucha ddi
ti
onal
complex
ityisneededtosup -por
tmob il
eIPv6.

1
8.8Mob
ileI
Pv4Addr
ess
ing

Whe nusingI Pv4,amob i


lehost
sp r
imaryorhomea ddr
essisac onve
nti
onal
IPv4a ddres
st hatisa s
signeda ndadmini
ster
edasusual
.Ap p
li
cationsonamob i
l
e
hostal-waysus ethep r
ima r
ya ddre
ss;theyremai
nunawareofa nyot heraddr
ess.
Thehos t
ss econdarya ddress,whichisa l
soknown asa care-ofaddr es
s,isa
temporarya ddressthati susedonlyb yt hemobi
leIPsoftwareont hehost.A
care-
ofa ddressisonlyvali
df oragivenforei
gnnetwor
k.
Mobi
l
eIPv
4suppor
tst wo t
ype
sofc ar
e-ofaddr
ess
estha
tdi f
ferinthe
methodbywhi
chtheaddr
essisobt
aine
dandinthewa yda
tagra
mf or
wardi
ng
oc
curs:

Co-
loc
ate
d
For
eig
nAg
ent

IPv4 Co- located Car e-of Addr ess


.A c o-l
oca
teda ddressa l
lows a mob il
e
comput ertoha ndl
ea llforwa r
dinga ndda tagr
a mtunneli
ngwi thouta nya ssis
tance
fromhos tsorr outersont hef orei
gnne twork.Infact,fromt hep ointofv i
ewof
syst
emsont hef orei
g nne twork,t hemob i
lehosta ppe
ar stob eac onventi
onal
hostt hatf ol
lowst henor -malp at
t ernofob ta
ini
ngal oca
la ddre ss
,us ingt he
address,andt he nreli
nquishingt hea ddress
.Thet emporaryaddr es
si sa s
sig
ne dv i
a
DHCPl ikeanyot heraddr e
s s
.
The chi
efa dvant
a ge of a co-l
ocateda ddressa ri
sesfr
om its uni
versa
l
appl
icab
il
it
y.Be causet hemob i
lehostha ndl
e sal
lregi
s t
rati
onandcommunicat
ion
detai
ls
,noa ddi
-tionalf a
cil
it
iesarer e
qui r
e dont hef orei
gnnet
work.Thus,a
mobil
e hostc an us ec o-
locat
edc ar
e-ofa ddr
essi
ng on a nar
bit
rar
y ne t
work,
inc
ludi
ngac onventionalWi-Fihot
spot,sucha sthos
ef oundinacof
feeshop.
Thest
anda
rdf orIPv6mobi
li
ty,RFC6275,c
omp
ris
es1
69p
age
s,de
fine
sma
nyme
ssa
get
ype
s,
a
ndgi
vesma
nyrule
sf orpr
otoc
oloper
ati
on.
386 Mob
il
it
yAndMob
il
eIP Cha
p.1
8

Therea r
etwodi sa
dvant
agesoftheco-locat
eda pp
ro ac
h.First
,co-l
ocat
ion
requir
e sextr
asoftwareonamob il
ehost
.S econd,thef oreig
nne t
workcannot
dis
tinguis
hahostt ha
tus e
smobil
eIPfrom ana rbi
tra
ryv is
itor.Wewil
lseethat
theinabil
itytoi
denti
fyahostasusi
ngmobil
eI Pcanimpactf orwa
rdi
ng.
IPv4For eignAgentCar e-ofAddr ess.Thes econdt ypeoft e mporarya ddress
al-
lowsaf oreignne twor kt ok now whe the rahos tisus ingmob il
eI Pb ecausea
system on t hef oreign net workp ar
t i
ci
p atesi na llfor warding.Thes ystemi s
known a sa f oreignagent ,a ndat emp orarya ddr es
sus edwi tht hes chemei s
knowna saf oreignagentc are-ofaddr ess.Tous et hef oreigna genta pproach,a
mob i
lehos tdoe snotob tai
nal ocala d-dressit s
elf.Inp arti
cular,amob il
ehos t
doesnotus eDHCP.I ns tea
d,whe namob ilehos ta rri
ve sa taf oreigns i
te,t he
mob i
lehos tusesadi s
cov er
yp rotoc oltoob tai
nt hei dent i
tyofaf or e
igna gent.
Themo b
ilehos tt henc ommuni ca t
e swi tht hea gentt ol earnt hec ar e
-ofa ddress
tous e.S urp
r i
si
ng l
y,af orei
g na ge ntdoe snotne e dtoa ssi
gne achmob il
ehos ta
uniquea ddress.Instead,whe nus ingaf ore i
gna ge nt,thec ar
e -ofa ddressist he
agentsIPv4a ddr es
s.Thea gentt hende liv
e rsincomingda tagr
a mst ot hec orrect
vis
iti
ngmob i
lehos t.

1
8.9I
Pv4For
eignAge
ntDi
scov
ery

Thep rocessofI Pv4f orei


gnagentdi scoveryus estheI CMPr out erdi scover y
me ch-anis
mi nwhi che achr out
erp e
riodical
lys endsanI CMPr outeradv erti
sement
me s
s age,anda l
lowsahos tt ose nda nICMPr outersoli
cit
ationtop romp tf ora n
adve rt
isement .Ar outert hata ctsa saf orei
g nagenta ppendsamob il
i
t yagent
extensiont oe a c
hme s-sage;thee xtensions peci
fiesthene tworkp refix,whi c
ha
mob il
ehos tus est ode t
ermi netha titha smov edt oane wne t work.Int erestingly,
mob il
itye x
t ensi
onsdonotus eas eparateI CMPme ssagetype .I
ns tead,amob ile
extensionisp re
s e
nti ft heda tagraml eng t
hs p ec
ifi
edint heI Phe aderi sg re a
t er
thant hel engths peci
fi
e di nt heI CMP r outerdi sc
overy me ss
age .Fi gure1 8.1
il
lustratesthee x t
e nsi
onf ormat.

0 8 1
6 24 31
TYPE(
16) LENGTH S
EQUENCENUM
LI
FETI
ME CODE RES
ERVED
ONEORMORECARE-
OFADDRES
SES

Fi
gur
e18.
1 The f or
mat of anIPv4 mobil
i
ty agent adverti
sement
extens
ion mess
age whe
ns ent byaf orei
gna gent.The
extens
ionisap
pend-
edtoanI CMProut
era dver
tis
ement.

Ea
che x
tensi
onme s
sag
ebeg
inswitha1 -oct
etTYPE fi
el
df ol
l
owe dbya1 -
octtLENGTHf
e ied.TheLENGTHf
l ie
ldspe
cif
iesthesi
zeoftheextens
ionmes
sage
inoc-te
ts,exc
ludi
ngt heTYPEandLENGTH oct
ets.TheLI
FETIMEf i
elds
pec
ifi
es
themax-
Amob i
lehostcana
lsomul
ti
cas
ttotheal
lagentsgroup
(224.
0.0.1
1).Amobi
li
tyag
entals
oapp
endsap r
efixextens
ion
toeachme s
sage
.
S
ec.1
8.9 I
Pv4For
eig
nAg
entDi
sco
ver
y 387

i
mum a mountoft i
mei nsecondst hatthea gentiswi l
li
ngtoac ce
ptr egi
stra
t i
on
reque
sts,witha l
l1sindi
catngi
i nfini
ty.FiedS
l EQUENCENUM s peci
fie
sas equence
numberf ortheme ss
agetoa l
lowar eci
pienttode t
er mi
newhename ssag
ei slos
t,
andthel as
tf i
el
dl i
ststheaddre ssofa tleas
tonef orei
gnage
nt .Eachb i
tint he
CODEf i
elddefi
nesas pec
ifi
cfe atureoft heagentasl i
stedi
nFigure18.2.

Bit Meaning
7Re gi
stra
tionwi thana ge ntisrequirede v
enwhe nusi
ng
aco- l
ocatedcare-ofa ddress
6Thea genti sbusyandi snota c
ceptingregis
tra
tions5
Agentfunctionsa sahomea gent
4 Age ntf unc t
ionsasaf orei
gna gent
3 Age ntus e
smi ni
male nc ap
sulati
on
2 Age ntus e
sGRE- st
ylee ncaps
ulation
1 Unus ed( mus tbezer o)
0 Age nts upportsrever sedtunneli
ng

Fi
gur
e18.
2BitsoftheCODEf
iel
dofanIPv4mobi
li
tyagent
a
dverti
sement
,wi
thbit0b
eingthel
eas
t-s
igni
fi
cantb
itof
t
heoctet.

Asthef i
gurei ndic
ates
,bit2a ndb it3speci
fyt heencap s
ulat
ionus edwhe na
mobil
ehos tc ommuni cate
swi tht hef ore
igna ge .Mi
nt nimalenc apsulat
ion i
sa
st
andardforI P-i
n- IPtunnel
i
ngt ha tabbrev
iate
sf i
eldsfrom t heorigi
nalhe ade
r
tosa v
es p
ac .Ge
e nericRouteEncaps ul
ati
on (GRE)isas t
a ndardtha tallowsan
arbi
traryprotocolt obeencaps
ula
te d;IP-i
n-IPisonep ar
ticularcase
.

1
8.1
0IPv
4Re
gis
tra
tion

Bef
oreitcanrecei
veda
tagramsatafor
eig
nl ocati
on,amobi
lehostmus tbe
r
egi
s-t
eredwithitshomeagent
.I fiti
susi
ngaf or
eignagentc
are-ofaddress
,
t
he mobil
e hos
t mustb eregi
ster
ed wi
thaf orei
gna ge
nt.The regi
strati
on
p
rot
ocolall
owsahostto:

Re
gis
terwi
tha
nag
entont
hef
ore
ignne
twor
k,i
fne
ede
d
Re
gis
terwi
thi
tshomea
gentt
ore
que
stf
orwa
rdi
ng
Re
newar
egi
str
ati
ont
hati
sduet
oex
pir
e
De
reg
ist
era
fte
rre
tur
ninghome

I
fi t ob
tains a co-l
oca
tedc a
re-of a
d dre
ss, a mobi
le hos
tp er
forms
re
gist
rat
iondi
rect-l
y;theco-l
oca
tedcar
e-ofaddressi
susedinal
lcommuni
cat
ion
wit
ht hemobil
e
shomea g
ent.Ifitobtai
nsaf orei
gnagentcar
e-ofaddr
ess
,a
mobi
lehos
ta l
lowst
hef
ore
igna
gentt
ore
gis
terwi
tht
hehomea
gentont
he
hos
tsb
ehal
f.
388 Mob
il
it
yAndMob
il
eIP Cha
p.1
8

1
8.1
1IPv
4Re
gis
tra
tionMe
ssa
geFor
mat

Allregist
ration me s
sagesa resent via UDP; agents usep ort 434. A
regis
trati
onme ssageb eg
inswithas etoff i
xed-si
zef i
el
dsf ol
lowedbyv ari
abl
e-
length extensi
ons. Ea c
h r equest i
sr equire
d t o c ont
ain a mob il
e-home
authenti
cati
on ext ens
ion tha
ta l
l
owst he home agent tov eri
fyt he mobil
e
s
identi
ty.Figur
e1 8.3il
lus
trate
st hemess
ageformat.

0 8 1
6 31
TYPE(
1or3) FLAGS
/CODE LI
FETI
ME
HOMEADDRES
S
HOMEAGENT
CARE-
OF-
ADDRES
S(r
eque
stonl
y)

I
DENTI
FICATI
ON

EXTENS
IONS...

Fi
gur
e18.
3Theformatofa nI
Pv4mobi
l
eIPr
egi
str
ati
onr
eques
tor
mobi
l
eI Prepl
ymessa
ge.

TheTYPEf ields pec


ifie
swhe thert heme ssagei sar equest(1)orar epl
y( 3).
TheLI FETI ME f i
e l
ds pecifi
est henumb erofs econdst her egis
tra t
ioni sv al
id( a
zerore -que s
tsi mme diatede re
g ist
rati
on,a nda ll1 sspecifiesani nfinit
el i
feti
me )
.
TheHOMEADDRES S,HOMEAGENT,andCARE- OFADDRESSf i
eldss peci
fyt het wo
IPa d-dr esses of t he mob il
ea nd t he address of i t s home a ge nt,a nd t he
IDENTIFI CATION f iel
dc ontainsa64- b i
tnumb e rg enerate dbyt hemob i
letha tis
usedt oma tchr equestswi thi ncomingr epli
esa ndt op reve
ntt hemob il
ef rom
accept
ingol dme ssages.Bitsoft heFLAGS /CODEf iel
da reus eda sar esultcodei n
ar egi
stra ti
onr e pl
yme ssagea ndt os peci
fyf or wa r
dingde tai
lsinar egis
tration
request,s uchaswhe thert her eg i
str
at i
onc orr
e s
p ondst oa na ddi
t i
ona l(i.
e.,ne w)
addres
sr e questa ndt hee ncapsulati
ont hatt hea gents houldus ewhe nf orwarding
datagramst ot hemob il
e.

1
8.1
2Communi
cat
ionWi
thAnI
Pv4For
eignAge
nt

Wesa
idthatafore
igna gentcanas
sig
noneofi tsIPv
4a ddres
sesforus easa
c
are
-ofaddre
ss.The consequenc
ei sthatthe mobil
e wil
lnotha v e a uni
que
a
ddres
sontheforei
gnne t
wor k.Thequest
ionbe
come s
:how c a
naf ore
igna g
ent
a
ndamobil
ehostcommunicateoveranetworki
ft hemobil
edoe snotha v
eav ali
d
I
Paddres
sont hene
t-work
?Communi
cat
ionr
equi
resr
ela
xingt
her
ule
sforI
P
a
ddr
ess
ingandusi
nganal
ter
-
S
ec.1
8.1
2 Communi
cat
ionWi
thAnI
Pv4For
eig
nAg
ent 389

nat i
ves chemefora ddre
ssbinding:whe namob il
ehos ts endstoaf oreig
nagent,
themob il
eisal
lowedt ouseitshomea ddres
sasa nIPs our c
ea ddress
,a ndwhena
foreigna g
entsendsada t
agra mt oamob il
e,thea ge nti sall
owe dt ouset he
mob il
e
shomea d-dressasanI Pde s
t i
na t
ionaddress
.Toa voi
ds endi
nga ni
nval
id
ARPr equest,af orei
gna ge
ntr ecordst hemo bi
le
sha r dwarea ddres
swhe nt he
firstr equestarriv
e sand usest he ha rdwarea ddres
st os end a r e
p l
y.Thus,
althoughi tdoesnotus eARP,t hefor ei
gna ge
ntc ans endda tagramst oamob il
e
viaha r
dwa reunic
a s
t.Wec ans umma rize:

Ifamobi l
edoesnothav eauni queforeignaddress
,af oreign
agentmus tus et hemobil
eshomeaddr essf orcommunic
ation.
Insteadofr el
yingonARPf oraddres
sbinding,theagentrecords
themobi l
eshar dwareaddresswhenar equestarri
vesandus es
ther ec
ordedinfor- mat
iontosupplythenec es
sar
ybindi
ng.

1
8.1
3IPv
6Mob
ili
tyS
upp
ort

Ex
p e
rie
ncewithmob il
eIPv4andt hedesi
gnoft heIPv 6pr
otocoll e
dt heIETF
t
o ma kes i
gni
fi
cantc hangesbetwee n mobil
eI Pv
4a nd mobi
leI Pv 6.TheI ETF
i
ntendedtointeg
ratemob il
i
tysupportmor et i
ghtl
yintot heprot
oc ol,compens
ate
f
ors omeoft hep rob
lemsa ndwe a
k nesse
st hathadb eendisc
overe dwi t
hmob il
e
I
Pv4,a ndsti
mulat
eus e.Thedif
ference scanbecharac
t e
rizedasfollows:

IPv6doesnotus eafore
ignagento
raf ore
ignage
ntcar
e-of
ad-dre
ss.Ins
tead,anIPv
6mob i
l
ehostusesaco-
loca
tedc
are-
ofa d-
dres
sa ndhandl
esallc
ommuni
cat
ionwithahomeagent
dir
ectl
y.

Becaus
ei tpermitsahosttohavemul
tip
leI
Paddress
es,IPv
6
makesite a
syf oramobil
ehosttohav
eahomea ddr
essanda
co-
locate
dc ar
e- ofa
ddre
sssi
mult
ane
ousl
y.

BecauseIPv6doesnotb r
oadcas
tar e
questtodis
cove
rahome
agent,anI Pv6hos
tonlyr ec
eivesares
pons
ef r
om oneagent
.
(I
Pv 4c a
nr e
cei
ver e
sponse
sf rom ea
cha ge
nton t hehome
network.)

Unl
ikecommuni
cat
ion b
e t
ween a mob
il
eI Pv
4 hostand a
for
eignage
nt,mob i
l
eI Pv6 doe
snot dep
end on l
i
nk-
laye
r
for
wardi
ng.

Aswewills
eelat
er,theIPv6routi
nge x
tens
ionheadermake
s
for
-wa
rding t
oa nI Pv6 mob
ile hos
t moree ff
ici
ent t
han
for
war
dingtoanIPv4mobil
ehost.

AnI
Pv6mob
il
ehos
tdoe
snotne
edaf
ore
igna
gentb
eca
uset
he
hostcang
e ne
ratealoc
a la
ddr
essa
nd c
ommuni
cat
ewi
tha
route
ronthefor
eig
nnetwor
k.
390 Mob
il
it
yAndMob
il
eIP Cha
p.1
8

1
8.1
4Da
tagr
am Tr
ans
mis
sion,Re
cep
tion,AndTunne
li
ng

Onceithasreg i
stere
d,amob il
ehostonaf oreignnetworkc a
nc ommunicat
e
witha narbi
trar
yc omp ute,X.The
r rearetwop oss
ibi
li
ti
es.Int hesi
mp l
estcase,
themob i
lehostcreatesands endsanoutgoi
ngdat ag
ramt hathascomp ut
erXsIP
addres
sint hedestinati
ona ddressfi
eldandthemob i
l
eshomea ddre
ssint heIP
sour
c eaddres
sf i
eld.Theout goi
ngda ta
gramfollowsas horte
stp athf rom t
he
mobil
ehostt odest
inationX.
Tec hnicall
y,us ingahomea ddres
sa sas ourcea ddressviolatestheTCP/ IPs tan
-dardsb e causeada t agra m wi l
lb etra nsmittedb yahos tonne twor kN,a ndt he
IPs our cea ddr essint heda ta gram willnotma tcht heI Pp r
e fi
xf orne t
wor kN.I f
ane twor kma nagerc hoos est oa p
plys tric
tr ules,t hema nagerma yc onfigure
route rst op rohibitt ra nsmissionswhe ret hes ourcea ddressdoe snotma tcht he
l
oc a
lne t wor k.How c ans uchr es
tric
t i
onsb eov erc
ome ?Mob ileIPv4us e
sat wo-
stept e
c hniquek nowna st un- neli
ng.I ne ss
ence,themob il
ehos tus estunne li
ngt o
senda nout goingda t a
g ra mb ackt oitshomea gent,a ndt hehomea gentt ransmits
theda tag rama si ft hemob i
lehos twe rel ocate
dont hehomene twork.
Tous et unne l
i
ng ,amob ilehoste nc a
psulate
sa nout goingda tagram,D1,i n
anot herda tagr m,D2.Thes
a ourcea ddr essonD2 i st hemob i
lescare-ofa ddre s
s
andt hede sti
na -ti
oni st hea ddressoft hemob il
eshomea gent .Whe nitr ecei
vesa
tunne led da tagram,t he home a gent e xt
ractst he i nner da ta
g r
am, D1,a nd
forwa dsD1 t
r oi tsde stinati
o n.Bot hs tepsusev alida ddresses.Thet ransmi s
sion
from t hemob i
lehos tt othehomea gentha sas our ceaddr essont hef oreign
networ k.Thei nne rda t agram,whi cht ra vel
sfrom t hehomea gentt ode st
ination
X,hasas ourcea ddr essont hehomene t work.
Formob i
leI Pv4,ar epl
ywi l
lnotf ol
low thes hortestp athdirectl
yt ot he
mobil
e .Ins t
ead,ar eplywil
lalwa yst ra
ve lt
ot hemob ile
shomene tworkfirs
t.The
home a ge nt,whi ch ha slearne dt he mob il
eslocation from t he regi
strat
ion,
i
nterc ep
tst her ep l
ya ndusest unne l
ingt odel
iverther e
plytot hemob il
e.Thatis,
wheni tr e c
eivesada tagra
m de s
tinedf oramob i
lehos t,ahomea ge
nta ls
ous es
tunne l
i
ng i te ncapsula
test her eplyina notherdat agram,D3,us esthemob ile
s
care-ofa ddressa sthede st
inationf orD3,a ndsendst hee nc
a p
sulateddatagramt o
themob i
l
e .Figure1 8.4ill
ustratest hep athofar e
-p l
yf rom ac omputer,D,t oa
mobil
ehos t,M.
Wec ans umma rize:

Becauseamobi l
eus esitshomeaddr essasas our
ceaddr es
swhen
communi c
atingwithanar bitr
ar ydesti
nati
on,eachI Pv4r epl
yis
for-warded tot he mobile
s home net work,wher e an agent
inter
ceptst hedatagram,enc apsul
atesitin anotherdatagram,
andf orwardsiteitherdirec
tlyt ot hemobileort othef orei
gn
agentthemobi l
eisus i
ng.

Mob
il
eI Pv
6 usesani
nte
res
ting opti
miza
tion t
oa v
oidinef
f i
ci
entrout
es.
Be
forei
tc ommuni
cat
eswi
thade st
inat
ion D,amob i
l
ehos tinformsit
shome
ag
ent.Thehos
ttheni
ncl
ude
samob
il
it
yhe
ade
rinda
tag
ramsi
tse
nds
.De
sti
nat
ion
Dcancommuni
cat
e
S
ec.1
8.1
4 Da
tag
ramTr
ans
mis
sion,Re
cep
tion,AndTunne
li
ng 391

withthehomeagent
,veri
fythemob
il
ehost
scurr
entloc
ati
on,a
ndus eanI
Pv6
routehe
adertodi
rectt
hedat
a g
ramtothemobi
l
ehost
scurr
entl
oca
tion.

s
endi
ngc
omput
er,D

Mob
ile
sHomes
ite For
eignS
ite

mobi
l
ehos
t,
I
NTERNET
homeagent M

t
unnel
i
ngus
ed

Fi
gur
e18.
4Thepat
harepl
ytak
e sfr
omc omput
erDtomobi
l tM
ehos
whe
nthemob
il
ehostisconne
cte
dt oaf
ore
ignnet
work.

Ofc ourse
,thee x
c hangesa mongamob il
ehost,homea gent,anddest
inati
on
mustb es e
cure.Further more,ane x c
hangemustoc c
urf ore ach de
sti
nati
on.
Theref
or e,theent
irep rocedureentai
lscons
ider
abl
eoverhea
d,a ndisonl
ys ui
tabl
e
forsit
ua ti
onsinwhichamob i
l
er emainsatt
achedtoag i
venf orei
gnnetworkfor
ane xtendedt i
mea ndc ommunicate
swi thag ive
n dest
inat
ion exte
nsi
vel
y.The
poi
ntis:

To opt i
mize repl
yf orwarding,IPv6 makes i t pos sibl
ef or a
desti
nationt olearnamobi lehostscurrentl oc
at ionands end
datagramsdirectl
yt othemobi lewit
houtgoi ngt hroughahome
agent; becauser out
e op- t
imizat
ion requires s
ev er almes s
age
exchanges,itisonlyus ef
ulf ormobil
est hatmov ei nf r
equent l
y
andt endtoc ommunicat
ewi thagivendestinati
onext ensivel
y.

1
8.1
5As
ses
sme
ntOfI
PMob
ili
tyAndUns
olv
edPr
obl
ems

Desp
itethe besti ntenti
ons of the I ETF, mobi
leI P ha
s not beena n
overwhel
mingsuc
cess.Oner eas
onf orthel ackofinter
esthasari
senfrom ashift
inthet ypeofmob i
l-i
tyt hatus er
se njoy.Whe nI P mobi
li
ty wase nv
isi
oned,
mobil
itywasli
mitedtob ulk
yl apt
opc omput e
r s ausercoul
dt r
ansp
ortal apt
op
computertoar emotes i
tea ndthenus et hec omp
uter.Now,ma nymob i
leusers
havesmartphone
st hatall
owc onti
nuous,onlinemobil
it
y.
392 Mob
il
it
yAndMob
il
eIP Cha
p.1
8

Twomor ei nfluencesha v ef urthercons pi


redt odi scouraget heus eofmob i
le
IP.First,VPN t echnology( coveredi nt hene xtc hap t
er)wa sinvented.A VPN
all
owsar e-mot ede vi
c etor etai
nahomea ddressa ndha vec ompletea cc
e s
st oits
homene twor ka si ft her emot edev ic
ei sat tacheddi rectl
yt oi t
shomenet work.
Second,fewa ppl
icati
onsnowr el
yonI Pa ddressesorr evers
eDNSl ookup.Instead,
becauseaut hentic
a ti
ons che me stha tusep asswordsa ll
owaus e
rt oa cces
ss ervi
ces
l
ikee mailf r
om ac omp uterwi tha narbitraryI Pa ddre s
s,r e
t a
ini
nga nI Pa ddress
i
snota si mportanta sitonc ewa s.Morei mportant :us i
nga na rbit
rarya ddress
all
owse fficie
ntr outing.Fore xamp l
e,whe naus e rt ravel
st oadi stancec i
ty,
connectst oWi -Fihot s
pot ,a nda c
cess
esawe bp ag e,da -ta
g r
amst rave
ldi re
ctly
betweent heus ersde vi
cea ndt hewe bs erv erwi thoutade tourt ot heus er
s
homene twor k.
We aknessesoft hemob ileI Ps c
hemec anb esumma ri
zed:

La
ckofha
nd-
offa
ndhi
era
rchi
calr
out
es
Pr
obl
emswi
tha
uthe
nti
cat
iononf
ore
ignne
twor
ks
I
nef
fic
ientr
eve
rsef
orwa
rdi
ng,e
spe
cia
ll
yformob
il
eIPv
4
Dup
li
cat
eaddr
essde
tec
tioni
nmob
il
eIPv
6
Co
mmuni
cat
ionwi
thhos
tsont
hemob
il
e
shomene
twor
k

Thene
xts
ect
ionsc
ons
ide
rea
choft
hes
etop
icsi
nmor
ede
tai
l
.

1
8.1
5.1La
ckOfHa
nd-
OffAndHi
era
rchi
calRout
es

Whent he
yt houghtofmob il
ity,thede s
ignerse nvi
sionedportabl
ec omputer
s
b
eingusedinr emotelocat
ions
.Cons equentl
y,mob il
eI Pdoe snotb ehavelikea
c
ell
ula
rsys-te
m.I tdoe snotha v
ef ac
ili
tiesforhig h-sp
e edhand-offamongl ocal
c
elltowers
,nordoe sitp rov
ide a system ofhi erarchica
lr outi
ng thatc oul
d
r
estri
ctthescopeofr out
ec hangesduringmi gr
ationf rom ana cce
ssne tworkto
a
na dj
ace
nta cc
essnetwork.

1
8.1
5.2Pr
obl
emsWi
thAut
hent
ica
tionOnFor
eignNe
twor
ks

Alt
houghs omef oreignnet
wor kspermitunr estri
ctedaccess
,ma nydonot .I n
par
- ti
cul
ar,ne twor k
sof tenrequireaus ert oa uthenti
catet hemsel
vesb efore
acc
e s
swi l
lb eg ranted.Fore xampl
e,ahot elmi ghtr e
quireag uesttoe ntera
room numb era nd l as
t name b ef
oret he g uesti sg ra
nt eda cc
ess.Typ i
call
y,
authenti
cati
onr equirestheusertoob t
aina nI Paddressandt henus etheaddress
tolaunchawe bb rowser.Thehotelinter-c
e p
t sthewe br equest
,a nddispl
aysa n
authenti
cati
onp agef ort heuser.Oncea uthenti-cat
ionha sbeenc omple
ted,t he
user
sde v
iceisgranteda cce
sstotheg l
obalInte r
ne t
.
Mob
il
eI Pc
annothandl
eweb
-ba
sedacce
ssauthe
nti
cati
onfortwore
asons
.
Fi
rst
,mobil
eIPa l
waysbegi
nsbyreg
ist
eri
ng wi
th a home a
gent
.A r
emote
net
worktha
tr e-qui
resauthe
ntica
tion wil
lnotf or
war
dp ac
ket
stot hehome
ag
entunt
ilaut
hentic
ati
oncomple
tes.Second,mob
il
eI Ps
pec
ifi
est
hata
pp l
i
cat
ions
musta
lwa
ysusethemob i
le
S
ec.1
8.1
5 As
ses
sme
ntOfI
PMob
il
it
yAndUns
olv
edPr
obl
ems 393

hos
tshomea
d dr
ess.Thus
,e v
enift heuserl
aunc
hesawebbrowser
,thebrowser
wil
latte
mpttousea nIPaddres
sf rom t
hehomenet
wor
k,andt heaut
hent
ica
tion
mechani
smwi
llrej
ecttheconnect
ion.

1
8.1
5.3I
nef
fic
ientRe
ver
seFor
war
ding,Es
pec
ial
lyForMob
ileI
Pv4

Aswe ha ves e
en,a r epl
ys ent t oa nIPv4 mob il
e host wil
la l
wa ysb e
forwardedt ot hemob il
e
shomene tworkf i
rstandt hent ot hemobil
e
sc urrent
l
ocation. The p roble
m i se s
peci
al
lys ev
ereb ecausec omp ute
rc ommunic at
ion
exhib
itsspatiallocal
it
yofr efer-
ence amobi l
ehos tvisi
ti
ngaf or
eignne twork
tendst oc ommuni cat
ewi thcompute rsont heforeignne twork.Tounde rstand
whys pati
allocali
tyisap rob
lem,considerFig
-ure18.5.

HomeS
ite For
eignS
ite

R2 I
NTERNET R3
R1 homeagent D M
des
tinat
ion
mobi
l
ehos
t
mobi
l
esor
igi
nalhome

Fi
gur
e18.
5At opol
ogyinwhi
chmobi
leIPv4rout i
ngisincre
diblyine
ffi-
ci
ent.Whenamob i
lehos,M,c
t ommunica
t e
swi thal ocal
des
ti-
naton,D,r
i epl
i
esfrom Dtravelacr
osstheI nter
netto
themobil
e
shomeage ,R1,a
nt ndt henbackt ot hemob i
l
e
hos
t.

Int hef igure,mob e M ha


i
l smov e df rom itshomene twor kt oaf orei
gn
networ k
.Themob i
leha sregi
ster
e dwi thi tshomea gent,rout erR1,a ndt hehome
agentha sag r
eedt of orwarddatagr ams.Whe nthemob i
lehostc ommuni cateswith
desti
nationD,whi c
hi slocate
da tt hes ames iteasthemob i
le,r epli
e ssentf rom D
toM f oll
ow a p atht hrough R3,a crosst he Internett ot he mob i
leshome
networ k
,a nda rethe ntunneledbac ka c
r osstheInternett ot hemob il
ehos t.That
is
,ada tag
r ams e
ntb et
we entwoa dja -c
e ntc omputerscross
e stheI nternett wic
e.
Becausec rossi
ngt heI nternetc ant a keor dersofma gnitudel ong ert hanl ocal
deli
very,t he situation descr
ibeda bovei ss ometime scalledt he t wo-crossi
ng
probl
em.I fde sti
nationDi snotont hes a mene t
wor ka sthemob ile
,as l
ightlyles
s
severeversionoft hep robl
emoc curswhi c hisknowna st ri
anglef orwar dingordog
-l
egf orwar di
ng.
Ifasi
teknowsthatag i
venmob il
ehostwi l
lvi
sitf
oralongtimeandexpec
ts
themobil
ehos
tt oint
erac
twi thlocalcompute
rs,thenetwor
kma nag
ercanins
tall
host
-spe
cif
icr
outestoavoidinef
f i
ci
entf or
warding
.Eachroute
ra tthes
itemust
hav
eahos t-spec
ifi
cr out
ef orthev
isi
ti
ngmobi
lehos
t.Thedis
adv
anta
geofsuc
h
ana r
range-
me nta r
isesfrom t
helackofaut
omatedupdat
es:whenthemobi
l
e
hos
tleave
st hesit
e,
394 Mob
il
it
yAndMob
il
eIP Cha
p.1
8

themanage
rmustmanual
l
yr emovet
hehost
-sp
eci
ficr
outesort
hehos
twi
l
lbe
unre
ach-
ablef
romcomputer
sa tt
hesit
e.Wecansummar
ize:

MobileIPi ntroducesar out ingi neffic


ienc yknownast het wo-
cross
ingpr obl
em thatoc c
ur swhenav i
sitingmobi l
ec ommunicates
withac om- puteratorneart hef orei
gns it
e.Eac hdatagrams ent
tot hemobi let r
avelsacrosst heI nternett ot hemobileshome
agentwhi cht henf or-wardst hedat agr am bac ktot hef oreign
sit
e.Eliminati
ngt heineffi
-cienc yr equi
r espr opagat
ionofahos t-
speci
ficroute.

1
8.1
5.4Dup
lic
ateAddr
essDe
tec
tionI
nMob
ileI
Pv6

InI Pv6,whe nahos tj oinsane w ne twork,t hehostt akesthrees teps:the


hostf i
ndst hene t
workp refix(orp re
fixes)b e
ingus edont hene t
wor k,g enerat
es
auni cas
ta ddres
s,andv erifi
e sthatt hea ddressisunique .Thef irsta ndt hi
rd
ste
psr equireap ac
kete x- change,and i ncl
ude t i
meout.A mob il
e hos t must
perform dup li
cat
ea ddressde tect
ione acht imet hehos tc hangesne twor k
sa nd
obtainsac are-ofaddressfort hene w networ k.Ironi
cal
ly,t hestandards peci
fi
es
thata nI Pv6mob i
lehostmus ta l
sogene r
atea ndc heckauni queli
nk-localaddress
.
Theov e
r head ofdup l
i
catea ddres
sde tection ma kesIPv6 unsuitabl
ef orr api
d
move ment .

1
8.1
5.5Communi
cat
ionWi
thHos
tsOnTheMob
ile
sHomeNe
twor
k

Anotheri nteresti
ngp rob
lema rise
swhe nac omputeront hemob il
eshome
networka t t
e mptst oc ommunica
te wi th a mobil
et hati svisi
ti
ng a forei
g n
network.Wes a i
dt hatwhe namob il
ec omputeriscurrent
lyawa yfrom home,its
homea genti nterceptsa l
lda-tag
ramst hatarr
ivea tthehomes itedesti
nedf or
the mob il
e.I ntercepti
ng datagrams t hata r
rivea tt he sitei sr el
ati
vely
stra
ightf
or ward:ane tworkma nagerchoosestorunhomea gentsoftwa
r eonthe
routerthatc onne c
t sthehomes i
tet other e
stoft heInter
net.
Aspec
ialcasea ri
ses
,howe ver,whenahos tonamob il
e
shomene twor ksends
ada ta
gramt ot hemob ile
.Be ca
useI Ps peci
fi
esdire
c td el
iv
e ry overt hel oca
l
network,t
hes ende rwil
lnotf or
wa r
dt hedatagramthroughar outer
.I ns
t ea
d,a n
IPv
4s ende
rwi lluseARPt ofindthemob il
e
sha r
dwarea ddre
ss,a nda nIPv6hos t
wil
luseneighbordi s
cove
ry.I neit
herca s
e,thehostwillencapsulatetheda tagra
m
i
naf ramea ndt r
a nsmi
tt heframedire
c tl
yt othemobi
le.
Ifamob i
leha smovedt oaf or
eignne twork,hostsandr outersont hehome
net
-workcannots endda tag
r amsdirect l
yt othemob i
l
e.The ref
ore,thehome
ag
entmusta r-ranget oc apturea nd f orwa
rda lldatagramsde sti
nedf ort he
mobi
le
,incl
udi
ngt hoses e
ntb yl ocalhos ts
.AnI Pv4homea ge ntuse
saf orm of
pr
oxy ARP to handlelocalintercep-
tion:whe nevera c omp uteron the home
net
workARPsf ora nIPv4mob ilehostt hathasmov e
dt oaf orei
gnne t
wor k
,t he
homea g
entans
werstheARPre
ques
ta ndsuppl
i
esit
sownha
rdwa
rea
ddr
ess
.Tha
t
i
s,loc
alIPv
4hostsar
et r
ick
edi
ntofor
wa r
dinganyda-
S
ec.1
8.1
5 As
ses
sme
ntOfI
PMob
il
it
yAndUns
olv
edPr
obl
ems 395

t
agra
m dest
ine
df orthemob
il
etothehomea gent
;t hehomea
gentc
ant
hen
f
orwardt
hedatag
r a
mt ot
hemobi
l
eonthefor
eig
nne twork
.
ForI Pv6,localtransmiss
ionp ose
sag reate
rp r
oble
mt hatrequi
resadditi
onal
proto-colsupport.Inp arti
cul
a r,compute
rsona nIPv6networkuset heNeighbor
Disc
ov e
r yProtocol(NDP)t ok now whichneig
hborsarepres
ent.I
famob i
leleaves
thehomene t-work,ot herc omputersusingNDP willqui
ckl
y decl
aret hatt he
mob i
leisunr eachabl
e.The refore
,mob il
eI Pmusta rr
angeawa yt hathostson
thehomene t
wor kc anb ein-formedwhe namob i
lehosthasmov e
dt oa nother
l
oc a
tion.
Tos olvetheprob
lem,mob il
eI Pv6modifi
esne i
ghb ordis
cov
ery.Ine ss
e nce
,a
homea genta ctsasa pr
oxy whenamobi l
ei sawa y.Thehomea gentinf orms
computer sont hel
ocalne
twor kt hataspeci
fichosti smob i
l
e.Iftheye ncounter
datagr
a msi nt
end-edforthemob i
lehost
,otherc omp uter
sont hehomene twork
forwardt he data
grams a c
-cording
ly. Whent he mob i
ler e
turns home ,t he
forwardingmus tberemoved.

1
8.1
6Al
ter
nat
iveI
dent
ifi
er-
Loc
atorS
epa
rat
ionTe
chnol
ogi
es

Thef unda me ntalpr oblemade si


gnerf a
ceswhe na ddingmob il
it
ys up portt oI P
arise
sf rom af undame nt alp r
inc ipl
eofI Pa ddressi
ng :thep refi
xi na nI Pa ddress
tiesthea ddr e
sst oas pe ci
f i
cne t work.Thati s
,a nI Pa ddr essse rv
e sa sal ocator.
Thea dva nt ageofal ocat orliesi na ne f
fici
entr outings ystemt hatf orwa rdse ach
datagramt othec orr
e c
tde stinat i
onne twork.Thedi sadv antageofal oc atora r
ises
from it si nabi
lityt oa ccom- moda te moveme nt:i ft he location c hang es,t he
addressmus tc ha nge.Et herne tMAC a ddress
ing ill
us tratest hea l
te rnative:a n
Etherne ta ddres sisag lob all
y- uniquev a
lue,butdoe snotc ontaina nyi nforma ti
on
aboutwhe r ethec omp ut erisl ocate
d.Tha ti s,ana d- dressse rvesa sauni que
identi
fier. The di sadva ntage of us i
ng a n i dentifi
e r a ri
se sf rom r outing
ineffi
ci
e nc y:hos t-speci
ficr out esa reneeded.
How c anonede si
gna na ddres
sings chemet hatc omb i
nesthea dva
ntagesof
bothloc a
torsa ndi denti
fie
r s
?Weha v eseent hefunda me nt
alide
a :ahostaddress
needst woc onc eptualp ar
t s
.Thef i
rstp arti sag loball
y-uni
quei dent
ifi
ert ha
t
neverc hangesa ndt hesecondi salocatort hatchangeswhe nthehostmov estoa
new ne twork.I nmob il
eI P,thet woc onceptua
lp i
e c
e sa r
er epres
entedbyt wo
i
nde p
ende ntIPa ddresse
s.Tha tisahos ts torestwoa ddr es
ses
,a ndusesitshome
addressasa nide nti
fierandi t
sc a
re-ofa ddressasaloc ator.
Sev
era
lpropos
alshavebee
nc re
ate
dt oforma
li
zethei
deaofanident
ifi
er-
l
ocat
orpai
r.Theapproa
chesdi
ffe
ri nthes
izeofthet
woitems
,thewayv al
ues
area ssi
g ned,whe therthet wop ar
tsa rev ieweda sb itfi
eldsi nas i
ngl
el arge
address or a st wo se
paratei t
ems,a nd whe therb othp artsa rev is
ibl
et o
appli
cations. For e x
ample, Ci
scoS ystems de f
inedt he Loc ator/
ID Separation
Protocol( LISP),whichusesap ai
rofI Pa d-
dresse
ss i
mi l
artot hewa ymob il
eI P
uses a ddr ess
es. The I ETF ha s de f
ined a p rotocol na med TRa nsparent
Interconnec ti
on ofLot sofLi nks (TRILL)t hate xt
e ndsthe i dea oflearning
bri
dg e
st omob il
it
yinawi dea r
eainternet.
Chapt
er22dis
cus
sesNDP,whi
chi
ssome
time
swr
itt
enI
Pv6-
NDt
oemp
has
izet
hatt
hep
rot
ocoli
s
a
nin-teg
ralpa
rtofIPv
6.
396 Mob
il
it
yAndMob
il
eIP Cha
p.1
8

1
8.1
7Summa
ry

Mobil
eI Pa l
lowsac omputertomov ef rom onene tworkt oanot herwi thout
chang-i
ngi tsI Pa ddres
sa nd withoutr equir
ingr outerstop ropa gateahos t-
spe
c i
fi
cr oute.Whe ni tmov esf rom it
sor i
ginalhome ne tworkt oaf or e
ign
network,amob i
lec omputermus tobtai
na na ddit
ional
,t empora
rya ddres
sk nown
asac are
-ofa ddress.Appli
cat
ionsusethemob i
le
sor i
gi
nal,homea ddr es
s;thec are
-ofaddressisonlyus edb yunderl
yingnetworks oftwaretoe nab
lef orwardinga nd
del
iveryacrossthef orei
gnne twork.
Onceitde tect
stha tithasmov ed,anI Pv 4mobil
ee i
the robta
insac o-l
ocated
car
e -ofaddressordis cov
er saf ore
ignmob il
ityagenta ndr equest
st hef orei
gn
agentt oassi
gnac are
- ofadd r
ess.AnI Pv
6mob i
l
ec angene r
ateac o-l
oc a
t e
dc a
re-
ofa ddres
swi thoutne edi
ngaf ore
igna gent.Af te
rob taini
ngac are-
ofa ddress
,
themob il
er e
gister
swit hitshomea gent(eitherdirect
lyori ndi
rectl
yt hroug hthe
forei
g nagent)
,a ndrequeststhatthea gentf orwarddatagrams.
Onc er egi
strat
ion i
sc ompl
ete, a mobi
lecan usei t
s home a ddresst o
communicatewitha narb
itrarycomputerontheI
nte r
net.Datag
ramss entbyt he
mobi
lea reforwardeddirectl
yt othespeci
fi
eddes
tinati
on.Repl
yr outi
ngc anb e
i
neffic
ientb e
causeada -t a
g r
ams enttot hemobi
lewi l
lbef orwardedt ot he
mobi
leshomene tworkwhe r
ei ti
sinte
rcept
edbythehomea gent,encap
s ul
ate
di n
IP,andt he
nt unnel
edtot hemob i
l
e.
Thesche
mef ormobi
leIPwa sdes
igne
dforslow move
ment,s
uchasv
isi
ti
nga
hote
l.Whe nappl
iedtodevi
cesthatmoverap
idl
y,mob i
leIPha
sseve
redr
awb a
cks
andha snotbee
nwi de
lya
dopted.

EXERCI
SES

1
8.1 Compa
ret he e
ncaps
ulat
ion sc
hemesin RFCs 2003 a
nd 2004.Wha
tar
ethe
adv
antag
esanddis
adva
ntagesofeac
h?
1
8.2 Rea
dt hemobi
leIPsp
ecifi
cat
ionc
are
ful
l
y.How f
reque
ntl
ymus
tar
out
ers
enda
mobi
li
-tya
gentadv
ert
ise
me nt
?Why?
1
8.3 Consul
tthemobi
l
eI Pspec
ifi
cat
ion.Whenafor
eig
na ge
ntf or
wardsareg
ist
rat
ion
re-que
sttoamobi
le
shomeagent,whi
chpr
otoc
olpor
tsa r
eused?Why?
1
8.4 Thes p
eci
fic
a t
ionformobi
leIPa l
l
owsas ing
lerout
ert of
uncti
ona sb ot
hahome
agentforane t
workandaf or
eignagentthatsuppor
tsvi
si
torsont hene t
work.
Wha taret hea dv
ant
age
sa nddisadv
antagesofusingasingl
er out
e rf orbot
h
functi
ons
?
1
8.5 Readthes
pec
ifi
cat
ionf
ormob
il
eIPv
6.Howma
nys
epa
rat
eme
ssa
gef
orma
tsa
rede
-f
ined?
1
8.6 Supp
oseac el
lp hone p
rov
ide
ra doptsmobi
l
eI Pv6f
oruse wi
ththei
rp hone
s.
Comput
et henumb erofpa
cketssentwhe
nap honep
ass
esfr
om onenet
wor kto
anot
her.
1
8.7 Ex
tendt
hep
rev
iouse
xer
cis
e.I
fNa
cti
vec
ellp
honeus
ersdr
ivea
longahi
ghwa
yat
60MPHa ndeac
hmus ts
witc
hf rom onecelltowertoanothe
rwithi
na1 500foot
areahalf-
waybetwee
ntwoc el
lt owers,es
timatethenetwor
kcapac
ityneede
dt o
handlethemes
-sag
esmobi
leIPv
6g ene
rate
st orel
ocat
ephonesfr
om onecel
ltower
toa not
her.
Ex
erc
ise
s 397

1
8.8 Readthespe
cif
ica
tionsformob
il
eIPv4andmob i
leIPv6todete
rminehowamobil
e
hos
tjoinsamulti
castgroup
.Howaremul t
ica
stdatag
ramsroutedtothemob
il
ein
eac
hca s
e?Whichapproa
c hi
smoreef
fic
ient?Exp
lai
n.
1
8.9 Comparemobi
leIPv4andmobi
l
eI Pv
6toCis
co
sLIS
Pp r
otocol
.Whataret
hedi
ffer
-ence
sinfunc
tional
i
ty?
1
8.1
0 Comparemobi
leI Pv
4a ndmobi
leIPv6t
ot heTRILLprot
ocol.Wha
tdoesTRILL
offe
r?
1
8.1
1 Rea
dab
outhand-
offp
rot
ocol
suse
dinac
ell
ula
rne
twor
k.Ca
nsi
mil
arp
rot
ocol
sbe
us
edwi
thIP?Whyorwhynot?
1
8.1
2 Consi
dertheappl
icat
ionsyouus
e.Doa nyoftheap
pli
cati
onsr
equi
reyoutor
etai
n
anIPa ddre
ss(i.e
.,doesyourp e
rsonalI
nte
rnetdevi
ceneedap er
mane
nthome
addr
ess)
?Ex -
pla
in.
Chapt
erCont
ent
s
1
9.1 Introd uc ti
on,399
1
9.2 Virtualiza t
ion,399
1
9.3 VirtualPr i
vat eNe tworks( VPNs ),400
1
9.4 VPNTunne l
ingAndI P-in-IPEnc aps
ulation,401
1
9.5 VPNAddr essingAndFor wa rding,402
1
9.6 Ext ending VPN Te chnology To I ndivi
dua lHost
s,
404
1
9.7 UsingAVPNWi thPr iv
at eIPAddr esses
,404
1
9.8 Ne twor kAddr essTr a
nslati
on( NAT),405
1
9.9 NATTr a nslationTa bl
eCr ea ti
on,407
1
9.1
0 VariantOfNAT,409
1
9.1
1 AnEx amp l
eOfNATTr ansl
a ti
on,409
1
9.1
2 Inter actionBe t
we enNATAndI CMP,41 1
1
9.1
3 Inter actionBe t
we enNATAndAp pl
i
cations,411
1
9.1
4 NATI nThePr e
senceOfFr agme nta
tion,41 2
1
9.1
5 Conc ept ualAddr essDoma i
ns,41 3
1
9.1
6 Linux ,Wi ndows ,AndMa cVe rsionsOfNAT,41 3
1
9.1
7 Ove rl
ayNe twor k s
,41 3
1
9.1
8 Mul tipl
eS i
mul taneousOv erlays,41 5
1
9.1
9 Summa ry,41 5
1
9

NetworkVi
rtual
i
zat
ion:
VPNs,NATs
,AndOverlays

1
9.1I
ntr
oduc
tion

Pre
viousc hap
tersde scri
bea ni nterneta sa s ingl
e -
levelabs
tracti
on that
c
onsist
s of ne tworksi nt
e r
conne ctedb yr outers.Thisc hapt
erc onsi
dersa n
a
lte
r nati
ve at wo-leveli
nter netarchitect
ur ethatv i
rtuali
zestheInternet
.The
f
irs
t l evelco nsi
sts of a c onve
n- t
ionali nternet t hat p r
ovi
des universa
l
c
onne c
tivi
ty.Ano rgani
za t
ionus estheunde rlyi
ngc onnectivi
tyt obuil
das econd
l
evelthatconformstot hene edsoft heor ganiza
tion.
The chaptere xami
ne st hreetechnologi
est hate mpl
oy v i
rtuali
zation.One
t
echnol
o-gyp ermitsac or porati
on toc onnectmul ti
p l
es i
tesa crosst heg l
ob a
l
I
nterne
t ,ort oa ll
ow a ne mp l
oyeet o uset heg l
ob alInternett oa c cesst he
c
orpora
t e network f r
om a n a rb
itra
ry r emotel ocati
on whi lek ee ping a l
l
c
ommuni c
ati
onc onfi
dential
.As econdforma l
l
owsas i
tet oprovideg l
obalI nternet
a
ccessformanyhos tswhi leonlyus i
ngas i
ngleglobal
ly-va
li
dI Pa ddress.At hird
t
echnol
ogya l
lowsa nor ganizat
iontoc reatea na rb
itraryne t
- workt opol og
yon
t
opoft heInternettopology.

1
9.2Vi
rtua
li
zat
ion

Weus ethetermvirtual
izat
iontodes
c r
ibeanabs
trac
tionthati
suse
dt ohi de
i
mp l
e-mentati
on detai
lsa nd p r
ovi
de high-l
eve
lf uncti
ona
lit
y. In g ene
ra l
,
vi
rtual
izat
ionmecha-ni
smsus eanunderl
yingmechani
smthatdoesnoti
ncludethe
nec
e s
sarydesi
redfunc-
tionali
ty.
39
9
400 Ne
twor
kVi
rtua
li
zat
ion:VPNs
,NATs
,AndOv
erl
ays Cha
p.1
9

Weha vealready seent echnol


ogie
sa nd p rotocolst hatp rovi
deal e
velof
networkv i
rtual
izati
on.Fore x
a mpl
e,aVLANEt he r
ne tswit c
ha ll
owsama na
gert o
confi
guret hes witcht oa ctlikeas etofi ndep endentEt he r
nets witc
hes.TCP
provi
dest he abstrac
tion of a r el
ia
ble
,e nd-to- end conne cti
on.I ne achc a
se,
however,theser v
iceisa nil
lusi
on t heunderlyingme chanism doesnotof fe
rt he
servi
cet hatt he v ir
t ual
i
za t
ion creates
. TCP, f or e xamp l
e,b uil
ds rel
iabl
e,
connect
ion-ori
entedde l
iveryove ranunrel
iab
lec on- nect
ionlesstrans
port.
Thi
schaptershowsthatseve
ralf
ormsofne tworkvir
tua li
zati
ona reusefulas
wel
la spopul
ar.Wewi llc
onsi
derthemotiv
ati
ona ndusesofv irtua
liza
tionsaswe l
l
astheme cha
nismsusedt ocr
eateeac
hf orm.Chapte
r28c ontinuesthediscuss
ion
byconsi
der-i
ngat ec
hnol
ogythatcanbeus e
dt ocreat
ev i
r tualpathst hr
ougha n
i
nternet.

1
9.3Vi
rtua
lPr
iva
teNe
twor
ks(
VPNs
)

Pa cketswi
tchi
ngus e dint heg l
ob a
lInternetha sthea dvantageoflow cost,
butt he dis
adv
antaget ha tp a
c ketsf rom multi
ple userst r
av e
la cros
sa g i
v en
networ k.Asar esul
t,t heg lob
a lInternetc a
nnotg uaranteet hatcommunicati
on
conduc tedovertheI n-
t ernetr emainsp ri
vate.Inp arti
cular
,i fa norgani
zati
on
compr is
es multi
plesite
s ,t he c ont
e nts of dat
agr a
ms t hatt ravelacros
st he
Internetb etwee
nt hesit escanb eviewedb youtsidersbecauset heypassacross
networ ksownedb youtsiders(i
.e.,ISPs).
Whe nthink i
ngaboutpriv
acy,networkma nagersof t
enc l
ass
ifyne tworksinto
at wo-l
e v
elarc hi
tect
urethatdist
ingui
shesbetweenne tworksthata ei
r nternalto
anor gani-
zationa ndnetworksthata reexternal
.Be causetheor ganizati
onc an
controlthei nt e
rnalnetworksitowns ,theo rganizati
on can makeg uar
a nt
ees
abouthow da tai sroute
da ndp r
eventitfrom b ecomingvisi
bl
et oot hers.Thus,
i
nt er
nalne t
wor kscanguaranteepri
vacy,whi
lee xt
er na
lne t
wor k
sc a
nnot .
Ifa nor gani
zati
onha smultip
les i
tes
,how c antheor ga
nizati
ong uarantee
pri
vacyf ortraffi
cs entamongt hes i
tes
?Thee a
s i
estappr
oachconsist
sofb uil
ding
ac ompletel
yi s
olate
dne t
wor kthati sowneda ndop erat
edb yt heor g
anizati
on.
Weus et hetermp riv
at enetworkorpr i
vateintranetforsuchane twork.Because
ap ri
vatene t
wor kusesleaseddig
italci
rcui
tstoint er
connectsi
tesandb eca
uset he
phonec ompanie
sg uaranteethatnoout si
dershav eacce
sstosuchc i
rcuit
s,a l
ldata
remainsp r
ivat
ea sitt r
avelsfromones i
tetoa nother.
Unfor t
unatel
y,a c omp l
etel
yp r
ivateintra
net may not s uffic
ef or two
reasons.First,mostorganizati
onsne eda c
cesstotheg lobalInternet(e.
g.,to
contactc ustomer
sa nds uppl
ier
s )
.S ec
ond,lease
ddi g
ita
lc irc
uitsa reexpens
ive
.
Conseque nt
ly,manyor gani
za-ti
onss eekalter
nati
vesthatof ferlowercost.One
approachus esaform ofv i
rtual
izati
ont ha
tCha pt
er16discusses
:MPLS .AnMPLS
connectionma ycosts i
gnif
icant
lyl es
st hanal e
aseddigi
t a
lc i
rcuitofthes ame
capacit
y.
Despi
tebe
ingle
ssexp
ensi
vetha
nadi g
italc
irc
uit
,anMPLSp
athismuc
hmore
e
x-p
e ns
ivethan atra
diti
ona
lInterne
tc onne
cti
on.Thus
,the c
hoi
ceiscl
ear
:
l
owe s
tc os
tc anbea c
hie
vedb yse
ndi
ngt ra
fficovertheg l
oba
lInt
ernet,a
ndt he
gr
ea t
estpriv
acyc anbeachi
evedbydedi
catedconnec
tions
.Thequest
ionari
ses
:is
i
tp oss
ibl
etoa chi
eveahigh
S
ec.1
9.3 Vi
rtua
lPr
iva
teNe
twor
ks(
VPNs
) 401

deg
reeofpri
vac
yandthelowc
ostofc
onv
ent
iona
lInt
erne
tconne
cti
ons
?Phr
ase
d
anot
herwa
y,onecana
s k
:

Howcananor ganizationt
hatusest
heglobalI
nternettoconnec
t
i
tssi
tesguar
ant eet hatal
lcommuni
cat
ioniskeptpriv
ate?

Theanswe rli
e sinat echnolog
yk nowna saVirt ualPrivateNetwork( VPN).
Thei deaofaVPNi sstraig
htforward:s e
ndda tagra
msa crosstheg l
obalInternet
bute nc
ryptt hecontents.Thet ermp ri
vatear i
sesbecauset heuseofe ncryption
me anst hatc om-municati
on b e
tweena nyp a i
rofc omp utersremainsconcealed
from out s
ide
r s.Thet e
rmv irtualari
sesbecauseaVPNdoe snotr e
quirededicated
l
ea s
e dcirc
uitst oconnectones i
tetoa nothe
r .Fi
gure1 9.1il
lustr
atestheconcep t.

I
NTERNET

S
ite1 enc
rypt
ionus
ed S
ite2

Fi
gur
e19.
1Ill
ustrat
ionofaVPNt hatus
esencr
ypti
onwhe ns
endi
ngdata
acrossthegl
obalInt
er ne
tbetwe
ent worout
ersattwosi
tes
ofa norgani
zat
ion.

1
9.4VPNTunne
li
ngAndI
P-i
n-I
PEnc
aps
ula
tion

At echniqueme nt ionedi nt hep r


ev i
ousc hap terp la
ysa ni mp ortantr olein
VPNt echnol
og y:t unnel ing.AVPNus e
st unnelingf orthes amer e
a s
ona smob i
l
e
IP:t os endada ta g
r ama crosst heI nter netb e
t we ent wos i
tes.Whynotj us t
forwa r
dt he da tag ram nor ma l
ly? The a nswerl i
e sini ncreasedp rivac
y( i
.e.,
confidential
ity).Enc ryp ti
ng t he p ayl
oa di n a da tagram doe s not g ua r
ant e
e
absol
ut ep ri
va cybec ausea no utsiderc anus etheI Ps ourcea ndde s
t i
na t
ionf i
elds,
theda tagramt ypef iel
d,a ndt hef r
eque ncya ndv olumeoft raff
ict og uesswhoi s
communi cating.AVPNe ncryp t
sa ne ntireda t
a gram,i ncludingt heI Phe ader.In
fact,tohi dei nforma tionf r
om out si
ders,s omeVPNsp ada l
lda tagramswi thext r
a
octetsb eforee ncrypt i
ngt hem,whi chme ansa nout siderca nnotus et hel e
ng t
hof
theda t agra
mt ode duc et het yp eofc ommuni cation.Thec onseque ncei stha t
encryptionme anst heda tagramhe aderc annotb eus e dforf orwa rdi
ng .
402 Ne
twor
kVi
rtua
li
zat
ion:VPNs
,NATs
,AndOv
erl
ays Cha
p.1
9

Most VPNs useIP-i


n-I
Pt unnel
ing. That i
s,t he or
igi
naldata
gram is
e
ncr
ypted,andt here
sul
tisplacedint hep a
yloa
ds ect
ionofanothe
rda t
agr
am
f
ortrans
missi
on.Fi
gur
e19.2il
lus
tratestheencaps
ula
tion.

ENCRYPTEDVERS
IONOFORI
GINALDATAGRAM

DATAGRAM
DATAGRAM PAYLOADAREA
HEADER

Fi
gur
e19.
2I l
l
ustr
ationofIP-
in-I
Penca
psul
ati
onuse
dwit
haVPN.The
ori
-gi
naldata
gramisenc
ryp
tedbefor
ebei
ngs
ent
.

Anor ganizationma yha vema nyc omp utersate achs ite.Forma x imalp r
ivacy,
in-di
v i
dua lc omp ut ersdonotp arti
c i
pa t
ei naVPN.I nstead,ama nag era rranges
forwa rd-ings ot ha tda t
a gramss e
nta crosst heVPNt unnela l
wa ystr avelfrom a
route ra tones itet oar outera tt heot he rs i
te.Whe nada tag rama rr
ivesov er
thet unne l
,t her eceivi
ngr outerde cryptst hep ayloadt or eproducet heor igi
nal
datag ram,whi c
hi tt henf orwardswi thint he si
te .Al thoug ht he da t
ag rams
travers ea rbitraryne twor ksast heyp assa crosstheI nternet ,out sidersca nnot
decode t he c ont ent sb ecausea n out s
iderdoe snotha v et he e ncr ypti
on k ey.
Furthe rmor e,e ve nt hei dentit
yoft heor i
gi
na lsourcea ndul ti
ma tede s
t i
-na t
ion
arehi dde n,b ecaus et hehe aderoft heor igi
na ldatagrami se nc rypted.Thus ,onl y
twoa dd r
e s
se sint heout erda tagram he adera rev i
sib
le :thes our cea ddressist he
IPa d- dressoft her outera tonee ndofat unne l
,a ndt hede stinat
iona ddressis
theI Pa ddre s
soft her out era ttheot here ndoft het unnel.Cons equently,a n
outside rc a
nnotde ducewhi chc omput ersa tthet wos itesa rec ommuni cat
ing.
Tos
umma
rize
:

AlthoughaVPNs endsdat
aac rossthegl
obalInt
ernet
,outsi
ders
can-not deduc
e whi c
h c omputer
s at t he two s i
tes ar
e
communicat
ingorwhatdatat heyar
eexchangi
ng.

1
9.5VPNAddr
ess
ingAndFor
war
ding

Thee asi
estwayt ounders
t a
ndVPNa ddres
singandr outingistothi
nkofe ach
VPNt unnela sar epl
acementforal ease
dc i
rcuitbetwee ntwor outers
.Asus ual
,
thefor ward-i
ngt a
bleineachoft hetwor outersconta
inse ntri
esfordesti
nati
ons
i
nsidet heor ga
niza-
tion.Theforwa r
dingt a
blea l
socontainsane tworkinter
face
thatc orre
s p
ondst ot heVPN tunne l
,a ndda t
a g
ramss entt oa nothersi
tea re
di
rect
edacros
sthetunne
l.Figur
e19.3il
l
ust
rat
est
hei
deab
yshowi
ngne
twor
ks
attwosi
tesandthef
orwardi
ngtabl
efora
S
ec.1
9.5 VPNAddr
ess
ingAndFor
war
ding 403

r
oute
rthatha
ndl
esVPNtunnel
i
ng.Al
thoug
hthee
xamp
leus
esI
Pv4,t
hes
amea
p-
p
roa
chcanbeuse
dforIPv6.

S
ite1 S
ite2
I
NTERNET

R1 R3
1
28.
10.
1.0/24 1
92.
5.48.
0/24
de
sti
nat
ion ne
xthop
R2 R4
1
28.
10.
1.0/24 di
rec
t
1
28.
10.
2.0/24 R 1
28.
210.
0.0/1
6
1
28.
10.
2.0/24 2

1
92.
5.48.
0/24 t
unne
ltoR3
1
28.
210.
0.0/1
6 t
unne
ltoR3
de
faul
t I
SP
srout
er

For
war
dingt
abl
einr
out
erR1

Fi
gur
e19.
3AVPNt hatsp
anstwos it
e ndR1
sa sfor
wa r
dingt
abl
ewitha
VPN tunne
lfrom R1 t
oR3 c
onf
igure
dl i
keap oi
nt-
to-
poi
nt
ci
r-c
uit.

Thef igureshowsade fa ulte ntryinR1sf orwardingt abl


ewi tha nI SPa st he
nexthop .Thei deai st hatc omp utersats i
te1c anac ces
sc omp utersa ts ite2or
comput er
sont heg lobalInt e r
ne t.Thet unnelisonlyus e
df ors ite-to-sit
ea c c
es s
;
otherda tag
r amsa ref orwar dedt otheI S
P.
Asa ne xampleoff or wa rdingi naVPN,c onsi
de rada tagra ms e
ntf rom a
comput eron ne twor k1 28.1 0.2.0t oac omp uteron ne twork1 28.210.0. 0.The
sendi
nghos tf or-war dstheda t a
g ramt oR2,whi chfor wardsitt oR1.Ac cordingt o
thef orwardingt abl
ei nR1,t heda t
agram mus tb ese nta c
rosst het unne lt oR3.
Therefore,R1e ncryp tstheda -tag ra
m,e ncaps
ul at
est her es
ultint hep ayloa da rea
ofa nout erda ta
g ram wi t
hd esti
na tonR3.R1t
i henf orwardst heout erda t agram
throught helocalIS Pa nda c rosst heInternet.Theda tagrama rrivesa tR3,whi ch
recogni
zesita st unne l
edf rom R1.R3de c
ryptst hep a
yl oa
dt op roduc et heor igi
nal
datagram,l ooksupt hede stination i
ni tsfor wardi
ngt able
,a ndf orwa rdst he
datagramt oR4 forde li
very.
404 Ne
twor
kVi
rtua
li
zat
ion:VPNs
,NATs
,AndOv
erl
ays Cha
p.1
9

1
9.6Ext
endi
ngVPNTe
chnol
ogyToI
ndi
vi
dua
lHos
ts

Manyc orporati
onsus eVPN t echnologytop ermite mp l
oyeestowor kfr om
remotelocati
ons .Thee mpl
oyeei sg iv
en VPN softwa ret hatrunson amob i
l
e
devi
ce( e.
g.,al apt
op )
.Tous et heVPN s oftware,aus e rbootst he
irde vi
c e,
connect
st oana rbit
rarynetwor k
,a ndob tai
nsanI Pa ddre
s sfrom al
oc alnet
wor k
provi
dera susual.Ifaus eriswor kinga thome,t heyc onnectt otheI SPt ha t
provi
destheirr esi
dentia
lInternetse rvi
ce.Iftheya rewor ki
nginahot el
,t hey
can obtai
ns er
v i
cef rom theI SPt ha tserveshotelg ues
t s,ands oon.Onc ea
networkconnectionha sbee
nob tai
ned,t heuserlaunchestheVPNs of
t ware,whi c
h
ispre-
config
ure dtof ormat unneltoar oute
ront hec orporatenet-work.
VPNs of t
wa rerec onfigur
e sthep rotoc
olsta cki nt heus ersc omp ut e
r.Whe n
itb e-g
ins,t heVPN s oftwaref ormsat unnelt ot hec orporatene tworka nd
communi cateso v
ert het unneltoob ta
inas ec
ondI Pa ddre s
s( i.
e.,a na ddresson
thec orporatene twor k )
.Thes oftwaret henc onfigur est hep rot ocols ta
c kto
res
tricta l
lcommuni cat i
ont og oovert heVPNt unne l
.Tha ti s
,a pp li
c at
ionsont he
compute r onlys eet he I Pa ddresst hat was ob -ta inedf rom t he c orpora
te
network .Alldatagramst hatappli
cati
onss endar et rans ferredov ert het unnelto
the corporate ne t
wor k ,a nd only datagr
a msc oming i nf r
om t he t unnelare
del
iveredt oa p pl
ic
ations.The refore,f rom ana p
pli
c ationsp ointofv i
ew,t he
user
sc omput erappear stob ea t
tacheddirectl
yt ot hec orporatene t work.
Toi nsuret hatc ommunicati
oni sc onfide
ntial
,alldatagr
a mst r
avel
inga c r
oss
thet unne laree ncrypte
d.Ho wever,t herei sap ote
nt i
alsecurityf l
aw:unl ikea
router,al ap-topca nbes t
oleneasil
y.I ft heVPNs oftwarecanha ndl
ee ncryp t
ion
andde crypti
on,a nout si
derwhos teal
st hel apt
opwoul dbea b l
et oob tai
na c c
e s
s
tot he c orp
ora te network.The refore,VPN s oftwarei s
suedt o usersus uall
y
requi
r e
sap ass
wor d.Thep asswordisc omb inedwiththet i
me- of-dayt og e
ne rate
aone -ti
mee ncrypti
onk eyt hatisus e
df oras ing
lesessi
on.Wi thoutt hec orrect
VPN p as
swor d,as tolenlaptopc annotb eusedt og ai
na cce
s st ot hec or
p orate
network.

1
9.7Us
ingAVPNWi
thPr
iva
teI
PAddr
ess
es

Interest
ingly,alt
houg haVPNus est heg l
obalInternetwhe nc ommuni cati
ng
betwee nsit
es,t hetechnologyma kesi tpossib
letoc rea
teap riva
tei ntr
a netthat
doesnotp rovideg l
obalInter
netc onne ct
ivit
yf orhostsont hec orporat
ene twor k
.
Tos eehow,i ma g
inea ss
igni
nghos tsnon- r
outableaddresse
s( e.g.
,a nI Pv6s i
te-
speci
ficaddressora nI Pv4p r
ivatea ddress)
.Oner outera te a
chs i
t eisassigne
da
glob
ally-v
a l
i
dI Paddress,andt her outeri sconfigur
edt of orm aVPNt unnelto
therout eratt heothers i
te.Figure1 9.4ill
ustra
testhec oncept.
S
ec.1
9.7 Us
ingAVPNWi
thPr
iva
teI
PAddr
ess
es 405

v
ali
dIPaddr
ess v
ali
dIPaddr
ess
S
ite1 S
ite2
us
ingsubnet R1 I
NTERNET R2 us
ingsubnet
10.
1.0.0 10.2.
0.0
10.2
1
0.1addr
ess addres
s

Fi
gur
e19.
4 Exampl
eofaVPN t hatinter
conne
ctst
wos
itesoverthe
g
lob
a lInt
ernet whil
ec ompute
rsa tea
chs
ite us
e non-
r
outabl
e(i
.e.
,priva
te)addre
sses
.

I
nt hef igure ,theor ga
nizationha sc hosent ous et henon- routabl
eI Pv4
prefix10.0.0.0/8( ap r
efixt hatha sbee nre ser
v e
df orus einap riva
t enetwork)
.
Site1us ess ubne t1 0.1
.0.0/16,whi les i
te2 us essub net1 0.2.
0.0/16.Onlyt wo
global
lyv ali
dI Pa ddress
esa rene ede dtoma k eaVPNp os
sibl
e.Onei sa ss
ignedto
thec onne c
tionf r om routerR1t ot heI nternet,a ndtheot herisa ssig
nedt othe
connectionf rom R2 t otheI nt er
-ne t.Thet wos itesma yb ef ara p
a rtandma y
ob t
ains ervi
cef rom t woi ndependentI S Ps,whi chme anst hatt het wog loba
ll
y-
vali
da ddr es
se sma yb eunr elated.Rout ersa ndhos tswi thinea c
hs i
teus ethe
privatea ddresss p ac
e;onl yt het wor out erst hatp a
r ti
ci
p at
ei nVPN t unneli
ng
ne e
dt ok nowa boutorus eg l
o b
all
y- val
idI Pa ddres
ses.

1
9.8Ne
twor
kAddr
essTr
ans
lat
ion(
NAT)

The p revi
ous s ec
t i
ons de s
cribeaf orm of v i
rtuali
zation thata ll
ows a n
organizati
on t oc onne cts i
t e
sa crosst he g lobalI nternet whil
ek ee pi
ng a l
l
communi cati
onc onfidenti
al.Thiss ectionc onsid
e rsat echnol
og ythatinvertst he
vir
tua l
izat
ionb yp rovi
dingI P-levelacc e
ssb etwe enhostsa tas iteandt heg lob a
l
Internet,wi t
houtr equiri
nge ach hosta tt hes i
tet oha v
eag l
obal
l
y- val
i
dI P
address.Knowna sNe t
wor kAddr essTr ansl
ation( NAT),thet echnol
ogyha sbecome
extreme l
yp opul
arf orb othc onsume rsa ndsma llbusi
ne s
ses.Fore xampl
e,wi reless
routersusedinhome se mployNAT.
TheideabehindNATisst
rai
ght
forwa
rd.Asi
tepl
acsaNATde
e v
ice,inf
ormal
l
y
c
all
edaNATb ox,betweennet
work(
s)atthes
itea
ndt her
estoft heInte
rnet
a
sFigur
e1 9.
5i l
lust
rat
es.
Al
thoug
hthenameimpl
iesthatNATrequi
ress
pec
ial
-pur
pos
eha
rdwa
re,i
tisp
oss
ibl
etor
unNAT
s
oft
wa r
eonag e
ner
al-p
urpos
ec omp
uter(e
.g.,aPC)
.
406 Ne
twor
kVi
rtua
li
zat
ion:VPNs
,NATs
,AndOv
erl
ays Cha
p.1
9

I
nternet Sit
eviews
vi
ews the
NATboxas
NATboxasa a
defaul
t
s
ingl
ehos
t router
NAT

I
NTERNET S
ITE

Host
s(androut
er s
)att he
si
teonlyusenon-routabl
e
addres
ses

Fi
gur
e19.
5Il
lus
trat
ionofaNATboxt
hata
ll
owsas
itet
ous
enon-
r
outab
leIPaddr
ess
es.

From thepoi
ntofv iew ofhostsa
tt hesit
e,theNATb oxappearstob earouter
thatconnec
tstot heInternet
.Tha ti
s,forwar
dingatthesit
ei sse
tupt odi
rect
outgoi
ngda -
tagra
mst otheNATb ox.From thepointofanI SPt hatprovi
des
serv
icetothesit
e,t heNATb oxappearstobeas i
ngl
ehost.Thatis
,t heNATb ox
obtai
nsas i
ngl
e,global
ly-v
ali
dI Paddre
ss,andappear
stouset headdresstosend
andr e
cei
vedatagr
a ms.
Thek e ytoNATt echnolog ya ri
sesbecauseNATt ranslates(i.e.,changes)da -
tagramst hatt ravelineithe rdirecti
on.Whe nahos ta tt hes i
tes endsada tagram
toade stinati
on on t heI nternet,NAT p lacesinf orma ti
on a boutt heout goi
ng
datagram( in-cl
udingar ecordoft heor i
gi
na lsender )inat able,cha ngesfie
ldsi n
thehe ader,a nds endst hemodi f
iedda t
ag ramt oi tsde s
t i
nation.I np arti
cular,
NATc hang est hes ourceI Pa ddresstoma keita pp eart hatt heda tagramc ame
from t heNAT b ox.Thus ,i fas iteont heI nterne tt ha tr e
c ei
vesada tagram
repl
ies,t her eplywi llbese ntt ot heNATb ox.Whe ni tr ec ei
vesada tagramf rom
theI nte r
ne t,t heNATb oxc onsultsitstable,findst heo rigi
na lsender,chang es
fi
e l
dsi nt hehe ade
r ,andf or wardst hedata g
ram.I np articular
,NATc hangest he
IPde sti
na tiona ddresstot hep r
ivateaddressthatt hehos ta tthes iteisusi
ng.

Becaus
eb othoutgoi
ngandi ncomingda t
agramst rave
lthrought heNATb ox,
NATs oftwarecanfoolbothhostsb ehi
ndt heNATb oxandarbitra
ryhos t
sint he
Int
er ne
t.Whe nahos tintheI nternetr ec
eiv
esda t
agramsfrom t hesite,the
dat
ag ra
msa ppea
rt ohaveori
gina
t eda ttheNATb ox.Whenahos tbehindtheNAT
boxob ta
insanI Pad-dres
s,thea ddressisnon-routabl
e(orsite-l
ocal)
.Howe v
er,
thehos tcanus ethenon- r
outab l
es ourceaddre s
swhe nsendinga ndr e
ceiv
ing
dat
ag ra
mswi thana r
bitr
aryInternethost.
Thechi
efa dv
anta
geofNATa r
ise
sf rom i
tscombina
tionofgenera
li
tya nd
t
rans
-par
ency.NATismoregener
althanas etofappl
ic
ati
ong at
ewa
ysb ec
auseit
a
ll
owsana r
bitr
aryint
erna
lhosttoacces
sa narbi
tra
rys e
rvic
eonac ompute
ri n
t
heg l
oba
lInter
net
.NATistr
ansp
are
ntb e
caus
ehos
tsa
tthes
iter
unc
omp
let
ely
s
tanda
rdprot
ocols
oft
war
e.Tosummari
ze:
Sec
.19.
8 Ne
twor
kAddr
essTr
ans
lat
ion(
NAT)
407

Networ k Addr es
s Tr ansl
ation (NAT) technol
ogy prov
ides
transparentIP-levelac
cesstot heI
nternetf
orahos tt
hathasa
private,non-
r outableI
Paddr ess
.

1
9.9NATTr
ans
lat
ionTa
bleCr
eat
ion

Ourov e
r vi
ew ofNATg l
osse
sov eraf ew detai
l
sb ecauseitdoesnotspeci
fy
how aNATb oxk nowswhichinternalhostshoul
dr e
ceiveada tagr
amt hata
rriv
es
from theIn-ternet.Wes a
idt hatNATma i
ntai
nsat ransl
ationtabl
eandusesthe
table whenf or-wardi
ng to a host
.Wha tinformati
on d oesNAT plac
eint he
transl
ati
onta bl
ea ndwhena r
et abl
ee ntr
iescrea
ted?
Themos twide l
yusedformofNATs toressi
xitemsini tst
ransl
ati
ontabl
e:

I
nter
nalI
P.Thenon-
rout
abl
eIPa
ddr
essus
edb
yani
nte
rna
l
c
omp
ute
r.
I
nter
nalPor
t.Thep
rot
ocolp
ortnumb
erus
edb
yani
nte
rna
l
c
omp
ute
r.
Ext
ernalI
P.TheI
Paddr
essofa
nex
ter
nalc
omp
ute
rloc
ate
d
s
ome
whe
rei
ntheI
nte
rne
t.
Ext
ernalPor
t.Thep
rot
ocolp
ortnumb
erus
edb
yane
xte
rna
l
c
omp
ute
r.
Payl
oadType.Thet
rans
por
tpr
otoc
olt
ype(
e.g
.,TCP,UDP,or
I
CMP)
.
NATPor
t.Thep
rot
ocolp
ortnumb
erus
edb
yaNATb
ox(
to
a
voi
dsit
uati
onsinwhi
cht
woi
nte
rna
lcomp
ute
rsc
hoos
ethe
s
ameportnumbe
r).

Whenada tagrama rr
ivesfrom theI nterne t
,NATs earchesthet a
ble.Ift he
IPsourcea ddr e
ssi ntheda t
ag r
am ma t
che sExt ernalIP,t hes our
c eprotocolport
numb e
rma tchesNATPor t,a ndt hedatag r
amt yp ema t
che sPayloadType,NAT
usesthet a
b l
ee nt ry.NATr e
placestheda tagramsde s
tinationI Paddress(whichis
always the a ddress of the NAT b ox itsel
f) wi thI nt ernalIP,r e
placest he
desti
nati
onp r otocolportnumb erwithI nternalPor t,a nds endstheda tagramt o
theinter
na lhost .
Ofc ourse,at ableentrymus tbecreatedb e
foreada t
agra ma r
riv
e sfr
om the
Inte
r- net;otherwis e
,NATha snowa yt oidenti
f ythecorr
e ctinternalhostto
whicht heda -t
agrams houl
db eforwarded.How a ndwhenist hetableini
tial
i
zed?
Thea bovede scr
iptionimp l
i
est hatoutgoi
ngda tagramsarealwaysus edtoc rea
te
tabl
ee ntr
ies.Althoug hweha vedescri
bedt hemos twidel
yus e
df orm ofNAT,
otherse x
ist.Thep os-si
bil
it
iesi
nclude:
Techni
cal
l
y,t
hev
ers
ionofNATde
scr
ibe
dhe
r sNe
ei twor
kAddr
essandPor
tTr
ans
lat
ion
(NAPT).
408 Ne
twor
kVi
rtua
li
zat
ion:VPNs
,NATs
,AndOv
erl
ays Cha
p.1
9

ManualI
nit
ial
i
zat
ion.A managerc
onf
igur
est
he t
rans
lat
ion
t
abl
ema
nua
ll
ybe
for
eanyc
ommuni
cat
ionoc
cur
s.
Out
goi
ngDat
agr
ams
.Thet
abl
eisb
uil
tasas
ide
-ef
fec
tofa
n
inte
r-nalhos
ts endi
ng a dat
a g
ram.NAT us
esthe outgoi
ng
datagra
mt ocre
ateat r
ansla
tiontab
leent
rytha
trecordsthe
sourceandde
sti
na-ti
onaddres
ses.
I
ncomi
ngNameLookups
.Thet
abl
eisb
uil
tasas
ide
-ef
fec
tof
handlingdoma i
nna mel ookup
s.Whenahos tont heInt
ernet
l
ooksup t he doma i
n name ofa ninte
r na
lhos t,the DNS
softwa r
es endstheaddressoftheNATb oxa stheans
wera nd
createsa ne nt
ryint heNATt r
ans
lat
iont abl
et ofor
wardt o
thec orrec
ti nt
ernalhos
t .

Ea c
hi niti
al
izati
on t echnique hasa dva
ntagesa nd dis
advantage
s. Ma nual
i
nit
ial
iza-t
ion prov
idesp er
ma nentma pp
ingst hata l
l
ow a r
bitr
ary hostsint he
I
nternett oreachser-v i
cesatt hesit
e.Us i
nga noutgoingdatagra
mt oi ni
ti
a l
ize
t
he t abl
e hast he adv antage of maki
ng out goi
ng communicati
on comp l
etely
a
utoma ti
c,b ut hast he disadva
ntage of not all
owing outsi
derst oi ni
tiate
c
ommuni cati
on.Usi
ngi ncomingdoma i
nna melookupsaccommodatescommunicati
on
i
nit
iatedfromout s
ide,b utrequiresmodi
fyingthedoma i
nnames oftware.
Aswes aidab ove,mos timp lementati
onsofNATus eout goi
ngda ta
gramst oini
-ti
alizet het a
ble;t hes trategyi sespeci
all
yp opularforwi r
e l
essr outersuseda t
Wi-Fihots pots.Ther out e
rc a
nb ec onnecteddi re
ctl
yt oa nI SP,e xactl
yl i
kea
host.Fore xamp le,t hewi re l
essrout ercanb ep l
uggedint otheDS L orc able
mode mt heI SPs uppli
e s.Thewi rele
ssr outerthe noffersWi-Fira dioconnecti
ons.
Whe namob il
eho s
tc onnectsv iaWi -Fi
,NAT s oft
warer unningi nt hewi rel
ess
route rassi
gnst hemob ilehos tap riv
ate,non- routabl
eI Paddressa nda ss
ignsits
addre s
sa sade faultrout era ddress
.Amob il
ehos tcancommuni catewi thanyhos t
ont heI nter
ne tme relyb ys endingda t
a g
ramst ot hewirel
essrout erov e
rt heWi -
Fine twork.Figure1 9.6i l
lustratesthea rc
hitec
tur e.

Wir
elessrouter
(Wi-Fihotspot)

Hos
tsus
ing
I
NTERNET
Wi
-Fi

Fi
gur
e19.
6TheuseofNATb yawi
rel
essr
out
er.Ea
chhos
tisa
ssi
gne
da
p
riv
ateIPaddr
ess.
Chapt
er23de
scr
ibe heDoma
showt inNameSys
tem (
DNS)
oper
ates.
Sec
.19.
9 NATTr
ans
lat
ionTa
bleCr
eat
ion
409

Awi rel
essr outermus ta ssigna nIPa ddresstoahos twhe neverthehos t
connects
.Fore xa mple,ifahos tus e
sIPv4,ther oute
rmi ghtassi
g nthef i
rsthost
192.1
68.0.1
,t hes econd1 92.168.0.2,andsoon.Whe naho stsendsada tagramt o
ade s
tinati
ono nt heI nternet,t hehostf orwardstheda tag
ram ov ertheWi -Fi
network,a nd the wi re l
essr oute rappli
est he outgoing NAT ma ppi
ng before
sendi
ngt heda t
ag ram overt heI nternet
.S i
milar
ly,whe nar eplya rr
ivesfrom the
Inter
ne t
,thewi r el
essr outera ppli
estheincom- i
ngNATt ransl
ationa ndforwards
thedatagramov ert heWi -Fine twor ktothecorrecthost .

1
9.1
0Va
ria
ntOfNAT

Manyv ari
antsofNATe xi
st,andma nyna mesha veb ee nusedt ode scri
bet he
vari
-ants.Sof a
r,weha v edescrib
e dsymmet ricNATt hata ll
owsa na r
b i
t ra
ryhos t
atthes itetocontacta na rbit
raryp rotocolportonahos ti nt heInte rnet.Ma ny
oft hep rop
osedv ari
ant sf ocusonr unnings erver
sb ehi
ndaNAT b oxt oa l
low
externa
lI nt
ernethos t
st oiniti
atec ommuni c
a t
ion(i.e.,pac ket
sc anar riv
eb ef
or e
a hosta tt he si
tes e ndsa p acket)
.For e xample,a v ari
ant known a sp ort
rest
rict
edc oneNATus e soneout goi
ngp ackett oes t
a bl
is
ha ne xt
erna lport,a nd
thens endsallpacketst ha tarrivea tt hep ortt ot hei nter-nalhos t.Thus,i f
int
ernalhostH1s endsap ack
etf rom sour c
ep ortXa ndt heNATb oxma psitt o
externa
lp ortY,allincomi ngp ack
e tsdesti
nedf orp ortYwi llbedirecte dtop ort
XonH1,nomat terwhi chhos tint heInt er
nets endsthep a ckets
.

1
9.1
1AnExa
mpl
eOfNATTr
ans
lat
ion

Ane xamplewillcla
rifyNATt rans
lati
on.Re ca
llthatthev e
rsionofNATwe
havediscusse
di scall
edNAPTb eca
usei ttransl
atesprot
ocolportsa swe l
lasI
P
address
e s
.Figure19.7ill
ustra
testhec onte
nt sofa nIPv4transl
ationtabl
euse
d
withNAPTwhe nf ourc omputer
sa tas it
eha v
ec re
atedsixTCPc onne
cti
onst
o
exte
r nalsi
tesontheI nter-
net.

Int
e rnal Internal Exte r
na l External NAT Payl
oad
IPAddr es
s Port IPAddr ess Port Port Type
1
92.168.0.
5 38023 128.10.19.20 80 41003 tc
p
1
92.168.0.1 41007 128.10.19.20 80 41010 tc
p
1
92.168.0.
6 56600 207.200.75.200 80 41012 tc
p
1
92.168.0.
6 56612 128.10.18.3 25 41016 tc
p
1
92.168.0.
5 41 025 128.10.19.20 25 41009 tc
p
1
92.168.0.
3 38023 128.210.1.5 80 41007 tc
p

Fi
gur
e19.
7Ane xa
mpl
eofatra
nsl
ati
ontab
leusedbyNAPT.Thet
abl
ein
-
clude
spor
tnumb
ersaswel
lasIPv
4a ddr
ess
es.
41
0 Ne
twor
kVi
rtua
li
zat
ion:VPNs
,NATs
,AndOv
erl
ays Cha
p.1
9

Thefigur
ei l
lust
ratesthre
ei nte
rest
ingc a
ses:as ingl
ehos tatthesi
teha s
f
ormedconnectionstotwohos tsontheInternet,twohos tsatthesi
tehaveeac
h
f
ormedac on-ne c
tiontot hesamewe bserv
eront heI nternet,andtwohost
sa t
t
hesitear
eus ingt hesa
mes ourceportnumbersimult
ane ousl
y.
I
nthef
igur
e,e
ache
ntr
ycor
res
pondst
oaTCPc
onne
cti
on.I
nte
rne
thos
t
192.
168.
0.6hasforme dtwoc onnec
tionstoe x
ternalhosts
,onet oawe bs e
rver
(por
t80)one x
ternalhost207. 200.
75.200andt heothertoa nemailserv
er(port
25)onexter
nalhost128.10.
18.3.Twoi nte
rnalhost,1
s 92.168.0.
5and1 92.1
68.0.
1,
arebothacc
essi
ngp rotoc
olp ort80one xte
rnalcomp ut
er1 28.
10.
19.20.Because
eac
hhos tatt hes i
teisfreet oc hooseas our cep ortnumb er
,uniquenessc annot
begua r
anteed.I nthee x
amp le,TCPc onnectionsf rom 192.1
68.0.5and192.168.0.3
bot
hha vesour ceport38023.Thus ,t oa voidp otenti
a lconf
lic
ts,NATa s s
ignsa
uni
que NAT p ortt oe achc ommuni ca
tion t ha ti s used on t he Internet.
Furthermor
e ,aNATp orti sunr el
atedt ot hes our cep ortthatas endinghos t
cho
os e
s.Thus ,t heconnec
tionf rom host192. 168. 0.1canus eport41007,andt he
NATb oxcanus eport41007f orac omp l
etel
ydi f
f e re
ntc onnec
t i
on.
Rec
alltha
tTCPide
ntif
iesea
chconne
cti
onwitha4- tupl
etha
tr ep
resentsthe
I
Pad-dressandpr
otoc
olportnumberofeache ndp
oint.Forex
a mp
le,thef i
rst
t
woe ntri
esinthetabl
ec or
res
pondtoTCPc onnect
ionswiththefoll
owing4-
t
upl
es:

(1
92.
168.
0.5,38023,128.
10.
19.
20,80)
(1
92.
168.
0.1,41007,1
28.1
0.1
9.20,80)

However
,whenc omputer128.1
0.1
9.20 i
nt heInt
erne
trecei
vesda
tag
rams
,the
NAT boxwil
lha v
et rans
lat
edt hesourc
ea ddr
ess
,which me
ansthesametwo
conne
cti
onswi
llhavethefol
lowi
ng4- t
upl
es:

(G,41
003,1
28.
10.
19.
20,80)
(G,41
010,1
28.
10.
19.
20,80)
whe
reGi
stheg
lob
all
yva
li
daddr
essoft
heNATb
ox.
Thep ri
ma ryadv anta
geofNAPTl iesintheg enerali
tyi tachi
eveswithas ingle
glo-
ba l
l
yv al
i
dI Pa ddress
;t hep r
ima rydisadvantagea ris
esb ec
ausei tr e
stricts
communi c
a -
tiont oTCP,UDP,a ndI CMP.Be causea l
mos ta l
lappl
ic
ationsuseTCP
orUDP,NAPTi st ransparent .Ac omputera tt hes i
tec a
nus ea rbi
trarysour ce
port numb ers,a nd c ana ccess multip
lee x
te r
na lc omputerss i
mul t
aneously.
Me a
nwhi l
e,mul ti
plec omput ersatt hes i
tec ana ccesst hesamep ortonag iv
e n
externalcomp ut
ers i
mul t
ane ousl
ywi thoutinterference.Tos ummarize:

Al
thoughs everalvar
iantsofNAT exi
st,theNAPT f
ormisthe
mostpo-pularbecaus
ei ttr
ans
lat
esprot
ocolpor
tnumber
saswel
l
asIPad-dresses.
Thenexts
ecti
onexpl
ainst
hataNATb
oxt
rans
lat
esa
ndf
orwa
rdss
omeI
CMPme
ssa
ges
,and
ha
ndl
esothe
rme s
sagesl
oca
ll
y.
S
ec.1
9.1
2 I
nte
rac
tionBe
twe
enNATAndI
CMP 41
1

1
9.1
2Int
era
cti
onBe
twe
enNATAndI
CMP

Alt
houg hweha vede s
c r
ibedNATa sop eratingonI Pa ddressesa ndp r
otocol
portnumb ers,thea ddr
e sst ransl
ationc ana ffe
c tot herp a r
tsofap acket.For
example,c on-si
de rI CMP.Toma i
nt ai
nt hei ll
usion oft ranspa
r ency,NAT mus t
understanda ndc hanget hec ontentsofa nI CMPme ssage.Fore xamp l
e ,supposean
i
nt e
rnalhos tus esp i
ngt ot e
str eachabi
lityofade st
ina t
ionont heI nternet.The
hostexpe ctstor eceivea nI CMPe chor eplyf ore achI CMPe chor eques tmes sage
i
ts ends.Thus ,NATmus tf or-wa rdinc ominge c hor epl
iest ot hec orrecthos t.
Howe v
er,NATdoe snotf orwa r
da llICMPme ssagestha ta rri
vef rom t heI nternet
(e.
g.,ifr outesi nt he NAT b ox a r
ei n-correct,a nI CMP me ssag e mus tb e
proces
sedl ocal
ly).Thus ,whe na nI CMPme ss
a g
ea r
rivesf rom t heI nt e
rne t,NAT
mustf i
rs tde t
erminewhe thert heme ssag eshouldb eha n-dledloc a
llyors entto
aninternalhos t.
Be for eforwa rdi
ngt oa ninternalhos t,NATmus tt r
anslat
et hee nti
reI CMP
mes-sag e.To unde rs
tand t he needf or I CMP t r
a ns
lati
on,c ons i
de ranI CMP
desti
nat ion un-r eachable message
.The me s
sagec ontai
ns the he aderf rom a
datagra m,D,t ha tc ausedt hee rror.Unf ortunat e
ly,NAT t r
a nsla
t edaddr es
ses
befores e ngD,s
ndi ot hes ourc
ea d-dressi nDi st heg lob
all
y-valida ddres
soft he
NATb oxr at
hert hant hea ddr
essoft hei nternalhos t
.Thus ,b eforef orwarding
theI CMPme ss
a geb ackt ot heinternalhos t,NATmus to pent heI CMPme ssage
andt ra nslat
et hea ddress
e sinD s ot heya ppea
ri ne xac
tlyt hef or mt hatt he
int
e r
na lhos tuse d.Af terma ki
ngt hec hang e
,NATmus tr ecomput et hechec k
sum
inD,t hec heck
s um int heI CMPhe ader,a ndt hec hecksum intheout erda t
a gr
a m
header.

1
9.1
3Int
era
cti
onBe
twe
enNATAndAp
pli
cat
ions

Althoug hI CMPc omp l


icatesNAT,p rovi
dingt ranspa renc ytos omea ppli
cat i
on
pro-tocolsr equi re ss ub s
t antiale ff
or t.Ing ene r
a l
,NATwi l
lnotwor kwi t
ha ny
appli
cationt ha ts e ndsI Pa ddressesorp rotocolp ortsa sda t
a.I np artic
ular,t he
Fil
eTr ansf erPr oto- col( FTP) ,whi chi susedt odownl oa dl argef il
es,e s
tabli
she sa
controlc onne ctionb etwe ent hec li
e nta nds e rver,a ndt he nf ormsane w TCP
connectionf ore a chf i
let ransfer.Asp artoft hep r otoc ol
,ones i
deob tainsa
protocolp ortont hel oca lma chine,c onvertst henumb e rt oAS CI I
,a nds endst he
resul
ta c r
os st hec ont rolc onne c
t i
ont otheot he rside.Theot hers idethenf or ms
a TCP c onne ct i
on t o t he s pecified port . Cons ide r wha t ha ppens whe n
communi cat i
onb etwe ent het wos ide spassest hroughaNATb ox.Ahos tb ehind
theNATb oxc anf orm ac ont rolconne cti
on.Howe ver
,i ft hehos tob -tai
nsal ocal
porta ndp a s
se st hei nf orma t
iont ot heot hers ide,NATwi llnote xpectpacketst o
arriv
ea ndwi lldi sca r
dt he m.The r
ef ore,FTPc anonl ywor ki fNATmoni -torst he
contentsoft hec ont rolc onne cti
on,s el
ectsap ortnumb er,a ndc hangest heda ta
streamt or e
f l
e ctt hene wnumb e r
.
Ma
ny i
mpl
eme
nta
tions of NAT r
ecog
nize p
opul
ara
ppl
i
cat
ion p
rot
ocol
s,
i
ncl
uding FTP,a nd mak
et he nec
ess
arycha
ngeint he da
tas tr
eam.As an
a
lter
na t
ive,var
iant
sofa ppl
ic
ati
onshaveb
eencre
ate
dt hata v
oidpass
ings
uch
i
nformationi
ntheda t
astre
am
41
2 Ne
twor
kVi
rtua
li
zat
ion:VPNs
,NATs
,AndOv
erl
ays Cha
p.1
9

(i
.e.
,a voi
dma k
ingc onnecti
onsi nthereve
rsedi
rection).Forexamp l
eav e
rsi
onof
FTPt hatdoesnotr equirethes ervertoconne
ctb a c
kt othec li
entisknownas
pas
siveFTP.Applic
at i
onp rogr
amme rsmustb eawareofNAT,a ndt omakethei
r
appl
ic
a t
ionstota
llyg ene
ral,the yshoul
davoidpas
singa ddres
sesorp ortnumbe
rs
intheda tas
tream.Tos umma rize:

NAT af f
ect
sI CMPandappl i
cati
onprot
ocol
s;exc
eptforaf ew
stan-dar
d appl
icat
ions li
ke FTP,an appl
ic
ati
on pr
otoc
olt hat
passesIPad-dress
esorpr ot
ocolpor
tnumbersasdatawil
lnot
operatecor
rectl
yac ros
sNAT.

Changingi temsi nada tas trea


mi ncreas
e st hec omp l
exityofNAPTi nt wo
ways.First,itme a
nst hatNAPTmus tha vedet a
iledk nowledgeofe achappli
cati
on
thatt ra
nsfe rssuchinforma tion.Second,ift hep or tnumb e r
sa rerepre
sentedin
ASCII,a sist hec asewi thFTP,c hangingt hev al
uec anc hangethenumb e
rof
octetstransferred.In-sertinge venonea dditi
ona loc tetintoaTCPc onnecti
onis
dif
f i
cul
tb ecausee achoc tetint hest r
ea m hasas equencenumb e
r.As enderdoes
notk nowt hata ddit
ionalda taha sbe
e ninserted,a ndc onti
nue stoassi
gns e
quence
numb erswi thout the a dditi
ona ldata.Whe ni tr eceiv
esa ddi
ti
onalda t
a,t he
recei
verwi l
lg eneratea c
k nowledgementst hata c-countf ort heda t
a.Thus,a ft
er
itinsertsa dditi
onaldata,NATmus tus eat e chniquek nowna sTCPs pli
ci
ngt o
transl
atet hes equencenumb e r
si neachout goings egmenta ndi ne a
chincoming
acknowledgeme nt.

1
9.1
4NATI
nThePr
ese
nceOfFr
agme
nta
tion

Thea bovede scri


pt i
onofNATha sma dea nimp ortanta s
sump ti
ona boutI P:a
NATs ys temr e c
eivescomp le
teI Pda tagramsa ndnotf ragme nts.Wha tha p pensifa
datagra mi sf ragmented?I Pa ddr e
ssesa renotap roblemb ec
aus ee a
c hf ragme nt
containst heI Pa ddressesoft hes ourcea ndde s
tinationhos t s.Unf ortunate l
y,
fragme ntationha sas i
gni-fi
cantc onseque ncef orNAPT ( themos twi de l
yus ed
varia
ntofNAT) .AsFi gure1 9.7s hows ,NAPT t ablelook upus e
sp r otocolp ort
numb er sfrom t het ransporthe adera swe l
la sI Pa ddressesf rom theI Phe ader.
Unfort unately,p ortnumb ersarenotp r esenti na llfragme ntsb ecaus eonl yt he
fir
stf r agmentofada tagramc arrie
st het r
a nsportp rotocolhe ader.Thus ,b efore
itcanp erformt helook up,aNAPTs ystem mus tr ece i
vea nde x-aminet hef irst
fragme nt of t he da tagram. I Ps e
ma nt i
csf urtherc omp l
icate NAT b ecause
fragme ntsc ana rri
ve out -of-order. The re f
or e,t he f ragme nt c arrying t he
transpor the aderma ynota r
riveb eforeot herf ragme nts.
A NAPT sys
temcanf oll
ow oneoft wode s
igns:thesystemc ans a
vet he
fr
agmentsandattemp
tt or eas
sembl
et hedatagram,ort hesystemc a
ndi s
card
fr
agmentsand onlyproc
essc ompl
ete data
grams.Ne it
her opti
on isdesi
rabl
e.
Reas
semblyr
equi
resst
atein-formati
on,whichme ansthesyste
mc a
nnotscal
et o
hi
ghs pe
edorl ar
genumb e
rsoff l
ows( a
ndi ssuscept
ibl
etoma l
ici
ousattack)
.
Di
sca
rding f
rag
mentsmea
nst hes
yst
em wi
l
lnotp
roc
essa
rbi
tra
ryt
raf
fic
.In
pr
acti
ce,onl
ythos
eNAPTsys
temst
hatar
e
S
ec.1
9.1
4 NATI
nThePr
ese
nceOfFr
agme
nta
tion 41
3

des
igne
df orslow-s
pee
d ne
twor
ksc
hoos
etor
eas
semb
le;ma
ny s
yst
emsr
eje
ct
fr
agment-
e dda
t a
grams
.

1
9.1
5Conc
ept
ualAddr
essDoma
ins

Weha ved escri


bedNATa sat e
chnologyt hatcanb eusedt oconne ctap r
ivat
e
net-workt ot heg l
obalInt e
rne t.Inf act,NATc a
nb eus edt ointerconne ctany
twoa ddressdomains.Thus,NATc anbeus edb etweent woc orpora
tionst hate a
ch
haveap rivatene t
wor kusinga ddress10.0.0.
0.Mor eimp ortant,NATc anb eused
att wole v
els:betwe e
nac ustome r
spr i
vatea ddres
sdoma ina nda nI SP
sp r
ivat
e
addressdoma ina swe l
lasb etwe e
nt he ISPsaddressdoma i
na nd t he g l
obal
Internet
.Fi nal
ly,NATc anb ec omb i
nedwi t
hVPN t e
chnologyt of orm ahyb ri
d
archi
tecturei nwhi chpriv
a tea d-dres
se sareus edwi thi
nt heor ganization,and
NATi susedt op r
ovideconnectivi
tyb etwe e
ne achsiteandt heg l
obalInterne t
.
Asa nexampleofmul ti
pl
elevelsofNAT,consideranindi
vidualwhowor ksat
homef rom se
veralcomputerswhichareconnec
tedt oaLAN.Thei ndiv
idualc
ana s
-si
gnp ri
vat
ea ddres
se stothecomputersathome,a nduseNATb etwe enthehome
net-worka ndt hec orp
orateintrane
t.Thec orporati
on cana l
soa ssi
gnp ri
vat
e
addres
sesandus eNATb etweenitsint
ranetandtheg l
obalInt
ernet .

1
9.1
6Li
nux
,Wi
ndows
,AndMa
cVe
rsi
onsOfNAT

I
na ddit
ion t os ta nd-alone de vi
ce s
,s ucha s wi r e
lessr outers,s oftwa re
implementa-tionsofNAT e xi
stt hata l
low ac onv enti
ona lc omp utert op erfor m
NAT f unc t
ions.For e xa mple,Mi crosof t usest he na me I nter net Connec tion
Sharing for NAT s oft
wa ret ha
t us ersc anc onf i
gure ;a dditiona lsoftwa rei s
avail
ableforWi ndowsse rvers.S e
ver a
lv er-sionsofNATha veb e enc reate
df ort he
Linuxop erati
ngs ys
tem.I npa rti
cular,iptablesandI PMas quer adebot himp leme nt
NAT.I ng ener a
l,NATs of twarec onsis
tsofac om- bina
t ion:a pplicati
ont oolst hat
all
ow a us ert oc onfi
g ur e NAT a nd k ernels upp ortf orp ac ketr ewriting a nd
firewall
ing.Mos tNATs of twa resup p
or tsmul ti
p lev ari
a nts.Fore xample
,b ec
a use
itof fer
ss tatefulp ac
ke ti nspecton,i
i ptablesc anb ec onf i
gure dt oha n-dleb a si
c
NATorNAPT.

1
9.1
7Ov
erl
ayNe
twor
ks

Thet hemeoft hi
sc ha
p t
erisv i
rtual
izati
on:usingt echnol
ogi
est hatp r
ovide
abstractser
v i
cestoas ubsetofc omputerst hatmimi cthes er
vic
ep r
ovidedb y
dedicatedhardware.Fore xampl
e,VPN t echnolog
ya l
lowsus erstoc onnectthe i
r
comp utersto a dis
t a
ntne tworka si ft here weread irectconnecti
on.NAT
technologyal
lowsas etofc ompute
r swithp ri
vateaddress
est ocommuni c
atewi th
arbit
r a
r ydesti
nat
ionsont heIn-terneta sifeac hc omputerint hes etha da
g
lob
all
y-v
ali
dIPa
ddr
ess
.Ca
nwee
xte
nd
41
4 Ne
twor
kVi
rtua
li
zat
ion:VPNs
,NATs
,AndOv
erl
ays Cha
p.1
9

vi
rtua
li
zat
ionfurt
her?Yes.Wewillseethatiti
sp oss
ibl
et ocr
eateav i
rtual
net
workthatconnec
tsana r
bit
rar
il
ylargesetofhostsacros
sma nysi
tesand
al
l
owst hehos
tst ocommuni
caea
t siftheyalla
tta
c he
dt oas i
ng l
ehar
dwa r
e
net
work.
How mighta n ove
rla
y ne twor kb eus e
ful? Wea l
ready di scuss
ed ap rime
e
xamplewhe nwec onsi
dere
dVPNs :s
ecuri
ty.S up p
oseac o rporationha ssi
xs i
tes
a
nd wa ntstoc reateac orpor a
tei ntr
anet.The c orporation woul dliket o
g
uaranteethatcommunicationa mongs i
tesisk e
ptc onf
ident i
a l
.VPN t ec
hnology
a
ll
owst hecorpor
ationtoc onfi
g ureroutersa te ac
hs i
tet ous et heInternetin
p
lac
eofi ndi
vi
dualli
nksande ncryptdatagramst hatflowac r
os sthev i
rtualli
nks.
Ov e
rla
y networki
ng ex
tendsv irt
ual
i
zati
on intwo ways.Fir
st,ins
tead of
i
ndi
vidualli
nks,over
laytechnol
og ycanb euse
dt oc r
eateane nti
renetwork.
S
econd,inste
adofc re
ati
ngav i
rtuali
nte
rnet
,ov e
rla
yt e
chnol
ogycanbeusedt o
c
reateav i
rtuall
aye
r2ne t-work.
To unde r
stand how a n ove r
lay networ k op erates,ima g
ine our e xamp l
e
corporati
onwiths i
xs i
tes.AswithaVPN,t hec orporationconfiguresoneormor e
routersa teachs i
tet ot unnelda ta
gramst oot hers ites.Morei mp ort
ant ,the
corporati
on cani mposea na r
bitraryr outing t opol
og ya nd a r
bitraryt raffi
c
poli
cies
.Fore xample,ifthec orporati
onob servest hatv i
deot raff
ics entdirect
ly
from sit
e1t os i
te4e xperi
enceshighde l
ays,o verlayr outi
ngc anb ea rr
ang edas
ift herei sa directlink betwe e
ne ac
hp air of s i
te se x
-ceptf or 1a nd 4.
Alternat
ivel
y,ifsit
es13a reont hee astcoa stands ites46a reont hewe st
coast,thecorporati
onmi ghtarranget heov e
r l
ayne t
wor kt oemulatet hreelong-
dist
ancelinks
.Figure19.8ill
ustratesthetwop ossi
b l
er outi
ngt opol
og i
es.

4 1 4 1

5 2 5 2

6 3 6 3

(
a) (
b)

Fi
gur
e19.
8Exampl
eoftwop os
sib
let
opol
ogi
est
hatc
anb
eac
hie
vedwi
th
ov
erl
ayte
chnol
ogy.

Itisi mport
anttounde rsta
ndt hatthet opol
ogiesshownint hef i
gurea re
v
irt
ua l
,notr eal
.Inpra
ctice,therearenol i
nks.Inst
ead,a l
lsi
tesconnecttot he
I
nterneta nd usethe I
nt e
rnett o del
ive
rda tagrams.Thus ,onl
yt he ov
erlay
c
onfigura
tioninFig
ure19.8(a)canpreve
nts i
te1f rom se
ndingdata
g ra
msdi re
ctly
t
os i
te4.
S
ec.1
9.1
8 Mul
ti
pl
eSi
mul
tane
ousOv
erl
ays 41
5

1
9.1
8Mul
ti
pleS
imul
tane
ousOv
erl
ays

Thet opol
og i
esi nFi gur e19.8ma ys eems ome whatp oi
ntl
ess.Aftera l
l,ifal
l
si
tesconne cttot heg lob alInternet ,da tagra
msc anb eforwardeddirect
lyt othe
cor
re c
t de sti
-nation s ite. Howe ve r,a n organizati
on ma y ha ver e
asons for
prefer
ring one t opology ov era not her. To unde rstand, supposet hatt he
organi
zat i
onha se st
ablishedr outingp oli
-ci
esf orsubgroups.Fore xampl
e,ap oli
cy
mayr equiretha ta l
lf inanc i
altraff i
cmus tb eisolate
df romc ustomert ra
fficor
thatcomp utersint hel egalde pa
rt me nta teachs i
t emustb eonap ri
vat
ene twork
thatisisol
atedf romt heI nternet.
Thet wok eyi deasb ehindov erl
a yt echnol
og i
esa re
:

Op
era
tionwi
thi
nas
ite
S
imul
tane
ousop
era
tionofma
nyov
erl
ays

Operat
ionwithinas i
te.Althoughweha vede s
cri
bedt heov e
rlaysforwide-
a
reat opol
ogie
st hatconnects it
es,ov erl
ayt echnol
ogye xtendst o hos
tsa nd
r
outerswithi
nas i
te.Thus,itisp oss
ibl
et oc re
ateas e
parat
eov e
r l
aynetwork
t
hatconnectscomputer
sowne db yt hefinanci
aldepartmentanda notherover
lay
t
hatconnectsthecomputersownedb ythele g
aldepartment.
Si
mult aneousoper ati
on ofmanyov er
lays.Thes econdk eyide
ai n over
lay
tec
hnol-ogyi st hesimul t
aneousop e
rat
ionofmul t
ipl
eov erla
ys.Thatis
,s ever
al
overl
ayne t-wo r ksc
a nc o-ex
ist(i
.e.
,operat
ea tthes amet i
me),maki
ngitp os
sib
le
fora n or ganiza-ti
on t oc reat
e multi
plev i
rtualnetwor k
st hatonly meeta t
spe
cifi
ci nterc onne
ction p oint
s.I n our e xample,c omputersin the l e
gal
depart
me ntc anb ecomp le
telyis
ola
tedfromot h-ercomputers.
Chapter28c onti
nuesthedisc
ussi
onofv i
rtual
iza
tiona ndoverl
ayne tworks
.
Thec hapt
erc ombine
st heconce
ptsofVPNa ndov erl
ayne twork
ingp r
esentedin
thi
sc ha
pterwi t
ht heconce
ptsofc l
ass
ifi
cati
ona ndswitchi
ngdisc
ussedinCha p
ter
17.Wewi l
lseet hatther es
ultisat echnol
ogyt hatc anb eusedtoc onfi
gure
vir
tualpaths.

1
9.1
9Summa
ry

Vi
rtual
izat
ion tec
hnolog
iesa l
low us toc r
eat
ea rt
ific
ialne t
wor
ks with
desi
rabl
e p ro-pe
rti
es b y imposi
ng c ons
trai
nts on c onvent
ionalInt
ernet
communica
tion.Wee xami
nedt hr
eev i
rtual
iza
tion t
echnol
og i
es:VPN,NAT,a nd
overl
aynetworks.
Al
thoug
hap
riv
atene
twor
kgua
rant
eesc
onf
ide
nti
al
it
y,t
hec
ostc
anb
ehi
gh.
Vi
rtu-
alPr
ivat
eNet
wor
k(VPN)t
echnol
ogy of
fer
sal
owe
r-c
osta
lte
rna
tiv
eby
whic
ha nor
gan-
izat
ionca
nus ethegl
oba
lInt e
rne
tt oint
erconne
ctmulti
plesi
tes
anduseenc
rypt
iontoguara
nteetha
tinter
sitetraf
ficre
ma i
nsconfi
dent
ial
.Like
atradi
ti
ona
lpri
vatenet
work,aVPNc aneitherbecomple
telyis
ola
ted(i
nwhi ch
cas
ehost
sa r
ea s
sig
nedpri
vat
ea d-dre
sse
s)orahybri
darchi
tec
tur
etha
tal
l
ows
hos
tst
oc ommuni
catewi
thdes
tinat
ionsontheg
lob
alI
nter
net.
41
6 Ne
twor
kVi
rtua
li
zat
ion:VPNs
,NATs
,AndOv
erl
ays Cha
p.1
9

Networ k Add ressTr ansl


ati
on p rovi
dest ransparent I P-levela c
cesst ot he
glob
alIn- t
e r netf rom ahos tthatha sap ri
vatea ddress.NATi sespeci
all
yp opul
ar
withwi rel
e ssr outersus e
di n Wi-Fihots pots
.NAT t rans l
ates( i
.e.
,r ewr i
tes
)
datagramst hatt r
avelfrom ahos ta tthes i
tet ot heI nter netorb a
ckf rom the
Internettoahos ta tthes i
te.Althoughs ever
alv ari
ant sofNATe xi
st,t hemos t
populari sk nown a s Network And Por t Translati
on ( NAPT) .I na ddition to
rewriti
ng I Pa ddr es
ses,NAPT r ewritest r
ansport-levelp rot ocolportnumb ers,
whichp rovide sc omplet
eg eneral
itya ndp er
mitsa rbit
ra r
ya p p
licat
ionsr unni ngon
arbi
traryc omp utersatt hesitetoa cces
sservic
esont heI nt ernetsimultane ousl
y.
Overl
ayne t
work i
ngt e
c hnol
ogie
sall
ow anorgani
zat
iont odefi
neane twork
amongmul ti
plesi
tesa sifthes i
teswereconne
cte
db yleaseddi
gi
talci
rcui
ts.The
overl
ay de -
finesp ossi
bl
e i nter
conne
cti
ons among si
t es
. With an overl
ay,
convent
ionalrouti
ngp r
o-tocolscanbeus edtof i
ndr outesal
ongtheov erl
ay
paths
.

EXERCI
SES

1
9.1 Underwhatc i
rcumst
anc
eswillaVPN t
rans
fersub
sta
ntia
ll
y mor
epac
ketsthan
conve
n-ti
ona
lI Pwhe ns
endi
ngthesamedataac
rosstheInte
rne
t?(
Hint
:think
aboutenc
aps
ula-ti
on.
)
1
9.2 S
oftwarei
mp l
ementa
tionsofNAT t ha
ta reus
edtopr
ovidere
mot eempl
oye
es
a
cces
st oan organi
zation
si nt
ranet of
tenre
duc
ethe net
work MTU t
hatis
r
eport
edtoloca
lappl
i-cati
ons.Expl
ai
nwhy.
1
9.3 Lookupthedefi
nit
ionofc
oneasappl
i
edt
oNAT.Whe
nisaNATs
yst
emc
ons
ide
red
tobeful
lcone
?
1
9.4 NAT t
ransl
ate
sb othsourc
ea nd de
st i
nat
ion I
Pa ddres
ses
.Whi
cha
ddr
ess
esa
re
tr
ans
late
donda t
a g
ramsthata
r r
ivefromt heI
nter
ne t
?
1
9.5 Cons
idera nI CMP hostunreachabl
eme s
sag
es entt hr
o ug
ht woNAT boxestha
t
i
ntercon-ne
ctt hreeaddre
ssdoma i
ns.How manya ddresstra
nsl
ati
onswil
locc
ur?
Howma nytra
nsla
tionsofprot
oc olportnumber
swilloccur?
1
9.6 I
magi
net hatwedecidetoc reateane wI nt
ernetpara
ll
eltotheexis
tingInte
rnet
t
hatal
lo-
c a
tesa
ddressesfromt hesamea ddres
sspac
e.CanNATt e
chnologybeuse
d
t
oconnectthetwoa rbi
tra
r i
l
yl arg
eI nt
ernetsthatusethesa
mea ddresssp
ace?If
s
o,exp
lai
nhow.I fnot,explai
nwhynot .
1
9.7 I
sNATc ompl
etel
yt r
ans
par
enttoahost
?Toa ns
wertheques
tion,tr
ytofinda
s
equenc
eofp ac
ketstha
tahostca
nt r
ansmi
ttodete
rminewhetheri
tisl
ocat
ed
b
ehindaNATbox.
1
9.8 Whata r
ethea dv
ant
age
sofc
omb
ini
ngNATt
echnol
ogywi
thVPNt
echnol
ogy?The
di
sadv
antag
es?
1
9.9 Confi
gur
eNAT on aLinux s
yst
emb etwe
en apri
vateaddres
sdomai
nand t
he
Inte
rnet
.Whi
chwel
l-
knowns e
rvi
ceswor
kcorr
ect
lyandwhichdonot
?
1
9.1
0 Readaboutav ar
iantofNATc al
l
edtwi
ceNAT thatall
owscommuni
cat
iontobe
i
niti
ate
df rom ei
thersideoftheNATboxatanytime.Howdoestwi
ceNATensur
e
tha
tt rans
la-t
ionsa r
ec onsi
ste
nt?Iftwoinsta
ncesoft wi
ceNAT areusedto
i
nterc
onne
ctt
hre
ead
-dr
essdoma
ins
,ist
her
esul
tcomp
let
elyt
rans
par
entt
oal
l
hos
ts?
Ex
erc
ise
s 41
7

1
9.1
1 Dr
awadi
agr
amoft
hep
rot
ocoll
aye
ringus
edwi
tha
nov
erl
ayne
twor
k.
1
9.1
2 Over
laytec
hnol
ogyca
nbeuse
dwi t
hLaye
r2a swel
lasLayer3.De
sig
nas yst
em
tha
tus e
sanoverl
ayt
ofor
mal a
rgeEt
her
netVLANt
hati
nclude
smul
tipl
esi
tes
.
Chapt
erCont
ent
s
20.
1 Introducti
on,41 9
20.
2 TheCl i
ent-Serv
e rMode l
,420
20.
3 ATr ivi
alExample:UDPEc hoS er
ver,420
20.
4 TimeAndDa teSe r
vice
,422
20.
5 Sequentia
lAndConc urre
ntS erv
ers
,423
20.
6 ServerComp l
exity,425
20.
7 Broadcasti
ngRe quests
,426
20.
8 Cli
ent-Server Alternat
ives And Extens
ions
,
426
20.
9 Summa ry,428
20

Cl
ient
- Ser
verModel
OfInteracti
on

20.
1Int
roduc
tion

Previousc hapt ersp resentt hede tai


lsofTCP/ IPt ec
hnolog y,incl
udingt he
prot
oc ol
st hatp r
ov ideb a
sics er
vice
sa ndp rotocol
st hatroute r
sus et oprop a
gate
routi
ngi nforma -tion.Now t hatweunde rs
tandt heb asi
ct echnology,wet urnt o
theque s
tionofhowa p-p
lic
at i
onp r
og r
amsp rofitfrom thec oope r
ativ
euseoft he
TCP/IPp rotocolsandt heg l
o- b
alInternet.Whi l
ethee xamplea ppli
cati
onsar eboth
prac
t i
cala nd i nter es
ting,t hey do not f orm t he ma i
ne mp hasi
sb ec
aus e no
Inte
r neta pp
licati
o nl as
tsf oreve
r . New a ppli
ca-ti
ons a rec reat
eda nd ol d
appl
icati
onsf a de.The refore,ourf ocusr estson t he patternsofi nteracti
on
amongc ommuni catinga ppl
icati
onp rograms.
Thep rimaryp att
ernofi nteract
iona monga ppli
cati
onst ha
tus eane t
worki s
knowna sthec li
ent -s
erverparadigm.Client-s
e r
verinterac
t i
onf ormst hebasi
sof
networ kcom- muni cati
on,a ndp rovi
dest hef oundati
onf ora pp l
ic
ationservi
ces.
Vari
ous high- l
ev e
le xte
nsions tot he clie
nt-server modelha veb e
e ncreated,
i
ncludingpeer- to-peernetwor k
-inga ndma p-reduceproces
sing.De s
pitema r
keti
ng
hype,t hee xtensi
onsdonotr epl
acec l
ient-se
r ve
rinteracti
ons.I nst
ea d,t
hene w
mod e
lsme relys uggestne w wayst oorgan-izelargedist
ributeds ys
tems a tthe
l
owe stleve
l,t heyr elyonc li
ent-
serverinterac-ti
ons.

Thi
schapte
rc onsi
der
st hebas
icc
li
ent-s
eve
rmodel;lat
ercha
ptersdes
cri
beits
us
einspec
ifi
ca pp
lic
ati
ons.Volume3expa
ndsthedi
scuss
ionbyexpl
ai
ningindet
ail
howa
ppl
i
cat
ions
,suc
haswe
bse
rve
rs,us
epr
oce
sse
sandt
hre
ads
.

41
9
420 Cl
i
ent
-Se
rve
rMode
lOfI
nte
rac
tion Chap.20

20.
2TheCl
ie
nt-
Ser
verMode
l

As erverisana ppl
i
c a
tio
np rogra
mt hatoffersas ervi
ceoveranetwork.A
s
erv
era c
ceptsanincomingreque
s t
,f ormsar esponse,andret
urnstheres
ultto
t
here quest
er.Forthesimples
tservi
ces,ea c
hr e
que s
ta r
riv
esinasing
ledat
agram
a
ndt heserverre-
turnsar es
ponseina notherdatagr
am.
Ane xe
cuti
ngp r
og r
amb ec
ome sac l
i
entwheni tsendsarequesttoaser
ver
andwa it
sf orar es
ponse.Becausethec l
ie
nt-se
rvermodelisac onv
eni
entand
naturalext
en-si
onofi nte
rpr
ocesscommunicat
ionusedonas i
nglemachi
ne,i
tis
eas
yf orprogra
m- merstobui
ldp r
ogra
mst hatusethemodelt
ointerac
t.
Serv
erscanperfor
ms i
mpleorc omp
lextasks
.Forexa
mpl
e,a ti
me-of
-day
s
erv
ermer el
yreturnsthec urr
entt i
mewhe nev
erac l
i
entse
ndstheserv
era
p
acke.A we
t bser
verr ec
eivesreque
stsfrom b
rowse
rstofet
chcopi
esofwe b
p
age
s;t
hes
erv
err
etur
nst
her
eque
ste
dpa
gef
ore
achr
eque
st.
Wes aidtha tas erverisanappli
ca t
ionp r ogra
m.I nf act,as erverisar unni ng
ap-pl
ication,whi chi sus uall
yc al
l
eda p r ocess.Thea dvanta geofi mpleme nting
serve
rsa sa p
p l
icati
onp rogramsisas er
v e
rc ane xecuteona nyc omput i
ngs yste m
thatsup portsTCP/ IPc ommunicati
on.Ast hel oadonas erv
e ri ncreases
,t hes erver
canb er unonaf as
terCPU.Te c
hnologiese xi
stt hata l
lowas e rv ertob erepli
c ated
onmul t
iplep hysic
alc omputerstoinc reaser e l
i
abil
it
yorp e r
f or mance i ncomi ng
requestsa res preada mongt hecomp utersr unningt hes er
v ert oreducet hel oad.
Ifac omp utersprima rypurposeiss uppor tofap a r
t i
cul
a rs erverp rogram,t he
term serverma yb ea ppl
i
edt othec omp ut -eraswe llast ot hes e
rverp rogr a
m.
Thus,onehe arss ta
teme ntssuchas ma c
hineAi sourwe bserv er .

20.
3ATr
ivi
alExa
mpl
e:UDPEc
hoS
erv
er

Thes i
mple
stf orm ofc li
ent-s
erverint
er ac
tion usesda t
agra
m de l
iv
eryt o
c
onveyme ss
agesfrom ac l
ientt oas er
vera ndb ack.Fore xampl
e,Fi gure20.1
i
l
lust
ratesthein-tera
ctioninaUDPe choserver.AUDP e choserveriss ta
rted
f
irs
ta ndmustb erunningb eforethecli
entsendsar eque
st.Theser v
e rspeci
fi
es
t
hati twil
luset hep ortr eser
vedf ortheUDP e c
ho servi
ce,UDPp ort7.The
s
erverthenente
rsa ninfini
teloopthathasthr e
es teps
:

(
1)Wa
itf
orada
tag
ramt
oar
riv
eatt
heUDPe
chop
ort
(
2)Reve
rset hesour
ceanddest
ina
tiona ddr
ess
e s
( i
ncl
udi
ngsour
ce
anddes
tinati
onIPaddr
ess
esaswe l
lasUDPp ortnumber
s)
(
3)Re
tur
nther
esul
ti
ngda
tag
ramt
oit
sor
igi
nals
ende
r

Onceiti srunni
ng,the ser
verappl
i
cati
on prog
ram cans
up p
lythe e
cho
s
erv
ice.Atsomesit
esintheInter
net,a
na pp
li
cat
ionbecome
sacl
ientoftheUDP
e
choservi
cebyse
ndingadata
g r
am.
Oneoft
hee
xer
cis
ess
ugg
est
scons
ide
ringt
hiss
tepi
nmor
e
det
ail
.
S
ec.20.
3ATr
ivi
alEx
amp
le:UDPEc
hoS
erv
er 421

. .
r
eques
tsentt
o
.
.

. .
. wel
l
-knownpor
t .

echo
c
li
ent
s
erve
r

(
a)

.
. r
epl
ysentto .
.
. .
. c
li
ent
spor
t .

echo
c
li
ent
s
erve
r

(
b)

Fi
gur
e20.
1TheUDPe chose
rvi
cea sa ne xa
mp l
eoft hecl
ie
nt-server
model
.In(a
),thecl
ientsendsar equesttotheserv
er
sIP
addr
essa
ndUDPport
.I n(b
) ,theserve
rr e
turnsaresponse
.

Whowoul dusea nechos erv


ice?I tisnotas ervi
cet hatthea ve
rageus er
findsi n-tere
sti
ng.Howe ver,programme r
swhode si
gn,imp l
ement,me a
sure,or
mod ifyne tworkp rotocolsoftware,orne twor kma nage
rswhot estroute
sa nd
de b
ugc ommunicat
ionp robl
ems,of t
enus eechos erver
sint e
sting
.Fore xamp
le,a n
echos er v
icecanbeus edt od e
termineifitisp ossi
bl
et oreachar emotemachine.
Fur t
he rmore,ac l
ientwi l
lre-cei
veb ac
ke xactl
yt hesamed ataasitsent.Acli
e nt
canc he c
kt he datai n ar epl
yt o de ter
mine whe ther datag
ramsa reb eing
corrup tedintrans
it.
A ma jordi s
tincti
on betweenc li
entsa nds erv
ersa ris
esf rom theiruseof
prot
ocolp ortnumb e
rs.As erverusesthewe ll
-knownp ortnumb era s
soci
atedwith
theservicei tof fers
.A c li
entk nowst hataUDP e chos erv
e rwi l
lus eport7
beca
uset hes tandardsreserveport7f ort heechos er
vice.Howe ve
r,ac li
entdoes
notuseawe l
l
-k nownp ort.Instea
d,ac li
entob tai
nsa nunusedUDPp rotoc
olport
from i
tsl ocalop erati
ngs yste
m,a ndus est hep ortnumb erast hes ourceport
whensendi ngaUDPme ss
ag e
.Thec li
entwa it
sforar e
ply,andt heserverusesthe
sour
cep ortini ncomingme ssage
st osendar e-pl
yb acktot hecorrectcli
ent.
TheUDPechose
r v
iceil
lus
tra
test
woi mp
ort
antpoi
ntst
hatarege
neral
l
ytr
ue
a
boutcli
ent
-se
rverintera
ctio
n.Thefir
stconc
ernsthedi
ffe
rencebet
weent
he
l
i
fet
imeofs
erv
ersa
ndc
li
ent
s:
422 Cl
i
ent
-Se
rve
rMode
lOfI
nte
rac
tion Chap.20

Aserverst
ar t
sexecuti
onbef oreinteracti
onbeginsandc onti
nues
t
oac ceptrequest
sands endr es
pons eswithouteverterminati
ng.
Ac l
ientisany pr ogr
am t hatmakesa r eques
tand awai tsa
r
esponse;t
hec li
ent(us
ually)terminatesafterusi
ngas erver.

Thesec
ondpoi
nt,whic
hismor
ete
chni
cal
,conc
ernst
heus
eofr
ese
rve
dand
non-
res
erv
edpor
tidenti
fi
ers:

As erverwai
tsforreques
tsatawel l-
knownpor tthathasbeen
res
ervedfortheservi
ceitoff
ers.Ac l
iental
locat
esanarbi
trar
y,
unused,nonr
eser
vedportforit
sc ommunicat
ion.

I
ti simportanttor ea
lizet ha
tc li
ent-serv
eri nteracti
onr equi
resonlyoneof
thetwop orts(theoneus edb yas erver
)t ober eserved.Thei deaiscruci
altothe
over
allpara-digmb e
causeita l
l
owsmul t
ipleappli
ca ti
onso nag i
venc omput
e rto
communicatewi thas erv
ers i
multaneousl
y.Fore x a
mp l
e,s upposetwous ersare
usi
ngal arget i
meshari
ngsys tematt hes amet i
me .S upp
oset hateachus errunsa
UDPe choc l
i
e ntandt heya llsendame ssagetot hesameUDPe chos e
rver
.Wi ll
conf
usionr esul
t?No.Be c
aus ee ac
hc l
ie
ntob tainsauni quel oca
lp ortnumb er
,
ther
eisne veramb i
guit
yint heserver
srepli
es.

20.
4Ti
meAndDa
teS
erv
ice

Thee chos e
rverisex t
remelysimpl
e,andlit
tlecodeisr equi
redt oi mple
me nt
e
ithert hes e
rverorc li
ents i
de( provi
dedthatt heoper at
ings ystem offersa
r
easonablewa yt oa c
ces
st heunderlyi
ngUDP/IPprotocol
s)
.Ours econde xampl
e,a
t
imes erve
r ,ise qual
lyt ri
vi
al.Howe ve
r,thee xamples howst ha te v
e nt r
ivi
al
a
pp l
i
c at
ionsc anb e useful
,a nd the ti
me servi
cer ai
sest he que s
tion ofda ta
r
epre s
entation.
Ati
mes e
rversol
vest heprobl
em ofautomatica
ll
ys et
tingac omput
er
stime-
of-da
ycloc
k.Whe nitboot s,acomputerconta
ct sat i
me-of-da
ys er
veranduses
therepl
ytos eti
tsloca
lc lock
.Ifa ddi
ti
onalaccuracyisneeded,acomputerca
n
conta
ctatimeserv
erperiodica
ll
y.

20.
4.1Da
taRe
pre
sent
ati
onAndNe
twor
kSt
anda
rdByt
eOr
der

How shouldti
meb erepr
esente
d?Oneus e
fulrepre
sentati
onstor e
sthetime
andda t
einas i
ngl
eintegerbyg i
vi
ngac ountofsecondsafterane p
oc hdat
e.The
TCP/IPprotocol
sdefinetheepochdatetob eJanua
r y1,1900,ands toret
hetime
i
na32- bi
tin-tege
r.Ther epre
senta
tionaccommoda
t esal
ldatesforaf ewdeca
des
i
nt hef uture;byt het i
mea32- bi
tintegerisexhauste
d,mos tc omput
ersare
expe
c t
edt ohave64- bi
tin-t
egercapabi
li
ty.
Sec
.20.
4 Ti
meAndDa
teS
erv
ice
423

Simp l
ys peci
fyingt hatav al
uewi l
lbest or
e da sa32-bitintegerisi nsuffici
ent
be-causet her ep
res entati
ono finteg
ersvar i
esa mongc omputers.Mos ta pp l
icat
ion
protocolde s
ignersf oll
owt hes a
mea pproa
c ha stheTCP/ IPp r
otocols
:i nteg ersare
representedinne t
wor kstandar dbyteorder .Tha tis,beforesendingame ss
age,
thes endinga ppli
ca- ti
on t ransl
ateseachi ntegerf rom thel ocalma chine
sb yte
ordert o networ kb yte ord er
,a nd upon r eceivi
ng a me ssa
ge,t he r eceiv
ing
appli
cationt ransl
ate se ac
hi nt ege
rf rom ne t
wor kbyteor dert ot hel oc alhost
byteor der.Thus ,t woc omp uter
swi th differentin-tegerr epre
sent ationsc an
exchangei nteger
swi thouta mb i
gui
ty.
Mosta ppl
icat
ionsa l
sof oll
ow t he TCP/ IPsta
nda r
dswhe nc hoosing thei
r
standardf orne tworkb yteor der:t hey useb i
gendi an rep
r es
entation.I nb i
g
endianor der,themos ts i
gnif
icantb yteoft heintegerc omesf ir
st,f oll
owe dby
thene xtmos tsigni
fi
c antb yte,a nds oon.I tma ys eemt hatus ingane twork
standardb yteorde rintroducese xtraov er
headort hatt hec hoi
ceofb i
ge ndi
an
orderisi neff
ici
ent.Howe ver
,e xperi
enc ehasshownt hatt heoverheadi nvol
vedin
transla
tingb etweenloca lbyteor dera ndne t
workb yteor derist ri
via
lc omp ar
ed
tot heot hercost
sofme ss
agep roces
sing.Further
mor e,usingas i
ngle,we ll
-known
byteor derstandardpr eventsma nyp robl
emsa ndambigui-ti
es.

20.
4.2Ti
meS
erv
erI
nte
rac
tion

Thei nteract
ionb etwe e
nac l
ie
ntandat i
mes erveril
lustr a
te sani nter
esti
ng
t
wiston c lie
nt-serveri nte
ra c
tion.A t i
mes ervi
ceop er
at esmuc hl ikea ne c
ho
s
ervi
c e.Thes erverb eginsfirst,andwa itstob econtacted.Howe v e
r,t het i
me
p
rotocoldoe snotde fi
near e-questme s
sage.Inst
ead,thet imes erve
rus esthe
a
rri
va lofaUDPme ssagetot ri
gg e
rar espons
e.Thatis,at imes er ve
ra ssumesany
a
rri
vingUDPme s
s a
ge ,independentoft heme ss
ages i
zeorc onte nts,isar equest
f
ort hecurr e
ntt i
me .The re
for e,theserverres
pondstoe achi ncomingme s
sageby
s
endingar e pl
yt hatc ontai
nst hec ur
rentt i
mei na32- biti nteg er.Figure20.2
i
l
lust
r ate
st heinteracti
on.
Wec ansumma rize:

Sendi
nganar bi
trar
ydat agram toatimeserv
erisequival
entto
mak-ingar equestforthec urrentti
me;theser
verr es
pondsby
retur
ning a UDP mes s
age t hat c
ontai
nsthe c
urrent ti
me in
networkstandardbyteor der.

20.
5Se
que
nti
alAndConc
urr
entS
erv
ers

Theexampl
esaboveil
l
ustra
teb as
icseque
ntials
er v
ers(i
.e.
,as er
vert ha
t
p
roces
sesonere
questatat i
me).Aft
era cc
ept
ingar eques
t,as eque
nti
alserve
r
s
ends a r
epl
yb e-
fore wai
ti
ng for anot
herr e
ques
tt oa r
riv
e.The i de
a of
se
quenti
als
erve
rsr a
ise
sanim-p
ortantques
tionaboutpr
otoc
ols oft
war
e:wha t
happe
nsifasubs
equentre
que
starr
iveswhi
l
eas er
ve ri
sbusyhandli
ngapre
vious
reque
st?
424 Cl
i
ent
-Se
rve
rMode
lOfI
nte
rac
tion Chap.20

. .
ar
bit
rar
ymes
sages
ent
.
.

. .
. t
othet
imes
erv
erpor
t .

c
li
ent t
ime
app. s
erve
r

(
a)

.
. r
epl
yc ont
aini
ngthecurrent .
.
. .
. t
imesenttot hec
li
ent
sport .

c
li
ent time
app. s
erve
r

(
b)

Fi
gur
e20.
2I l
lustr
ationoft
heinterac
tionusedwit
hat i
mes
erver
.The
p
ro-tocoldoesnotde f
ine a reque
stme ss
agebe
causean
a
rb i
traryUDPdat
agra
mwi lltri
ggerarepl
y.

Forourtrivi
alexampl
es,theque st
ioni sir
rele
vant.Forserv
ers,suc
ha sa
vi
deodo wnl
oads er
ver
,i nwhic
has i
ng l
er equestcant a
keminutesorhourst o
honor,theques
tionbec
omesimport
ant .Inge ne
ral,ser
versmus
tb eengi
neere
dt o
me e
tt heexpe
ct-eddemand.Twot echnique
sc anb eusedtoaccommodatema ny
request
s:

I
ncomi
ngr
eque
stsc
anb
epl
ace
dinaque
ue
As
erv
erc
ans
ati
sfymul
ti
pl
ere
que
stsc
onc
urr
ent
ly

Requestqueui ng.I fas equenti


alserve
ri sbusyp r
ocessingar e
que s
twhe na
subs
e-quentr eque sta rri
ves,thes erve
rc annotp l
acethei ncomingr eques ti na
queue.Unf or-
t una t
ely,p acketst e
nd t oa rri
vei nb urs
ts,whi ch meanst hat
multi
pler equestsc ana rri
vei nr apidsuc c
essi
on.To ha ndleb urs
ts,p rotocol
soft
wa reisdesignedt op rovi
deaque uefore achappl
icat
ion.Be causeque ue i
ngi s
merelyintendedt oha ndl
eb urst
s ,typi
calqueues i
zesa r
ee xtr
eme lysma ll(e .
g.,
some operati
ng s ystemsl imita que ue tof iv
e orf ewere ntries
).The r efore,
queuei
ngonl ys uf fi
cesf ora ppl
icati
onswhe ret hee xpec
te dp roces
singt imei s
negl
igi
ble.
Concurrent serv
ers. To ha ndl
e mult
ipl
e simul
taneous requests
, most
p
roducti
on server
sa rec oncur
rent.A concur
rent s
erverc a
n ha ndl
e mul
tip
le
r
eques
ts a
tt he same time.
We uset he te
rm concurrent ratherthan
s
imul
taneoust oemphasi
zethatall
Sec
.20.
5 S
eque
nti
alAndConc
urr
entS
erv
ers
425

c
li
entss
haret
heunder
lyi
ngc omputati
onalandnetworkres
ource
s.Aconcurr
ent
s
erve
rcanhandl
eana rb
itr
ar i
l
yl ar
ges etofc li
ent
sa tag i
venti
me,b utthe
s
ervi
ceea
chcl
i
entre
cei
vesdegradespropor
tiona
ltothenumberofcl
i
ents
.
Tounde rst
andwhyc oncurrencyisimpor
t a
nt,imagi
newhatwouldhappen
withas equenti
als
erv
erifac l
ientreques
tsav i
deodownloa
doveranext
remely
sl
ow ne t
wor k.Noothercli
entr e
questswoul
db ehonor
ed.Withaconc
urrent
des
ign,howe ver,aser
verwillhonorot herrequest
swhileitc
onti
nue
stos e
nd
pack
e t
sov erthesl
owcon-
ne c
t i
on.

Thek
eyt
oac
onc
urr
ents
erv
erl
i
esi
ntheop
era
tings
yst
ema
bst
rac
tionofa
c
on-
cur
rentpr
oces
sandt
hea
bil
i
tyt
ocr
eat
epr
oce
sse
sdyna
mic
all
y.Fi
gur
e20.
3
g
ive
stheb
asi
cst
epsac
onc
urr
ents
erv
erf
oll
ows
.

Op
enp
ort
Theserv
erop
enst
hewe
ll
-knownp
orta
twhi
chi
tca
nbe
rea
che
d.

Wa
itforc
li
ent
Theser
verwa
itsf
ort
hene
xtc
li
entr
eque
stt
oar
riv
e.
S
tar
tcop
y
Theserverst
art
sani ndep
endent,c
onc urr
entc op
yofi t
self
to handl
et he re
que st(i.
e.,a c oncurrent proc
e s
s or
thr
ead).Thecop
yha ndl
esonereques
ta ndt henterminates
.
Cont
inue
Theor i
ginals
erverret
urnstot hewaitste
p,a
ndcont
inues
ac-ce
pting new r e
ques
ts whil
et he newlycr
eat
edc op
y
handl
est heprev
iousre
questconcur
rentl
y.

Fi
gur
e20.
3Thes t
epsaconcur
r entser
vertak
estha
tall
owt
hes
erv
ert
o
ha
n-dl
emult
iplerequest
sa tthes
ametime
.

20.
6Se
rve
rComp
lexi
ty

Thechiefadvantag
eofac onc
ur r
entserve
risthea
b i
li
tyt ohandl
er equest
s
p
rompt-l
y:ar equestthatarr
iveslaterdoesnotnee
dtowa itforr e
que s
tsthat
s
tar
tede ar
li
ert oc ompl
ete
.Thec hi
efdisa
dvanta
geiscomple
xity:ac oncurr
ent
s
erv
erismor ediff
icul
ttoconstruc
t .
I
na ddi
tiontot hec omp l
exi
tyt ha
tr esul
tsb eca
uses e
rvershandl
er eques
ts
c
on-c
ur r
e nt
ly,complex
itya l
soa ri
sesbecaus
es erve
rsmus tenforceauthor
izat
ion
a
nd protec-ti
on rul
es.Be causetheyr eads yst
emf i
les
,k ee
pl ogs,and acces
s
p
rot
ectedda ta,se
r v
era p
p l
ic
a ti
onsusual
lyne e
dt oexecutewithhighes
tp r
ivi
le
ge.
Ap r
ivi
l
egedp r
ogram mustbedes
igne
dc ar
efull
ybe
causet
heop
erati
ngs
ystem wi
ll
notrestr
ictas er
verprogramifitatte
mp tstoacc
essa
narbi
tra
ryuser
sfil
es,
acc
essana r
bitr
arydatab
a s
e,orse
nda nar-
426 Cl
i
ent
-Se
rve
rMode
lOfI
nte
rac
tion Chap.20

bitr
aryp acket.Thus,server
sc annotb l
indl
y honorr e
questsfrom ot
hers i
tes
.
Instead,e a
chs er
vert a
kesr espons
ibi
l
ityf orenforci
ngt hesystemac c
essand
protecti
onp ol
i
cies
.Fore xa
mp le
,af il
es e
r v
ermus texaminearequestanddeci
de
whe t
he rthecl
ientisau-
thorizedtoaccessthespeci
fi
edf i
le
.
Final
ly,s e
rve r
sa r
ec omp le
xt ode si
gna ndimpl
eme ntb ec
auseas ervermus t
p
ro-tectitsel
fa gainstma lf
or medr equest
sorr eque
stst hatwillcauset heserv
e r
a
ppli
cati
on t oa bort.Of ten,i tisdi ffi
culttof or
eseep otentialproblems.For
e
xamp l
e,onep rojecta tPur dueUni ve
rsit
yde si
gnedaf i
les erv
ert hata ll
owed
s
tudent op e
r a
ting s yste
ms t oa c-ces
sf il
es on a UNI Xt imeshari
ng s ys
tem.
S
tudentsdi s
coveredt hatr equesti
ngt hes erv
ert oop enaf i
lena me d/dev/t
ty
c
ausedt hes ervert oa bortb ecaus
ei n UNI Xthena mer e
ferst ot hec ontrol
t
erminalap rogrami sus i
ng.Howe ver,becauseitwaslauncheda tstartup,thefile
s
erverha d no c ontrolt erminal.The re
fore,a nattemp tt o opent he control
t
erminalcausedt heop erati
ngs ystemt oaborttheserv
e rprocess.
Wec a nsumma ri
zeourdi sc
ussi
onofs ervers
:

Serversareusuall
ymor edi
ffi
cul
ttobui l
dt hanc l
i
ent s
.Although
theyc anbeimplementedwit
happli
cati
onprograms ,server
smus t
enfor c
ealltheac ces
sandpr ot
ecti
onpolici
esoft hec omputer
system onwhicht heyrun,andmustpr ot
ec tthemselvesagai
nst
possibl
eerr
ors.

20.
7Br
oadc
ast
ingRe
que
sts

Sof a
r,a lloure xample
sofc l
ient-s
erv
eri ntera
ct i
onr equir
et hecli
entt o
knowt hecomp l
eteserveraddre
ss.Ins omecases,howev e
r,ac li
entdoesnotknow
thes e
rver
sa ddress
.Fore xamp l
e,whe nitb oots
,ac omputerc anuseDHCPt o
obtai
na na dd
re s
s,b utthe cli
entdoe snotk now the a ddres
sofa s e
rver.
Inst
ead,thec l
ientbroadca
stsitsrequest.
Thepointis:

Forpr ot
ocol
swher ethecl
ientdoesnotknow thel
ocati
onofa
server
,t he cl
ient
-ser
verparadi
gm per
mitscl
ientprogr
amsto
broadcas
tre-quests
.

20.
8Cl
ie
nt-
Ser
verAl
ter
nat
ive
sAndExt
ens
ions

Wes ai
dt hatcl
ie
nt-ser
verinte
racti
oni stheba
sisf
ora l
mostal
lInt
ernet
communi
-ca
tion.However
,t he ques
tion a
rise
s:whatvari
ati
onsar
ep os
sib
le?
Thre
eg e
neralap
-pr
oache
sa reus
ed:
Chap
ter22e
xami
nes
DHCP.
Sec
.20.
8 Cl
i
ent
-Se
rve
rAl
ter
nat
ive
sAndEx
tens
ions
427

Pr
oxyc
achi
ng
Pr
efe
tchi
ng
Pe
er-
to-
pee
rac
ces
s

Proxyc ac hing.Wes ai
dt hatt hec onventionalcli
ent-serverp a
ra di
gmr equir
es
ana ppli
cation t ob ecome a c l
i
e nt a nd c ontactas er v
e r whene ve
ri t needs
i
nf orma ti
onf r om thes erver.Howe ve r,latencyc anbeap robl
em,e s
pe ci
a l
l
yi n
caseswe ret hes erverisf a
rf romt hec li
ent.I frequestsa reli
k e
lyt ober e peat
ed,
cachingc a ni mp rovet hep er-forma nceofc l
ient-serve
ri nteracti
onb yr e
duc i
ng
l
a t
e ncya ndl owe r
ingne tworkt raffic.Fore xample,consi
de ras etofe mp loyeesin
ac orporationwi tha cc
e s
st ot heWe b.I fonee mployeefindsawe bp ageus efulor
i
nt eresti
ng ,t hee mp l
oyeei sli
kelyt op a s
st heURLt oaf ewf riendswhot henv iew
thep a
g ea ndp asstheURLt oot herf ri
ends.Thus ,ag ivenwe bp agema yb e
accessedadoze nt i
mes.Wi thac onv entionalclie
nt -s
ervera p-proach,eacha cces
s
requirest hep aget obef etchedfr omt hes erv
e r.
Toimproveper
formance
,ac orporationca ni
nstallap roxywebc ac
he.When
itre-cei
vesareques
t,thep r
oxyc achelookso nitsdiskt os eeift
her eques
ted
it
e misavai
l-
abl
e.Ifnot,theproxycont a
c t
st heappropri
atewe bser
vertoob tai
n
theitem,pla
cesacopyondisk,andr eturnsac op
yt ot hebr owse
rthatma dethe
reques
t.Be c
ausethep r
oxyc ansati
s f
ye ac
hs ubse
que ntre ques
tfrom itslocal
dis
k,thewe bser
verisonl
ycontacte
donc e .
Ofc ourse,cl
ient
smus tagreetous et hep r
oxyort hea p p
r oac
hwi llnot
work.Tha tis,eac
hus ermustconfi
gurethei
rwe bb rowse
rt oconta c
tt heproxy
forr e
que st
s( mos
twe bbrowse
r shaveas etti
ngt hatusesap roxy).Indiv
idual
s
haves trongmot i
vati
on f
orusingap roxyb ec
auset hep roxy doe snoti nje
ct
si
gni
f i
cantov e
rheadandmayimproveperfor
ma nceconsi
derably.
Otherexampl
esofc li
ent-s
erve
rc a
chi
ngexis
t.Forexampl
e,theARPprotocol
p
resent
edinCha p
te r6a ls
ofoll
owsthecli
ent
-serv
ermodel.ARPuse
sac a
c heto
a
voidrepea
tedl
yr equest
ingtheMACa ddr
essofane i
ghb
or.IfARPdidnotus ea
c
ache,net-
worktra ff
icwoulddoubl
e.
Prefetching.Alt houghi timprovesp erfor manc e
,c ac
hingdoesnotc hanget he
ess
e nc eofc li
e nt-s
er verinteracti
on i nfor ma t
ioni sfetchedonl
ywhe nt hef i
rst
cl
ientma kesar eques t.Thatis,a nappli
c a
t ione xecutesuntili
tneedsinformati
on
andt hena c
t sa sac lientt oobtainthei nfor mation.Ta k
ingade mand-
dr i
venv i
e w
oft hewor ldi snatur alanda r
isesfrom e xperi
e nce.Cachi
nghe l
psallevi
atet he
cos
tofob taining infor -
ma ti
on byl owe ring ther etri
evalcostfors ubsequent
fetche s,butdoe snotr e
ducet hecostoft hef ir
stf etch.
Howcanwel owe
rre
tri
eva
lcos
tforanini
ti
alrequest
?Theanswerliesinpre
-
fet
ching ar
rangetocol
le
ctand st
oreinfor
ma ton b
i ef
ore any part
icul
ar
progra
mr e-que
stsit.Prefet
chi
ngr educesthel a
tencyf
ortheini
tia
lr eques
t.
Mor eimp
ortant,prec
olle
cti
ng i
nfor
ma ti
on me ansthatacl
i
entc an ob
ta i
na n
answerevenifthene tworkistemporar
il
ydi s
connect
edorc
onge
s t
edwhe nt he
cl
ientmakesareque
st.
Anea
rlyUni
xprog
ram na
me drupt
imeil
l
ustr
atesthei
deaofpre
fetc
hingtha
t
i
snow usedin ma
ny da
tac ent
erma na
gementsyst
ems.The r
upti
me prog
ram
p
rov
idedt
he
428 Cl
i
ent
-Se
rve
rMode
lOfI
nte
rac
tion Chap.20

CPUl oadofa l
lc omputersont helocalnetwork.Ar upti
mec l
ie
nta lwaysope r
ated
i
n- s
tantlyb e
ca us
et heinformationwa sp refe
tchedb yab ac
kgrounda ppli
cati
on.
Eachc om-puteront hene tworkwoul dbroadcasti
tscurrentl
oadp eri
odic
a l
ly,and
theb ackg
roundp rogramsc ol
le
cteda nnouncementssentbyotherc omputers.Pre-
coll
ecti
ngp erformanceinformati
oni simp ort
antb e
causea noverl
oadedc omputer
cannotr e
spondt oar equestquic
k l
y.
Precollecti
onha st wodi sadvant a
ges.First,p re
c ol
lec
tionus esp r
ocessorand
net-workr esourceseveni fnoc li
entwi l
la c
cesst heda tab eingcollect
ed.I nour
perf
or -ma ncee xample,eachma chinemus tp arti
cipateb yb roadcasti
ngi t
ss tatus
andc ol
lectingb roadcas
tsfrom ot he rmachines.Ifonlyaf ewma chinespartic
ipate
i
nt heb roadcast,p r
ecoll
ecti
onc ostswillbeins i
gnif
icant.I nal arg edatac enter
cl
ustert ha tincl
ude shun-dr e
dsofma chines
,t heb roadcastt raf
f i
cg eneratedb y
prec
ol l
ectionc ani mposesigni
fi-cantl oadont hene twork.Thus ,p r
ecoll
ecti
oni s
usual
lyr eservedf orspeci
alc as
e swhe rethep rocessi
ngc ostandne tworkov erhe
a d
canb elimited.
Peer -to-peeraccess
.Thethi
rdvari
ati
onofcl
ie
nt -s
erverint
eract
ionisk nown
asp eer-to-peer net worki
ng (
P2P)
. P2P wa sp opula
rize
d b y fil
e s hari
ng
app
li
c at i
onst hatall
ow userstoe
xcha
ngef i
le
s,s
ucha sMP3f il
escontai
ningmus i
c
orvide os.
Thei de ab ehindt hep e
er-to-peera pproac hiss trai
ght f
orwa rd:i nste adof
havingas i
ng lese rver,a rr anget ogivema nys erversac opyofe a chfil
ea nda ll
ow
aus e rt odownl oadf rom t hene arests er
ver.Thes amei de aisus edb yCont ent
Distribut i
onNet - wor k( CDN)t echnologies
,s ucha st heonep i
one er
edb yAk ami.
Howe v er,p eer-to-p e
e rne tworkinga ddsa ni nterestingt wi s
t:i nsteadofs pecia
l
serverc omp ute rs,ap ee r-to-peersys temr el
iesonus erscomp ut e
rs.Tha ti s
,i n
excha ng ef orf il
ea cces
s ,aus era gr
e estoa ll
ow t he i
rc omp utert ob eus e dlikea
server .Whe nac li
entma kesar equest,thep eer-to- peersys te
mk nowst hes etof
userswhoha vedownl oa de dac opya nds el
ectsonet ha twillp r
ovidef astesta ccess
fort hene wr e
que st.S omep eer-to-peerf i
les yst emss tartdownl oadsf rom a
handf ulofl ocations,a ndt he nuset hedownl oadt ha tp roceedsthef as
te st.Ot her
peer- to-pe ers ystemsdi videf il
esintoc hunksa nda r r
a ngef orac hunkoft hef il
e
tob edownl oade df rom onel ocati
onwhi l
eot herc hunk sa redownl oade df rom
otherl ocations.I na nyc ase,onc eaus erha sdo wnloade da nitem( i
.e.
,ac omp lete
fil
eorac hunkoft hef ile),theus er
scomput erb ecome sap otent i
alsour ceoft he
ite
mf orot he rus erst odownl oad.

20.
9Summa
ry

Ma ny mode r
na pp l
ic
ati
ons usec omp uter networksa nd the I
nternett o
c
ommuni -c
ate.Thep ri
ma ryp a
tternofus eisk nowna sc l
i
ent-ser
verinte
raction.
Aserverprocesswait
sf orar eque
st,p er
formsa cti
onsb as
edont herequest,a nd
r
eturnsar eply.Ac l
ientp r
ogramf ormulatesar equest,sendstherequestt oa
s
erver,and awa i
tsar epl
y.S omec l
ientss end reque
stsdi re
ctl
y,whileot hers
br
oadcastrequests
;broadcasti
ngise s
pecia
llyusefulwhe nana ppl
ic
ati
ondoe snot
k
nowt
hea
ddr
essofas
erv
er.
Wee xa
mine
daf ewtrivi
ale
xamplesofc
li
ent
sa ndserv
ers
,suchasati
me-
of-
days erv
iceand a UDP e
cho ser
vic
e.The ti
me-of-da
ys er
vic
ei l
l
ust
rat
esthe
imp
or t
anceof
Sec
.20.
9 S
umma
ry
429

net
worksta
ndardbyteorde
r,a
nda
lsos
howst
hatas
erv
icedoe
snotne
edt
o
de
finear
e-que
stformat
.
Al
thought rivi
alser
vic
esuseas e
quenti
ala pproa
ch,mos tproducti
ons ervers
p
ermitconcur r
entp roc
essi
ng.Becauseitc r
ea te
sas e
pa r
atepr oc
esst oha ndle
e
achrequest,ac oncurr
entserverdoesnotr equir
eac li
entt owa i
tforp revious
r
eques
tst ob es e
rved.Concurr
encyise s
peci
allyimportantfors er
vic
es,s uc
ha s
v
ide
odo wnl
oa d,inwhichitcantakeminutesorhour stosatis
fyas i
ngl
er equest.
We consi
dereda l
ter
nativ
esa nd e
x t
e ns
ionst othe cli
ent-
serve
rp a
radi
gm,
i
ncl
udi
ngcaching,pre
fetchi
ng,a ndp
eer-to-peerint
erac
tions.Eachtechni
quecan
i
ncr
eas
ep erfor-ma
nce,de p
endingont hep atte
rnofr epeatedreques
t sandthe
t
imerequi
redt oac
cessdata.

EXERCI
SES

20.
1 Bui
ldaUDPechocli
enttha
tsendsadat
agramtoas
pec
ifi
ede
chos
erv
er,a
wai
tsa
rep
ly,a
ndcompar
esittotheori
gi
nalmes
sag
e.
20.
2 Care
ful
lycons
ide
rhow aUDPechos
erve
rformsar e
ply.Underwhatcondi
tionsi
s
ti
i ncor
recttocrea
tene
wI Pa
ddres
sesbyr
evers
ingthesourc
ea ndde
stina
tionIP
ad-
dres
ses
?
20.
3 Al
thoughmos tser
v e
rsar eimpl
ement
edb ysepa
rat
ea p
pli
cati
onprogr
ams ,anI
CMP
ec
hos erv
eri susuall
yb uil
tintotheprotoc
olsof
twareint heoper
atingsys
t e
m.
Whataret headvantage
sa nddis
adva
nta
g esofhav
ingana p
pli
cat
ionprogra
m( user
pr
ocess
)p erser
ver?

20.
4 Supposeyoudonotk nowt heIPa ddre
ssofal ocalhostc
omp ut
ert hatrunsaUDP
echoserver,b
utyouk nowt hatitresp
ondst orequest
ssenttop ort7.Isthe
rean
IPaddre s
syouc anusetor eac
ht heserve
r ?Expl
ain.
20.
5 Buil
daUDPc lie
ntf ort heInternettimes e
rvi
ce,a nddemonstr
a t
et hatitwor
ks
corr
e c
tly.
20.
6 Canas erverrunont hes a
mep hysi
calhostcomputerasac l
i
ent?Ex pl
ain.
20.
7 Conside
rada tace
nterclus
terwith200c ompute
rs.Ifeachcomp ut
erbroa
dcas
ts
i
tsc ur
rent l
oadevery5s e
condsa nd e
ach mess
agec ont
ains240 octetsof
i
nf ormati
on(pl
usass
oci
atedheader
s),how muchnetwor
kc apaci
tyisus
edb ythe
broadcas
ts?
20.
8 Whatserversarerunni
ngo ncompute
r satyoursi
te?Ifyoudonothaveacc
essto
s
ys-temc onfi
gura
tionfi
le
st hatl
isttheserv
ersstar
tedforagiv
encomputer
,s ee
i
fyours ys-t
em hasacomma ndthatprint
sal i
stofope
nTCPa ndUDPport
s( e.
g.,
theUNIXne ts
tatcommand).
20.
9 S
omeserv
ersal
l
ow amanage
rt oi
mpl
ementgr
ace
fuls
hut
downorr
est
art
.Wha
tis
t
headv
antag
eofgrac
efuls
erve
rshut
down?
20.
10 Supp
oseac onc
urre
nts e
rve
rfoll
owst
hea l
gori
thm g
ive
ninFi
gur
e20.
3(onp
age
425).Wha
tv ul
ner
abil
i
tydoess
uchaser
verexhi
bit
?
Chapt
erCont
ent
s
21
.1 Introduc t
ion,431
21
.2 VersionsOfTheS ock etAPI,432
21
.3 TheUNI XI /OPa radig mAndNe twor kI /
O,432
21
.4 AddingNe twor kI/Ot oUNIX,432
21
.5 The S ocketAb stract i
on And S ocke tOp e
rations
,
433
21
.6 Ob tainingAndS e tti
ngS ocketOp tions,438
21
.7 HowAS erve rAccept sTCPConne ctions,439
21
.8 S erversTha tHa ndleMul ti
pleSe rv
ice s
,440
21
.9 Ob tainingAndS e tti
ngTheHos tNa me ,441
21
.10 Lib
ra ryFunc ti
onsRe lat
edToS ocket s
,442
21
.11 Networ k Byt e Orde r And Conv ersion Routines
,
443
21
.12I PAddr es
sMa nipulationRoutines,444
21
.13 AccessingTheDoma inNa meS ystem,444
21
.14 ObtainingI nforma tionAb outHos ts,446
21
.15 ObtainingI nforma tionAb outNe twor ks,447
21
.16 ObtainingI nforma tionAb outPr otocols,447
21
.17 Obtaining I nforma tion AboutNe twor kS er
vices
,
447
21
.18 AnEx ampleCl ie
nt ,448
21
.19 AnEx ampleS erver,453
21
.20 Summa ry,460
21

TheSoc
ketAPI

21
.1I
ntr
oduc
tion

Earlierchap tersdi s
cus st hep r i
ncip
lesa ndc onceptsthatunde rliet heTCP/ IP
proto-cols,andt hep reviousc hapterc onsiderst hec l
ie
nt-serverp a radi
gmt hat
appli
cationsus et oc ommuni cateov e
raTCP/ IPi nter
net.Thec hap tersomi ta n
important de tail
:t hey do not s peci
fyt he e xac
ti nterfac
et ha ta p
plication
programsus et oi nt eractwi thp rotocols oft
wa re.Thisc hapterc omp l
etest he
disc
ussi
onb yc onsidera nAp plicationPr ogram Int er
face(API)t hatha sb ecomea
def actos tandar df ort heI nte r
ne t.Thec hapterde s
cribe
st heov e ral
la pp roach
taken,a ndr evi
e wse noug hoft hef unctionsint heAPIt oe xpl
aina ne x ample .We
glos
sov e rma nyde t
a il
sa ndf ocusonunde rsta
ndingt heb as
ics
;doi ngs owi llhe l
p
usa ppre c
iat
et hec odene ede df orat ri
vi
a lcl
ient-ser
vera ppl
ication.Vol ume3
expandst hedi s
c ussi
onb ys ho wingmor ede tail
sa ndlargere x
amp l
esofc l
ienta nd
serverap pl
ic
a ti
onst ha tus et heAPI .
The rearetwor easonswep ostponedt hed i
scussi
onofAPI suntilthi
sc hap t
e r
.
Firs
t,t heTCP/ I
Ps tandardsdonots pecif
yt hee xac
ti nte
rfacethata ppli
c a
t i
ons
uset oa c-
cessnetwor ks e
rvi
ces;t hede tail
sde pendon t heop erat
ings ystem.
Second,i tisimpor
-t antt odi
stinguishbet weent hef uncti
onal
it
yt hatp rot ocol
s
provi
dea ndthefunc ti
onali
tytha tisma dea vail
ablethroughas peci
fi
ci nte r
f a
c e
.
Fore xamp l
e,TCPisde si
gnedtoha ndleane xtre
mec as
ewhe retwoe ndpointse ach
tryt of orm aTCPc onnecti
onsimul-taneous l
y.Howe ver,noneoft hewi dely-used
APIse v
e rpermit
teds uchac as
e.
43
1
43
2 TheS
ock
etAPI Cha
p.21

21
.2Ve
rsi
onsOfTheS
ocke
tAPI

Wewi l
lexaminethesocketAPI,whi
chi si
nfor
ma l
l
yc al
lds
e ockets
.Thesocke
t
int
er f
a ce wasor i
gina
ll
yc reate
da sp ar
t of the BSD Unix operat
ing s
yst
em.
Versi
onsofs ocke
t sappe
ari nmor erec
entBS Dsystems,Linux,a ndMacOSX;
Microsofta dap
tedav ers
ion ofsock
etsk sWi
nown a ndowsSoc kets
f orthei
r
operatingsyste
ms.
The cha
pte rprovi
desan ov er
vie
w oft he sock
etAPIt hata pp
li
est oa l
l
sys
temsa ndshowsab a
sicexa
mp lethatfol
lowstheBS Dstyl
e.Reader
swhowa nt
furt
he rdetai
lsa ndexampl
esf oras pec
ifi
cv ers
ionoftheAPIa rerefe
rredt o
Vol
ume3oft het e
xt,whichc omesinv ersi
onsf orBS
D,Li nux
,a ndWi ndows
soc
kets.

21
.3TheUNI
XI/
OPa
radi
gmAndNe
twor
kI/
O

Dev elopedi nt helate1960sa nde a


rly1970s,t heUNIXop e
ra t
ings yst
em wa s
ori-g
inallyde s
ignedasat ime s
harings ys
temf ors i
ngleprocess
orc omput er
s.Itisa
process
- or i
entedop erati
ngs yste
mi nwhichea chappli
cati
onp rograme xecutesasa
userleve lp rocess
.Ana p
p l
i
ca t
ionp r
ograminte r
actswitht heop erati
ngs yste
mb y
ma kngs
i ys temc all
s.Fromt hep rog ra
mme r
sp oi
ntofv iew,as ystemc alll
ooksa nd
behavese x actlylikeotherf unctionc al
ls.As ystemc al
lca nt a
kea r
gume ntsa nd
canr eturnoneormor er es
ults.Ar gumentsca nbeda tavalues(e .
g.,integers
)or
pointer
st oob jec
tsi nthea ppl
i
ca ti
onp rogr
a m( e.g.
,ab uf fert ob ef i
ll
edwi th
characters )
.
Derive
df romt hoseinMultic
sa nde arli
ersys tems,t heUNI Xinputa ndout put
(I/
O)p rimiti
vesf ol
low ap aradi
gms ome ti
me sr efe r
r e
dt oa sop en-cl
ose-read-
write.Be-forea nap p
li
cati
onc anp er
for mI /Oop erations,itc asop
l
l ent os pec
ify
thef il
eorde vic
et ob eused.Thec allto op en re t
ur nsas mallintegerf il
e
descri
ptort hatt hea ppl
ic
ation usest op er
f ormI /O operati
ons.Onc ei tha s
openedaf il
e( orde vi
ce),ana ppli
cation in-vokesr ead orwr ite operat
ionst o
transfe
rda t
a.A c a l
lha sargumentst hats pe c
ifyt he de sc
riptort o use,t he
addressofab uffer,a ndthenumb erofb yt
e st ot ransfer.Af te
ra l
ltransfer
operati
onsa rec omp l
ete,theus erp rocessc alsc
l loset oi nformt heop er
ating
systemt ha
ti thasfinis
hedusingthef il
eorde vice.

21
.4Addi
ngNe
twor
kI/
OtoUNI
X

Theg roupa ddingne t


wor kpr otocol
st oBS DUNI Xma det wode s
ignde ci
si
ons.
Thef ir
stde si
gnde cisi
ona rosefrom t her ic
hf uncti
ona li
tyofne twor kprotocols
.
Be-cause networ kp rotocols of
f er ma ny mor ep os s
ibi
li
tiest hanc onventi
onal
devic
esa ndf i
les
,i nteract
ionb etwee na ppli
cat
ionsa ndne twor kp rotocol
sne eded
tos pecify new f uncti
ons. For e x
a mp l
e,a p r
ot ocoli nterface mus ta llow
programme rstoc re ateboths erverc ode( thata wa i
tsc onne c
tionsp ass
ivel
y)a s
we l
lasc l
ientcode( t
hatf ormsc on-nectionsactiv
ely).I na ddit
ion,a na p
plic
ation
programt hatsendsada tagram ma ywi sht ospeci
fyt hede stinati
ona ddressalong
wi
theac
hda t
agra
mi ns
teadofbindi
ngthedes
ti-
nati
ona
ddr
esst
othes
ock
et.To
ha
ndl
eallc
ases
,thedesi
gner
schosetoa
b a
ndonthe

Prog
ramme
rsoft
enuset hetem WI
r NSOCKtore
fert
oWindowsS
ock
e t
s.
Theterm
fil
edes
cri
ptor
a r
ise
sbec
auseinUNI
Xdevi
cesa
remapp
edintothef
il
esys
tem.
S
ec.21
.4 Addi
ngNe
twor
kI/
OtoUNI
X 433

tra
diti
ona lUNIXopen-
clos
e-r
ead-
writ
epa
r a
dig
mandaddsev
e r
alnewsyst
emc al
l
s.
Thede s
igni nc
reas
edt hecompl
exi
tyoftheI/Oi
nte
rfac
es ubs
tant
ial
l
y,b utwas
neces
-sary.

Thes e
condd esig
nde cisi
ona roseb ecaus
ema nyp rotocol
se x i
st e
d,a nditwa s
notob vi
oust hatTCP/ I
Pwoul db esos ucces
sful.The refore,de si
g nersa ttempted
tob uil
dag e neralme chanismt oa ccommoda tea l
lp rotoc
ols.Fore xamp l
e,t he
general
ityma k esitp ossi
blef ort heop erati
ngs yste
mt oi ncludes oftwaref or
otherprotocols uit
esa swe l
lasTCP/ IPa ndtoa l
lowa na ppl
icati
onp rogra mtous e
one ormor e oft he protocols ui
tesa ta g i
vent i
me .Asa c ons equence,a n
appl
icat
ionp rogr a
mc a
nnotme relysupplyab i
naryv al
uea nde x
p ectt hep rotocol
s
tointerprett hev al
uea sa nIPa ddress.Inste
ad,a nap pl
i-
cationmus ts peci
fyt he
typeoft hea ddress(i.
e.,t hea ddres
sf amil
y)e xp l
ici
tly.Theg ene r
a l
ityha spa i
d
offf orIPv 6 i nste
adofr edesi
gni
ngt hesock eti nterf
ace ,e ngineer sme r
e l
y
neededtoa ddop ti
onsforI Pv6a ddres
ses.

21
.5TheS
ocke
tAb
str
act
ionAndS
ocke
tOp
era
tions

Thebasi
sf orne tworkI/Oint hes
ocketAPIc enter
so na noperati
ngs yst
em
abst
racti
on known a st he s
ocket.Wet hi
nkofas ocketa same c
hanis
mt hat
provi
desa na p p
lic
ation with a desc
ript
or thatc a
nb e usedf or net work
communicati
on.S oc
ke tsaredynamic ana p
pli
cati
onp rogramrequestsas ocket
whenonei sneededa ndr e
lea
sesthesoc
ketwhe nithasf i
nis
hedperformingI/O.
S
oc ke
tsdosha
reonet hi
ngwi thotherI/O as
ock
etisgivenadescr
iptor
jus
tlikeanopenfi
le.Inmos tsyste
ms,as i
ngl
ese
tofdes
cri
ptor
sa r
eused.Thus,
des
cri
pt or
s5a nd7mi g htcor
r e
spondtoa nopenfi
l
e,andde s
cri
ptor6mi ght
cor
respondtoasoc
ke tforaTCPc onnec
t i
on.

21
.5.
1Cr
eat
ingAS
ocke
t

Thes
ocketfunct
ioncre
ate
sas oc
ketondemand.Thef
unc
tiont
ake
sthr
ee
i
nte
gerar
gument
sa ndret
urnsani
nteg
erdes
cri
ptor
:

de
scr
ipt
or=s
ock
et(
pfa
m,t
ype
,pr
otoc
ol)

Argumentpfam s
p e
cifi
est heprotoc
olfami
lyt
ob eusedwi
ththesocke
t(i
.e.
,it
sp
ec i
fi
eshow tointer
preta ddr
esses
).Themos
timpor
tantfa
mil
ie
sa r
eI Pv
ersi
on
4(PF_INET)andIPv ers
ion6( PF_I
NET6).
Argumentt ypespe
cifi
esthetypeofc ommunicati
ondesi
red.Poss
ibl
etypesin-
cl
udear e
li
ablestrea
mde li
veryse
rvic
e( SOCK_STREAM),aconnecti
onl
essdat
agr a
m
del
iv
e r
ys ervi
ce( SOCK_DGRAM),a nd a r aw t ype(SOCK_RAW) t hatallows
pr
ivi
legedp r
ogramst oacces
sspec
ialprotocol
sorne t
workinterf
aces
.
Be
caus
easi
ngl
epr
otocolf
amil
ycanha
vemulti
pl
eprot
ocolst
hatprov
idethe
s
amet
ypeofc
ommuni
cat
ion,thesoc
ketc
allha
sat hi
rdargumentt
hatc a
nb e
us
edt
ose
lec
ta

Upp
erc a
sete
rmsus
edthr
oughoutt
hee
xamp
lesa
ret
hena
mesofs
ymb
oli
ccons
tant
stha
t
p
rog
r a
mme r
susewi
tht
hes
ock
etAPI
.
43
4 TheS
ock
etAPI Cha
p.21

s
peci
fi
cprot
ocol
;ifthepr
otoc
olfamil
yonlycont
ainsoneprot
ocolofagi
vent
ype
(
e.g
.,onlyTCPsuppli
esaSOCK_STREAM s
ervi
cef orIPv
4a ndI Pv
6),t
hethi
rd
a
rgumentca
nb esetto0.

21
.5.
2Soc
ketI
nhe
rit
anc
eAndTe
rmi
nat
ion

InUNI Xsystems,thef or
kandexecs ys
temc a
llsareus
edt ocr
eat
eap roces
s
run-ningas peci
fi
ca ppl
ica
tionp rog
ram.I nmo s
ts yste
ms,whenane wp roces
sis
crea
t e
d, t he newlyc reat
e dp roc
essinherit
sa c c
esstoa llopensock e
ts.A
concurrentserve
rus essocketinheri
tanc
et ocreat
eane wproce
sstohandleeach
newc l
ient.
Botht heolda ndthene wproce
ssshareacce
ssright
st oe xi
sti
ngdescr
ipt
or s
.
Therefore,b othc ana cces
sthe socketfor a givenc li
ent.Thus,iti st he
res
pons i
bi
li
tyoft hep rogra
mmert oensuretha
tt hetwop roces
sesusetheshared
soc
ke tme a
ningful
ly.
Whe nap roce
ssf i
nis
hesusi
ngas oc
k e
titcal
lscl
ose.Closehastheform:

c
los
e(de
scr
ipt
or)

whereargumentd es
cri
ptorspeci
fie
st hede s
cri
ptorofas ocke
tt ocl
ose.Whe
na
proce
sstermi
natesforanyr eas
on,thes ys
temc l
osesa
lls
oc k
etsthatr
ema i
nopen.
Inte
rnal
ly,ac al
lt oc l
ose decr
ementst her ef
e r
enc
ec ountf oras ock
etand
dest
roysthesoc
ketifthec ountreacheszero.

21
.5.
3Sp
eci
fyi
ngALoc
alAddr
ess

Ini
tial
ly,as ocke
tisc reate
dwi t
houta nya ss
oci
ationtol ocalorde sti
nati
on
ad-dres
ses.Fort heTCP/ IPp r
otocols
,t hi
sme anst hatane wsoc k
etdoe snotb egi
n
withlo-calorr e
mot eIPa ddres
sesorp r
otocolp ortnumb er
s.Cl i
entp rogramsdo
notc ar
ea b outt helocaladdres
st heyus e,a nda rewilli
ngtoa ll
ow t hep r
otocol
softwaretof i
lli
nt hecomp uter
sI Paddressa ndchooseap ortnumb er .However,
serverproce s
sest hatoperateatawe l
l-
knownp ortmus tb ea bl
et os peci
fythe
portt ot hes ystem.Onc eas ocketha sb eenc reate
d,as erverus est he bi
nd
functi
ont oe stabli
shalocaladdressforthes ocket.Bindhast hef ol
l
owi ngform:

b
ind(
des
cri
ptor
,loc
ala
ddr
,addr
len)

Ar g
ume nt descri
ptor ist he intege
r de s
cri
ptor of the sockett ob eb ound.
Ar g
ume ntlo-cal
addri sas tr
ucturet ha tspeci
fi
esthelocalendpointt owhicht he
sockets houldbeb ound,a nda rgume nta ddrl
en i
sa ninteg
e rt hats pe
cifi
est he
l
e ngthoft hes t
ruc tur
eme asuredinb ytes
.Instea
dofg iv
ingt hee ndpoi
ntme rely
asas equenceofb ytes,thede s
ignersc hoset odefi
neas t r
uct ure.Figur
e21 .
1
i
llustr
at esthesockaddr_instr
uctureus e
df orIPv4endpoi
nts.
I
fa cl
i
entdoesnotcalb
l i
nd,the op
era
ting s
yst
ema
ssi
gnsa p
ortnumb
era
utoma
tic
all
y;
t
ypi
cal
l
y,p
ortnumb
ersa
reas
sig
nedse
quent
ial
l
y.
S
ec.21
.5TheS
ock
etAb
str
act
ionAndS
ock
etOp
era
tions 435

0 1
6 31
ADDRES
SFAMI
LY(
2) PROTOCOLPORT
I
Pv4ADDRES
S

Fi
gur
e21
.1Thes
ockaddr
_instruc
tureusedwhe
npa
ssi
nga
nIPv
4
e
ndp
ointtoas oc
ketfunct
ion.

Thes tructureb e g
inswitha1 6-bitADDRES SFAMI LYfiel
dt hatidenti
fi
est he
pro-tocolsuitet owhi chtheaddr essb e
longs;eac hprot
ocolfa mil
yde fi
nest he
l
ayouto ft her emainderoft hest r
uc ture.Thev alue2 i
nt heADDRES SFAMI LY
fi
eldindicatestha tt hestruc
tureisus edf orIPv4,a ndtheref
or e,theremainder
oft hes tructurec onsist
sofa1 6-b i
tp rotoc
olp ortnumb eranda32- b
itI Pv4
address.Whe np asseda sa nargume nt,thes truc
t uremustb ec asttoag e
ne ri
c
structur,s
e ockaddr.
ForIPv
6a ddr
ess
es,a na ppl
icati
onma yneedtosuppl
ytwoa ddi
tionalp
ieces
ofin-for
mation:anidentif
ierf ora nIPv
6f l
ow orthesc
opeofa naddress(e
. g
.,
l
ink-l
ocal
,si
te -
loca
l,orglobal)
.Fi g
ure21.2il
lus
trat
esthesoc
kaddr_i
n6s t
ructure
use
dt orepresentanIPv6e ndpoint.

0 1
6 31
FAMI
LY PROTOCOLPORT
I
Pv6FLOW I
NFORMATI
ON

I
Pv6ADDRES
S

S
COPEI
D

Fi
gur
e21
.2Thes
ockaddr
_in6str
uct
ureus
edwhe
npa
ssi
nga
nIPv
6endp
oint
toasoc
ketfuncti
on.

Althoughi tisp oss


iblet ospec i
fya rbi
trar
yv a
luesintheaddres
ss truct
ure
whenc al
-lng b
i ind,notal lp os
sib
leb indi
ngsa reval
i
d.Fore xa
mp l
e,t hec al
l
er
mightr equestal ocalprotocolportt ha
ti salr
eadyinusebyanothe
rp rogram,or
i
tmi g htr equesta nin- v
a l
i
dI Pa ddre
s s
.I nsuchcases
,the bi
nd cal
lf a
ilsand
re
tur nsa ne r
rorc ode.
43
6 TheS
ock
etAPI Cha
p.21

21
.5.
4Conne
cti
ngAS
ocke
tToADe
sti
nat
ionEndp
oint

Ini
tiall
y,as ocketi screate
di nt heunconnectedstat
e,whi chme anst hatt he
soc
keti snota ssociat
edwi t
ha nyr emotede s
tinat
ion.Thef unctonc
i onnec tbinds
ap e
r manentr emot ee ndpoi
ntt oas ocke
t,p l
aci
ngi tinthec onnecteds tate.An
appl
icati
on p r
ogram mus tc alc
l onnectt oestabl
ishac onnecti
on b eforei tc an
tra
nsf e
rda tat hroughar eli
abl
es treams oc
ket.Socketsusedwi thc onnectionl
ess
datagrams ervi
cesdonotne edt ob econnectedbeforetheya r
eus ed,b utdoings o
makesitp ossi
bletot ransferdatawi thoutspeci
fyi
ngt hedesti
natione achtime .
Thec onnectf unctionhasthef orm:

c
onne
ct(
des
cri
ptor
,de
sta
ddr
,addr
len)

Argumentdesc
r i
ptoristheinteg
erdesc
rip
toroft hesoc
k e
ttoconnect .Arg
ume nt
des
t -
addrisas ocketaddres
ss t
ruct
uretha ts
pecif
iesthedes
tinati
ona ddres
st o
whichthesockets houl
db ebound.Arg
ume ntaddrl
enspeci
fi
est helengthoft he
des
t i
nati
onad-dressmeasuredi
nb yt
es.
Thesemant
icsofc onnectdependont heunde rl
yingp rot
ocol
.Select
ingt he
rel
i
a bl
es tr
eam del
iverys e
rv i
cei nt he PF_
INET or PF_ INET6 famil
i
e sme ans
choosi
ngTCP.Insuc hcas
es,c onnec
tbui l
dsaTCPc onnecti
onwi ththedesti
nation
andr et
urnsanerrorifitc annot.Int hecaseofc onnec
tionle
ssserv
ice,connect
doesnothi
ngmoret hanstoret hedest
inati
onendpointloc
ally.

21
.5.
5Se
ndi
ngDa
taThr
oughAS
ocke
t

Onceana ppl
ica
tionp r
ogram hasest
a bl
ishe
das oc ke
t,i
tcanus ethes ocke
tt o
t
rans
mitda ta.The r
ea r
ef iv
ep ossi
bl
ef uncti
onsf rom whi
cht oc hoose:send,
s
endto,sendmsg,wr it
e,and wr it
ev.S end,wr it
e,and wr i
tev only workwi th
c
onnectedsock
e t
sb ecausetheydonota llow thec al
lert
osp e
cifyade sti
nation
a
ddress
.Thedi ff
erencesb e
tweent hethre earemi nor.Acal
ltos endt a
k e
sf our
a
rguments:

s
end(
des
cri
ptor
,buf
fer
,le
ngt
h,f
lag
s)

Ar g
ume ntde scri
ptorisa ni nt egers ocketde scri
pt or,a rgume ntb uf ferc ontains
thea d- dressoft heda t
at ob es ent ,a rg
ume ntl engt hs pecif
iest henumb erof
bytest os end,a nda rgume ntf lagscont rol
st het ransmi s
sion.Onev a l
uef orf lags
all
owst hes endert ospeci
f yt hatt heda tas houldb es entout -
of -
ba nd( e
.g .,TCP
ur g
entda ta).Ac al
lt os endbl ocksunt i
lt heda tac anb et r
ansfer red( e .g.
,i t
blocksifi nternalsystemb uff ersfort hes ocketa ref ull
).Anot he rva l
uef orf lags
all
owst hec a l
le
rt oreque stt hatt heme ssageb es e ntwi t
houtus ingt hel ocal
forwa rding t ab
le.The i nt ention ist oa ll
ow t he c al
lert ot akec ontr olof
forwa rding,ma kingitp ossib
let owr itene tworkde buggings oftwar e.Ofc ourse,
nota lls ock
e tssup p
orta l
lr eque stsfr om arbitr
a r
yp rograms .S omer eque stsr e-
quireap r
og ram t o hav es pe ci
alp r i
vi
leges; otherr eq uestsa res i
mp ly not
support edona llsocke
t s
.Li kemos ts ystemc all
s,s endr e turnsa ne rr orc odet o
t
hea pp
lic
ati
on c
all
i
ng i
t,a
ll
owi
ng t
hep
rog
ramme
rtok
now i
ftheop
era
tion
s
ucc
eeded.
S
ec.21
.5 TheS
ock
etAb
str
act
ionAndS
ock
etOp
era
tions 437

21
.5.
6Re
cei
vi
ngDa
taThr
oughAS
ocke
t

Anal
ogoustothef i
vediffe
rentout putoperati
ons,thesoc
ketAPIoffer
sf ive
func-ti
onsthatap r
ocesscanus et orecei
ved at
at hr
oug hasock
et:read,readv,
recv
,r ecv
from,andrecvmsg.Thei nputoperat
ionsrecvandreadcanonlybeus e
d
whent hesocke
tisconnect
e .Re
d cvhasthef orm:

r
ecv
(de
scr
ipt
or,b
uff
er,l
eng
th,f
lag
s)

Argument descriptor speci


fi
e sas ocke
tde scr
iptorf rom which datas houldbe
rec
e i
ved.Ar gume nt buffer s p
e c
ifie
st he addressin me moryi nto whi c
ht he
messageshouldb ep l
aced,a rgume ntlengthspecif
iest helengthoft heb uffe
r
are
a ,anda rg
ume ntflagsal-lowst hec a
ll
ertoc ontrolthere c
eption.Amongt he
pos
sibl
ev a
luesf ort heflagsar gu-mentisonet hatall
owst hecall
ert olooka he
ad
bye xtra
cting a c opy of t he ne xtincom-i
ng me ssa
g e wi
thout r e
mov i
ng the
messagefromt hes ocket.
Toformare
ply,aUDPse
rvernee
dstoobtainmorethant hecontentsofthe
UDPpayl
oad i
tmus tal
soobtai
nt hesend
e r
sI Padd
ressa ndp r
ot ocolp
ort
numbe
r.Todos
o,ituse
sthesoc
ketfunct
ionrecvf
rom.Ac a
llhasthefor m:

r
ecv
from(
des
cri
ptor
,buf
fer
,le
ngt
h,f
lag
s,f
roma
ddr
,fr
oml
en)

Thet woa dditi


onalarg
ume nts,fromaddrandf roml
en,arep oi
nt er
st oasoc k
et
addresss t
r uctureand ani nteg
er .Theop erati
ng syst
emr e c
ordst hesenders
endpoint i
nf orma-ti
on inl oc
aton f
i romaddr and the l
ength of t he e
ndp oi
nt
i
nf or
ma ti
oni nl oc
atonf
i r
om- l
en.Whens e
ndingar ep
ly,aUDPs e r
verc anpassthe
endpoint i nformati
on t o f unction sendto. Thus, f or
mi ng a r eply i s
strai
ghtforwa rd.

21
.5.
7Ob
tai
ningLoc
alAndRe
mot
eSoc
ketEndp
ointI
nfor
mat
ion

Wes aidt hatne wlyc reatedp r


ocessesinheri
tt hes e
tofop e ns ocketsfrom
thep ro-cesst hatc r
eat e
dt hem.S ome ti
me s
,ane wlyc rea
te dp rocessne edsto
extractt her e motee ndpointaddressf r
om as ockett hathasb e eni nherit
ed.In
additi
on,b ec
a uset heop erat-i
ngs yst
e mf il
lsint hel ocale ndpointi nformati
on
automa ti
call
y,ap r
ocessma yne edtode terminet hel oc
alendp oi
nta ddr esstha
tis
usedf oras oc ke
t.Twof uncti
onsp rovi
des uchinf ormaton:g
i etpeername and
getsockname ( de s
pitet hef uncti
on name s,b oth ha n-
dlewha twet hinkofa s
endpointa ddres s
es,notdoma i
nna mes)
.
Aproce
sscal
lsget
peernamet odeter
minetheendpoi
ntofap e
er(
i.
e.,t
he
r
emotea
p p
li
cat
iontowhichas oc
ketconnec
ts)
.Thec
a l
lhasthef
orm:

g
etp
eer
name
(de
scr
ipt
or,d
est
addr
,addr
len)

Ar
g ntde
ume scr
ipt
ors
pec
ifi
est
hes
ock
etf
orwhi
cht
hede
sti
nat
ione
ndp
ointi
s
des
ire
d.Arg umentdestaddrisapoi
ntertoastr
uc t
ureoft ypes
ockaddr(s
ee
Fi
gures 21
.1a nd 21.
2) t ha
t wi
l
lr ec
eiv
ethe endpoi
nt i
nfor
mat
ion.Fina
ll
y,
ar
gume ntaddrl
enisapointer
43
8 TheS
ock
etAPI Cha
p.21

toani
ntege
rt ha
twi l
lre
cei
vethele
ngt
hoft
hee
ndp
oints
truc
tur
e.Ge
tpeer
name
onl
ywork
swi t
hc onne
cteds
ock
e t
s.
Func
tiong
ets
ocknamer
etur
nst
hel
oca
lendp
ointa
ssoc
iat
edwi
thas
ock
et.A
c
allhasthefor
m:
g
ets
ock
name
(de
scr
ipt
or,l
oca
laddr
,add
rle
n)

Asexpect
ed,a rg
ume ntdescript
orspe ci
fiest
hes ocke
tforwhi
chthelocalendp
oint
i
sde s
ire
d.Ar gume ntloc
aladdrisap oi
ntertoas tr
uct
ureoftypesockaddrthat
wil
lcon-tai
nt hee ndpoi
nt,a ndar
g ume ntaddrl
eni sapoi
nte
rtoa nintegerthat
wil
lcontai
nt helengthoft heendpoints t
ructur
e .

21
.6Ob
tai
ningAndS
ett
ingS
ocke
tOp
tions

Ina ddi
tiont obindi
ngas oc kett oal ocalendpointorc onnectingi ttoa
desti
na ti
one ndp oint
,t hene eda ri
sesf orame c
hanismt hatp ermitsa ppli
cati
on
programst oc ontrolthes ocket.Fore x ample,whe nus i
ngp rotocolst hatemp l
oy
timeouta ndr etrans
mi s
sion,thea ppl
ic
at i
onp rogram ma ywa ntt oob tai
nors et
thet i
me outp a r
a meters
.Thea ppli
ca-ti
onma ya ls
owa ntt oc ontrolthea ll
ocati
on
ofb uf f
ers pa ce,determineift hes ocketa l-
lowst ransmis
sionofb roadcast,or
controlp roce
s si
ngofout -of-
b a
ndda ta.Ra t
he rthana ddne wf unc t
ionsf oreach
newc ontrolop erati
on,t hede si
g nersde c
idedt ob uil
das i
n- gl
eme chani
sm.The
me c
ha ni
smha st woop er
ations:get s
ockoptands et
sockopt.
Functong
i etsockoptal l
owst hea ppl
ic
a t
iontorequestinformationa b
outthe
soc
ke t
.Ac al
l
ers p e
c i
fiest hes ocket
,t heop t
ionofinterest
,a ndal ocati
onat
whicht ostoret her eque s
t e
di nformati
on.Theope ra
tings yste
me xaminesi
ts
i
nternaldatast r
uc t
ur esf ort hesocket
,a ndpass
esther equest
edi nformati
onto
thecall
er.Thec al
lha st hef orm:

g
ets
ock
opt
(de
scr
ipt
or,l
eve
l,op
tioni
d,op
tionv
al,l
eng
th)

Argument de scr
iptor speci
fi
e st he socketf or whi
chi nformation is needed
.
Argumentl eveli
dentifi
eswhe thert heope r
ationa p
pli
estot hesocke tit
selforto
theunde r
lyingprotocolsbei
ngus ed.Argume ntop ti
oni
dspecifi
esas ingl
eop ti
onto
whichther equesta p
pli
e s
.Thep a
irofa r
g ume ntsopti
onv
alandl engths pe
cifytwo
point
ers.Thef irs
tg ive
st hea ddres
sofab uff e
rintowhicht hesystemp lace
sthe
request
edv al
ue,andt hes econdg ive
st hea ddressofani ntegerint owhichthe
syste
mp lacesthelengthoft heop tionvalue.
Functon s
i et
sockoptall
owsa nappli
cation pr
ogra
mt os
etas oc
ke topt
ion
us
ingt hesetofv al
uesobtaine
dwithgetsockopt.Thecal
le
rspec
ifi
esas ock
etfor
whic
ht heop-
tionshouldb eset,t
heop ti
ont ob echang
ed,andav al
uef orthe
opt
ion.Thec a
lltoset-soc
kopthastheform:
s
ets
ock
opt
(de
scr
ipt
or,l
eve
l,op
tioni
d,op
tionv
al,l
eng
th)
Se
c.21
.6 Ob
tai
ningAndS
ett
ingS
ock
etOp
tions
439

wherethe a r
g umentsar eli
ket hosef or getsoc
kopt,e xceptt hatthe length
arg
umenti sani ntegerthats pe
cif
iest henumb erofb ytesi
nt heopti
onb eing
pas
sedtot hes ys
tem.Thec all
ermus tsup p
lyal egalval
uef ortheop t
iona swe l
l
asacorrectlengthforthatv al
ue.Ofc ourse,nota l
loptionsapp
lyt oallsockets
.
Thecor
r e
ctnessands e
ma nti
csofindivi
-dualrequest
sde pendont hecurrentstate
ofthesocketandt heunderl
yingprotocolsbe-i
nguse d.

21
.6.
1Sp
eci
fyi
ngAQue
ueLe
ngt
hForAS
erv
er

Wes a
idt hattheoperat
ingsyste
m ma i
ntai
nsaqueueofincomingrequest
s.A
queuei se s
pec i
all
yimport
antf orsequenti
alser
ver
s,b utmaya l
sob eneededto
handlepa cke
tb urs
tsforconcurre
nts erv
ers.Oneoft heop
tionsthata pp
li
esto
socket
si suseds ofre
quentl
yt hatas e
p a
ratefunc
tionhasbeende di
cat
edt oit
:
sett
ingt heque uelengt
h.
Socketfuncton l
i i
sten all
owss erverstop r
epareas ocketf or incomi
ng
c
onnecti
ons.Intermsoft heunde rl
yingprotocol
s,lis
ten putsthes oc ke
ti na
p
assi
vemoder ea
dyt oa ccep
tc onnect
ions.Onl
ys erve
rsusel i
sten.Ina dditi
onto
p
lac
ingap rot
ocolinp a
s s
ivemode ,li
stencontai
nsa na rg
ume ntt ha
tc onfi
gure
s
t
hes i
zeofaqueuef orincomingre-quest
s.Aca l
lhasthefor m:

l
i
ste
n(de
scr
ipt
or,ql
eng
th)

Argumentde scr
iptorgivest hede s
c ri
ptorofas ockett hatshoul
db ep re
paredfor
usebyas erve
r,a nda rg
ume ntqlengths pe
cifi
esthel engthoft her e
questqueue
forthats ocket.Aftert hec all
,t hesystem willenqueueupt oqlengthreques
ts
forconnecti
ons.I ftheque uei sfullwhe nar e
questa r
r i
ves,theoperati
ngsystem
wil
lrefusethec onnecti
onb ydi scardi
ngt herequest.Li
s t
enappliesonlytosock
ets
thathaves e
lectedreli
abl
es tr e
amde l
iver
ys er
vice.

21
.7HowAS
erv
erAc
cep
tsTCPConne
cti
ons

Asweha veseen,as e r
verproce
ssusesthef unctionss oc
ket,bind,andl i
sten
toc rea
teas ocket
,b i
ndi ttoawe ll
-knownp rotocolp ort,ands peci
fyaque ue
l
eng t
hf orconnect
ionr equest
s.Notet hatthec al
lt ob indassoci
atest hesocket
withawe l
l-k
nown p rotocolpor
t ,butt ha
tt hes ock eti snotc onnectedt oa
sp
ec i
fi
cr emoted est
ination.Inf act,the remot e destinat
ion musts p
eci
fya
wil
dcard,al
lowingthes ockettor ec
eivecon-necti
onr equest
sf r
om a na rbi
trary
cl
ient.
Onceas oc
ket hasbee
ne s
tabl
i
shed, t
he s e
rver needs t
o waitf or a
connect
ion.Todoso,thes
ervercal
l
sfunctona
i c
cept.Acal oa
lt cc
eptbl
ock
sunt i
l
ane wconnect
ionreque
sta
rri
ves.Thecal
lhastheform:

ne
wsoc
k=a
cce
pt(
des
cri
ptor
,addr
,addr
len)
Arg
ume ntdesc
ript
ors p
eci
fi
esthedes
cri
ptorofthesocketon whi
cht owa i
t.
Arg
ume ntaddrisap oi
ntertoastr
uctureoftypes
ockaddr
,anda ddr
len i
sa
poi
nte
rt oaninteger
.
440 TheS
ock
etAPI Cha
p.21

Whe nar eque sta rr


ives,thes ystemf i
ll
si na r
gume nta ddrwi tht hee ndpoi
nt
inf
ormat i
onoft hec l
ie
ntt hatma det her e
quest,ands etsaddrlent othel eng
th
ofthee ndp oints t
ruc-ture.Final
l
y,t hesystemc re
at e
sane ws ocketthatha sits
desti
nati
on c onnectedt ot he requesti
ng cli
ent,a nd returnst he news ocke
t
descr
ipt
or t ot he call
er. The origi
nals ock-e
ts ti
llha s a wi l
dcardr emote
desti
nati
on,a ndi tstil
lr e
ma i
nsop en.Thus ,theorigina
ls er
v e
rc anc onti
nuet o
acceptaddi
t ionalrequestsattheor igi
nalsocke
t.
Whe nac onnectionr eques tarr
ive
s ,thec al
ltoa cceptreturns .Thes erve
rc an
eitherha ndlet her e
que stitselforuset heconc urr
e nta ppr
oach.I fitha ndlesthe
reque s
ti t
self,t hes e rve
rs e
ndsar eply,closesthene ws ocket ,a ndt henc all
s
acceptt oob ta i
nt hene xtc onnecti
onr equest.Int hec oncurrenta pproach,a f
ter
thec alltoa cceptr etur ns,thes er
verc reat
esane wp rocesstoha ndlet herequest
(i
nUNI Xt erminology,i tf orksac hil
dpr ocesst oha ndlether e que s
t )
.Thec hil
d
proc e
ssi nheritsac op yoft hene ws ock-et,s oitc a np r
ocee dt os ervi
cet he
reque s
t .Whe ni tf i
nis hes
,t hec hi
ldclosesthes ocketa ndt er
mi na tes.Me anwhil
e,
theor iginalse rv
e rpr ocessc l
osesitscopyoft hene ws ock-et(a fters tarti
ngt he
child)
,a ndc ont i
nuest ocallaccepttoob tai
nt hene xtc onnec
tionr equest.
The c oncurrent de si
g nf or s erversma ys eem c onf us i
ng b ecause mul tip l
e
proce s
ses willb e us ing t he s ame l oc alp rot
oc olp or t numb e r.The k eyt o
unde rst
andingt heme ch-anisml iesint hewa yunde rlyingp rotocolstreatp rot ocol
ports.Re cal
ltha tinTCP,ap airofe ndp ointsde fineac onne cti
on.Thus ,itdoe s
notma tterhow ma nyp r
oc essesus eag ivenl ocalp rotoc olp ortnumb era slonga s
theyc onnectt odif ferentde s
t i
nations.I nt hec aseofac oncurrents erver,t he re
isonep r
ocessp erc l
ienta ndonea dditi
ona lp ro-cesst ha ta cc e
ptsc onnections.The
sockett hatt he or i
ginals erverp roc essus esha sa wi l
dc ardf or the r emot e
destinati
on,a l
lowinga na rbi
tr aryr emot es i
tet of orm ane wc onnecti
on.Whe n
acceptr eturnsane ws ocket,t hes ocke twi l
lha veas pecifi
cr emot ee ndp oint.
Whe naTCPs egme nta rri
v e
s,t hep rotoc ols oftwa rewi lls endt hes egme ntt ot he
sockett hati sa lr
e ady c onne ctedt ot hes egme nt
ss our ce.I fno s uc hs oc ket
exist
s ,thes e
gme ntwi llbes entt ot hes oc kett hatha sawi l
dcardf orit sremot e
destinati
on.Be causet hes ocketwi thawi ldcardr emot ede stinati
ondoe snotha ve
an op enc onnec-tion,i twi llonly honoraTCP s egme ntt hatr e
que s
t sane w
conne cti
on(i.e.
,aS YNs eg-me nt);allot her swillbedi sc arded.

21
.8S
erv
ersTha
tHa
ndl
eMul
ti
pleS
erv
ice
s

The soc
k etAPIprovidesa nothe
ri nt er
esti
ng possi
bi
li
tyf ors erve
rde s
ign
b
ecauseital
lowsasi
nglepr oc
esst owaitf orconnec
t i
onsonmul ti
pl
es ockets
.The
s
yst
e mcallthatmak
est hede s
ignp os
sib
lei scal
ledsel
ect,andita pp
li
e stoI/Oi n
g
eneral
,notj us
ttocommuni ca
tionovers ockets
.Ac al os
lt el
ecthasthef orm:

nr
eady=s
ele
ct(
nde
sc,i
nde
sc,out
des
c,e
xcde
sc,t
ime
out
)

I
nge
ner
al,ac
al os
lt el
ectbl
ock
swa
iti
ngf
oroneofas
etoff
il
ede
scr
ipt
ors
t
ob e
-comerea
dy.Ar
g nt nde
ume scs
pec
ifi
eshow ma
ny de
scr
ipt
orss
houl
dbe
e
xami
ned(t
he

Thevers
ionofs
elec
tinWi
ndowsS
ock
etsa
ppl
i
esonl
ytos
ock
et
des
cri
ptor
s.
S
ec.21
.8 S
erv
ersTha
tHa
ndl
eMul
ti
pl
eSe
rvi
ces 441

descr
iptorsche ckeda realways0t hroughnde sc-1)
.Ar g ume nti ndescisap ointer
toab i
tma skt hats pec
ifiesthef i
ledescript orst oc heckf ori nput,a rgume nt
outdescisap ointert oab i
tma skt hatspecifie sthef il
ede scri
ptor stoc heckf or
output,a nda rgumente xcdescisap ointert oab i
tma s
kt hats peci
fiest hef il
e
descr
iptorst oc heckf ore xcep
-t i
onc onditions .Final
ly,i fa rgume ntt imeouti s
nonzero,i tist hea ddre
ssofa ni ntegert hats peci
fi
e show l ongt owa itf ora
connecti
onb efor ereturningt ot hec al
ler.Aze r
ov a
luef ort ime outf orcest he
cal
lt ob l
oc kunt ilade scri
ptorb e
come sr ead y.Be causet he timeoutar gume nt
contai
nst hea ddressoft het i
me outintegera ndnott hei nt egeri ts
elf
,ap r
ocess
cana l
sor equestze rode laybyp assi
ngt hea ddressofa ni ntegert hatc ont a
ins
zero(i.
e .
,ap roc e
ssc anpolltose eifI/Oisr ea dy).
Ac al
ltosel
ectr eturnst henumb erofdescri
ptorsfrom thes peci
fie
ds etthat
arer e
a dyforI/O.I talsocha ngest hebi
tma sksspeci
fie
db yi ndesc,outdesc,and
excdesctoinfor
mt hea ppl
ica
t ionwhi choftheselecte
df il
ede scri
ptorsarere a
dy.
Thus,b ef
orecal
- ngs
l
i elect,thec a
ll
e rmustturnont hoseb i
tst hatcorres
pondt o
descri
ptorstob ec hecked.Fol lowing the c
all
,a llbitst hatr emains ett o1
corres
pondt oar eadyfiledesc ri
ptor.

Tocommunicateovermorethanones ocket,aproc
essfi
rstcre
a t
esal
lthe
s
ock
etsitneeds,andthenusessel
ecttode t
e r
minewhichsoc
ketbecomesr
eady
f
orI/Ofir
st.Onceitfi
ndsasock
etisready,thep r
oce
ssuse
stheinp
utoroutput
f
uncti
onsdefi
nedabov
et oco
mmunicate
.

21
.9Ob
tai
ningAndS
ett
ingTheHos
tNa
me

Alt
houg hI Pusesade s
tina
tiona ddresswhe ndel
iveri
ngdatagr
ams,us erand
appl
i-cati
onp rogra
msus eana met orefe
rt oac omputer
.Forcomp ute
rsont he
Internet,ac omputer
sna mei sde ri
vedfrom t heDoma i
nNa meSystem des
cri
bed
i
nCha p
te r23.Theg ethostnamef uncti
ona ll
owsa nappli
cati
ontoobtai
nt heloca
l
computersna me.Ar el
at e
df unction,sethostname,all
owsama nagertos etthe
hostnamet oag i
venstring.
Gethostnamehast hefor m:

g
ethos
tna
me(
name
,le
ngt
h)

Argumentnamegivesthea ddre
ssofa narra
yofb yteswheret henameistobe
st
or e
d,andargumentlengthisaninteg
erthatspe
cifi
esthemaximum le
ngthofa
name( i
.e.
,thesizeoft henamear r
ay).Thefunc
tionretur
nst hele
ngthofthe
namet ha
tisretr
ieve
d.Tos etthehostname,apri
vil
egedappl
ic
at i
oncal
l
s:

s
ethos
tna
me(
name
,le
ngt
h)

wher
ea rgumentnamegivest
headdr
essofanarr
ayinwhichanamehasbe
en
st
ored,a
nda r
g ntl
ume engt
hisani
nte
gertha
tgi
vesthel
eng
thofthena
me.
442 TheS
ock
etAPI Cha
p.21

21
.10Li
bra
ryFunc
tionsRe
lat
edToS
ocke
ts

Ina ddi
ti
ont ot hef unctionsde sc
ribedprevi
ousl
y,thesoc
k e
tAPIof f
e rsa
l
a r
ges etoff unc
tionst hatp e
r form usef
ult as
ksrelat
edtonetworki
ng.Beca use
theydonoti n-t
er a
c tdirectl
ywi thprotocolsoft
wa r
e,manyoft hea ddi
tional
socke
tf uncti
onsarei m-plemente daslibr
aryr out
ines
.Fig
ure21.3il
l
ustratest he
dif
ferencebetweens yst
e mc a
ll
sa ndl
ibrar
yr outi
nes.

appl
i
cat
ionpr
ogr
amboundwi
thl
i
brar
yrout
inesi
tcal
l
s

Ap
pli
cat
ionPr
ogr
am Code

Li
bra
ryRout
ine
sUs
ed

Syste
mCa l
lsIn
Comp
ute
r
sOp e
rat
ingSys
tem

Fi
gur
e 21
.3Ill
ustr
ati
on of t
he di
ffer
enceb etwee
nl ibra
ryrouti
nes
,
whic
ha reboundint
oa na pp
li
cati
onp rogra
m,a ndsys
tem
ca
ll
s,whic
ha r
epartoftheoperat
ingsyste
m.

Ast hefi
gureshows,asystemc a
llpas
sescontroldire
c t
lytot hecomp ut
er
s
operat
-ingsyste
m.Ca l
l
ingal i
brar
yf uncti
on pass
esc ontroltoac opy oft he
functi
ont ha
thasb eeninc
orp
oratedintotheappli
cati
on.Ana pp
li
cati
oncanma ke
asystemc al
ldi
rect
lyorc ani
nvokeli
braryfunc
tionsthat( usua
ll
y)ma keas ys
tem
cal
l.
Manyoft hesocke
tlibr
a r
yf uncti
onsp rovi
dedataba
ses ervi
cesthata l
low a
proces
st odeter
minethename sofma chine
sa ndnetworks e
r v
ice
s,p r
otocolport
numb e
rs,andotherrel
ate
di nfor
ma t
ion.Fore xampl
e,ones etoflibr
aryr outi
nes
provi
desacces
st othedatab
a s
eofne tworks e
rvi
ces
.Wet hinkofe ntri
esint he
serv
icesdat
abaseas3-t
upl
es:

(
ser
vic
e_na
me,p
rot
ocol
,pr
otoc
ol_
por
t_numb
er)

whereserv
ice_namei sastri
ngtha
tg iv
e sthenameoft heservi
ce,pr
otocolisa
tra
nsportprotocolthati
susedtoacc
esst hes
erv
ice ndp
,a rot
ocol
_por
t_numberis
theportnumb ert ouse.Forex
ample
,t heUDPe choser
vic
ede s
cri
bedinCha p
ter
20hasane ntry:

(
"ec
ho"
,"udp
",7)
The nexts
ect
ionse xamine e
xampl
esoflibra
ryr outi
nes
,expl
ai
ning t
he i
r
p
urposesandpr
ovi
dinginformati
onabouthow theyareused.Wewillseethat
s
etsofs oc
ketl
i
-br
a ryfuncti
onsoftenfol
l
ow t
hes amep a
tter
n.Ea
chs etal
lows
t
hea p
pli
cati
ont
o:estab
-
Sec
.21
.10 Li
bra
ryFunc
tionsRe
lat
edToS
ock
ets
443

l
ishcommunicati
onwi ththeda t
ab as
e( whichcanb eaf i
l
eont hel ocalcomp uter
ora r emoteserver),obtaine nt r
iesone a ta t ime,a nd te
r minate us e.The
routi
nesusedfort hethre
eop era
t i
onsa rename dsetXent,get
Xe nt,a nde ndXent,
whereXi sthena meoft heda tabase
.Fore xampl
e,t helib
raryr outinesf ort he
hostdatabas
ea rena meds ethostent,g ethos
tent,a nd e
ndhostent.Thes ec
tions
thatdescr
ibether outi
ness umma -ri
zet hecal
lswithoutr e
peatingt hede tail
sof
thei
ruse.

21
.11Ne
twor
kByt
eOr
derAndConv
ers
ionRout
ine
s

Recallthatma c
hinesdifferint hewa yt he ystoreinteg e
rqua nt i
ti
esandt hat
t
heTCP/ IPp rotocol
sde fi
neane twor ksta
nda rdb yteorde rthati sindepe
ndentof
a
nyc om-p uter.Thes ocke
tAPIp rov i
desfourma cr
ost hatc onve r
tb etweent he
l
oca
lma chineb yteorde randt henet workst andardb yteor der.Toma keprog
ra ms
p
ortabl
e,t heymus tb ewr it
tent oc al
lthec onvers
ionr outinese verytimet hey
c
opya nint e
ge rva l
uef rom theloca lmachinet oane tworkp ac
ke torwhe nt hey
c
opyav aluef romane tworkp ack
ett otheloc almachine.
Al
lf ourconversi
onr outi
nesa refuncti
onst hatta keavalueasanargument
a
ndr e-t
ur nane wv aluewi t
ht heb ytesrear
r anged.Fore x
a mpl
e,t
oc onve
rta
s
hor
t( 2-byte
)i n-
te ge
rf rom ne
t workbyteor dertot hel
ocalhos
tbyteorder,a
p
rogra
mme rc
alsnt
l ohs(networkt ohostshort
) .Thef orma
tis:

l
oca
lshor
t=nt
ohs
(ne
tshor
t)

Argumentnet
shor
tisa2-byte(
16-
bit
)inte
geri
nne t
worksta
ndardbyt
eor
der
andtheres
ul,l
t oc
als
hor
t,i
sthes
ameinte
gerinl
oca
lhostb
yteorde
r.
TheCp rog
ramminglanguagecal
ls4-
b yte(32b i
t)inte
g esl
r ongs.Function
nt
ohl(ne
tworktohostlong)conv
ertsa4-bytelongfrom ne
t worksta
ndardb yte
or
dertoloc
alhostbyteorder.Prog
ramsinvokentohlasaf uncti
on,suppl
yinga
l
ongi
nte
geri
nne
t-wor
kbyt
eor
dera
sana
rgume
nt:

l
oca
ll
ong=nt
ohl
(ne
tlong
)

Twoa nalo
gousf unct
ionsall
ow thep rogrammertoc onv
ertfrom loc
alhos
t
b
yteor dertonetwor kstanda
r dbyteor der.Funct
ion htonsconver
tsa2- byt
e
(
short
)i nt
egerint hehos t
sloca
lb yt
eor dertoa2- byteinteg
eri nnetwor
k
s
tandardbyteorde
r.Pr o-
gramsinv eht
ok onsasaf unct
ion:
ne
tshor
t=ht
ons
(l
oca
lshor
t)

Thef
inalc
onver
sionr
out
ine,htonl
,c onv
ertsa4- byt
eint
ege
rtone
twor
k
s
tanda
rdbyt
eorde
r.Liket
heother
s,htonlisafunc
tion:

ne
tlong=ht
onl
(l
oca
ll
ong
)
444 TheS
ock
etAPI Cha
p.21

21
.12I
PAddr
essMa
nip
ula
tionRout
ine
s

Becaus
ema ny progr
a mst r
ansl
ateb etween 32-bi
tI Pv4a ddress
esa ndt he
c
orre s
pondi
ngdot t
edde cimalnotati
on orb etween1 28-bi
tI Pv6a ddres
sesa nd
c
olon-hexnotati
on,thes ocke
tl i
brar
yi ncl
udesutil
ityrouti
nest ha
tp erformt he
t
ranslati
ons.Fore xa
mp l
e ,functon i
i net_at
on transl
atesfrom dot ted de
cimal
f
orma ttoa32- bi
tIPv 4ad-dres
sinne tworkbyteorder.Acallhasthef orm:

e
rror
_code=i
net
_at
on(
str
ing
,addr
ess
)

wherea rgume nts t r


inggi vesthea ddressofa nAS CIIs tri
ngt hatc ontainst he
IPv4a d-dresse xpresse
di ndottedde ci
malforma t
,a nda ddressisap ointert oa
32-bi
ti ntegeri ntowhi cht hebinaryv a
lueisplac
ed.Thed otteddeci
ma lfor mc an
haveonet of ours egme ntsofdi gi
tss e
paratedb yp e
r i
ods( dots)
.I fa llf our
appear
,e achs e g
me nt c orre
spondst oas ingl
e octet of t he re
sulting 32- bi
t
int
eger.I ffewe rt hanf oura pp
e a
r,t helas
ts e
gme ntisexp a
ndedt ofillremaining
octet
soft headdr ess.
Functon i
i net
_ntoaper
formsthei
nve
rseofinet_at
on bymappi
nga32-
bit
I
Pv4a d-
dresst
oa nASCI
Istri
ngi
ndott
eddeci
malfor
ma t.I
thasthefor
m:

s
tr=i
net
_nt
oa(
int
erne
taddr
)

wher
ea r
gumentint
ernet
addrisa32-b
itI
Pv4a ddr
essi
nne
twor
kbyt
eor
der
,and
st
ristheaddr
essoftheres
ult
ingASCI
Ivers
ion.

21
.13Ac
ces
singTheDoma
inNa
meS
yst
em

As
etoffivel
i
brar
yf unct
ionscons
tit
utet hei
nterf
acet otheDomai
nName
Sys
tem(DNS)
.Appl
i
cat
ionprogramstha
tc al
ltheli
bra
ryf unc
tionsb
ecomecl
i
ent
s
oft heDoma inNa meS yste
m.Tha tis,whe na na ppl
ic
ationc al
lsal ibrar
yf uncti
on
too btai
ni nformati
on,t helibr
a r
yf unctionf ormsaque ry,se ndstheque rytoa
doma i
nna mes erver,anda waitsa nanswe r .Oncet hea nswe ra rr
ives,thelibr
ary
functionre t
urnst heinformationt othea pp
li
ca t
iont hatma det hec a
ll
.Be ca
use
ma nyop t
ionse xi
st,theli-
b r
aryf uncti
onsha veonl yaf e
wb asicarguments.They
rel
yonag l
obalstructur,r
e es,t oholda ddit
ionala r
g ume nt
s .Fore xample,one
fie
ldi nresenablesdebuggingme s-sa
ges,whi l
ea notherf i
e l
dc ontrol
swhe therthe
appli
cati
ons pecif
iesusingUDPorTCPf orque rie
s.Mos tfiel
dsi nr esbeginwith
reasonabl
e de f
aults,sos ocketl i
braryf unc-tionsc ano ftenb e us ed wi
thout
changingres.
Aprog
ramc
alsr
l es
_ini
tbef
orec
all
i
ngot
herf
unc
tions
.Thec
allt
ake
snoa
rgu
-
ments
:
r
es_
ini
t()

Res
_ini
tst
ore
sthena
meofadoma
inna
mes
erv
eri
ngl
oba
lst
ruc
t er
ur es
,ma
king
t
hes
yst
emr
eadyt
ocont
actt
hes
erv
er.
Chapt
er23c
ons
ide
rst
heDoma
inNa
meS
yst
emi
n
det
ail
.
Sec
.21
.13 Ac
ces
singTheDoma
inNa
meS
yst
em
445

Funct
ionres
_mkqueryfor
msadomainna
meque
rya
ndp
lac
est
heque
ryi
na
b
uff
e rinmemory.Theformofthec
alli
s:

r
es_
mkque
ry(
op,dna
me,c
las
s,t
ype
,da
ta,da
tal
en,ne
wrr
,buf
fer
,buf
len)

Thef i
rstseve na rgume ntscorre sponddi re
ct l
yt ot hef i
eldsofadoma inna me
query.Ar gume ntops pecifiesthere que s
tedop er ation,dna megi vesthea ddressof
ac haractera rrayt hatc ont ai
nsadoma i
nna me,c l
assisa ni ntegerthatg ivest he
cla
ssoft heque ry,t ypei sa ninteg
e rt hatg ivest het yp eoft heque ry,da tagives
thea ddre s
sofa na rrayofda tat ob ei ncludedi nt heque r y,andda taleni sa n
integ
e rt hatg i
ve st hel engthoft heda ta
.I na dditiont ot hel i
braryf unc t
ions,
the s ocket API p rovi
de sa p
pli
ca-tion p rograms wi t
h de finit
ions of s ymb oli
c
constantsf ori mp ortantv al
ues.Thus ,p ro-g r
a mme rsc anus et heDoma i
nNa me
System wi t
hout unde rstandi
ng t he de ta i
ls of t he p rotocol. The la s
tt wo
argume nts,b ufferand buf l
en,s p
e cifyt hea ddre ssofa na r
eai ntowhi cht he
querys houldb ep l
a ceda ndt heinteg erlengtho ft heb uf f
era rea,respectivel
y.I n
thec urrentimp l
e ment ation,argume ntne wr risunus ed.
Onc
eap r
ogra
m hasforme
daquer
y,itc
alsr
l es
_sendt
ose
ndi
ttoana
me
s
erv
erandob
tainare
spons
e.Thef
ormi
s:

r
es_
send(
buf
fer
,buf
len,a
nswe
r,a
nsl
en)

Argume ntb uf
ferisap ointe
rt ome moryt ha
tholdst heme s
saget obes e
nt
(pr
e s
um- ab
ly,t hea p
pli
cat
ionc al
l
edf unc
tionres_mkqueryt oformt heme ss
age).
Argume ntbuflenisa ninteg
ert hatspeci
fiesthelengt
h.Ar gumenta nswergives
thea ddres
si n me moryintowhi char espons
es houl
db ewr i
tten,a ndinteger
argumenta nsl
ens peci
fi
esthelengthofthea ns
we rarea.
I
na dditi
ont of unc
tionsthatma keand send querie
s,t hes oc
ketl i
brar
y
c
ont
ainstwof uncti
onsthatt r
ansl
atedomai
nna mesb etweenc onvent
ionalASCII
a
nd the compres
sedf ormat usedin que
rie
s.Func tion dn_expand expandsa
c
ompres
seddoma i
nna meintoaf ul
lASCI
Ivers
ion.Ithast heform:

dn_
exp
and(
msg
,eom,c
omp
res
sed,f
ull
,ful
l
en)

Argumentms g givest hea ddre


s sofadoma inna meme ss
aget hatcontai
nst he
namet ob ee x
pande d,wi theom sp e
c i
fyi
ngt hee nd-of-mess
agelimitbeyondwhich
thee xpa
nsionc annotg o.Argume ntc ompress
edi sap oi
nte
rt ot hefirs
tb yteof
thec ompressedna me .Ar gumentf ul
li sap ointert oa na rr
ayi nt
owhi c hthe
expandedna mes houldb ewr i
tten,a nda r
gume ntf ull
enisanintegerthatspeci
fi
es
thelengthoft hea rray.
Generati
ngac ompress
e dnameismor ecomplexthane xp
andi
ngac ompres
sed
name b ecause c ompressi
on i nv
olve
s e li
minat
ing c ommon s uffi
xes. Whe n
compress
ingna mes,thec l
ientmustk eepar ec
ordofs uffi
xesthathavea ppe
ared
prev
iousl
y.Func -tion dn_comp compress
esa f ulldoma i
n name b yc ompari
ng
suff
ixestoal istofp r
e vi
-ousl
yus e
ds uff
ixesande l
i
minati
ngt helonge
s tposs
ibl
e
s
uff
ix.Ac
allha
sthef
orm:

dn_
comp
(ful
l
,comp
res
sed,c
mpr
len,p
rev
ptr
s,l
ast
ptr
)
446 TheS
ock
etAPI Cha
p.21

Argume ntfullgiv
est headdressofaf ul
ld omai
nna me.Ar gume ntcompres
sed
poi
ntst oa na rrayofb yt e
sthatwi llholdt hecompressedna me,wi thargument
cmprlens p
ecif
yingt helengthoft hea rra
y.Thea r
gume ntprev pt
rsi stheaddres
s
ofana rrayofp oi
nterstop re
viouslycompr e
s s
edsuffi
xesint hec urrentmessa
ge,
withlastptrpointi
ngt ot heendoft hearray.Norma l
ly,dn_compc ompres
sesthe
namea ndup datesprevpt
r sandlastptrifane ws uf
fixha sbe
enus ed.
Functondn_
i compcanalsob
eus edtotrans
lateadomai
nna mefromAS CI
Ito
theinternalfor
m withoutcompre
ssi
on(i.
e.,withoutremovi
ngs uf
fix
es)
.Todo
so,ap ro-ces
sinvoksdn_
e c
ompwi ththeprevptrsarg
ume ntsettoNULL (i.
e.,
zero).

21
.14Ob
tai
ningI
nfor
mat
ionAb
outHos
ts

Libraryf uncti
onse xis
tt ha
ta ll
ow a na ppl
ic
ati
on t oretr
ieveinfor ma
tion
aboutahos tgive
ne i
therit
sdoma i
nnameori t
sI Paddress
.Thelibr
aryf uncti
ons
ma kethea p-pl
icati
onac li
entoftheDoma inNameS yste
m:t heysendar e
que s
tt o
ad oma i
n na me s erve
ra nd waitf or a r es
ponse. For exa
mp l
e,f unc
tion
gethostbynamet a k
esadoma innamea ndreturnsap ointertoas t
ructureof
informationfort hespeci
fie
dhost.Ac a
lltakestheform:

p
tr=g
ethos
tbyna
me(
name
str
)

Argume ntna mestri


sap oi ntertoac haract
e rst
ringthatcontai
nsadoma inname
fort hehost .Thev al
uer etur d,p
ne tr
,p ointstoas truct
ur ethatc ontai
nsthe
fol
lowinginf orma-t
ion:t heof fi
cia
lhostna me,al i
stofa li
asestha
tha vebeen
reg
isteredf ort hehost,t hehos taddresstype( i
.e.
,IPv4,I Pv
6,ors omeother
type),thelengt hofana ddr es
s,andal i
stofo neormor ea ddre
sse
sf ort hehost
.
Mor edetai
lsc a
nb efoundi ntheUNIXPr ogrammer
sManual.
Func
tion gethos
tbyaddrproducesthesameinf
ormat
ion asgethostbyname.
Thediffer
e nc
eb etweent hetwof unct
ionsi
st tg
ha et
hos
tbyaddrac
c ep
tsahos t
addr
e s
sasa nargument:

p
tr=g
ethos
tbya
ddr
(addr
,le
n,t
ype
)

Argumentaddrisap oi
ntertoas equenc
eofb yt
esthatc
ontainahostaddres
s.
Argu-mentlenisaninte
gert hatgi
vesthel
engthoftheaddres
s,andargument
typeisanin-te
gerthatspec
ifie
sthetypeoftheaddr
ess(
e.g.
,thatiti
sanI Pv6
addre
ss)
.
As menti
onedearl
ier
,f unct
ions set
hostent
,g ethos
tent,a nd e
ndhost
ent
pr
ovi
des e
quenti
alacc
esstot hehostda tab
ase a na ppl
ica
tion c
an ope
nt he
da
taba
se,ext
ractent
riess
equent
ial
ly,andthenc l
osethedataba
se.
Sec
.21
.15 Ob
tai
ningI
nfor
mat
ionAb
outNe
twor
ks
447

21
.15Ob
tai
ningI
nfor
mat
ionAb
outNe
twor
ks

Thes oc
ketlibr
aryals
oinclude
sf uncti
onst
hatall
owana
p p
li
cati
ontoacc
essa
da-t
a ba
s eofne t
wor k
s.Funct
iong etnet
bynameobta
insa
ndformatsthec
ontent
s
ofane ntryfrom thedatab
aseg i
v e
nt hedomainnameofane t
work.Acal
lhas
theform:
p
tr=g
etne
tbyna
me(
name
)

whe r
ea r
g umentna mei sap ointe
rt oas tri
ngt hatcontainst hena meoft he
networ kf orwhichinforma ti
oni sde s
ired.Thev al
uer et
ur nedisap oint
ert oa
structuret hatcontai
nsf iel
dsf ortheof fic
ialnameoft hene t work,al i
stof
regis
tereda li
ases
,ani ntegera ddres
st ype(i.
e.,IPv4,IPv6,ors omeot hertype)
,
andt hea ddresspre
fixusedwi t hthene twork(i.
e.,thene t
wor kp ort
ionofa nIP
addresswi ththehostp or
tions ettoze ro).

21
.16Ob
tai
ningI
nfor
mat
ionAb
outPr
otoc
ols

Fiveli
bra
ryf uncti
onsp r
ovideaccesstothedata
baseofprotoc
olsav
a i
l
abl
eon
ama c
hine.Eachprotocolhasanof fici
alname,re
giste
redal
i
as e
s,andanof fi
cia
l
pr
otocolnumber.Functiongetprotobynameall
owsac al
le
rtoob tai
ninforma
tion
ab
outap roto
-colgiv
e nitsname :
p
tr=g
etp
rot
obyna
me(
name
)

Argume ntnameisap oi
ntertoa nASCIIstri
ngt ha
tc ont
ainsthenameofthe
protocolforwhic
hinformati
onisdesi
red.Thef unc
tionreturnsapoi
ntertoa
struct
ur ethathasf
iel
dsf ortheoff
ici
alprotoc
olname,al is
tofali
ase
s,anda
uniqueintege
rval
ueas-s
ignedtotheprotoc
ol.
Functon g
i et
prot
obynumber al
lows a pr
oce
sst
o s
ear
ch f
or p
rot
ocol
i
nfor
ma t
ionus
ingtheprot
ocolnumbe
ra sake
y:

p
tr=g
etp
rot
obynumb
er(
numb
er)

Fi
nal
l
y,funct
ionsgetpr
otoent,set
prot
oent
,ande
ndpr
otoentpr
ovi
des
eque
nti
al
ac
ces
stotheprotoc
oldatabas
e.

21
.17Ob
tai
ningI
nfor
mat
ionAb
outNe
twor
kSe
rvi
ces

Recal
lfromCha pt
ers10a nd11t hatsomeUDPandTCPp rotoc
olportnumbers
arer e
servedforwe l
l-knowns e
rv i
ces.Forexampl
e,TCPp t37i
or sre
serve
df or
thet i
mepr otocoldes
cribedint hep revi
ouscha
pter
.Thee ntryi ntheservi
ces
data
b as
es peci
fi
e sthe servi
ce name ,time,a prot
ocol
,( e.
g., TCP)
,a nd the
p
rotoc
olportnumber37.Fiveli
brar
yf unc
tionse
xis
ttha
tob
tai
ninf
orma
tion
a
boutser
vic
esandt
heprotoc
olportsthe
yuse.
448 TheS
ock
etAPI Cha
p.21

Funct
ion g
etser
vbyname i
sthemos
timp
ort
antb
eca
usei
tma
psana
med
s
erv
iceontoap or
tnumb er
:

p
tr=g
ets
erv
byna
me(
name
,pr
oto)

Argume ntna mespe c


ifi
esthea ddres
sofas tri
ngtha tc ontai
nst hena meoft he
desi
reds ervi
c e
,a nd argument protoisas tri
ng tha tg i
vest hena meoft he
protocolwithwhi c
ht hes er
v i
ceistobeus e
d.Typi
ca l
ly,p rot
oc ol
sa r
el i
mite
dt o
TCPa ndUDP.Thev al
uer e
turnedisap oi
ntertoast ructuret hatcontai
nsf i
el
ds
fort hena meoft heservi
ce,al i
stofa l
ias
es,anide ntif
icat
ionoft heprotocol
withwhi chthes e
rviceisused,andanin-teg
erprot
oc olp ortnumb erassi
gnedfor
thats er
vice
.
Funct
ionget
ser
vbypor
tal
lowsthecal
l
ertoob
tai
nanentr
yf rom t
hes
erv
ice
s
da
ta-ba
seg i
vent
heportnumb
e ras
sig
nedtoi
t.Acal
lha
sthefor
m:

p
tr=g
ets
erv
byp
ort
(por
t,p
rot
o)

Argumentp ortistheintegerp rotocolportnumbera s


sig
nedt othes er
vice,a
nd
argumentp rotosp
e c
ifi
est hep rotocolforwhichthes erv
iceisdesi
red.Aswi t
h
otherdatabase
s,ana pp
li
c a
tionc ana cc
esstheserv
ice
sda taba
sesequenti
all
yusi
ng
sets
ervent
,g ets
erv
ent,a nde nds
erv ent
.

21
.18AnExa
mpl
eCl
ie
nt

Thef ol
l
owing ex
ampl
eC p r
ogr a
mi l
lust
rateshow anappl
ic
ation usesthe
s
ocketAPIt oacc
essTCP/
IPprotocol
s.Thec l
ie
ntf ormsaTCPconnectiontoa
s
erve
r,sendstheli
nesoft
extaus e
re nt
ers,anddis
p l
ayst
hese
rver
sresponseto
e
ach.

/
************************************************************************/
/
* */
/
*Progra
m: Cl
i
entt
ote
stt
hee
xamp
lee
chos
erv
er */
/
* */
/
*Me t
hod: FormaTCPconnecti
ontotheechoserverandrepeatedl
y*/
/
* readali
neoftext,sendthetexttothes erverand */
/
* recei
vet hesamet extb ac
kf romt hes erver. */
/
* */
/
*Use: c
li
ent[
-pp
ort
]hos
t */
/
* */
/
* whereporti
saTCPportnumberorname,andhos
tis */
/
* thena meorIPa ddre
ssoft heserver
shost */
/
* */
/
*Author: Ba
rryS
hei
n,b
xs@The
Wor
ld.
com,3/
1/201
3 */
/
* */
/
************************************************************************/
Sec
.21
.18 AnEx
amp
leCl
i
ent
449

#i
ncl
ude<s
tdi
o.h>#i
ncl
ude
<uni
std.
h>#i
ncl
ude<s
tdl
i
b.h>
#i
ncl
ude<g
etop
t.h>#i
ncl
ude
<s
tri
ng.
h>#i
ncl
ude
<s
tda
rg.
h>#i
ncl
ude
<s
ys/
typ
es.
h>#i
ncl
ude
<e
rrno.
h>#i
ncl
ude<f
cnt
l.h>
#i
ncl
ude<t
ime
.h>

#i
fde
fUS
E_READLI
NE
#i
ncl
ude <r
eadl
i
ne/
rea
dli
ne.
h> #i
ncl
ude
<r
eadl
i
ne/
his
tor
y.h> #e
ndi
f /
*
US
E_READLI
NE*/

#i
ncl
ude<s
ys/
soc
ket
.h>
#i
ncl
ude<ne
tdb
.h>#i
ncl
ude
<ne
tine
t/i
n.h>

stati
c c har *prog;
#defi
ne DEFAULT_PORT "
9000"
/
*pt
rtop
rog
ramna
me(
forme
ssa
ges
) */
/
*mus
tma
tchs
erv
erde
faul
tpor
t */

/
*Defi
neproces
sexi
tcodes*/

#def
ineEX_OK 0 /
*Norma
lterminat
ion */
#de
fineEX_ARGFAI
L 1 /
*Inc
orr
ectarguments */
#def
ineEX_SYSERR 2 /
*Err
orinsyst
e mcal
l */

/
*Log-di
spl
aya
ner
rorori
nfor
mat
iona
lme
ssa
gef
ort
heus
er*/

s
tat
icv
oidLog
(cha
r*f
mt,
...
)
{va
_li
stap
;

v
a_s
tar
t(a
p,f
mt)
;
(
voi
d)v
fpr
int
f(s
tde
rr,
fmt
,ap
);
v
a_e
nd(
ap)
;
}

/
*Fa
tal-di
spl
ayaf
ata
ler
rorme
ssa
get
otheus
era
ndt
hene
xit*/

s
tat
icvoi
dFa
tal
(i
nte
xva
l,c
har*f
mt,
...
){v
a_l
i
st
ap
;

v
a_s
tar
t(a
p,f
mt)
;
450 TheS
ock
etAPI Cha
p.21

(
voi
d)v
fpr
int
f(s
tde
rr,
fmt
,ap
);
v
a_e
nd(
ap)
;
e
xit
(ex
val
);
}

/
*ge
tLi
ne-g
etonel
i
neofi
nputf
romk
eyb
oar
d*/

s
tat
iccha
r*getLi
ne(
char*p
romp
t)
{#i
fde
fUS E_
READLINE
r
etur
n(r
eadl
i
ne(
pro
mpt
));#e
lse/
*
!
USE_
READLI
NE*/

(
void)f
puts(p
rompt
,st
dout
);/
*di
spl
ayt
hep
romp
t*/
f
flush(
stdout);

/
*re
adonel
i
nef
romt
hek
eyb
oar
dre
tur
nNULL*/
i
f(f
get
s(b
uf,
si
zeof
(buf
),s
tdi
n)==NULL)
r
etur
n(NULL)
;
e
lse{
c
har*p
;

/
*emul
ater
eadl
i
ne(
)ands
tri
pNEWLI
NE*/i
f((
p=
s
trr
chr
(buf
,\
n)
)!=NULL)
*p=
\0
;
r
etur
n(s
trdup
(buf
));/
*re
adl
i
ner
etur
nsa
ll
oca
tedb
uff
er*/
}
#endi
f/*!
USE_
READLI
NE*/
}

/
*ini
tCl
i
ent-i
nit
ial
i
zea
ndc
rea
teac
onne
cti
ont
othes
erv
er*/

s
tat
icintini
tCl
i
ent(cha
r*host,
cha
r*p or
t){s
truc
t
addri
nfohi
nts;
struc
taddri
nfo*resul
t,*r
p;int
s;

me
mse
t(&hi
nts
,0,
si
zeof
(hi
nts
));
hi
nts
.ai
_fa
mil
y=AF_
UNS
PEC;/
*us
eIPv
4orI
Pv6*/hi
nts
.ai
_soc
ktyp
e=
S
OCK_
STREAM;/
*st
rea
mso
cke
t(TCP)*/

/
*Ge
taddr
essofs
erv
erhos
t*/
i
f((
s=g
eta
ddr
inf
o(hos
t,p
ort
,&hi
nts
,&r
esul
t))!
=0)Fa
tal
(EX_
SYS
ERR,
"%s
:ge
taddr
inf
o:
%s
\n"
,pr
og,
gai
_st
rer
ror
(s)
);

/
*tr
yea
cha
ddr
essc
orr
esp
ondi
ngt
ona
me*/
S
ec.21
.18 AnEx
amp
leCl
i
ent 451

f
or(
rp=resul
t;rp!=NULL;rp=rp -
>a i
_next){
i
nts ock
,r et
; /
*sock
etde
scr
ipt
ora
ndr
etur
nva
lue */
cha
rhos tnum[NI
_MAXHOS
T]; /*hostname */

/
*Ge
tnume
rica
ddr
essoft
hehos
tforme
ssa
ge*/
i
f((
ret=g
etna
mei
nfo
(rp
->a
i_a
ddr
,rp
->a
i_a
ddr
len,
hos
tnum,s
ize
of(
hos
tnum)
,
NULL,
0,NI
_NUMERI
CHOS
T))!
=0){
Log
("%s
:ge
tna
mei
nfo
:%s
\n"
,pr
og,
gai
_st
rer
ror
(re
t))
;}e
lse
{
(
void)p
rintf
("Tryi
ng%s
...
",hos
tnum)
;
f
flush(
stdout);
}

/
*Ge
tane
wsoc
ket*/

i
f((
soc
k=
s
ock
et(
rp-
>ai
_fa
mil
y,r
p->a
i_s
ock
typ
e,r
p->a
i_p
rot
ocol
))<0){i
f((
rp-
>ai
_fa
mil
y==
AF_
INET6)&&(
err
no==EAFNOS
UPPORT)
)
Log
("\
nsoc
ket
:noIPv
6suppor
tont hi
shos
t\n"
);e
lse
Log
("\
nsoc
ket
:%s\
n",
str
err
or(er
rno
) )
;
c
ont
inue;
}

/
*tr
ytoc
onne
ctt
hene
wsoc
kett
othes
erv
er*/

i
f(c
onne
ct(
soc
k,r
p->a
i_a
ddr
,rp
->a
i_a
ddr
len)<0){Log
("c
onne
ct:
%s
\n"
,st
rer
ror
(er
rno)
);(
voi
d)s
hut
down(
soc
k,S
HUT_
RDWR)
;
conti
nue;
}el
se{/ *succ
ess*/(v
oid)
pri
ntf(
"conne
cte
dto
%s\
n",hos
t);r
eturn(
sock
);
brea
k ;
}
}
Fa
tal
(EX_
ARGFAI
L,"
%s:c
oul
dnotc
onne
ctt
oho
st%s
\n"
,pr
og,
hos
t);r
etur
n(-
1);/
*ne
ver
r
eac
hed,b
utt
hiss
upp
res
seswa
rni
ng*/
}

/
*runCl
i
ent-r
eadf
romk
eyb
oar
d,s
endt
ose
rve
r,e
chor
esp
ons
e*/

s
tat
icvoidr unCl
i
ent
(ints
ock
){FI
LE
*sf
p ;
char*input;
452 TheS
ock
etAPI Cha
p.21

/
*cr
eat
eab
uff
ere
dst
rea
mfors
ock
et*/i
f((
sfp=
f
dop
en(
soc
k,"
r+"
))==NULL)
{(
voi
d)s
hut
down(
soc
k,S
HUT_
RDWR)
;
Fa
tal
(EX_
SYS
ERR,
"%s
:coul
dn
tcr
eat
ebuf
fer
eds
ock
.\n"
,pr
og)
;
}
s
etl
i
neb
uf(
sfp
);

(
voi
d)p
rint
f("
\nWe
lcomet
o%s
:pe
riodne
wli
nee
xit
s\n\
n",
prog
);

/*r
eadk eyboar
d...*/
whi
l
e(((
input=getLi
ne(
">"
))!
=NULL)&&(
str
cmp
(inp
ut,
"."
)!=0)
){c
har
buf[BUFSI
Z];

(
void)fp
r i
ntf(s
fp,"
%s\n"
,input)
; /
*wr
itet
osoc
ket*/
fr
ee(input);
i
f(fgets
(buf,si
zeof(
buf)
,sfp)==NULL){ /
*ge
tre
spons
e*/
Log("
%s :l
ostconnecti
on\n",
prog
);
break;
}else
(
voi
d)p
rint
f("
res
pons
e:%s
",b
uf)
;/*e
chos
erv
err
esp
. */
}
}

/
*done
Cli
ent-f
ini
sh:c
los
esoc
ket*/

s
tat
icv
oiddone
Client
(intsock)
{i
f(s
ock>=0)
i
f(s
hutdown(soc
k,SHUT_RDWR)!
=0)
Log
("%s
:shut
downe
rror
:%s
\n"
,st
rer
ror
(er
rno)
);Log
("c
li
ent
c
onne
cti
onc
los
ed\
n")
;
}

/
*Us
age-he
lpf
ulc
omma
ndl
i
neme
ssa
ge*/

s
tat
icvoidUsage(
voi
d){
(v
oid)pr
intf
("Us
age
:%s[
-pp
ort
]hos
t\n"
,pr
og)
;
exi
t(EX_OK)
;
}

/
*ma
in-p
ars
ecomma
ndl
i
nea
nds
tar
tcl
i
ent*/

i
ntmain(i
ntargc
,cha
r**a
rgv
){i
nt
c
;
c
ha r*hos
t=NULL;
S
ec.21
.18 AnEx
amp
leCl
i
ent 453

c
har*por
t=DEFAULT_
PORT;
i
ntsoc
k;

p
rog=s
trr
chr
(*a
rgv
,/
)?s
trr
chr
(*a
rgv
,/
)+1:*a
rgv
;

whi
l
e((c=g e
topt(
arg
c,a
rgv
,"hp
:")
)!=EOF)
swit
ch(c
){
cas
ep:
p
ort=op
tar
g;
b
rea
k;
c
ase
h:
de
faul
t:
Us
age
();
}
i
f(op
tind<a
rgc
){
hos
t=a
rgv
[op
tind++]
;if
(
opt
ind!
=ar
gc){
Log(
"%s:t
ooma
nyc
omma
ndl
i
nea
rgs
\n"
,pr
og)
;
Usa
ge()
;
}
}e l
se{
Log(
"%s :missi
nghostarg
\n"
,pr
og);
Usag
e() ;
}
s
oc k=initCli
ent(hos
t,p
ort)
;/*cal
lwil
lexi
tone
rrororf
ail
ure*/
runCli
ent(
s ock)
;
done
Cli
ent
(soc
k);
e
xit
(EX_
OK)
;
}

21
.19AnExa
mpl
eSe
rve
r

Thee xampl
es erve
rc odeisonlysli
ghtlymor ec ompl
ext hanthecli
entcode.
Theov eralloper
ati
oni sstrai
ghtf
orward:thes erverisite
rati
ve.Theserverbegi
ns
bys pe
c i
- f
yingap ortt ouse,andt he
nwa it sf
orc onnecti
ons.Theser
vera cc
epts
anincomi ngTCPc onnect
ion,runsas ervi
ce ,a
ndwa it
sf orthenextconnecti
on.
Thes erviceusedisat rivi
alechoservi
ce:t heserverreadsincomi
ngli
nesoft ext
ands endse achli
neb ackt othecli
entunc hanged.Thec l
ientmustterminat
et he
connection.
Theserverwi
llal
l
ow ac l
i
enttousee it
herI Pv4orI Pv
6( assumi
ngI Pv
6i s
a
vai
l
- ab
le)
.Evenonsyste
mswhe ret
heprotocolst
a c
ki snotconf
iguredforIPv6,
t
hecodeassumest
hatincl
udefi
le
sarea
vail
ableforp rogr
amstouse.
454 TheS
ock
etAPI Cha
p.21

/************************************************************************/
/* */
/*Pr ogram: Servert hatof f
ersatextechos ervi
cev i
aTCPon */
/* IPv4orI Pv6 */
/* */
/*Me t
hod: Repeatedl
yacceptaTCPconnection,echoli
nesoftext */
/* untiltheclientclos
estheconnecti
on,andgoonto */
/* wa i
tf ort hene xtconnection. */
/* */
/*Us e: server[ -pp ort] */
/* */
/* whe rep or ti saTCPp ortnumb erorna me */
/* */
/*Aut hor: Barr yS hein,b xs@TheWor ld.com,3/ 1
/201 3 */
/* */
/************************************************************************/
#include<s t
dio. h>
#include<uni std. h>
#include<s t
dlib .
h>
#include<g etop t.h>
#include<s t
r i
ng .h>
#include<s t
da rg .h>
#inc
lude<sys/types .h>
#include<e rrno. h>
#include<s i
gna l.h>
#include<s etjmp .h>
#i
nclude<sys/
socket. h>
#include<ne tdb .h>
#i
nclude<neti
net/ i
n. h>

s
tat
icc
har *p
rog
; /
*ptrtoprogramname(
formes
sages
) */

/*Thisi
sarbi
trarybutshoul
db eunp
riv
il
eged(
>1024)*/
#def
ineDEFAULT_PORT "
9000" /*mustmatc
hc l
i
entde
faul
tpor
t */

/
*Defi
neproces
sexi
tcodes*/

#def
ineEX_OK 0 /
*Normalterminat
ion */
#defi
neEX_ ARGFAIL 1 /
*Incor
rectarguments */
#defi
neEX_ SYSERR 2 /
*Errorinsyst
e mcal
l */
#defi
neEX_ NOMEM 3 /
*Cannotall
ocatememory */

/
*Se
rve
rst
ruc
tur
eus
edt
opa
ssi
nfor
mat
ioni
nte
rna
ll
y*/

t
ype
defs
truc
t{
S
ec.21
.19 AnEx
amp
leS
erv
er 455

i
nt sock; /
*s ocke
tde scr
ipt
or */
char *port_name
; /*ptrtonameofpor tbei
ngused */
i
nt port_number
; /*integerval
uef orport */
FILE *ferr; /
*stdiohandl
eforerrormess
ages */
}_
Server,*S
er v
er;

/
*Log-di
spl
aya
ner
rorori
nfor
mat
iona
lme
ssa
gef
ort
heus
er*/

s
tat
icvoi
dLog
(Se
rve
rsr
v,c
har*f
mt,
...
){v
a_l
i
st
ap
;

v
a_s
tar
t(a
p,fmt)
;(voi
d)v
fpr
int
f(s
rv
-
>fe
rr,
fmt,a
p);va_
end(a
p);
}

/
*Fa
tal-di
spl
ayaf
ata
ler
rorme
ssa
get
otheus
era
ndt
hene
xit*/

s
tat
icvoidFatal(
Serversr
v,i
ntexval
,cha
r*f
mt,
...
){v
a_l
i
st
ap;
va_
start(a
p,fmt);(v
oid)
vfp
rint
f(srv
->f
err,fmt,ap)
;va_end(
ap)
;
exi
t(ex
val);
}

/
*ne
wSe
rve
r-Cr
eat
eane
wse
rve
rob
jec
t*/

s
tat
icS
erv
erne
wSe
rve
r(v
oid){S
erv
er
s
rv;

/
*Al
l
oca
teme
mor
yforne
wse
rve
r,e
xitone
rror*/

i
f((
srv=(
Ser
ver
)ca
ll
oc(
1,s
ize
of(
*sr
v))
)==NULL)
{(
voi
d)f
pri
ntf
(st
der
r,"
%s"
,st
rer
ror
(er
rno)
);e
xit
(EX_
NOMEM)
;
}el
se{
sr
v->fe
rr=s t
der
r;/
*ini
ti
al
izel
ogout
put*/
ret
urn(s
rv)
;
}
}

/
*fr
eeS
erv
er-f
reeme
mor
yas
soc
iat
edwi
thi
nst
anc
eofas
erv
ers
truc
t*/

s
tat
icv
oidf
ree
Ser
ver
(Se
rve
rsr
v){
456 TheS
ock
etAPI Cha
p.21

i
f(s
rv-
>por
t_na
me!
=NULL)f
ree
(sr
v
-
>por
t_na
me)
;
f
ree
(sr
v);
}

/
*ini
tSe
rve
r-I
nit
ial
i
zei
nst
anc
eofas
erv
ers
truc
t*/

s
tat
icS
erve
rini
tSer
ver
(cha
r*p
ort
)
{Se
rvers
rv;
c
har*p
rot
ocol="
tcp
";s
truc
t
p
rot
oent*p
p;s
truc
tse
rve
nt
*s
por
t;c
har*e
p;
e
xte
rnc
ons
tst
ruc
tin6_
addri
n6a
ddr
_any;s
truc
t
s
ock
addr
_st
ora
ges
a;
i
nts
opt=0;e
xte
rni
nt
e
rrno;

s
rv=ne wServ
er(
); /
*e xi
tsonf ail
ure */
s
rv->por
t_name=str
dup(
por
t); /
*saveportnametheypas
sed */

/
*Lookupp
rot
ocolnumb
erf
or"
tcp
"*/

i
f((
pp=g
etp
rot
obyna
me(
prot
ocol
))==NULL)Fa
tal
(s
rv,
EX_
ARGFAI
L,"
ini
tSe
rve
r:
%s
\n"
,st
rer
ror
(er
rno
));

/
*Fi
rsts
eei
fpor
tnumb
eri
sas
tri
ngofd
igi
ts,s
ucha
s"9000"
,*//
*andt
hens
eei
fiti
sa
na
mes
ucha
s"e
cho"(
see/
etc
/se
rvi
ces
)*/

i
f((
(sr
v->p
ort_numbe
r=s
trtol
(sr
v- >po
rt_na
me,&ep,
0))
>0)&&(
*ep
==
\0
))s
rv
-
>por
t_number=htons(
srv->port_
numbe
r )
;
e
lsei
f((
spor
t=g
ets
erv
byna
me(
srv
->p
ort
_na
me,
prot
oco
l))==NULL)
Fa
tal
(s
rv,
EX_
ARGFAI
L,"
ini
tSe
rve
r:b
adp
ort
%s
\n"
,sr
v->p
ort
_na
me)
;
e
lse
sr
v->p
ort
_numb
er=s
por
t->s
_por
t;/
*Suc
ces
s*/

/
*Ge
tane
wIPv
4orI
Pv6s
ock
eta
ndp
rep
arei
tforb
ind
()*/

(
voi
d)me
mse
t(&s
a,0,
si
zeof
(sa
));
i
f((
srv
->s
ock=s
ock
et(
AF_
INET6,
SOCK_
STREAM,
pp-
>p_
pro
to)
)<0){i
f(e
rrno==EAFNOS
UPPORT){/
*NoI
Pv6
ont
hiss
yst
em;us
eIPv
4*/

i
f((
srv
->s
ock=s
ock
et(
AF_
INET,
SOCK_
STREAM,
pp-
>p_
prot
o))<0)
Fa
tal
(s
rv,
EX_
SYS
ERR,
"i
nit
Ser
ver
:soc
ket
:%s
\n"
,
s
tre
rror
(er
rno)
);
e
lse{
S
ec.21
.19 AnEx
amp
leS
erv
er 457

s
tructsoc
k add
r_i
n*sa4=( str
uctsoc
kaddr
_in*)
&sa
;
s
a4->si
n_famil
y=AF_ I
NET;
s
a4->si
n_port=srv-
>port_number
;
s
a4->si
n_addr.
s_a
ddr=I NADDR_ANY;
}
}
}e
lse{/*IPv
6s up
porte
d*/
st
ruc
tsocka
ddr_i
n6*sa
6=(
str
ucts
ock
addr
_in6*)
&sa
;
/
*Se
tthes
ock
etop
tionI
PV6_
V6ONLYt
oze
ro(
off
)sowe */
/
*wi
l
lli
ste
nforb
othI
Pv6a
ndI
Pv4i
ncomi
ngc
onne
cti
ons
. */
i
f(s
ets
ockopt(s
rv->sock,
IPPROTO_I
PV6,
IPV6_V6ONLY,
&sopt,
si
zeof(
sopt)
)<0)
Fatal
(s
r v
,EX_SYSERR,"i
nitS
erv
er:s
etsoc
kopt:%s\n"
,
st
rerror
(errno)
);
s
a6->s
in6_famil
y=AF_ I
NET6;
s
a6->s
in6_port=s r
v -
>port_numbe
r;
s
a6-
>si
n6_
addr=i
n6a
ddr
_any;/
*Li
ste
ntoa
nyi
fac
e&a
ddr */
}

/
*Bi
ndt
hene
wsoc
kett
othes
erv
ice*/

i
f(b
ind(
srv
->s
ock
,(c
ons
tst
ruc
tso
cka
ddr*)
&sa
,si
zeo
f(s
a))<0)
Fa
tal
(s
rv,
EX_
SYS
ERR,
"i
nit
Ser
ver
:bi
nd:%s
\n"
,st
rer
ror
(er
rno)
);
/
*S etthema ximumnumb e
rofwa i
tingincomi
ngconnec
tions*/
i
f(l
i
sten(s
rv->sock,
SOMAXCONN)<0)
Fatal
(sr
v ,
EX_SYSERR,
"ini
tSe
rve
r:lis
ten:%s\n"
,st
rer
ror(err
no)
);
r
eturn(s
rv);
}

/
*runS
erv
er-Runt
hes
erv
er&i
ter
ati
vel
yac
cep
tinc
omi
ngc
onne
cti
ons*/

s
tat
icvoi
dr unS
erv
er(
Serv
ersrv
){
whil
e(1
){/*Iter
atefor
ever(
unt
itheus
era
bor
tst
hep
roc
ess
)*/i
nts
;

/
*sockaddr_s
toragei
slargeenoughtohol
dei
therI
Pv6or */
/
* I Pv4s ocketi
nfor mati
on,a sdef
ine
db ysys
tem. */

s
truc
tso
cka
ddr
_st
ora
gea
ddr
;soc
kle
n_t
a
ddr
len=s
ize
of(
addr
);
s
truc
tsoc
kaddr*s
ap=(
str
ucts
ock
addr*)
&addr
;

/*acc
eptwillbl
ockwait
ingforanewinc
omingc
onne
cti
on*/
memset(
&addr,
0,si
zeof
(addr
));
i
f((
s=a cce
pt(s
rv->s
ock,
sap,
&addr
len)
)>=0){
458 TheS
ock
etAPI Cha
p.21

c
harhos
t[NI
_MAXHOS
T];c
har
s
erv
ice
[NI
_MAXS
ERV]
;FI
LE*s
fp;

/
*Ge
tinf
orma
tiona
boutt
hene
wcl
i
ent*/

/
*NOTUS
EDi
f(g
etp
eer
name
(s,
sap
,&a
ddr
len)!
=0){Log
(sr
v,"
get
pee
rna
me:
%s
\n"
,st
rer
ror
(er
rno
));(
voi
d)s
hut
down(
s,S
HUT_
RDWR)
;
c
ont
inue
;
}e
lseEND_
NOTUS
ED*/i
f(g
etna
mei
nfo(
sap
,add
rle
n,hos
t,s
ize
of(
hos
t),s
erv
ice
,si
zeof
(se
rvi
ce)
,0)
!
=0){

Lo
g(s
rv,
"ge
tna
mei
nfo
:%s
\n"
,st
rer
ror
(er
rno)
);
(
voi
d)s
hut
down(
s,S
HUT_
RDWR)
;
cont
inue
;
}
Log
(sr
v,"
acce
pt:hos
t=%sp
ort
=%s
\n"
,hos
t,s
erv
ice
);

/
*cr
eat
eab
uff
ere
dst
rea
mforne
wsoc
ket*/

i
f((
sfp=f dopen(s,
"r+"
))==NULL){
Log(s
r v,
"fdopen:err
orc r
eati
ngbuf
fereds
trea
m?\n"
);
(voi
d)shutdown(s,
SHUT_RDWR);
conti
nue ;
}el
se{/ *Av a l
idconnec
tionhasbee
nacce
pted*/cha
r
buf[
BUFS IZ];

/
*loop,r
eadi
nginp
uta
ndr
esp
ondi
ngwi
thc
harc
ount*/
s
etl
ine
buf(
sfp
);
whi
l
e(f
get
s(b
uf,
si
zeof
(buf
),s
fp)!
=NULL){Lo
g(s
rv,
"cl
i
ent
:%s
",b
uf)
;
(
voi
d)f
pri
ntf
(sf
p,"
got%zdc
har
s\n"
,st
rle
n(b
uf)
);
}
Lo
g(s
rv,
"cl
i
entc
los
edc
onne
cti
on\
n")
;
i
f(s
hut
down(
s,S
HUT_
RDWR)!
=0)
Lo
g(s
rv,
"%s
:shut
downe
rror
:%s
\n"
,st
rer
ror
(er
rno)
);(
voi
d)f
clo
se(
sfp
);/
*
f
reea
nyme
mor
yas
soc
iat
ed*/
/
*wi
ths
tdi
ofi
l
epoi
nte
rsf
p */
}
}
}
}

/
*done
Ser
ver-us
era
bor
tedp
roc
ess
,soc
los
ese
rve
rsoc
keta
ndLog */
Sec
.21
.19 AnEx
amp
leS
erv
er
459

s
tat
icv
oidd
one
Ser
ver
(Se
rve
rsr
v){i
f(s
hut
down(
srv
-
>soc
k,S
HUT_
RDWR)!
=0)
Log(
srv,
"%s:shut
downe r
ror:%s\n"
,st
rer
ror
(er
rno
));
fre
eS e
rver(
srv)
;
Log(
srv,"
\n%s:shutdown\
n\n",
prog)
;
}

/
*Ha
ndl
ese
rve
rshut
downwhe
nva
riouss
igna
lsoc
cur*/

s
tat
icj
mp_bufsi
genv;
s
tat
icv
oidonSi
gnal
(i
ntsi
gno){
l
ong
jmp
(si
genv
,si
gno)
;/*s
endb
acks
igna
lnumi
fanyo
nec
are
s*/
}

/
*Us
age-Pr
intame
ssa
gei
nfor
mingt
heus
era
bouta
rgs
,andt
hene
xit*/

s
tat
icv
oidUsage(v
oid){
(voi
d)pr
intf
("Usa
ge:%s[
-pt
cp_
por
t]\
n",
prog
);
exit
(EX_OK);
}

/
*ma
in-ma
inp
rog
ram:p
ars
ear
gume
ntsa
ndt
hens
tar
tthes
erv
er*/

i
ntma i
n(i
ntargc,
cha
r**ar
gv)
{Serversrv
;
char*por
t=DEFAULT_PORT;/
*de
faul
tpr
otoc
olp
ortt
ous
e*/i
ntc
;

p
rog=s
trr
chr
(*a
rgv
,/
)?s
trr
chr
(*a
rgv
,/
)+1:*a
rgv
;

/
*Pa
rsea
rgume
nt*/

whi
l
e((c=g etopt(argc,
argv,
"hp:"
))!
=EOF)
swit
ch(c){
cas
e p
:/*p or tnameornumb erfromcommandl
i
ne*/p
ort
=opt ar
g ;
break;
cas
e h
:/ *help,fall
sthrough.
..*/de
fault
:/*
unrecognizedcomma ndarg*/Usage
();
}

s
rv=i
nit
Ser
ver
(por
t);/
*thi
sca
lle
xit
sone
rror*/

i
f(s
etj
mp(
si
genv
)>0){
460 TheS
ock
etAPI Cha
p.21

doneSer
ver(
srv
);/
*tohe
reons
igna
l*/
exi
t(EX_OK)
;
}e
lse{s
igna
l(S
IGHUP,
onS
igna
l);
s
igna
l(S
IGI
NT,
onS
igna
l);
s
igna
l(S
IGTERM,
onS
igna
l);
}

Log(s
rv,"
\n%s:Ini
ti
a l
i
zed,wai
tingf
orinc
omingconne
cti
ons
\n\
n",
prog
);
runServ
er(s
rv);
retur
n(EX_OK);/*suppr
ess
escompi
lewar
ning*/
}

21
.20S
umma
ry

Althought heTCP/ IPs tanda rdsdonotde fi


net hee xac
tinterfac
eb etwe ena n
ap p
li
- cationprog rama ndTCP/ I Pp rotocols
,t hes ocketAPIha sbecomeadef acto
standa rdus edb yv endorss ucha sMi crosofta ndAp pl
ea swe l
lasinLinux.S ockets
adop ted t he UNI X op en- c
lose -read-wr i
tep aradi
gm, a nd a dded many ne w
func ti
ons .A s ervera p pl
i-cation mus tc reateas ocket,b i
nd addres
sest ot he
socke t,a cc
epti ncomingc onnec tionsorme s
sages,ands endr epl
i
es.Ac l
ientmus t
createas ocke t
,c onne ctt he s oc
k ett oar e-motee ndpoi
nt,a nd t hen
communi cate.Whe na na ppl
icat i
onf i
nis
he sus i
ngas ocket,thea ppl
ic
ati
onmus t
closet hes ocket.I na dditiont ot hes ockets yst
e mc al
ls
,t hesocketAPIi ncludes
ma nyl i
b raryroutinest hathe l
pp rogramme rsc r
eatea ndma ni
pulateIPad-dr e
s se
s,
conve rti ntege
r sb etweent hel ocalma chinef ormata ndne tworks t
andardb yte
or d
er ,a ndsearchf orinf orma tions ucha shos taddresse
s.
Weexa
mine
de xampl
ec odeforac li
entands erv
ert hatill
ustrat
edt heus
eof
thesock
etAPIf orab a s
ict ex
t uale
cho ser
vice.Ina ddi
tion to many de
tai
l
s
rel
atedtotheus eofs ocket
s,t heexa
mplec odei scomp li
cat
e db e
causeiti
s
wri
ttentouseei
therIPv
4orI Pv6,wit
hI Pv
6b einggive
np r
eference.

EXERCI
SES

21
.1 Downl
oadtheexa
mpl
ecl
i
enta
nds
erv
erf
rom c
omer
books
.com andr
unt
hem on
yourl
oca
lsys
tem.
21
.2 Buil
das i
mples e
rvert hatacceptsmul
tipl
ec oncurrentTCPc onnec
t i
ons.Totes
t
yourser
ver,ha v
et hep roces
st hatha
ndlesac onnecti
onpri
ntas hortmess
age
,
del
ayarandomt ime,printanothermes
sage,ande xit.
21
.3 Whenistheli
stenc al
limport
ant?
21
.4 Whatfuncti
onsdo e
syourl oca
lsystemprov
idet oa c
cesstheDomainNa meSys
tem?
Ex
erc
ise
s 461

21
.5 Devi
seaserv
erthatusesasing
leLi
nuxp r
ocess(i
.e.
,as i
ngl
ethre
a dofexe
cut
ion)
,
buthand
lesmul
ti
pl
ec oncur
rentTCPconnect
ions
.(Hint
:thinkofsel
ect
.)
21
.6 Reada bouta l
ter
nati
vest
ot hesock
eti
nte
rface
,suc
hastheTr
anspor
tLibr
ary
Interface( TLI
)a ndcompar
et he
mt os
ocket
s.Whatar
ethemajorconc
eptua
l
dif
f e
re nces
?
21
.7 Eachoper
ati
ngsyst
eml i
mit
sthenumbe
rofsoc
ket
sag i
venprog
ramca
nus
eata
ny
ti
me .Howmanysocke
tscanaprogr
amcre
ateonyourl
ocals
yste
m?
21
.8 Canthesock
et/
fil
edes
cri
ptormechani
smandass
oci
atedr
eadandwr
iteoper
ati
ons
becons
ide
redaformofobjec
t-or
iente
dde
s i
gn?Exp
lai
nwhyorwhynot.
21
.9 Considera nalterna
tiveAPIde s
ignt hatprovi
desani nte
rfaceforeac
hl a
yerof
protocolsoft
wa re(e.g
.,t heAPIa ll
owsa nappl
ic
ati
onp rogra
mt osendandrecei
ve
rawf r
a meswithoutusingI P,ort os e
nda ndrece
iveI Pdatag
ramswit
houtusing
UDP or TCP) .Wha ta r
et he advantag
es of havi
ng sucha ninter
face? The
di
sadv anta
ges?
21
.10 Acl
i
enta ndser
vercanbothr unonthes a
mec omput
era nduseaTCPs ocketto
c
om-muni
c a
te.Expl
ai
n how itisposs
ibl
et ob uil
dac l
i
enta ndserv
ert ha
tc a
n
c
ommunic
a t
eonas i
ngl
ema c
hinewit
houtlearni
ngt hehost
sIPaddr
ess.
21
.11 Experimentwiththes a
mp l
es e
rveri
nthischapt
ertoseeifyoucang ene
rat
eTCP
con-necti
onssuffi
cie
ntlyf a
stt oex
cee
dt heb a
ckl
ogtheserve
rs pe
cif
ies
.Doyou
expectin-comingconnect
ionr e
ques
tstoe xc
eedtheback
logfast
eri ftheser
ver
operatesonac om-puterthathasonec or
et hanonac ompute
rt hathasfour
core
s ?Explai
n.
21
.12 S
omeofthef unc
tionsi
ntheori
gi
nalsoc
ketAPIa
renowi
rre
lev
ant
.Ma
keal
i
stof
s
ock
etfunc
tionsthatar
enolongerus
eful
.
21
.13 ReadmoreaboutIPv6a
ddr
e s
sscop
e.I
fas e
rverb
indsasoc
kett
oana
ddr
esswi
th
l
ink
-loc
alsc
ope,whic
hcomputer
scanc
ont
actthese
rver
?
21
.14 I
fap rog
rammerwant
stoc r
eateaserv
erthatca
nb ere
a c
hedei
thervi
aIPv4or
I
Pv6,whatsock
etf
uncti
onsshoul
dtheprog
rammeruseandhow s
houl
daddr
ess
es
b
es p
eci
-fi
ed?
Chapt
erCont
ent
s
22.
1 Intr
oduc tion,463
22.
2 His
toryOfI Pv 4Boot stra
p ping,464
22.
3 Usi
ngI PToDe termi neAnI PAddr es
s,464
22.
4 DHCPRe tra nsmissionAndRa ndomi zati
on,465
22.
5 DHCPMe ss ageFor ma t,465
22.
6 TheNe edForDyna micConf i
gura t
ion,468
22.
7 DHCPLe a se sAndDyna micAddr essAssig
nme nt
,469
22.
8 Multi
pleAddr es
se sAndRe lays,469
22.
9 DHCPAddr essAc quisiti
onS t ates,470
22.
10Earl
yLe a seTe rmina ti
on,471
22.
11LeaseRe ne wa lSta tes,472
22.
12DHCPOp tionsAndMe ssageTyp e ,473
22.
13DHCPOp tionOv erload,474
22.
14DHCPAndDoma inNa mes,474
22.
15ManagedAndUnma nagedConf i
g urati
on,474
22.
16ManagedAndUnma nagedConf i
g urati
onForI Pv6,475
22.
17IPv6Conf igur ati
on Op ti
onsAndPot entia
lConfli
cts
,
476
22.
18IPv6Neig hb orDi scov eryPr otocol(NDP) ,477
22.
19ICMPv6Rout erS o l
icitati
onMe ssage,478
22.
20ICMPv6Rout erAdv e r
tiseme ntMe ssage,478
22.
21ICMPv6Ne ighborS ol i
ci
tationMe ssage,479
22.
22ICMPv6Ne ighborAdv erti
seme ntMe ssage,480
22.
23ICMPv6Re directMe ssage,480
22.
24Summa ry,481
22

Boots
trapAnd
Autoc
onfigur
ati
on(
DHCP,
NDP,IPv6-ND)

22.
1Int
roduc
tion

Earli
e rc hapterse xplainhow TCP/ IPp rotocolsop e
r atei nt hes t
eadys ta t
e.
Thec haptersa ssumehos t sa ndr out ersarer unninga ndt hep rotoc olsoftwareha s
beenc on- fi
g ureda nd i nit i
ali
ze d.Thi sc haptere xamine ss yst em s tartup a nd
dis
c ussest hes tepsas ystemt ak est oinitiali
zet hep rotoc ols tack .Interesti
ng l
y,
thec ha ptere xplai
nst hatma nys ystemsus et hec l
ient-serv erp aradigma spartof
theirb oot st
r app roc edure.I np a rti
cular
,t hec hapterc ons i
de rsahos tcomp uter
attache dt oaTCP/ I Pi nterne t.I te x-pl
ainshowt hec omp ute rca nob ta
ina nI Pv4
orI Pv6a ddr e
ssa nd t he a ss
ocia te
di nf orma -ti
on,i ncluding a na ddressma s
k,
networ kp refix,andt hea ddresse sofade faultr outera ndana mes erver.The
chap ter de scribest he p rotocols a hos tc an us et o ob tai
nt he ne cessary
informa tion.S ucha utoma t icinitiali
zati
oni simp ortantb ec ausei tp e r
mitsaus er
toc onne ctac omp ut ert ot heI nt er
ne twi thoutunde rs
ta ndingt hede t
ail
sofa d-
dresse s
,ma sk s
,r out e rs
,orhow t oc onf igurep rotocols oftwa re .Thec hapter
conc l
ude swi thadi scus s
iono fI Pv 6Ne ig
hb orDi scovery,whi chha ndlestaskss uch
asa ddressb indingina dditiont oc onfi
gur ation.

Theb oot
str
app
ingp r
ocedur
esdes
cri
bedhe r
ea resurpr
isi
ngb eca
usethe
yus e
IPtotransfermes
sage
s.I tmights
eemimp os
sibl
et ouseI Pbeforeacomputer
hasl
ear
nedi t
sownI Paddres
s.Wewil
lsee,however,tha
tt hesp
ec i
alIPa
ddres
ses
de
scr
ibe
dea
rli
erma
kes
uchc
ommuni
cat
ionp
oss
ibl
e.

46
3
464 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) Chap.22

22.
2Hi
stor
yOfI
Pv4Boot
str
app
ing

AsCha pt
e r6de sc
rib
es,theRARPp rotoc
olwa sinit
ial
l
yde v
elope
dt opermita
hostcomp ute
rt oob t
ainitsI
Pv4a ddres
s.Later,amor egene
ralprotoc
olname d
BOOTstrapPr otocol(BOOTP)repla
c e
dRARP.Fi nall
y,theDynamicHostConf i
gura-
ti
onPr otocol( DHCP)wasdev e
lopeda sane xtensi
onofBOOTP.Be caus
eDHCP
wasde riv
e df r
om BOOTP,ourde scr
ipt
ionofb as
icsappl
i
esb r
oadlytob oth.To
si
mp l
if
yt hedi s
cussion,wewillfocuspri
maril
yonDHCP.
Be c
a useitus esUDPa ndI P,DHCPc anbei mp l
ement edb ya na ppli
cat
ionp ro-
g
ram.Li k eot hera p
p l
ic
a t
ionp rotocols,DHCPf oll
owst hec l
i
e nt-serv
e rparadigm.
I
nthes imp le
s tcases,DHCPr e
qui r
esonl yas ingl
ep ackete xcha ngeinwhi c
hahos t
c
om-p uters endsap a c
kett or equestb ootstr
a pinformationa ndas erverresponds
b
ys endingas i
ngl
ep ac
k etthats pec i
fiesitemsne ededa ts t art
up ,incl
udingt he
c
omput ersIPv 4a d-dress,theI Pv4a ddressofade f
a ultr outer,a ndt heI Pv4
a
ddressofadoma i
nna mes erver.DHCPa l
soincludesav endor -
speci
f cop
i ti
oni n
t
here pl
yt hata l
lo
wsav endort ose nda ddi
tionalinforma t
ionus edonlyf orthe i
r
c
omput ers.

22.
3Us
ingI
PToDe
ter
mineAnI
PAddr
ess

Wes a i
dt hatDHCPus esUDPt oc arr
yme ssagesa ndt hatUDPme s
sagesaree n
-capsul
atedi nIPda tagramsf orde l
ivery.Tounde rstandhowac omp utercansend
DHCPi na nI Pda tagra mb eforethec omp uterlearnsi tsI Pa ddress,recal
lfrom
Chapter5t hattherea reseveralspecial
-caseI Pv4a ddr es
ses.Inp a r
ticul
ar,whe n
used a s a de st
i-nation a ddres
s,t he I Pv4 a ddr es
sc onsis
ting of a ll1 s
(255.255.255.255) spe ci
fi
esl imitedb roadcast.I Ps oftwa r
ec ana cce
pta nd
broadcastda tag
ramst hatsp eci
fyt hel i
mit e
db r
oadc a s
ta ddressev enb e
foret he
softwareha sdiscov
e r
edi tslocalIPa ddressinforma- tion.Thep ointis:

Anappli
cati
onprogramcanuset heli
mit
edbroadcas
tIPv4address
tof or
c eIPs oft
waret o broadcas
t a dat
agram on the l
ocal
net
wor kbe-for
et heIPsoftwareont hehosthasdisc
overedits
IPaddress
.

Supposec l
ientma chineAwa nt st ouseDHCPt of i
ndb ootstrapinformati
on
(
in-cl
udingi tsIPv4a ddres s
)a nds up p
oseBi sthes e r
veront hesa mephysica
lne t
t
ha twillanswert her eque s
t.Be causei tdoe snotk now B sIPv4a ddre
ssort heIP
p
r e
f i
xf ort hene t
wor k,Amus tbr oadcastitsinitialDHCPr eques
tus i
ngt heIPv4
l
i
mi tedb roadcasta ddress.Ca nBs end adi rectedr eply? No,i tc annot,e v
en
t
houg hB k nowsA sI Pv4a ddress .To s eewhy,c onsi
de rwha tha ppensifa n
a
p pl
icat
iononBa ttemp t
st os endada tagr
a m usingA sIPa ddress.Afterrouti
ng
t
heda t
a g
ram,I Ps oftwa reonBwi l
lp a
sst heda tagramt ot hene tworkinterfac
e
s
oftwa re.Thei nterfaces oftwa r
emus tma pt hene xt-hopI Pv4a ddresstoa
c
orrespondingha rdwa r
ea ddress.Ift hene t worki nterfaceus esARPa sde s
crib
ed
i
nCha pter6,ARPwi l
lf a
il Aha snotye tr ece
ivedt heDHCP
Defi
ningDHCPa sanext
ensi
onofBOOTPe na
ble
dDHCPt obedepl
oye
dwi
thoutre
pla
cinge
xis
ting
BOOTPr e
layagents
.
Aswewi l
lsee,theterm op
tionsissome
whatmis
lea
dingb
ecaus
eDHCPusesanopt
ionsf
iel
dt o
car
rymuc hoft heboots
tra
pinfor
ma ti
on.
S
ec.22.
3 Us
ingI
PToDe
ter
mineAnI
PAddr
ess 465

reply,soAdoe snotr ec ogni


zeit sIPaddress.Therefore,Ac a
nnota ns
we rBsARP
re-quest.Asac ons
e que nc,B ha
e sonlyt woa lterna
t i
ves:B canb r
oadcastt he
replyb a
ckt oA,orBc ane xt
ra ctAsMACa ddres
sf rom theframet hatcar r
ied
ther equestandus et heMAC a ddresstos endadi recte
dr epl
y.Mos tp r
otocol
stacksd onotp ermita na ppl
ica-ti
ont oc reatea nds endana rbi
traryLaye r2
frame .Thus,onet ec hniquec onsis
tsofe x-tr
acting A
sMAC a ddressfrom t he
requestp a
cketanda ddingt hee ntrytot helocalARPc acheforA.Onc ethee ntry
hasb eenp l
ace
di ntheARPc ache,outgoingp ack
et swillbesenttoA( unti
lt he
entrye xpi
res
).

22.
4DHCPRe
tra
nsmi
ssi
onAndRa
ndomi
zat
ion

DHCPp l
acesa llres
p onsi
bil
it
yf orr eli
ablecommuni ca
t i
onont hec l
i
e nt.We
know thatb ecauseUDP us esIPf orde liv
ery,me s
sagesc anb ede layed,l ost,
del
ivere
doutofor der,ordup li
cated.Fur thermore,becauseI Pdoesnotp rovidea
chec
k s
um f orda ta,theUDPda tagra mc oulda rr
ivewiths omeb it
sc orrupt e
d.To
guarda g
ainstc orrupt
ion,DHCPr equirest hatUDPha vethec hecks
um t urne don.
TheDHCPs tandarda l
sosp ec
ifi
estha treque stsandr e
pli
ess houl
db es entwi ththe
donotf ragmentbi tsett oa c
-commoda t ecli
e nt
st hathavet oolit
t leme moryt o
reas
semb l
eda tagrams.Fina l
l
y,t oha ndl
edup l
icates
,DHCPi sconstruc te
dt oa ll
ow
multi
plerep l
i
e s
;t heprotocolonlyac -ce
pt sandp roces
sesthef ir
stre ply.
Toha ndl
eda tag
ramloss
,DHCPusestheconv
ent
ionalt
ec queoft
hni i
meout
andret
ransmis
sion.Whenittra
nsmi
tsare
ques
t ,t
hecli
entsta
rtsati
mer
.I fno
replya rr
ivesbeforet het imere xpires
,t hec l
ientmus tr et
ra nsmitt her e quest.Of
course,a fte
ra p owerf a i
lure a l
l ma c
hines on a ne t work wi llr eboot
si
mul taneousl
y, p ossibl
y ov errunning t he DHCP s erver(
s ) wi ths imultaneous
requests.S i
mila
r l
y,i fa llc l
i
e ntsus ee xactl
yt hesa mer et r
a nsmissi
on t imeout ,
ma ny or a l
lo ft hem c ana ttemp tt or et
r a
ns mi
ts imult ane-ously.To a void
si
mul taneousactions,t heDHCPs p
e ci
fi
ca ti
onr ecomme ndsa ddingar a ndom de lay.
Ina dditi
ont ochoos i
nga ni ni
t i
alti
me outb etwe en0a nd4s econdsa tr andom,t he
specif
icati
onr ecomme ndsdoub li
ngt het i
me ra ftereachr etrans mis
sion.Af te
rt he
timerr eachesal argev a
lue,60s econds,t hec l
ientdoe snoti ncreaset het ime r,
but c ont i
nuest o us e r andomizati
on. Doub li
ng t he t i
me out a ft e
r e a ch
retransmissi
onk eepsDHCPf rom addinge xcessi
vet raffi
ct oac ongeste dne twor k;
ther andomizati
onhe lpsavoids i
multaneoust ransmiss
ions.

22.
5DHCPMe
ssa
geFor
mat

Tok ee
pa nimpl
ementa t
ionassimpl
easp os
sibl
e,DHCPme ss
age
sha v
ef i
xed-
l
engt
hf i
el
ds,andrep
li
esha vethesameformatasr equest
s.Alt
houghwes ai
dt hat
c
li
entsand serv
ersarep rograms,theDHCP p r
otoc oluse
st hete r
msl oosel
y,
r
eferr
ingtothemachi
net hatsendsaDHCPr e
questa sthecli
entandanymac hine
t
hatsendsarepl
yasas er
v er.Fi
gure22.1s
howst heDHCPme s
sageforma
t.
Al
thoughthe st
anda
rda l
l
ows a c
li
ent t
o wa
itf
or r
epl
i
esf
rom mul
ti
pl
ese
rve
rs, mos
t
i
mpl
ementati
onsa
c-c
eptandpr
ocesst
hef
irs
trepl
y.
466 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) Chap.22

0 8 1
6 24 31
OP HTYPE HLEN HOPS
TRANS
ACTI
ONI
D
S
ECONDS FLAGS
CLI
ENTI
Pv4ADDRES
S
YOURI
Pv4ADDRES
S
S
ERVERI
Pv4ADDRES
S
ROUTERI
Pv4ADDRESS
CLI
ENTHARDWAREADDRES
S(16OCTETS
)
.
.
.
S
ERVERHOS
TNAME(64OCTETS
)
.
.
.
BOOTFI
LENAME(128OCTETS
)
.
.
.
OPTI
ONS(
VARI
ABLE)
.
.
.

Fi
gur
e22.
1Thef or
matofaDHCPmes
sage
.Thepr
otocolus
esf
ixe
d
fi
el
dstokee
ptheDHCPs
oftwares
mal
lenoughtof
itint
o
ROM.

Fi
eldOPs p
ecifi
eswhe thertheme ssageisar eque s
t( 1)orar eply(2).Asin
ARP,fiedsHTYPEa
l ndHLENs pec
ifythene twor
kha rdwa ret ypeandl engt
hoft he
hardwareaddres
s( e.
g.,Ethernetha stype1a nda ddressle ng
th6) .Thec l
i
ent
plac
es0 int heHOPSf i
el
d.I fi trecei
vest her e
que sta ndde cidest opassthe
reques
ton t oa notherma c
hine (e.
g.,t oa l
l
ow b oots
trap pi
ng a c
rossmul t
ipl
e
router
s),theDHCPs erve
ri ncre-mentst heHOPSc ount.TheTRANS ACTION ID
fiel
dcontai
nsani nteg
ert hatc l
ient
sus et oma t
chr es
ponse swithr eques
ts.The
SECONDSf i
el
dr ep
ortsthenumb erofsecondssi
ncet hec l
ients tar
t e
dt oboot.
TheCLI ENTI Pv4ADDRESSf ie
lda ndallfi
eldsf ol
lowingitc ont
a i
nt hemos t
i
m-p ort
a nti nformati
on.Toa l
low theg r
eates
tf lexibi
l
ity,cli
e ntsfi
llina smuc h
i
nforma tiona stheyknowandl eav
er emai
ningfieldssettoze ro.Fore xampl
e,ifa
c
li
entk nowst he name ora ddres
sofa s peci
fics erverfrom whi chi twant s
i
nforma tion,itca nfi
lli
ntheS ERVERI Pv
4ADDRESSorSERVERHOSTNAMEf i
eld.
I
ft he s
ef iel
dsa renonzero,onlyt hes er
verwi t
h ma tchi
ngna me/a
ddresswi l
l
a
nswe rt her e
que s
t;ifthe
ya rezero,anys e
rve rthatr ecei
ve stherequestwi l
l
r
eply.
DHCPc
anb
eus
edf
rom ac
li
entt
hata
lre
adyk
nowsi
tsI
Pv4a
ddr
ess(
i.
e.,t
o
ob
tai
not
heri
nfor
mat
ion)
.A c
li
entt
hatk
nowsi
tsI
Paddr
essp
lac
esi
tint
he
CLI
ENTI
Pv4

Value
sf heHTYPEf
ort iel
dar
eas
sig
nedb
ythe
IETF.
S
ec.22.
5DHCPMe
ssa
geFor
mat 467

ADDRESSf i
el
d;othercli
entsus ezero.Ifthec l
ientsIPa ddr
essiszeroint he
request
,aserverre
turnsthec l
ie
nt
sI Paddre
ssint heYOURI Pv4ADDRESSf i
el
d.
The16-btFLAGSf
i i
el
da ll
owscontrolofther eques
ta ndrespons
e.AsFigure
22.2s hows
,onlyt hehigh-orderbi
toft he FLAGS fiel
d hasb eenass
igneda
me
ani
ng.

0 1
5

B MUS
TBEZERO

Fi
gur
e22.
2Thef ormatofthe16-
bitFLAGSfi
el
di naDHCPme s
sag
e.
Theleft
mostbitisi
nterp
rete
da sabroadc
astr
eque
st;all
othe
rsbitsmus
tbesettozero.

Ac li
e ntus est hehi gh-orde rb i
tint heFLAGSf iel
dtoc ontrolwhethert he
servers endst her es ponseviauni castorb r oa dcast.Tounders t
andwhyac li
ent
mightc hooseab roadc astresponse,r eca
llt ha twhi l
eitcommuni c
ateswithaDHCP
server
,ac l
ientdoe snotye tha vea nIPa ddr e ss,whichmeanst hec l
i
entc annot
answerARPque ries.Thus ,toe ns urethatt hec li
entc a
nr e
ceiveme ss
agessentb y
aDHCPs e r
ve r
,ac li
e ntcanr e -questt ha tt hes erve
rs e
ndr esp
onsesusingI P
broadcast,whi chc orr es
pondst o hardwa reb roadcas
t.Ther ul
esf orda t
a gr
am
process
inga l
l
ow I Pt odiscar
da nyda tagramt ha tar-ri
vesvi
aha rdwareunicastif
thede sti
na ti
ona ddr essdoesnotma tcht hec omp uter
saddress.However,I Pis
requir
edt oa cce
pta ndha ndl
ea nyda t
agra ms entt otheIPbroadcastaddres
s.
Int e
restingly,DHCPdoe snotp rovides p
ac ei nt heme s
saget odownl oada
speci
ficme moryi ma gef ora ne mb edde dsystem.I nste a
d,DHCPp rovidesaBOOT
FILENAMEf ieldt hatas ma l
ldi s
k l
esss ystemc anus e.Thec l
ientc anus ethef iel
d
tos upp l
yag enericna mel i
ke uni
x ,whi chme ans, Iwa ntt ob oott heUNI X
operatings ystemf ort hisma chi
ne .
TheDHCPs er verc onsultsitsc onfi
gur ati
on
databaset oma pt heg en- er
icna mei ntoas pe c
ificf i
lena met ha tc ontai
nst he
me moryi mag ea p propria
t ef or t he c lie
nt ha rdwa r e,a nd r e
t urns the f ull
y
quali
fiedf il
ena mei ni tsr e
ply.Ofc our se,thec onf igurationda t
a basea l
soa l
lows
comp l
etelya utoma t i
cb ootstrapping,i nwhi cht hec li
e ntp lace
sze rosi ntheBOOT
FILENAMEf ie
lda ndDHCPs electsame moryi ma gef ort hema chine .Thec li
ent
thenus esas tandar dfil
et ransf erpr otocolsucha sTFTPt oob tai
nt hei mage.The
advanta g
eoft hea p proachist hatadi skles
sc l
ie
ntc anus eag enericna mewi thout
encodingas pec i
fi
cf i
le,a ndt hene twor kma na g
e rc a nc hanget hel ocat
ionofa
bootima gewi thoutc hangingt heROM i ne mbedde ds ystems .
It
emsi nt heOPTIONSar e
aa l
luseaTyp e-Length-Val
ue(TLV)styleenc
odi
ng
eachi t
emc ontansat
i ypeoctet,alengthoctet,ande ndswithav al
ueofthe
s
pec
ifi
edl eng
t h.Twooptionsareespec
ial
lysig
nifica
nt:a nIPv4subnetma s
kfor
t
helocalnet-workandanI Pv4addre
ssofade faultrouter.
468 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) Chap.22

22.
6TheNe
edForDyna
micConf
igur
ati
on

Ea r
lyb oots
trapprotocol
soperate
di narelat
ivel
ysta
t i
cenvir
onme ntinwhic
h
e
ach hos t ha d a pe r
ma nent network connecti
on. A ma nagerc reate
d a
c
onfi
g urat
ionf i
lethatsp e
c i
fi
edas etofp aramete
rsfore ac
hhos t,incl
udi
ngan
I
Paddr ess
.Thef i
ledi
dnotc hangefrequent
lyb e
causetheconfigura
t i
onusual
l
y
r
emaineds tabl
e.Typi
call
y,ac on-f
igurat
ionconti
nuedunchangedforwe eks
.
Int hemode rnI nternet,howe v e
r ,ISPsha veac ontinuall
yc hangings etof
custo-me r
s,a nd por ta
b l
el aptop c omp uterswi t
h wi relessc onnecti
onsma keit
possi
blet omov eac omput e
rf rom onel oca
tiontoa not herqui ckl
ya nde asi
ly.To
handlea utomate dad-dressa ssi
gnme nt,DHCPa ll
owsac omput ertoob taina nIP
addressqui ckl
ya nddyna m- i
call
y.Tha tis,whe nc onfiguringaDHCPs erver,a
ma nagersup p
li
e sase tofI Pv4a d- dresses.Whene v
e rane wc omp ut
erc onnectsto
thene twork,t hene wc omp uterc ont actstheservera ndr eque s
tsa naddress.The
serverchoosesoneoft hea ddr es
s esf rom thesett hatt hema nagerspecif
ied,and
all
ocatesthea ddresstot hec omp uter .
Tob ec omp l
ete
lyg enera l
,DHCPa l
lowst hreetypesofa ddressassi
gnme nt:

S
tat
ic
Aut
oma
tic
Dyna
mic

Ama nagerchooseshow DHCPwi l


lr espondf ore ac
hne tworkandf ore ach
host.Likei tspredeces
sorBOOTP,DHCPa l
lowss tati
cc onfi
gurati
oni nwhi cha
ma nagerma nual
lyconfigur
esas peci
fica ddressforag i
venc omputer.DHCPa lso
permitsaf orm ofautomaticaddr
e s
sc onfigurati
oni nwhichama nageral
lowst he
DHCPs er
v e
rt oa ss
ignap ermanenta ddresst oac omputerwhe nt hecomp uter
firsta ttachest o the ne t
-work. Fi nall
y, DHCP p ermits dynamic address
config
ur a
t i
oninwhi chas erverl
oansa na ddre
sst oac omputerforal imited
time.Dyna micaddres
sa s
sig
nmentist hemos tp owerfulandnov elas
pectofDHCP.
ADHCPs e
rverus esthei denti
tyofac l
ienta ndac onfi
gurati
onf i
letode ci
de
how t op r
oceed.Whe n ac lie
ntc ontactsaDHCP s e
r v
er,t hecli
ents endsa n
ident
ifi
er,usual-l
yt hec l
ient
sha rdwarea ddr e
ss.Thes e
rverusest hec l
ient
s
ident
ifi
er(andt hene t
wor kov erwhi c
ht her equestarriv
es)tode te
rminehow t o
assi
gnt hecli
enta nI Pa ddress.Thus,ama nagerha scomp l
etecontroloverhow
address
esa r
ea ssi
gned.As erverc a
nb ec onfiguredtoa ssi
gna nIPv4a ddres
st o
one computers tati
call
y,whi l
ea l
l
owing ot herc omputerst o obt
aina ddress
es
automatic
all
yordyna mi c
a l
ly.Tos umma r
ize:

DHCPper mi
tsacomputertoobtai
nal
lthei nfor
mationneededto
communicat
e on a gi
ven net
work(i
ncluding an IPv
4 addres
s,
subnetmask,andt headdres
sofadef aultrouter)when the
computerboot
s.
Sec
.22.
7 DHCPLe
ase
sAndDyna
micAddr
essAs
sig
nme
nt
469

22.
7DHCPLe
ase
sAndDyna
micAddr
essAs
signme
nt

DHCP
sdyna
mica
ddr
essa
ssi
gnme
nti
ste
mpor
ary.Wes
ayt
hataDHCPs
erv
er
l
eas
esanaddr
esst
oac
li
entf
oraf
ini
tep
eri
odoft
ime
.Thes
erv
ers
pec
ifi
est
he
l
easeper
iodwheni
ta ll
oca
test
hea ddres
s.Duri
ngt helea
sepe
r i
od,thes
erverwil
l
notle
asethesa
mea ddres
stoanothercli
ent
.Att hee ndofthelea
seperi
od,the
cl
ie
ntmus tr
enewtheleas
eorstopusingtheaddr
es s
.
How l ongshoul daDHCPl easelast?Theop ti
ma ltimef oral e
asede pendson
thep articularne twor ka nd thene edsofap arti
cul
a rhost .Fore xa mp l
e,t o
guaranteet hata d-dre s
s e
sc anb erecycledqui c
kly,comp utersonane twor kus ed
bys tudent sinauni versi-
t ylaborat
or yc a
nha veas hortle a
s ep eri
od( e .
g .
,one
hour).Byc ontrast,ac orporat
ene twor kmi ghtus eal eas
ep e ri
odofoneda yor
onewe ek.AnI SPmi g htma k
et hedur ati
onofal easedep endonac ustome r
s
contract.Toa ccommoda tea l
lp ossi
bl
ee n-vi
ronme nts,DHCPdoe snots pe ci
fya
fixe
dc onstantf ort hel easep eri
od.I nstead,t hep rotocola l
lowsac li
e ntt o
requestas peci
ficl ea
s ep eri
od,a nda ll
owsas ervert oinformt hec l
ientoft he
l
e as
ep e r
iodi tgr ants.Thus ,ama nagerc and ecidehow longe achs er
v ers hould
all
ocatea na ddre
s stoac li
ent.Int hee xtreme,DHCPr eserv
e sav aluefori nfi
nity
top ermital e
aset olasta rbi
traril
ylong( i.e
.,t oma keap erma nenta ddre ssas-
si
gnme nt).

22.
8Mul
ti
pleAddr
ess
esAndRe
lays

Amul ti-homedc omp uterc onne ctst omor et hanonene twork.Whe ns uc ha


com-put erb oots,itma yne e
dt oob tai
nc onfi
g ura
t i
oni nfor
ma ti
onf oreac hofi ts
i
nt er
fa ces.Asweha ves een,aDHCPme ssageonlyp rovidesthecomp uterwi t
hone
IPv4a ddressa nd onlyp rovi
desi nformation (e.g.
,t he sub netma sk)f orone
networ k.TheDHCPde sig
nme ansac omp uterwi t
hmul tip
leinter
facesmus tha ndl
e
eachi nterfaces eparatel
y.Thus ,a l
thoughwede scrib
eDHCP a si fac omput e
r
needso nlyonea ddres
s ,ther eadermus tr e
me mbert hate achinter
f ac
eofamul ti
-homedc omp uterne edsitso wna ddr e
ss.Ifamul t
i-home dhostc hoosestos end
requestsonmul tipl
eint erfaces
,t heDHCPc li
entsof twa r
ef oreachinterfacema y
bea tadi fferentp oi
nti nt hepr otocol.
DHCPus est henot ionofar el
ayagentt op ermitac omputertoc ont ac
ta
serveronanonl ocalnetwor k.Whe nar el
aya ge nt
,t ypical
lyar outer,receivesa
broadcastrequestf rom ac l
ient,i tfor wardst her equestt oaDHCPs erv e
ra nd
returnsar epl
yt ha
ti ssentf r om theDHCPs ervert othehos t.Relayage ntsc a
n
comp l
ic
ate multi-home dc onfi-gur a
t i
on b e
c a
useas erverma yr e
ceive mul t
iple
requestsfr
om t hes amec omp ut e
r.Al thoughDHCPus esthet ermcli
entident i
fier,
we a ss
ume t hat a mul ti-home dc l
ient sendsa di ffer
ent identi
fierf or ea c
h
i
nt er
face(e.g.,auni queha rdwa rea ddressfore achint e
rface).Thus,aser verwi l
l
alwaysb ea
blet odistinguis
ha mongr equest
sf rom amul ti-homedhost,eve nwhe n
t
hes
erv
err
ece
ive
ssuc
hre
que
stsv
iaar
ela
yag
ent
.
47
0 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) Chap.22

22.
9DHCPAddr
essAc
qui
si
ti
onS
tat
es

Wheni
tus e
sDHCPt oob
tai
nanIPv
4a ddre
ss,acl
ie
ntisi
noneofsi
xst
ates.
Thestat
etransi
tiondi
agr
aminFi
gur
e22.3showseve
ntsandmes
sag
est
hatcaus
e
acli
enttochangestat
e.

Hos
tBoot
s
I
NITI
ALI
ZE

/DHCPDISCOVER

DHCPNACK DHCPNACK
S
ELECT
or
Leas
eExpi
res

Leas
eReac
hes
DHCPOFFER
87.
5%Expirat
ion/
DHCPREQUES
T
REBI
ND RENEW
Sel
ectOf
fer/
DHCPREQUES
T

DHCPACK

REQUES
T DHCPACK

Leas
eReaches
50%Expi
ration/
DHCPACK DHCPREQUES
T

BOUND
Canc
elLeas
e/DHCPRELEASE

Fi
gur
e22.
3Thes ixmainsta
tesofaDHCPc li
entandtransi
tionsa
mong
the
m.Ea c
hl a
belonat r
ans
iti
onlist
stheincomingme s
sage
oreventthatcaus
esthetrans
missi
on,fol
l
owe db yas l
ash
andthemessa
gethecl
ie
ntsends.

Whe nitf ir
s tb oots
,aDHCPc li
ente nt
erst heINITIALIZE s
tate.Tos tart
acquir
inga nIPv4a ddress
,thec l
i
entf i
rstcontactsal
lDHCPs e
rversintheloc a
l
net.Todos o,t hec li
entbroadcastsaDHCPDI SCOVERmess a
gea ndmov e
st ot he
st
a telabel
edS ELECT.Bec auset hep r
otocoli
sa ne xt
ensi
onofBOOTP,t hecli
e nt
se
ndst heDHCPDI SCOVER mes sa
g einaUDPda ta
gram wit
ht hedesti
nat
ionp ort
s
ett
othe
S
ec.22.
9DHCPAddr
essAc
qui
si
ti
onS
tat
es 471

BOOTPport(i.
e.,p
ort67).Al
lDHCPserve
rsont
hel oca
lne tr
e c
eiv
etheme s
sage,
andthos
es e
rverstha
thavebeenprog
rammedtorespondt othepart
icula
rc l
ie
nt
sendaDHCPOFFERme s
sag
e.Thus
,ac l
ie
ntmayrece
iveze r
oormor eresponse
s.
Whi lei ns ta
teS ELECT,t hec l
ientc ol
lec
tsDHCPOFFER r esp
onse sfrom DHCP
s
ervers.Ea chof fercontai
nsc onf i
gurationinformati
onf ort hec l
ienta l
ongwi th
a
nI Pv4a ddressthatthes erverisoff e
ringtol e
asetot heclient.Thec li
e ntmust
c
hooseoneoft her es
ponses( e.
g .
,t hef i
rstt oarri
ve),andne gotiat
ewi ththe
s
erverf oral eas
e.Todos o,thec li
ents endstheserveraDHCPREQUES Tmes s
age
a
nde nte rst heREQUES Ts tate.Toa cknowledger e
cei
ptoft her equesta nds t
art
t
he le ase,t he serverr es
ponds b y se ng a DHCPACK. Ar
ndi ri
val of t he
a
cknowle dgeme ntcausesthec li
entt omov et otheBOUNDs t
a te,whe ret hecli
ent
p
roceedst ouset headdres
s .Tos umma ri
ze:

Tous eDHCP,ahos tbecomesac li


entbybroadcas
tingames s
age
toallserver
sont heloc
alnetwork.Thehostthenc ol
l
ect
sof fer
s
fr
om s er
vers,sel
ect
soneoft heoffer
s,andv eri
fi
esaccept
ance
wit
ht heserver
.

22.
10Ea
rlyLe
aseTe
rmi
nat
ion

Wet hinkoft he BOUND s tatea st heno rmalst ateofop erat


ion;ac li
ent
typi
cal
lyr ema insint heBOUNDs tatewhilei tuse stheI Pa ddressitha sacquired.
Ifac l
ie
ntha ss ec
onda rystorage(e.g.
,al ocaldisk)
,t hecli
e ntcans t
or etheI Pv 4
addre
ssitwa sa s-
signed,andr equestthes amea ddresswhe ni trestartsagain.I n
somecase s,howe ver,ac l
ientint heBOUNDs tat
ema ydi s
cov e
ritnol ong erne e
ds
anI Pa ddr ess
.Fo re x
amp le
,s upposeaus era ttac
he sal apt
opc omp utert oa
network,us e
sDHCPt oa cqui
rea nI Pa d- dres
s,a ndt henus est hec ompute rt o
readelectronicma il
.Thep rotocolspec
ifiest hatal ea s
emus tlastami ni
mum of
onehour ,whi chma yb elongertha ntheus e rneeds.
Whe nana ddressisnol o ngerne e
de d,DHCPa l
lowsac li
entt otermi
natet he
l
eas
ee arl
ywithoutwa i
tingf ort heleaset oexpi
re.Ea r
lytermina
t i
onisesp
e c
ial
ly
i
mportantifthenumb erofI Pa ddres
s esas e
rverha savai
labl
ei smuchs mall
er
t
hant he numb er of comp ut e
rst hata tta
cht ot he network.I feachc l
ient
t
erminatesi
tsleasea ssoona st heI Pa ddres
sisnol ongerneeded,these
rverwi l
l
b
ea bl
et oas
sig
nt hea ddr e
sst oa notherc l
ie
nt.

Tot er
mina t
eal eas
ee ar
ly,ac li
ents endsaDHCPRELEAS E mess
aget ot he
ser
v er
.Re l
eas
inga naddres
sisaf ina
la cti
ont hatprev
entsthecli
entfrom using
thea ddr
essf urthe
r.Thus,a ft
ert ransmit
t i
ngt herele
aseme s
sage
,t hec li
ent
mus tnotsenda nyotherdatagramsthatus et headdr
ess.Intermsoft hestate
transi
ti
ondiagram ofFigure22.3,ahos tt hatsendsaDHCPRELEASEl eav
est he
BOUNDs tat
e,a ndmuststartattheINI -
TIALIZEs ta
teagainbe
foreitcanus eIP.
47
2 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) Chap.22

22.
11Le
aseRe
newa
lSt
ate
s

Wes ai
dt hatwhe ni ta cq uiresa na ddress,aDHCPc l
ientmov e
st ot heBOUND
state.Up one nteri
ngt heBOUND s tate,t hec l
ie
nts e
t st hr eetime rst ha tc ontrol
l
e asere newa l
,r ebi
ndi ng,a nde xp irati
on.ADHCPs erverc ans peci
fye x pli
c i
tv alues
fort het i
me rswhe ni ta ll
oc a tesa na ddre sst othec l
ient ;ift hes erv erdoe snot
specifyt ime rv al
ues,t hec l
ie ntus esde faults.Thede faultv a l
uef ort hef irst
timeri sone -halfoft het ot all easet ime .Whe nt hef ir
stt imere xpires,t hec l
ient
mus ta t temptt or ene wi tsl ease .To r eque s
ta r ene wa l,t he clients e ndsa
DHCPREQUEST mes sa g et ot hes e rverf rom whi cht hel easewa sob taine d.The
cl
ientt henmov estot heRENEW s tatet oa wa i
tar esp
ons e.TheDHCPREQUES T
conta i
nst heI Pa ddr esst hec l
ie nti sc ur rently using,a nda skst hes er ve rt o
extendt hel eas
eont hea ddr e ss.Asi nt hei niti
all easene g otia
- ti
on,ac li
e ntc an
reque s
tap eri
od f or t he e x t
e nsion,b ut t he s e
rv er ul ti
ma tel
yc ont rolst he
rene wal.As e
rverc a
nr e spondt oac l
ientsr enewa lreques ti noneoft wowa ys:it
cani nstruc tthec l
ientt os topus ingt hea ddr e
ssori tc a
na ppr
ov econt inue dus e.
Ifi tap proves,thes e rve rs endsaDHCPACK,whi chc aus e
st hec li
entt or et ur nt o
theBOUND s tateandc ont inueus ingt hea ddress.TheDHCPACKc ana l
soc ont ain
newv aluesf ort hec lient
st ime rs .Ifas e rverr ejec
t scont i
nue dus e,t hes erver
sendsaDHCPNACK( neg ativea cknowl edge me nt)
,whi chc aus est hec lientt os top
usingt hea d-dressimme diatelya ndr eturnt otheI NITI ALI ZEs tate.
Afters e nga DHCPREQUES
ndi T mes saget hatr eque s
tsa ne xt
ension on i ts
l
e a
se,a c l
ientr ema i
nsi ns t ae RENEW a
t wa it i
ng a r esponse.I fno r e
sp onse
arri
ves,t hes ervert hatg rant edt hel eas
ei se itherdown orunr eacha bl
e.To
handl
et hes ituation,DHCPr e-l
iesonas econdt imer,whi chwa ssetwhe nt he
cl
iente nter edt heBOUND s t
a te.Thes ec
ondt i
me re xpiresaf t
er87. 5% oft he
l
e a
sep eriod,a ndc a
us e
st hec li
entt omov ef r
o ms taeRENEW t
t os t
ateREBI ND.
Whe nma k i
ngt het r
ansiti
on,t hec l
i
enta s
sume st heol dDHCPs erverisuna vai
la bl
e,
andb egi
nsb roadca s
tingaDHCPREQUES Tmes sag et oa nys erveront hel ocalne t.
Anys erverc onfiguredt op rovideservicetot hec li
entc a
nr esp
ondp ositi
v el
y( i.e.
,
toe xte
ndt hel e
a s
e )
,orne g
a tive
ly(i.e.tode nyf urtherus eoft heIPa ddr es
s ).If
i
tr ecei
ve sap osi
tiver esp
ons e
,t hec li
entr eturnst otheBOUNDs tate,a ndr esets
thet wot i
me rs.Ifi tr ecei
vesane g a
tiver e
s pons e,thec li
entmus tmov etot he
INITIALIZEs tate,mus timme dia
telys topusingt heI Pa ddress,andmus ta cquire
ane wI Pa ddr es
sb eforeitc anc onti
nuet ous eI P.
Af
termov ingtot heREBI NDstate
,ac li
entwillhaveaskedtheorig
inalser
ver
p
lusal
lse r
versont hel oca
lne tforal easeextension.Int herar
ec asethata
c
li
entdoesnotr ece
ivear esponsefrom a
nys erve
rb e f
oreitsthi
rdtimere x
pires
,
t
heleas
ee xpir
e s
.Thec li
entmus tstopusingtheI Pa ddre
ss,mustmov eb ac
kt o
heI
t NITIALIZEstate,andmus tacquir
eane wa ddress.
S
ec.22.
12DHCPOp
tionsAndMe
ssa
geTyp
e 473

22.
12DHCPOp
tionsAndMe
ssa
geTyp
e

Sur
pri
si
ngly,DHCPdoe snotall
ocatefixe
df i
el
dsint hemessa
gehe a
derfor
t
heme s
sag
et ypeorle
aseinformat
ion.Inst
ead,DHCPretainst
heBOOTPme ss
age
f
ormatandusestheOPTIONSf i
el
dt oident
ifythemessa
gea sDHCP.Fi
gure22.4
i
l
lus
trat
estheDHCPme s
sagetypeoptionthatspeci
fi
estheDHCPme s
sagebei
ng
s
ent.

0 8 1
6 23
CODE(
53) LENGTH(
1) TYPE(
1-8)

TYPEFI
ELD Cor
res
pondingDHCPMe ssa
geTyp
e
1 DHCPDISCOVER
2 DHCPOFFER
3 DHCPREQUEST
4 DHCPDECLINE
5 DHCPACK
6 DHCPNACK
7 DHCPRELEASE
8 DHCPINFORM

Fi
gur
e22.
4Thef ormatofaDHCPop
tionus
edt os
peci
fyt heDHCPmes
-s
agetypewithal
is
tofthepos
sib
leva
lue
sf orthethi
rd
oc
tet.

Over200 OPTIONShaveb eende fi


nedf orus einaDHCPr epl
y;eac
hha sa
typea nd le
ngthf i
eldthatt oge
the r de
termine the si
ze of t
he opti
on.The
assi
gnmentsa r
es omewhat hapha
za rdb e
causev endorsusedv a
luesthatwe re
ini
ti
all
yr ese
rved.Asitas-s
ignedc odes,theI ETFde c
idedtoavoidconfl
ict
sb y
avoi
dingcodesthattheve
ndorswe reusing.Fig
ur e22.5li
stsafewofthep oss
ibl
e
opti
ons.

Item Item Length Contents


Type Code Oct
et ofVa l
ue
Subnetma sk 1 4 Subnetmaskt ouse
Routers 3 N IPv4addres
sesofN/ 4router
s
DNSS erve
rs 6 N IPv4addres
sesofN/ 4serv
ers
Hostname 12 N Nb yt
esofc li
enthostname
BootSize 13 2 2-oct
etintegersi
zeofbootf i
le
Defaul
tI PTTL 23 1 Val
uef ordatagr
amTTL
NTPS erver
s( t
ime) 42 N IPv4addres
sesofN/ 4serv
ers
MailServer
s( SMTP) 69 N IPv4addres
sesofN/ 4serv
ers
WebS ervers 72 N IPv4addres
sesofN/ 4serv
ers
Fi
gur
e22.
5Ex a
mp l
esofOPTI
ONSt
hatc
anb
epr
ese
nti
nanI
Pv4DHCP
r
eply.

Becaus
ee a
chI
Pv4a
ddr
essoc
cup
ies4oc
tet
s,af
iel
dofNoc
tet
shol
dsN/4I
Pv4
addr
esses
.
47
4 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) Chap.22

22.
13DHCPOp
tionOv
erl
oad

Fi
eldsS ERVERHOSTNAMEandBOOTFI LENAMEi nt heDHCPme ss
agehe a
de r
eac
hoc cup yma nyocte t
s.Ifagive
nme s
sagedoe snotc onta
ini nf
ormat
ionine i-
theroft hosef i
el
ds,t hesp
aceiswa s
ted.Toa ll
ow aDHCPs ervertousethet wo
fi
eldsforot herop t
ions,DHCPdefinesanOp ti
onOv er
loadopti
on.Whe npresent,
theov e
r -
loadop t
iont el
lsarece
ivertoi g
noret heus ualmeaningoftheS ERVER
HOST NAME and BOOT FI LE NAME f i
el
ds,a nd look forop t
ionsint he fi
elds
i
nstead.

22.
14DHCPAndDoma
inNa
mes

Althoughitc ana l
locat
ea nI Pa ddresstoac omputeronde mand,DHCPdoe s
notc omp l
etel
ya utoma teallthep r
oc edur
e srequiredtoa t
t ac
hap erma ne
nthost
toani nter-net.Inp arti
cul
a r
,theDHCPp rot
oc oldoesnots pe
cifyanyi ntera
cti
on
wit
ht heDoma inNa meS ystem( DNS).Thus ,unl es
sa na ddi
tiona
lme chani
smis
use
d,t hebindi
ngb etwe enahos tnamea ndt heI Paddres
sDHCPa s s
ignsthehost
wil
lre mainindepen-dent.
Des
pitet helackofas tandard,s omeDHCPs erversdoindeedinter
a ctwith
DNSwhe nt heya s
sig
na na ddres
s.Fore xampl
e,Unixs ys
temssucha sLi
nuxorBS D
ar-ra
ngef orDHCP t ocoor di
natewi tht heDNSs oft
wa r
e,whi chisk nown as
namedbindors implybind.Similar
ly,t heMicrosoftDHCPs oftwarecoordinate
s
withtheMic r
o s
oftDNSs oftwa r
et oe nsureahos tthatisassi
gnedaDHCPa ddres
s
als
oha sadoma inna me.Thec oordinati
onme chanismsa l
sowor kinr everseto
ensurethatwhe naDHCPl ea
seisr evoked,aDHCPs ervernoti
fi
e sDNStor ev
oke
thecorres
pondingna me.

22.
15Ma
nage
dAndUnma
nage
dConf
igur
ati
on

Therearetwob
r oa
da ppr
oa c
hestoconf
igur
ationofnet
workdev
icesthat
hav
ec onse
quenc
esfor bot
ht he ne
tworkinfras
truc
tur
ea nd c
onf
igura
tion
pr
otocols
.

Ma
nag
ed
Unma
nag
ed

Managed.A managed s ys
tem r e
quir e
s network oper
ator st oi nstalland
confi
gures er
vers
.Whe nac omp ute
rj oi
nsane twork,thec omp uterc ontact
sa
confi
gurati
ons e
rvertoobtaininformati
ona b
outa ddr
essi
ng,r outing
,a ndother
servi
ces
.Althoughiti
sdiff
i-cul
tt oenvis
ionma nagedserv
ice
si nt heabstr a
ct,our
dis
cussi
on ofDHCP ma ke
st hec onceptc le
arb e
causeDHCP i sof ten us edasa
canoni
calexampl
eofma nagedconfi
-guration.
Unmanaged.Anunmanageds
yst
em doesnotr equi
reanetworkma nage
rto
a
ssi
gna ddress
esnor doe
si tre
qui
rec onf
igurat
ion s
erv
ers
.I ns
tead,whe na
c
omputerjoinsanetworkthecomput
erg ener
atesauniqueaddres
s,a ndthe
n
us
est
hea
ddr
esst
ocom-

Chapt
er23consi
der
stheDomai
nNa meSys
temin
det
ail
.Thet
e m na
r medi
sshor
tf orna
medaemon.
S
ec.22.
15 Ma
nag
edAndUnma
nag
edConf
igur
ati
on 475

municate.Theorigi
nalAppleTal
kprotocolil
lustrate
sa nunmanagedsyst
em:whe n
i
tj oinedane twork
,ac omp uterusedar andom numb ergenerat
ort ochoos
ea n
address,andthenbroadc
as tame s
sagetov erif
yt hatt headdres
swa snotalr
eady
i
nus e.Ifanothercomputerwa salre
adyus ingt hea ddr
ess,ane wrandom val
ue
wass el
ectedunti
launiquea ddr
esswa sfound.Noot herconfi
gurat
ionwasneeded
becauseservi
ceswerereachedbyb r
oadcasti
ngr equests.
Eacha pproacht oc onfigurati
on ha sa d
vanta ge
sa nd di s
a dvant age s
. An
unma nagedne t
wor kha sthea dvantagesofnotr equiri
nghuma nst oc onf igureand
operateas eto fs erve
r s
.Thus ,c omput er
sa ndot herde v
ice
s( e.g.,p rinter s
)can
attacha ndc ommuni c
atea utoma tic
a l
l
y.Unf ortunate l
y,theunma nag eda pproac
h
als
oha sdi sa
dv antages
.Ra n-
dom a ddre s
sa ssi
gnme ntc anleadt oc onf li
ctsi fa
comp ut
eri st emporari
lydi sc
onne ctedorb usywhe nane wc omput erj oinsand
choosesthes amea ddress
.Fur thermor e,ast henetwor ksi
zeinc r
ea se
s ,t heus eof
broadcas
tb ecome sap robl
e ma nunma nageda p-proachcanwor ka cr ossas i
ngl
e
network,b utnota crosstheg lobalInternet.
Amanagedapproachhast hec hi
efadva
ntageofg iv
inge ac
hne tworkowne r
com-pl
etecont
rolove rthec omputersanddevi
cesthata tt
acht othene twork.
Networkmanager
sus ual
lypre f
ert hemanag
eda ppr
oachb e
causeak nowledge
ab l
e
sta
f fi
sr e
-qui
redf orot hert as
ksa ndac onf
igurat
ion ser
verc a
nb er un on
hardwa
rewithotherservers
.

22.
16Ma
nage
dAndUnma
nage
dConf
igur
ati
onForI
Pv6

Whe nI Pv6wa sfirste nv is


ioned,t hede si
g nerst houg hta boutas pecialcase:
t
woI Pv6hos tst hatc onne c
twi thouta nys erversont hei
rne twork.Fore xample,
c
onsi
dert woI Pv6mob il
ede v ice
st hatha veWi -Ficapa bili
ty.Thede sig
nerst hought
i
tshouldb ep os
s ib
lefort hede vic
est oc ommuni catedi r
ectlywi thoutr equiringa
b
asestat i
ona ndwi thoutr equiringas ervert oha ndouta ddr ess
es.Conse quently,
t
hede signersa dopteda n unma nageda ppr
oa chi n whi cha ddressa ss
ignme nti s
a
utoma t
e d.Theyus et het ermI Pv6s tatel
essaut oconf igurationt ode scri
b ethe
I
Pv6a ddressa l
l
oc ati
ons cheme .Whe n-everahos tj oinsa nunma nagedne twor k,
t
hehos te mp l
oyss t
at el
essa utoconfigurati
ont og ene r
atea nI Pv6a ddr es
sa nd
b
egi
n c ommunic ati
on. Thus ,s tat
elessa ut oconfi
g ur ati
on me ans hos tsc a n
c
ommuni catewit houtr equiringas er
v e
rt oha ndouta ddresses.
Manyma nagersobjec
tedt os t
a te
lessautoconfi
gurati
on.Networkoperators
whoma nagel arg
ec omme rc
ialISPne tworkswe reespeci
al
lydis
appoi
nted.Becaus
e
theyma na
g ef or
- p
rofi
ts ervi
cesthatc harg
ec ustomersfornetworkconnec
tions,
theoperatorswa ntedcontroloverwhic hhost
sc onnec
tt othei
rne t
wor k(
i.
e.,to
excl
udenon- customers
).I np ar
tic
ular,t heoperator
swa ntedama na
gedservic
e
thatwouldg i
v ethemcontrolovera ddressas
sig
nme nt.
Inte r
msofma nagedaddressass
ignments e
rvi
ces
,DHCPi swidel
yacc
epteda s
t
heindustrystandard.Net
wo r
kop e
ratorsli
keDHCPb ec
auseitgivesanoperat
or
p
reci
sec ontr
olov erhow a ddres
sesarea ss
igned.Inpart
icul
ar,ama nage
rc an
c
hoos
et hea s-
signmentpol
icyonahos t-b
y-hostbasi
sbypre-as
signi
ngafixedIP
a
ddres
stoag iv
enhos
tora
ll
owi
ngt
hehos
ttoob
tai
nana
ddr
essf
rom ap
ool
a
utomati
cal
l
y.
47
6 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) Chap.22

22.
17I
Pv6Conf
igur
ati
onOp
tionsAndPot
ent
ialConf
li
cts

Tosati
sfynetworkoperat
orswhowa ntama na
g eds
oluti
onandindi
vidual
s
whowanttobea b
letoc r
eatead-hocnetwor
ks,t
heI ETFdeci
dedt
oe ndor
set wo
ap
proa
chestoIPv
6a ddr
essconfi
gurati
on:

Ma
nag
edv
iaDHCPv
6
Unma
nag
edv
ias
tat
ele
ssa
utoc
onf
igur
ati
on

Managedv i
aDHCPv 6.A new versi
onofDHCPha sb ee nc rea
tedf orI Pv6.
NamedDHCPv 6,t henewv e
rsi
onisconceptuall
ys imil
artot heor igi
nalDHCP.Li ke
theorigi
na l
,f ore xampl
e ,thenewv ersi
onr e
quiresas ervert ob ea va
il
a blef or
eac
hne t-worka ndrequiresahosttoc ont
a ctt heserve
rt oob tainanI Pa ddr e
ss.
However,b e-
c auseIPv6doe snotsupportb r
oa dcast
,ahos tc annotus ebroa dcast
toreachaDHCPv 6serverthesamewa ya nI Pv4hos tbroadcastsaDHCPr e quest.
Ins
tead,I Pv6a l
lowsahos ttogenerateal i
nk -l
ocaladdressa ndus elink -l
ocal
multi
cast
,whi chi seffe
ct i
vel
ythesamea sa nIPv 4limi
tedb roadcast
.
Unf ortunat el
y,DHCPv 6iss ubsta
nt i
all
ymor ec omplext hanDHCP.Li k emos t
ofI Pv 6,DHCPv 6t ri
estoa cc
ommoda t
ea llposs
ibi
li
ties
.DHCPv 6c omplete
lyc hanges
thef orma tofme s
sagesanda ddss ev
er a
lne w messaget ypestha tg i
vea ddit
ional
func tionali-
ty.Fo re xample
,t hes pec
ific
a ti
ona owsp
l
l r
ef i
xdelegat i
oni nwhi cha
serverde legatesas etofp refi
xe stoa notherserver(e.g.,t oahomer outerf or
ass
ig nme ntt ode v
icesi
nt hehome )
.Someoft heincreasedc omp le
xityarisesfrom
theI Pv 6p r
ov i
sionthatall
owsahos tt ous emultip
lene tworkp r ef
ixesonag iven
int
e rf ace.Ot hercomp l
exi
tya ri
sesb e-
causeDHCPv 6a l
lowsf ora uthentic
a t
ion.The
resulti st hatt heRFCt hatde fi
nesDHCPv 6isovertwicet hes i
zeoft heRFCt hat
define sDHCP.
Unmanagedv iast ateles
saut oc onfiguration.Wes a i
dt ha
ti nI Pv6,stat
eless
a
uto-confi
g urati
onr ef e
r stot heme thodofa ddr es
sc reationf ora nunmanaged
l
i
nk.S tat
ele s
sa utoc
onf igurationr eli
e sont heI Pv6Ne i
ghborDi scoveryProtocol
NDP)des
( cribedint hene xts ection.Wewi l
ls e
et hatNDPp rovide smuchmor e
f
uncti
onali
t yt hanma nag edaddr essc onfiguration.Howe v e
r,whe nc ompari
ngNDP
t
oDHCPv 6weonl yne edt oc onsidert heb asics:withoutus i
ngac onfi
gurati
on
s
erver
,ahos tc angene ratea nI Pv6a ddr essandv e
rif
yt hatthea ddressi
sunique
(
i.
e.,noot hernodeont hene twor ki sus ingt hes amea ddress)
.
Theus eoft woapproachesforI Pv6c onfi
gurati
onl eadstoque sti
ons.I sone
ap-proac
hp referredoveranot he
r?Ca nag ive
nhostus eb otha p
proaches?I fboth
areus e
da ndt her es
ulti
ngI Pv6a ddres
sesdi f
fer,shouldt hehostr eta
int het wo
IPv6a ddres
s e
sors hould onea ddressb edi s
conti
nue d? Thes tandardsdo not
spe
cifyp referencesorhow t oha ndl
ea ddressconfli
cts.I ns
tead,t hestandards
merelyprovidet woalte
rnativetech-nol
og i
es.Wec ans umma ri
ze:

IPv6s tandardsinc
lude s
chemesf or managed and unmanaged
addres
s as s
ignment
. The standards do not specify whichis
pref
erredorhowt ohandl
esituati
onswher econf
lict
sarise.

Di
rec
tcomp
ari
sonoft
heRFCsf
orDHCPa
ndDHCPv
6iss
ome
wha
tunf
airb
eca
uset
heDHCPv
6
s
pec
ifi
cat
ioni
ncl
ude
ssomeoft
heop
tions
.
S
ec.22.
17 I
Pv6Conf
igur
ati
onOp
tionsAndPot
ent
ialConf
li
cts 477

22.
18I
Pv6Ne
ighb
orDi
scov
eryPr
otoc
ol(
NDP)

IPv sNe
6 i
ghborDisc
overyProtoc
ol(NDPorI Pv6-ND)inc
ludeslow-lev
elf unc-
tional
itys ucha s La
ye r2 a ddres
sr esol
uti
on a nd hostr edir
ect me ss
a g
es.
The r
e fore,itma yseemt hatNDPb el
ongsinearl
yc hapt
ersoft het ex
t.Howe ver,
the dis c
ussion hasb e
e n de
laye
d untilthischapterbecaus
e NDP a l
soincludes
functionali
tyf r
om hig
he r
-la
yerp r
otocol
s.Spec
ifi
cal
ly,NDPp rovide
same chanis
m
fora ddressc onfi
gurat
ion.
NDPoperatesatLa
yer3byusingI
CMPv
6me
ssa
ges
.Thef
oll
owi
ngl
i
stst
he
ma
-jorfunc
tionstha
tNDPpr
ovi
des
:

Rout
erDi
scov
ery:ahos
tca
nide
nti
fyt
hes
etofr
out
ersona
g
ive
nli
nk
Next
-hopRout
es:ahos
tca
nfi
ndt
hene
xt-
hopr
out
erf
ora
g
ive
nde
sti
nat
ion
Nei
ghborDi
scov
ery:anodec
ani
dent
ifyt
hes
etofnode
sona
g
ive
nli
nk
Nei
ghborUnr
eac
habi
l
ityDet
ect
ion(
NUD)
:anod
emoni
tor
sit
s
nei
ghbor
sc ont
inuous
lyt
ole
arn whe
n a ne
ighb
or b
ecome
s
unre
ach-ab
le
Addr
ess Pr
efi
x Di
scov
ery: a hos
tca
nle
arnt
he ne
twor
k
p
ref
ix(
es)b
eingus
edonal
i
nk
Conf
igur
ati
on Par
amet
er Di
scov
ery: a hos
tca
n de
ter
mine
p
ara
me-
ter
s,s
ucha
stheMTUus
edonag
ive
nli
nk
St
atel
essAut
oconf
igur
ati
on:ahos
tca
nge
ner
atea
naddr
ess
f
orus
eonal
i
nk
Dupl
i
cat
e Addr
ess Det
ect
ion (
DAD)
:a node c
an de
ter
mine
whe
the
rana
ddr
essi
tge
ner
ate
sisa
lre
adyi
nus
e
Addr
essRes
olut
ion:anodec
an ma
panI
Pv6a
ddr
esst
oan
e
qui
val
entMACa
ddr
ess
DNSSer
verDi
scov
ery:anodec
anf
indt
hes
etofDNSs
erv
ers
onal
i
nk
Redi
rec
t:ar
out
erc
ani
nfor
m anodea
boutap
ref
err
edf
irs
t-
hopr
out
er.

Toa
chi
evet
hea
bov
e,NDPde
fine
sfi
veI
CMPv
6me
ssa
get
ype
s:

Rout
erS
oli
ci
tat
ion
Rout
erAdv
ert
ise
ment
Ne
ighb
orS
oli
ci
tat
ion
Ne
ighb
orAdv
ert
ise
ment
Re
dir
ect
47
8 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) Chap.22

Ins
tead of de
f i
ning a uni
que mess
aget yp
ef or eac
h of t
he functi
ons
desc
ribe
da bove,NDPus esac ombi
nati
onoft hef i
veI CMPv6mess
aget yp
est o
achi
evee a
chf unc
tion.Thef oll
owi
ngsecti
onsdisc
usse achofthef i
veme s
sage
types
.

22.
19I
CMPv
6Rout
erS
oli
ci
tat
ionMe
ssa
ge

Ahos
tsendsaRouterSoli
ci
tat
ion mes
sag
et op r
omptr
out
erst
ore
spond.
Fi
gur
e22.
6il
l
us t
rat
est
hef or
matofaRout erSol
i
cit
ati
on.

0 8 1
6 24 31
TYPE(
133) CODE(
0) CHECKSUM
RESERVED
OPTIONS
.
.
.

Fi
gur
e22.
6Thef
orma
tofa
nICMPv
6Rout
erS
oli
ci
tat
ionMe
ssa
ge.

Ifanodealr
eadyknowsi
tsI Paddre
ss,theOPTI
ONSf
iel
dcont
ainst
henode
s
MACaddr
ess(c
all
edali
nkl
ayeraddr
essinI
Pv6)
.

22.
20I
CMPv
6Rout
erAdv
ert
ise
mentMe
ssa
ge

Ar outersnds a Rout
e er Adv
erti
sement mess
agep e
riodi
call
y or when
promptedbyaRout erSol
ic
ita
t i
on.Theme s
sageal
lowsaroutert oannounceits
pres
enceont henet-workandi tsava
il
abi
li
tya sanodethroughwhi choff-l
i
nk
traff
icc anb efor
wa r
ded.Fi g
ure 22.7ill
ust
ratesthe f
orma t of a Router
Adverti
sement
.

0 8 1
6 24 31
TYPE(
134) CODE(
0) CHECKSUM
CUR.HOPLI
MIT M O RES
ERVED ROUTERLI
FETI
ME
REACHABLETI
ME
RETRANSMITTIME
OPTIONS
.
.
.
Fi
gure22.
7Thef
orma
tofa
nICMPv
6Rout
erAdv
ert
ise
ment
mess
age
.
Se
c.22.
20 I
CMPv
6Rout
erAdv
ert
ise
mentMe
ssa
ge
479

TheCUR.HOPLIMITs pe
cifi
esav al
uethattheshoul
db eusedastheHOP
LI
MITine ac
houtgoi
ngdatagram,theM b i
tspeci
fi
eswhetherthenet
workis
us
ingmana
gedaddr
essas
sig
nme nt(i
.e.
,DHCPv6)
,andt heObitsp
eci
fi
eswhet
her
otherconfigurati
oni nf
ormationisavai
lab
lev i
aDHCPv 6.Ift heroutercanb eused
asade f
aultr outer,theROUTERLI FETIMEf iel
dg ive
st hea mountoft i
met he
routerc anb eus edi nseconds.Fied REACHABLE TI
l ME s pe
cifi
eshow l ong(in
mill
is
econds)ane ighborrema i
nsreachabl
ea fte
rt hene i
ghborha sresponded,and
fie
ld RETRANS MIT TI ME sp e
cif
ies how f requentl
yt or etrans
mit Ne ig
hbor
Soli
ci
tati
onme ssa
ge s
.Possib
leop t
ionsinc
ludet hes e
ndersMACa ddres
s,t heMTU
usedont hel i
nk,andal is
tofoneormor eI Pv6p r
efixe
sus e
dont heli
nk.

22.
21I
CMPv
6Ne
ighb
orS
oli
ci
tat
ionMe
ssa
ge

Anodes endsaNeighborSoli
ci
tati
onmessag
efortworeas
ons
:toob
tai
nthe
MACa ddressofane i
ghbor( t
heI Pv6equi
val
entofARP)andtotes
twhet
hera
nei
ghbori sstil
lrea
cha b
le.Figure 22.
8ill
ustr
ate
sthe f
ormatofa Nei
ghb
or
Sol
i
citat
ion.

0 8 1
6 24 31
TYPE(
135) CODE(
0) CHECKSUM
RES
ERVED

TARGETI
Pv6ADDRES
S

OPTI
ONS
.
.
.

Fi
gur
e22.
8Thef
orma
tofa
nICMPv
6Ne
ighb
orS
oli
ci
tat
ionme
ssa
ge.

Fi
eldTARGETI Pv6ADDRESSgive
st heIPaddre
ssofane i
ghborforwhicha
MACa ddre
s si
sne e
de d.I
fthesenderalr
eadyhasanIPaddr
ess
,t heOPTIONSfie
ld
i
n-cl
ude st
hes endersMACaddres
ssot herec
eiv
erknowsthesender
sIP-to-
MAC
ad-
dr e
ssbindi
ng.
480 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) Chap.22

22.
22I
CMPv
6Ne
ighb
orAdv
ert
ise
mentMe
ssa
ge

Anodes endsaNe i
ghborAdvert
isementmessa
gei
nr e
spons
etoaNe i
ghb
or
S
oli
ci
-ta
tion messa
g eort op ropa
gater eac
hab
il
it
y.Fi
gur
e22. 9il
l
ust
rat
esthe
f
ormatofaNe ighborAdverti
seme
nt.

012 8 1
6 24 31
TYPE(
136) CODE(
0) CHECKSUM
RSO RES
ERVED

TARGETI
Pv6ADDRES
S

OPTI
ONS
.
.
.
Thef
orma
tofa
nICMPv
6Ne
ighb
orAdv
erti
sement
Fi
gur
e22.
9 messa
ge.

TheRb itindi
c a
te sthatt hes enderisar outer
,t heSb i
tindi
c at
esthatthe
a
dverti
se-
menti sar esponset oaNe ig
hborS oli
ci
tati
onme ssa
ge,a ndtheO b i
t
i
ndi
catesthatin-forma ti
onint heme ss
ageshouldov e
r r
ideanyinformat
ionthat
t
her e
ceiv
erhasp revi
- ousl
yc a
c hed.Despi
teitsname ,fie
ldTARGETI Pv6ADDRESS
g
ive
st heIPa ddressoft hesende r(thesenderwa st hetargetoft heNeig
hbor
S
oli
ci
tati
onme ssag
et hatp r
omp t -
edt headverti
sement).TheOPTIONSf i
eldgiv
es
t
hesender
sMACa ddre s
s.

22.
23I
CMPv
6Re
dir
ectMe
ssa
ge

Ar outersendsa Redi
rec
t messageforexa
ctl
yt hesa
mer eason a
nI Pv
4
r
outersendsanI CMPredir
ect
:t orequestahos
ttoc ha
ngeit
sf i
rsthopf ora
s
pec
ifi
cde s
tina
-ti
on.Fi
gure22.10il
l
ustrat
esthef
ormatofaRedir
ectmessag
e .
Ase xpec
t ed
,aRe di
rectme ssagespec
ifi
est woIPv6addresses
:ade s
tinati
on
andt hea ddr
e s
sofaf irs
tho pt ouse.Typica
lly,aRedi
rectme ss
agei spromp t
ed
whenar outerr ec
eivesada tagra
mf rom ahos tonadirectl
y-connectedli
nka nd
ther outerfindsthatt hede st
inati
onisreache dt
hroughanotherr outeront he
samel i
nk.Whe nahos tr e-c
e i
vesaRe di
rect
,t hehostmustchangeitsf or
wa rdi
ng
tabl
et ous ethes pec
ifi
edFI RSTHOPI Pv6ADDRESSf orfutureda t
agramss entto
theDES TINATIONI Pv6ADDRESS.
S
ec.22.
23I
CMPv
6Re
dir
ectMe
ssa
ge 481

0 8 1
6 24 31
TYPE(
137) CODE(
0) CHECKSUM
RES
ERVED

FI
RSTHOPI
Pv6ADDRES
S

DES
TINATI
ONI
Pv6ADDRES
S

OPTI
ONS
.
.
.

Fi
gur
e22.
10Thef
orma
tofa
nICMPv
6Re
dir
ectme
ssa
ge.

22.
24S
umma
ry

TheDyna micHostConfigura
tionProtoc
olall
owsanI Pv
4c omputert oobtai
n
in-f
orma t
ionats ta
rtup,inc
ludi
nga nIPaddres
s,theaddres
sofade f
aultrouter
,
andt headdressofadoma i
nna mes er
ver.DHCPp er
mitsas er
vert oa l
l
ocateIP
address
esa u-tomatic
all
y or dynamica
ll
y.Dyna micall
ocat
ion is nec
essar
yf or
envi
ronme nt
ss uchasawi rel
essnetworkwherecomputerscanattachandde t
ach
quic
kly.
To use DHCP,a comput erb ec
ome sa c l
ie
nt.The c omputerb r
oadcastsa
re
que s
tf orDHCPs erv
ers,s e
lect
soneoft heof f
ersitr ec
eives
,a nde xchange
s
message
switht hese
rvertoob tai
nal easeont headvert
ise
dI Pv4a ddress
.Ar el
ay
age
ntc anforwa r
dDHCPr equestsonb ehal
foft hec l
i
ent,whi c
hme ansas i
tecan
haveas i
ngl
eDHCPs erv
erha ndl
ea ddres
sa s
signmentformul t
ipl
esub nets
.
Whe nac l
ientob tai
nsa nI Pv4a ddre
ssf rom DHCP,t hec l
ientstartst hr
ee
ti
me rs
.Af tert hefirstti
me re xpi
res
,t hecli
enta ttemp tstorenewi tsle
a s
e.I fa
secondt i
mere x -
pir
esb eforerenewalc ompl
e t
es,t hec l
i
e ntat
temp tstor ebi
ndi ts
addressfrom anya vail
-ableDHCPs erver.Ifthef inaltimerexpiresbefor
eal eas
e
hasb eenr enewed,t heclientstopsus i
ngt hea ddressa ndreturnst othei nit
ial
statet oacquireane wa ddres
s.Af initestatema chines p
eci
fi
e sleas
ea cqui
siti
on
andr enewal.
WesaythatDHCPprovi
desmanagedaddr
essassi
gnment;theal
ternat
iveisan
un-manage
dsyste
mi nwhic
he ac
hc omput
e rchoos
esa naddre
ssandv er
ifi
esthat
thead-dr
essi
sunique
.IPv6offe
rsb ot
hma nagedandunmanagedass
ignment.The
I
Pv6
482 Boot
str
apAndAut
oconf
igur
ati
on(
DHCP,NDP,I
Pv6-
ND) Chap.22

manag
eda pp
roachusesDHCPv
6,a
ndt
heI
Pv6unma
nag
eda
ppr
oac
hus
ess
tat
ele
ss
ad-
dressa
utoconf
igur
ati
on.
Statele
s sa ut
oc onfigurat
ion is ha
ndledb yt he IPv6 Nei
ghbor Di
scovery
Protocol(NDPorI Pv 6-
ND) ,whic
ha lsohandle
saddressresol
uti
ona ndne i
ghbor
reac
hab il
i
ty.NDPde finesfiveICMPv6me ssa
ges:twof orroutersol
ici
tat
ionand
advert
iseme nt,twof orne i
ghborsol
ic
itat
ionandadvert
isement,andoneforf i
rst
-hopre di
rection.

EXERCI
SES

22.
1 DHCPdoe
snotc ontainanex
pli
citfie
ldforreturni
ngthetimeofdayfrom t
he
se
rve
rt ot he cl
ient,but makesi tpart of the (
opti
ona
l)vendor
-sp
eci
fi
c
i
nfor
mati
on.Shoul
dt het
imebeincl
udedi
nt herequi
redfi
el
ds?Whyorwhynot?
22.
2 Arguet
hats
epara
tionofconf
igur
ati
ona
nds
tor
ageofme
mor
yima
ge snotg
si ood.
(S
eeRFC951forhint
s.)
22.
3 TheDHCPme ssa
gef orma tisinconsi
ste
ntb eca
us eithast wofie
ldsforac l
i
entIP
ad-dressandonef ort hena meoft heb ooti mage
.I ft hecli
entl e
avesitsIP
addressfi
eldempty,t hes er
verr et
urnsthec l
ientsI
Pa ddres
sint hesecondfi
el
d.
Ift hecli
entle
avest heb ootfil
ena mef i
el
de mp ty,theserverrepl
acesitwithan
expli
ci
tna me.Why?
22.
4 Readt
hes t
andar
dtof
indouthow c
li
ent
sands
erv
ersus
etheHOPSf
iel
dina
DHCPmes
sage.
22.
5 WhenaDHCPcl
ie
ntrece
ive
sar e
p l
yv i
ahardwa
reb r
oadca
st,how doesitknow
whe
the
rther
epl
yisi
nte
ndedforanothe
rDHCPcli
entonthesamephysi
calne
t?
22.
6 Whenamachi
neobt
ainsi
tssubne
tma s
kwi
thDHCPi
nst
eadofI
CMP,i
tpl
ace
sle
ss
l
oadonot
herhos
tcomputer
s.Expl
ai
n.
22.
7 Rea
dthesta
ndardtof i
ndouthow aDHCPcli
enta
nds
erv
erc
ana
gre
eonal
eas
e
dur
a-t
ionwi
thoutha
vingsync
hroni
zedc
loc
ks.
22.
8 Considerahosttha
tha sadis
kanduse
sDHCPtoobtai
nanIPaddr
ess.Ifthehost
st
or esitsaddre
sson thediskal
ongwiththedatethel
eas
ee xpi
resandt he
n
rebootswit
hinthelea
seper
iod,c
anituset
headdr
ess
?Whyorwhynot ?
22.
9 DHCPmanda
tesamini
mum addr
essl
easeofonehour
.Canyoui
mag
ineas
itua
tion
i
nwhic
hDHCPsmi
nimumle
as eca
use
sinconv
eni
enc
e?Exp
lai
n.
22.
10 Re
adt heRFCtofi
ndouthowDHCPspec
ifi
esr
ene
wala
ndreb
indi
ngt
ime
rs.S
houl
d
aser
verevers
etonewit
houtt
heothe
r?Whyorwhynot?
22.
11 Thestat
et r
ansi
ti
ondia
gra
mf orDHCPdoe
snots how re
tra
nsmi
ssi
on.Rea
dthe
sta
nda
rdt ofi
ndouthowmanyti
mesacl
i
entshoul
dret
ransmi
tareques
t.
22.
12 CanDHCPg
uara
nteethatacl
i
entisno
ts
poof
ing(
i.
e.,c
anDHCPg
uara
nte
ethat
i
twil
lnots
endconf
igur
ati
oni
nfor
mati
onf
orhostAtohostB)
?Whyorwhynot
?
22.
13 DHCPspec
ifi
esthatacli
entmustbep r
epa
redt
oha
ndl
eatl
eat31
s 2 oc
tet
sof
opt
ions
.Howdidthenumber31
2ari
se?
22.
14 Canac
omput
ertha
tusesDHCPt
oob
tai
nanI
Pv4a
ddr
essr
unas
erv
er?I
fso,how
doe
sacl
ie
ntrea
chthes
erver
?
Ex
erc
ise
s 483

22.
15 Suppos
ea nI Pv
6c omput
eratt
achestoanetwor
kt ha
td oesnothaveanyroute
rs.
How doest heIPv 6nodeknow thatits
houldusestat
ele
ssa ut
oconf
igur
ati
ont o
obt
aina nIPv6a ddres
s?
22.
16 Ext
endt hep rev
iousque
sti
on:ifanIPv6nodeatt
ache
st oanetwor
ktha
tdoe s
hav
e a r outer, how does the node know whether t
o use st
ate
less
aut
oconfi
gurati
on?
22.
17 IfanI Pv6 nodeus e
sstat
ele
ssautoc
onfi
gur
ati
on,canthenoderun as
erve
r?
Expl
ai
n.
Chapt
erCont
ent
s
23.
1 I ntroduc ti
on,485
23.
2 Na me sForComp ute rs,486
23.
3 Fl a
tNa me space ,486
23.
4 Hi erarchicalNa me s,487
23.
5 De legationOfAut hor ityForNa me s,488
23.
6 S ubsetAut horit y,488
23.
7 I nterne tDoma inNa me s
,489
23.
8 Top -Le velDoma i
ns ,490
23.
9 Na meS ynt axAndTyp e,492
23.
10 Map pi
ngDoma inNa me sToAddr es
s es,493
23.
11 Doma inNa meRe solution,495
23.
12 Effici
entTr ans l
a tion,496
23.
13 Caching :TheKe yToEf fi
ciency,497
23.
14 Doma inNa meS ys temMe ssa
g eFor ma t
,498
23.
15 Comp ressedNa meFor mat,501
23.
16 AbbreviationOfDoma i
nNa mes,501
23.
17I nverseMa pping s,502
23.
18 PointerQue ri
e s,503
23.
19 ObjectTyp esAnd Re sourceRe cor d Cont
ent
s,
504
23.
20Ob tainingAut hor ityForAS ubdoma in,505
23.
21S erverOp e rationAndRe pl
icati
on,505
23.
22Dyna micDNSUp da teAndNot ifica
t ion,506
23.
23DNSS e
c urityEx t ensions(DNS SEC) ,506
23.
24Mul t
icastDNSAndS ervic
eDi scovery,507
23.
25S umma r y,508
23

TheDomai
nNameSys
tem
(DNS)

23.
1Int
roduc
tion

Thep r
ot ocol
sde s
cri
bedine arl
ie
rc hap
tersuseb inaryval
uesc al
le
dI nte
rnet
Proto-cola ddress
es( I
Pa ddres
ses)toidenti
fyhostsa ndr outer
s.Althoughsuch
address
e spr o-vi
deac onve
nient,compactrepr
ese
ntationf orspe
cifyi
ngt hes
ource
and destinat i
on in dat
agramss e
nta cros
sa ninterne t
,us er
sp refert oassi
gn
machinesp ronounceabl
e,easi
lyrememb e
rednames.
Thischapterconsidersas chemef ora s
signingme ani
ngfulhigh-l
evelname st o
ala rges etofma c
hines,a nddiscuss
esame chanismt hatma p
sb etweenhi gh-l
ev e
l
ma chinena mesa ndb inaryI Pa ddres
ses.Itc ons i
der
sb otht het r
ansla
tionf rom
high-levelnamest oI Pa ddressesandt het ranslat
ionf r
om IPa ddress
est ohi gh-
l
e v
e lma chi
nena me s.Thena mings chemei sinteresti
ngf ortwor easons.First,it
hasb eenus edtoa s-si
gnma c
hinena mesthroug houttheI nte
rnet.Second,b ecause
i
tus esag eographi
ca l
l
ydi str
ibuteds e
tofs erv erstoma pname stoa ddress
e s
,t he
i
mp leme ntat
ionoft hena mema p pi
ngme chanismp rovi
desal a
r g
es cal
ee xampleof
thec lie
nt-serv
erp aradigmde scri
bedinCha pter20.
48
5
486 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

23.
2Na
mesForComp
ute
rs

Thee arli
estc omp uters ystemsf orcedus erst ounde r
standnume r
ica ddresse
s
for ob -je
c t
sl ikes ystem t able
sa nd p er
ipher alde vic
es.Ti meshari
ng s ystems
advancedc omp ut -i
ngb ya ll
owi ngus erst oinve ntme ani
ngfulsymb ol
icna me sfor
bothp hysicalo bjects(e.g.,p e
r i
pheraldev i
ces)a nda b s
tractobjects(e.g.
,f il
es)
.A
si
mi l
arp atte rn hase me rgedi nc ompute rne twor king.Ea rl
ys ystemss upported
point-to-pointc onne cti
onsb e
t weenc omp utersa ndus edlow-lev
elMACa ddresse
s
tos pecif
yc omp uters.Int er
ne twor k
ingi ntroduc e
duni ve
rsaladdressi
nga swe l
las
protocols of t
wa ret o ma p uni versala ddressesi ntol ow-levelMAC a ddresses.
Becauset he I nternetc ontainsmi l
li
onsof ma chines,us ersne ed me aningful
,
symb ol
icna me st oidentif
ys p ecif
iccomp uterst hatt heyus e.
Earlycomp ute
rna mesr e
flec
tedt hesmal
lenvi
ronmenti
nwhi c
ht heywe r
e
chos
e n.Itwa squitecommonf oras itewithahandfulofmachi
nest ochoos
e
namesb ase
dont hema chi
nespurposes.Forexampl
e,machi
nesofte
nha dna mes
l
ikea cc
ounting,devel
opment,andp roducti
on.Us
ersfi
ndsuchnamespre
ferabl
eto
cumbe r
someha rdwareaddre
sses.
Alt
houg ht hedi
sti
nct
ionbetweenaddressandnamei si
ntuiti
vel
ya p
peal
ing,it
i
sartif
ici
a.Any na
l me i
sme rel
ya nidentifi
ert hatcons
ist
sofas eque
nc eof
c
harac
tersc hosenfr
om af i
nit
ea l
pha
bet.Na mesareonlyusefuli
fthesyst
emc an
e
ffi
cie
ntlyma pthemtot heobje
cttheyde note.Thus,wethinkofa nIPaddress
sa l
a ow-levelname, and we s ayt hat usersp ref
er hi
gh-l
evelnames f or
c
omputers.
Thef orm ofhi g h-levelname sisi mportantbe c
ausei tde t
ermi ne show na me s
aret rans latedt ol ow- l
e v
elna me sorb oundt oob j
ects,a swe l
la show na me
assi
gnme nt sarea ut horized.Wi thonl yaf e
w ma chi
nes,c hoosi
nghi g h-lev elname s
iseasy e acha d-mi nistratorca nc hoosea narbi
t ra
ryna mea ndv erifyt hatt he
name i snot i n us ei nt he locale nvi
ronment.For e xample,whe ni tsma in
departme ntalcomp ut erwa sc onnec tedt ot heInterne tin1 980,t heComp ut er
Scie
ncede partme nta tPur dueUni versit
yc hosethena mep urduet oi de ntif
yt he
connec t
e dma chine.Att het i
me ,thel i
stofp otentialconfli
ctsc ont aine donl ya
few doze n name s.By mi d1 986,t he offici
allist of hostson t he I nt
e rnet
contained31 00of f
ic i
all
yr eg i
ste
r e
dna me sand6500of fic
ialali
ases.Al t hought he
l
ist wa sg rowing r api
dlyi nt he 1 980s, mosts ites ha da dditionalma chines
(typi
ca l
ly,p er
sona lc omp uters)thatwe reunr e
gis
t er
ed.I nt hec urr entI nternet,
withhun- dredsofmi ll
ionsofma chines,choosi
ngs ymb oli
cna me si smuc hmor e
diff
icult.

23.
3Fl
atNa
mes
pac
e

Theor
igi
nals
etofma
chi
nena
mesus
edt
hroug
houtt
heI
nte
rne
tfor
meda
f
latnamespac
e,inwhi c
he ac
hna meconsi
stedofaseque
nceofchar
a c
t e
rswithout
a
ny furthers t
ructure.Int he ori
gi
nalscheme
,a c ent
ralsi
te,t he Ne
twor k
I
nformati
onCent er(NIC)
,adminis
teredthenames
paceanddet
erminedwhethera
new na
mewa sa
ppropri
-at
e(i
.e.
,itp
rohi
bi
tedob
sce
nena
mesorne
w na
mest
hat
conf
li
ctedwi
thexi
sti
ngnames
).
S
ec.23.
3 Fl
atNa
mes
pac
e 487

Thec hie fa dvanta geofaf latna me s


pa ceist hatna me sa rec onv eni
e nta nd
short;thec hi
e fdisadv a
ntagei sthataf latna me s
pa c
ec annotg enerali
zet ol arge
setsofma c hi
ne sf orb otht ec
hnicala nda dminis
tr a
t i
ver e
a s
ons .Fi rst,b ecause
name sa r
edr a wn f rom as i
ng l
es etofi de ntif
iers,t hep otent i
a lforc onfli
ct
i
nc r
easesa st henumb e rofs i
tesin- c
re as
es.S econd,b ecausea ut hor i
tyf ora dding
newna me smus tr esta tas i
ng l
esite,t hea dministr
a ti
vewor kloada ttha tc e
ntr a
l
si
tea ls
oi nc reaseswi tht henumb erofs i
tes.Tounde rst
a ndt hes everityoft he
probl
em,i ma gineac entralauthoritytr yi
ngt ohandlet hec ur r
e ntI nt e
rne twhe re
ane wc omp ut era ppea r
sa pproxi
ma tel
yt e
nt imesp ers econd.Thi rd,b ecauset he
name -t
o-addr essb inding schangef requently,t he c ostofma intaini
ng c orrect
copi
esoft hee nti
rel istate achsiteishi gha ndi ncreasesa st henumb erofs i
tes
i
nc r
eases.Al ternatively,ift hena meda taba s
er esidesa tas ing les i
te,ne t
wor k
traffi
ct ot hats it
ei ncreaseswitht henumb ero fsites.

23.
4Hi
era
rchi
calNa
mes

How ca n ana mings yste


ma c c
ommoda teal arge,ra pi
dl
ye x
pandingsetof
nameswi thoutr equiring a c entrals i
tet oa dmini
steri t
? The a nswerli
esin
dece
nt r
ali
zingt hena mi ngme chanis
mb yde l
egati
nga uthorit
yf orp artsofthe
namespacea nd dis
tribut i
ngr e sp
ons i
bil
ityf ort hema ppingb etween namesand
addres
ses.TheI nternetus e
ss uchas c
he me.Be for
ee xamini
ngt hede t
a i
ls
,wewil
l
cons
iderthemot i
vati
ona ndint ui
tionb ehindit.
Thep ar
t i
tioningofana mespacemus tb edefi
nedinawa ythats up
ports
ef
ficientnamema p pi
ngandg uar
anteesautonomouscontrolofnamea ssi
gnment.
Opti
mi zi
ngonlyf ore ff
ici
entma ppi
ngc anl e
adt osolut
ionsthatr eta
inaf lat
namesp a
cea nd r educetraff
icb y di
vidi
ng the namesa mong multi
pl
e mapping
machines.Opti
mi zi
ngonlyf oradmini
strat
iveeasecanleadtosoluti
onsthatma ke
del
egat i
onofa uthor i
tyeas
yb utnamema ppingexpe
nsiv
eorc omplex
.
Tounde rst
andhow t hena me spaceshouldb edivi
ded,c onsi
dert hei nternal
st
ruc -ture ofl arg
e or ganiza ti
ons.Att he top,a c hi
efe x ec
utiv
e ha sov er a
ll
res
p onsib
il
ity. Be-causet he c hie
fe xecuti
vec annot overseee verything,t he
organizati
onma yb ep a
r t
itionedi ntodiv i
si
ons,witha ne xecuti
vei nc hargeof
eac
hdi vi
si
on.Thec hiefe xecut i
veg rantseachdivis
ionautonomywi thi
ns pe
cifie
d
l
imits.Mor et othep oint,t hee xecutiveinchargeofap arti
culardivi
s i
onc anhi re
orfiree mployees,assignof fic
e s
,a ndde l
egateauthori
ty,withoutob tai
ningdi r
e ct
permissi
onf romt hec hiefe xecuti
ve .
Besi
desma k
ing i
te asyt o del
egatea uthor
ity,t he hi
erar
chy of a lar
ge
organi
zati
on introduc
e sa utonomousop era
t i
on.For e xampl
e ,whena n offic
e
workerne e
dsi nforma
- ti
onliket hetel
ephonenumb e
rofane wemp l
oyee
,heor
sheb e
ginsb ya s
kinglocalcl
e r
icalworker
s( whoma ycontactcle
rica
lwor ke
rsin
otherdivi
sions)
.Thep ointist hatalt
hougha ut
horitya l
waysp as
sesdown the
corp
oratehi er
archy,informationcanflow acrossthehi e
rarchyfrom oneoffic
e
toanother.
488 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

23.
5De
lega
tionOfAut
hor
ityForNa
mes

Ahi erarchica
lna mi ng scheme wor ksl iket he ma nage
me nt of a l a
rge
organizati
on.Thena me spac
ei sp arti
ti
onedatt het ople vel
,a nda uthori
tyfor
name si ns ubdiv
isi
onsi sp a
ssedt o desig
nateda g ents
.Fo rexamp l
e,onemi ght
chooset op ar
t i
ti
ont hena mesp
a c
eb a
sedons itenameandt odel
e g
atet oeachsi
te
responsibi
l
ityf orma i
ntaini
ngna me swithi
ni tsparti
t i
on.Thet opmostle v
elofthe
hier
a rchydivi
de sthena mespac
ea ndde legat
esa uthorit
yf ore ac
hdi vi
si
on;itneed
notb eb otheredb ychangeswithi
nadi vi
-si
on.
Thesynta
xo fhie
rarc
hic
all
yassi
gnedna
mesofte
nr ef
lect
sthehi
erarc
hic
al
de
leg
a-ti
on of a
uthori
ty us
edt oa ss
ignthe
m. As a
ne x
ampl
e,cons
idera
names
pac
ewithnamesoftheform:
l
ocal.s
ite

wheresit
eisthesi
tenamea uthor
izedb ythec e
ntr a
la uthoriy,l
t ocalisthep a
rt
ofana mecont
rol
le
dbyt hesit
e ,andthep eri
odc haract
e risade l
i
mi t
e rusedto
sepa
ratethem.Whenthet opmosta uthori
tya ppr
ov esaddingane ws ite,X,it
addsXt otheli
stofval
idsitesandde leg
atestos iteXa uthori
tyf ora l
lnames
thatendin.X.

23.
6Sub
setAut
hor
ity

Inahi erar
chicalname s
p ace,aut
horityma yb ef ur
t hersubdi
vi
deda te a
ch
l
evel.Inoure xamp l
eofp a
rtitionbysit
e s
,t hesiteit
sel
fma yconsi
stofs e
veral
admini
strat
iveg roups,a nd t he s
itea uthori
ty ma yc hooset os ub
div
ide its
namespaceamongt heg roups.Theideaist ok e
eps ub
divi
dingthename s
paceuntil
eachsubdi
visi
onissma l
lenoug ht ob
ema nageable.
Syntac
tic
all
y,subdi
vidi
ngthenames
paceint
roduc
esanot
herpa
rti
tionofthe
name
.Fore x
ample
,a ddingagroupsub
div
isi
ont oname
sa l
rea
dypar
titi
one
db y
si
teproduc
esthefoll
owingnamesynt
ax:
l
ocal.gr
oup.s
ite

Becausethetopmostl
eveldel
egat
esa uthor
ity,gr
oupna mesdonothavetoagree
amonga llsi
tes.A uni
versi
tysitemi ghtchoos
eg r
oupna me
sl i
keengi
neer
ing,
sc
ience, and art
s, whi
leac orpor
a t
es i
te might c
hooseg r
oup nameslike
producti
on,acc
ounti
ng,andpers
onnel.
TheU. S.telephones ys
temp r ov
idesa nothere xampleofahi e r
archic
alna ming
syn-tax.The1 0di gitsofap honenumb e rhav eb eenp ar
tit
ione dintoa3- digi
t
areac ode,3-digte
i xchange,and4- di
g its ubsc
r i
bernumberwi thinthee xchange.
Eache xchangeha sa uthori
tyfora s
signings ubscrib
ernumb er
swi t
hinitspieceof
the na mespace
.Al thoughi tisp ossibl
et og roup a rb
itra
rys ubscri
ber
si nto
exchangesa ndt og roupa r
bit
rarye x -
c hang esintoa reacodes,t hea s
sig
nme ntof
tele
phonenumb ersisnotc apri
cious;thenumb ersa recareful
lyc hosentoma keit
easytor outep honec all
sacro
sst het el
e phonene twor k
.
Indoma
inna
mes
,thep
eri
odde
li
mit
eri
spr
onounc
ed
d
ot.

Sec
.23.
6 S
ubs
etAut
hor
ity
489

Thet el
ephonee xamp leisi mporta ntb ecauseiti l
lus
tratesak eydi sti
ncti
on
betweent hehi erar
c hi
c alna mings che meus edin aTCP/ I
Pi nte
r neta ndother
hier
archies:p arti
-tioningt hes etofma chinesowne db ya nor ganiza ti
ona l
ong
l
inesofa uthori
tydoe snotne cess
a r
il
yi mp lyp art
iti
oningb yphysi
ca llocati
on.For
example,i tc ouldb et hata ts ome uni ve r
sit
y,a s i
ngleb ui
l
ding hous esthe
ma t
hema t
icsde p
artme nta swe l
la st hec omp utersciencedepartme nt .Itmight
event ur n outt hata l
thoug ht hema chinesf r
om t hesetwog roup sf al
lunder
completelys ep
a r
atea dmi ni
s t
rativ
edoma i
ns,t heyc onnectt othes a mep hys
ical
network .Ita l
soma yha ppent hatas ing l
eg roupownsma chi
nesons everalphys
ical
network s. For thes er e asons,t he TCP/ I
P na ming s c
heme a l
lows a rbi
-tr
ary
dele
gationofa uthorityf ort hehi era
r chicalna me s
pacewi t
houtr e
g ardt ophys
ical
connections.Thec onc e
p tc a
nb esumma rized:

In the I nt
er net, hi
erarchic
al mac hi
ne names ar e as
signed
accor
dingtothes truct
ur eofor gani
zationsthatobtainaut
hor i
ty
forpar t
soft henamespace,notnec essar
il
y accordi
ngt ot he
str
uctureoft hephysic
alnet workinterconnecti
ons
.

Of cour
se,a t many si
test he or
ganizati
onalhierarchy corres
pondswi ththe
str
ucture of physi
calne t
wor kinterconnec
tions. For examp l
e,s uppos
et he
compute
rsi n ag i
ven department a
llc onne
ctt ot he sa
me ne twork.I fthe
depar
tmentisassi
gnedp a
rtoft hena minghierarc
hy,a llmachine
swi thnamesin
thatpar
toft hehier
archywillal
socon-necttoas ing
lep hys
icalnetwork.

23.
7Int
erne
tDoma
inNa
mes

TheDoma i
nNameSys tem (DNS)isthesystemt hatp r
ovidesnamet oa ddre
ss
map-pingfort heI nternet.DNSha stwoc oncep
tuall
yi ndependentaspect
s .The
fi
rstisa b
str
a c
t :itspecif
iest hena mesyntaxandr ul
esf orde l
egati
nga uthori
ty
over names.The s ec
ond i sc oncret
e:i ts p
ecif
iest he imp l
ementati
on of a
di
strib
utedc omp uti
ngs ys-temt ha
te ffi
ci
entl
y ma psna mest oa ddres
ses.This
se
ctionconsi
derst henames yntax
,a ndla
tersecti
onsexami netheimplementati
on.
TheDoma
inNameSyst
em us
esahie
rarc
hica
lnami
ngsc
hemeknownasdoma
in
names.Asin ourea
rli
erexa
mp l
es,adomain na
mecons
ist
sofas eque
nceof
s
ubnamessepara
tedb yade l
imite
rchara
cter
,t hedot.Inoure
xample
s,wesai
d
t
hatindi
vidualsec
tionsoft hena memightr e
p r
ese
ntsite
sorgroup
s,butDNS
s
impl
ycall
se a
chsectionalabel.Thus
,thedomainname:

c
s.pur
due.edu

contai
nsthreel
abel
s:cs
,pur
due,andedu.Anysuff
ixofalabeli
nadoma i
nname
isalsoca
lldad
e omai
n.Intheabovee x
ampl
e,thelowest
-leveldoma
iniscs.
purdue.edu,(thedomai
nnamefortheComputerSci
enc
ede p
a r
tmentatPur
due
Uni
ver
sit
y),t
hes
econdl
eve
ldoma
i sp
ni ur
due.edu(
thed
oma
inna
mef
orPur
due
Uni
ver
sit
y),a
ndt
he
490 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

top-l
eveldomainisedu (thedomainna meforeduca
tiona
linsti
tut
ions
).Ast he
exampleshows,domai
nna me sarewrit
te nwi
ththelocall
abelfi
rstandthet op
domainl a
st.Aswewi l
ls ee
,wr it
ingt heminthisorderma k
esitp oss
ibl
et o
compressmess
agesthatcon-tai
nmulti
pledomai
nnames.

23.
8Top
-Le
velDoma
ins

Fi
gur
e23.
1li
stse
xamp
lesoft
heg
lob
alt
op-
lev
eldoma
inna
mesc
urr
ent
lyi
n
us
e.

Doma i
nNa me Me aning
aero Airt rans por tindus try
arpa Infras truc turedoma i
n
asi
a Regiona ldoma i
nf orAs i
a
biz Busine sses
cat Catala nla ngua gea ndc ultural
com Comme rci
a lor ganizat i
on
coop Coop era ti
v ea ssoci
a tions
edu Educ ationa lins ti
tution( 4-year)
gov UnitedS tat esgov ernme nt
info Informa ti
on
int Interna tiona lt reatyor ga nizati
ons
jobs Huma nr esour c ema na geme nt
mil UnitedS tat esmi li
tar y
museum Mus eums
name Individua l
s
net Ma j
orne twor ks up portc ent e
rs
org Organi zationsot hert ha nt hoseabove
pro Crede ntiale dp rofessiona l
s
travel Trave lindus tr y
xxx Interne tp ornogr aphy
c
ount
ryc
ode Eachc ount r y( geogr aphics cheme)

Fi
gur
e23.
1Thet op-
leve
ldoma i
nsa s
s i
gnedint heI
nterne
ta ndthei
r
mean-i
ngs.Al
thoug hlabe
lsa reshowninl
owerc as
e,doma
in
name compari
s ons arei nsens
iti
vet ocas
e,s o COM is
equi
val
enttoc om.

TheInternetCorporati
onf orAss
ignedNamesandNumber s(
ICANN) ,whic
ha s
-si
gnsname s
,ha sst
rug gl
edwitht hequestionofhow manytop-
leveldomai
nsa r
e
neededandwha tname sshouldb eall
owe d.The2- l
etterc
ountryc odescheme,
oncethoughtt obepe rmanent,issub
jectt opol
iti
calcha
nge
s.Forex ampl
e,when
Germany reunifi
ed,t he top-
leveldoma n dd t
i hatha dbeenassi
gne dto Eas
t
Ge
rma
nywa
sma
deob
sol
ete
.
S
ec.23.
8 Top
-Le
velDoma
ins 491

Ani nte
rna
tional
i
zati
onme cha
nism ha
sb eeninv
ent e
dt ope
rmi
tna me
sinother
charac
tersets
.Thus
,t hef
igureonl
yg i
vesasnapshottha
tmaycha
ngeasne
wt op
-le
velnamesareapp
rovedandb e
comea c
tiv
e.
Conc ep
tual
ly,thet op-levelname sp e
rmitt wodi ffere
ntna minghiera
rchi
es:
geo-graphicandor ga ni
za ti
ona l
.Theg eogra
phics chemedi vi
dest heunive
rseof
ma c
hinesb yc ountry.Ma chinesi nt heUnitedS ta tesfallundert hetop-le
vel
doma n us
i ;whe naf or
e ig
nc ountrywa ntst or egis
terma chi
nesi ntheDoma in
NameS yste
m,t hece ntrala u-thori
tya ssi
gnsthec ountryane wt op-le
veldomain
witht hec ountry
si nternat i
onals tan-
dard2- let
te ridenti
fi
era sitslabel
.The
authorityfort heUSdoma i
nha schosentodivideiti ntoones ec
ond-le
veldomain
perstat e
.Fore xample,t hedoma i
nf orthestateofVi rgi
niais:

v
a.us

Asa na lte
rna ti
vet ot hegeographichi er
a r
c hy,thet op-
leveldoma i
nsa l
low
organi-zati
onst ob eg roupedbyor ganizati
onalt ype.Whena nor ganizati
onwa nts
top art i
ci-
pa tei nt heDoma in NameS ystem,i tc hoose
show i twi shest ob e
regi
stere da nd r e-questsapprova. A doma
l i
n name r egi
strar r evi
ews t he
appl
icationa nda ssi
gnst heor-gani
zationas ubdoma i
nunde roneoft hee x
isti
ng
top-l
e v
e ldoma i
ns .Theowne rofag ivent op-le
veldoma incande c
idewha ttoa l
low
andhowt of urtherp ar
titi
onthena me spac
e.Fore xampl
e,int heUnit e
dKi ngdom,
which ha st he t wo- l
ettercountryc ode uk,uni v
ersi
ti
esa nd ot hera c
ademic
ins
titutionsa rer eg
isteredunderdoma na
i c.uk.
Ane xamplewil
lhel
pc l
ari
fyther el
ati
onshipb e
tweenthenaminghi
era
rchy
and authorit
yf or na
me s
.A ma chi
ne namedx inu inthe Comp
uterSci
ence
dep
ar t
me ntatPurdueUni
versi
tyha
st heoffi
ci
a ldomainna
me:

xi
nu.c
s.pur
due.edu

Thema chinena mewa sa pproveda ndr egi


steredb yt hel oc
alne t
workma nageri n
the Comp uterS cience de part
me nt .The de partme nt ma nager hadp revi
ously
obtai
neda u-thori
tyf ort he subdoma incs.pur due .edu f rom a univ
ersity
networka uthorit
y,whoha dobtainedp ermiss
iont oma nagethesubdomainpurdue
.edu from t heI nterneta uthority.TheI nt e
rne ta uthori
tyr etai
nscontrolof
the edu domai n,s o ne w universiti
esc an onlyb ea dded withi t
sp ermis
sion.
Simi
larl
y,t heuniversi
tyne tworkma nag
era tPur dueUni ver-s
ityretai
nsauthority
forthep ur due.edus ubdomain,s one wt hi
r d-
leveldoma i
nsma yonlyb eadde d
withthema nager
sp e
rmi ssi
on.
Fi
gure23. 2ill
ust
ratesas ma l
lp ar
toft heInternetdomai
nna mehierar
c hy.
Asthef i
gureshows,IBM c orporati
on,ac ommerci
alorgani
zat
ion,regi
ster
eda s
i
bm .c om,Pur -dueUniversi
tyr e
gist
ereda spurdue .edu,and theNa tional
Sci
enceFounda t
ion,ag overnme ntagency,regi
ste
reda snsf.gov.I ncontrast,
theCor pora
tion forNat i
onalRe sea
rchI ni
ti
ati
vesc hos
et oregi
sterundert he
geogra
phichiera
rchyasc nri.reston.v a.us.
Thes
tandarddoesnotde
f i
nethetermsubdomai
n.Wehavec
hos
ent
ous
ethet
ermb
eca
usei
ts
a
nal
ogytosubsethel
pscl
ari
fythere
lati
ons
hipamongdomai
ns.
492 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

unnamedr
oot

c
om e
du gov ... us

i
bm p
urdue ns
f v
a

ma
th c
s e
cn r
est
on

c
nri

Fi
gur
e23.
2As mallpartoftheInt
ernetdomai
nnamehiera
rchy(
tre
e).
I
np r
ac t
ice
,t hetre
eisb r
oada ndfl
at;mos
thos te
ntri
es
a
ppea
rb yt hefi
fthl
eve
l.

23.
9Na
meS
ynt
axAndTyp
e

TheDomainNameS ys
temisquitegene r
albecaus
ei tal
lowsmul t
ipl
enaming
hie
rarchi
estob eembeddedin onesyst
e m.I na ddi
tion,thes ys
temc an hold
vari
oustypesofmappi
ngs.Forexampl
e,ag ivennamec anbet henameofahos t
computerthatha
sanI Pv4addr
ess,ahostc omputerthathasa nIPv6addre
ss,a
mailserv
er,andsoon.Inter
est
ingl
y,thes yntaxofna mesdoesnotindic
atet he
type.
Top ermitac lientt odisti
ng ui
sha mongmul t i
plet ypesofe nt r
iesint he
syst
e m,e achna medi tems tor
e disa s
signedat ypet hatspe ci
fi
e swhe theritist he
addressofac omp ute r
,ama il
box ,aus er,a nds oon.Whe nac l
ienta skst he
doma i
ns ystemt or esolveana me,i tmus ts peci
fyt het ypeofa nswerde si
red.For
examp le
,whe na ne lec-tr oni
cma ilappli
cat i
onus est hedoma ins yste
mt or es
olvea
name ,its peci
fiest ha tt hea nswers houl db et hea ddressofama i
lexc hanger.
Whe nab rowserres ol
v esadoma i
nna mef orawe bs ite,theb rows e
rmus tspecify
thatits eekstheI Pa ddr essoft hese r
v erc omput er .Interesti
ng l
y,ag i
venna me
canma pt omul ti
plei tems .Whe nr esol
v i
ngana me ,t hea nswe rreceivedde pends
ont het ypespe ci
fi
e di nt heque ry.Thus ,ifaus ers endse mailtos omeonea tx.
com a ndt ypsx.c
e om i ntoab rowser,t het woa c t i
onsma yr e s
ultinc ontacting
twoe nt i
relydiffe
re ntc omp uters.Wec a ns umma rizet hek eyp oint:
Sec
.23.
9 Na
meS
ynt
axAndTyp
e
493

Agivennamemaymapt omorethanonei t
em int hedomain
s
ystem.The cl
ientspec
ifi
esthe t
ype ofobjectdesi
red when
r
esolv
inganame,andtheserv
erret
urnsobj
ectsofthattype.

Ina ddi
ti
on tospe
c i
fyi
ngt het yp
eofa nswersought,thedoma i
ns ys
tem
al
l
owst he cl
ie
nt tospecif
yt he protoc
olf amil
yt o us
e .The domai
ns ys
tem
pa
rti
tionst heenti
resetofna mesb yc l
ass
,a l
lowi
ngas ingl
edatabas
et ostor
e
mapp
ingsf ormult
ipl
eprotocols
uit
es.
Thesynta
xo fanamedoesnotdeterminethep r
otocolcla
ssort hetypeof
obj
ectt owhichthena
mer ef
ers
.Inp ar
ticula
r,thenumb erofl abe
lsinana me
doe
snotde termi
newhethe
rthenamereferst oanindi
vid
ua lobje
ct(machi
ne)or
adoma i
n.Thus,i
nourexampl
e,i
tispos
sib
let ohav
eama chi
nena med

gwen.pur
due.edu
e
vent
houg
h
c
s.pur
due.edu

na
mesas
ubdoma
in.Wec
ans
umma
rizet
hisi
mpor
tantp
oint
:

Onecannotdisti
nguisht
henamesofsubdomai
nsfr
om thenames
ofindi
vidualobjectsorthetypeofan objec
tusingonl
yt he
domai
nnames ynt ax.

23.
10Ma
ppi
ngDoma
inNa
mesToAddr
ess
es

Ina ddi t
iont ot her ule
sf orna mes yntaxa ndde legati
onofa uthority,t he
doma i
nna mes che mei nc l
udesa ne ff
ici
ent,re l
iab
le,g eneralpur pose,distribut ed
systemf orma ppingna me stoa ddress
es.Thes ystemi sdist
ributedi nthet e
c hnic a
l
sense,me aningt ha tase tofs erversoperat
inga tmul ti
plesi
tesc oopera t
ivel
ys olve
thema ppingp r
ob -lem.I tiseffic
ientint hesenset hatmos tna me scanb ema pp ed
l
oc a
ll
y;onl yaf ewr e-
qui r
ei nternettraffi
c.I tisg eneralpur poseb ecausei ti s
notr est
r i
ct edtoc omp uterna me s(al
thoughwewi l
luset hate xamp l
ef ornow) .
Final
ly,itisr eli
ab leint hatnos in-gl
eserverf a
il
urewi llpreventt hes ystemf rom
operati
ngc orrectly.
The doma in mechanis
m f or ma p
ping na me st o a ddress
esc onsi
sts of
i
ndep
endent,cooperati
vesystemscall
edna mes erver
s.Ana mes e
rveri sas e
rver
p
rogramthats up-pl
ie
sna me-to-
addres
st ransl
ati
on,ma ppingf rom doma i
nna mes
t
oI Paddress
es.Of te
n,s er
ve rs
oftwaree xecute
sonade dicatedprocessor
,a nd
t
hema chi
neitselfiscal
ledt henames e
rver.Thec l
ie
nts of t
wa re,cal
ledana me
r
esol
ver,mayc onta
ctoneormor enames er
v e
r swhent r
ans l
atingana me .
Inprac
tic
e,f
ewd
oma
ins
erv
ersus
emul
ti
pl
epr
otoc
ol
sui
tes
.
494 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

Thee a
sie
s twa yt ounde r
sta
ndhow doma i
ns erverswor kist oi maginet hem
ar-rangedi n at rees tructuretha tcorres
p ondst ot hena ming hi e
rar chy,a s
Figure23. 3il
lus-trates.Ther ootoft hetreeisas erverthatr ecognizest het op-
l
e v
e ldoma i
nsa ndk nowswhi chse r
verr es
olvese a c
hdoma in.Gi v
e n ana met o
resol
v e
,t herootc a
nc hoosethecorrectserverf ort hatna me.Att hene xtl evel
,
as etofna mes erverse achp r
ovi
dea nswersforonet op-l
eveldoma in( e
.g .,edu).
As ervera tt hislevelk nowswhi chs er
versc anr esolvee achoft hes ubdoma i
ns
unde ritsdoma i
n.Att het hi
rdlevelofthet r
e e
,na mes erve
r sprovi
dea nswe r
sf or
subdoma i
ns( e.g.,purdueunderedu) .Thec on-cep t
ua ltreec onti
nue swi thone
serverate achle v
elforwhi chasubdoma i
nhasb ee nde -fi
ned.

Li
nksint hec once
ptualtr
eedonoti ndi
ca t
ep hys
icalnetwor
kc onnecti
ons.
Inst
ead,theys how whi
chothernameser
versag i
venserverknowsandc ontac
ts.
Thes er
verst hemsel
vesmayb eloca
teda ta r
b i
trar
yl oc
ationson anint e
rnet.
Thus,t he tree of s e
rve
r sisa nabstrac
tion that usesa ni nter
ne tf or
communica
tion.

Root
S
erve
r

s
erverfor s
erv
erfor s
erv
erfor s
erv
erfor
...
.
com .
edu .
gov .us

s
erve
rfor ser
verfor s
erverfor s
erverfor
ibm.
com p
urdue.
edu ns
f.gov v
a.us

Fi
gur
e23.
3Thec oncept
ualarrangementofdomai
nna mes er
ver
si na
t
reethatcorres
pondst othenami
nghier
a r
chy.Intheory,
e
achserv
erk nowst hea d
dres
sesofal
llower-l
evels
ervers
f
oral
lsub-domai
nswi t
hinthedomai
nithandl
es.

Ifser
ver
sint he domains ys
tem workede x
actl
ya sours i
mpli
sti
cmode l
s
ugges
ts,t
herel
ati
onshi
pb e
twe e
nc onne
cti
vi
tya ndautho
rizati
onwouldb equi
te
s
imp
le.Whenaut
hori
tywa sgrantedforasubdomai
n,theor g
aniza
tionreque
sti
ng
i
twouldne
edt oe
s-t
abl
i
shadoma
inna
mes
erv
erf
ort
hats
ubdoma
ina
ndl
i
nki
t
i
ntot
hetree.
Sec
.23.
10 Ma
ppi
ngDoma
inNa
mesToAddr
ess
es
495

Inp r
actic
e ,ther elat
ionshi
pb e
t weent henami nghi er
a r
chya ndthet re
eof
se
r v
e r
sisnota ssimplea sourmode limpl
ies.Thet reeofs erv
ershasf ewlevel
s
becauseas i
nglephys i
calservercanc ontai
na l
loft hei nformati
onf orla
r g
ep ar
ts
oft henaminghi erar-chy.Inp art
icular,organi
zationsof tencoll
ectinformati
on
from alloft heirs ubdoma i
nsintoas ingl
es erv
er .Fi g
ure23. 4s howsamor e
real
ist
icorganizat
ionofs e
rversfort henaminghiera r
chyo fFigure23.2.

Root
S
erve
r

s
erve
rfor ser
verfor s
erverfor ser
verfor
...
ibm.
com p
urdue.
edu ns
f.gov r
est
on.v
a.us

Fi
gur
e23.
4Ar e
alis
ticorg
aniza
tionofserve
rsforthenaminghie
rar
chy
ofFigure23.2.Becausethetreei
sb r
oada ndfla
t,onl
ya
fe
ws erversneedtob ec
ontac
tedwhenresol
vinganame.

Ar oots e
rv e
rc onta
insinformati
ona boutt herootandt op-
le v
eldoma i
ns,and
e
achor gani
zationus esas i
ngl
es erv
erf oritsna mes.Becausethet reeofs ervers
i
sshall
ow,a tmos tt woserver
sne edtob ec ontacte
dt oresol
veana melikexinu.
c
s.pur due.edu:t herootserverandt hes erverfordoma np
i urdue.edu( i.
e.,
t
her oots e
rverk nowswhi chserverhandlesp urdue.edu,andt hee nt
iredoma i
n
i
nfor
ma ti
onf orPur dueUniversi
tyre-si
desino neserv
er)
.

23.
11Doma
inNa
meRe
sol
uti
on

Althoug ht hec onceptualt r


eema ke
sunde rs
tandingt her e
lations hipbe t
we en
serverse asy,i thi dess everals ubtl
e detai
ls.Looking att he na me r es
olution
alg
or i
thm wi llhelpe xplai
nt hem.Conc eptuall
y,doma inna mer esolutionp roceeds
top-down,s tarti
ngwi t
ht her ootna mes erverandp roceedi
ngt os e rverslocated
att helea vesoft het r
ee.The rea retwowa ystous et heDoma inNa meS ystem:
byc ontactingna mes erversonea tat imeora ski
ngt henames erv ers ys
t e
mt o
performt hec omp l
e tet r
ans l
ati
on.I ne it
herc a
se,t hec li
ents oftwa reformsa
doma i
nna meque ryt hatc ontai
nst hena met ober esolve
d,ade clara ti
onoft he
cl
assoft hena me ,t hetypeofa nswerde si
red,andac odethats pec i
fieswhe ther
thena mes e
rv e
rs houldt ransl
atet henamec omplet
ely.Thec li
ents e ndst heque ry
t
oana
mes
erv
erf
orr
esol
uti
on.
496 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

Whe nadoma inna mes e


rverr ec e
ivesaque ry,itc heckst os eeift hena me
l
iesint hes ubdoma i
nf orwhichiti sa nauthori
ty.Ifs o,itt rans
latesthena met o
ana ddr e
ssa ccordi
ngt oitsdatabase,a nda pp
endsa na nswert ot hequeryb efore
sending itb ackt ot he c l
ie
nt.I ft he name serverc a
nnotr esol
vet he na me
comp l
et e
ly,itc heckstos eewha tt ypeofi nter
actiont hec l
ients pe
cif
ied.I ft he
cl
ient r equestedc omp l
etet ra
nslation (re-c
ursi
v eres ol
ution,in doma i
n na me
terminology),t hes er
v ercontactsadoma i
n names e rvert hatc anr esolvet he
namea ndr et
ur nsthea nswertot hec li
ent.Ifthec l
ie
ntr e
-que s
te dnon-re c
ursive
resol
ut i
on( iterati
ver esol
uti
on),t hena mes er
verc annots upp
lya na ns wer.I t
gener a
t e
sar e
p l
yt hats pe
cifi
est hena mes er
vert hec l
ie
nts houldc ont actt o
resol
v ethena me .
Howdoe sac l
i
entf i
ndana meser
vera twhic
ht obe gi
nt hesear
ch?Howdoe s
ana mes e
rverfi
ndot hernames er
versthatcananswerque sti
onswhenitcannot?
Thea nswersares i
mple.Ac li
entmustk now how toc ontactatleastonena me
server.Toensur
et hatadoma innamese r
vercanreachot her
s,thedomainsystem
requir
e sthateachs erv
e rknow thea ddre
ssofa tlea stoner ootserve
r.I n
addit
ion,as e
rverma yk now theaddr
essofas erverfort hedoma i
nimmediat
e l
y
aboveit(cal
le
dt heparent).
Doma i
nna mes erv ersus eawe ll
-knownp rotocolportfora l
lcommuni ca ti
on,
soc l
ientsknow how t oc ommuni cat ewithana mes erve
ronc etheyk now t heI P
addressoft hema chi
nei nwhi chthes erverexecutes.How doesac l
ientlear nt he
addressofana mes er ver?Ma nys yst
emsob tainthea ddre
ssofadoma i
ns erver
automa t
ical
lyasp a
r toft heb oots
t rapproces
s.Fore xa
mple,boots
trapp rot ocol
s
sucha sIPv4sDHCPa ndI Pv6sNDPorDHCPv 6c ans up
plyana meservera ddr ess
.
Ofc ourse,othera p-p roachesa rep oss
ibl
e.Fore x
a mple
,thea ddres
sofana me
servercanb eboundi ntoa p-pl
ica
tionp rogra
msa tcompil
etime.Alter
na ti
vely,t he
addresscanb estor
e di naf i
l
eons econdarystorage.

23.
12Ef
fic
ientTr
ans
lat
ion

Althoughi tma ys eem na tura ltor es


olv eque rie
sb ywor kingdownt het reeof
names ervers,doi ngs oc a nl eadt oineffici
e nc i
e sfort hre er e
a sons .First,b eca
us e
mostna mer esol
ut ionr efe rst ol ocalname s,t racingap a tht hr oug ht hehi era
rc hy
toc ont ac
tt he l oc ala ut hority woul db ei neffi
cient.S econd,i fe ach na me
res
o l
ution alwa yss ta r
te db yc on- tacti
ng t het opl eveloft hehi erarchy,t he
machinea tt ha tp oi ntwoul db ecomeov erloa d-ed.Thi rd,f ailur eofma chinesa t
thet oplevelsoft hehi e ra rchywoul dp reve ntna mer e
s ol
ut i
on,e venift hel oc a
l
authori
t yc ouldr esolvet hena me .Thet elep honenumb erhi erarchy me nti
one d
earl
ierhe l
pse x pl
ain.Al t houg ht elephonenumb e rsarea ssignedhi erarchi
c a
lly,the y
arer es
olvedinab ot tom- upf ashion.Be c
a uset hema j
orit yoft el
e-phonec all
sa re
l
ocal,the ycanb er e sol
v edb yt hel ocalex cha ng ewi t
houts earc hingt hehi erarchy.
Furthermor e,c al
lswi thinag i
ve na reac odec anb er es
ol vedwi thoutc ont act-ing
si
tesout si
det hea r eac ode .Whe na p
pli
edt od oma i
nna me s,the seideasle adt oa
two-stepna mer e solutionme cha nismt hatp re servesthea dmi nistrativehi era
rc hy
butp er-mitsef fi
cie ntt r ans l
ation.
Forrel
iab
il
it
y,therearemul t
ipl
eserv
ersfore ac
hnodei nt
hedoma
ins
erv
ert
ree
;ther
oot
s
erv
erisfurt
h-errep
li
c a
tedt
op rovi
deloa
dbala
ncing.
SeeChap
ter22f oradi
scus
sionofboot
stra
pp i
ngprot
ocol
s.
Sec
.23.
12 Ef
fic
ientTr
ans
lat
ion
497

Inthet wo-
stepnameresol
utionproces
s,re
sol
uti
onb e
ginswit
ht heloc
al
namese
rver
.I ftheloc
als
erv
erc annotres
olveaname,thequerymustthe
nb e
se
nttoanothers
erve
rinthedomainsyst
em.Thefoll
owi
ngisak e
yide
a:

Ac
li
ental
waysc
ont
act
sal
ocaldomai
nnames
erv
erf
irs
t.

23.
13Ca
chi
ng:TheKe
yToEf
fic
ienc
y

Ifar es
olve
rs endseachnonlocalquerytoar ootser
ver,t hec
ostoflookup
f
ornon-localnamesc anb eextremelyhigh.Evenifquerie
sg odi
rec
tlytot he
s
erve
rtha thasauthorit
yf orthename ,namelookupcanpresentaheavyl
oadt o
t
heInternet
.Thus,t oimprovetheov era
llper
formanceofana meserv
ersyste
m,
i
tisnec
essarytolowe rthecos
tofl ookupfornonloc
alnames.
Int er
ne tna mes erver
sus ec achi
ngt oma k ere s
olutione ffic
ient.Ea chs er
ver
ma i
n-ta i
nsac ac heofa nswerst or ec
e ntl ookup saswe l
la sar e c
ordofwhe rethe
answerwa sob tained.Whe nac li
enta s k
st hes e rve
rt or e s
olveana me,t hes er
ver
fi
rstc he c
k stos eei fitha sa uthorityf ort hena mea c c
ordingt ot hes t
andard
procedur e
.I fno t ,thes er
ve rc hecksi tsc ac het os eei ft hena meha sb een
resol
vedr ece
ntly.S e
rv er
sr eportc achedi nforma tiont oc li
ents,b utma rkita sa
nonaut hori
tativebi ndinga ndg i
vet hedoma i
nna meoft hes e rver,S,f rom which
theyob t
ainedt heb inding.Thel ocalse r
v e
ra lsos endsa l
onga dditi
onalinforma ti
on
thatt ell
st hec li
e nttheb i
ndingb etwe enSa nda nI Pa ddress.The refore,c l
ie
nts
recei
vea nswe rs qui c
k l
y,b ut t he i nforma tion ma yb e out -of-date.Be c
ause
effi
ciencyi si mp ortant,ac lie
ntwi lla cceptt henona uthoritati
vea nswera nd
proceed.
Cachingwor kswe l
lint heDoma i
nNa meS ystemb ec
a usenamet oa ddre
ssbind
-
ingsc hangei nfrequently. Howe ve
r ,t hey do c hange.I fs erv
e r
sc ached
i
nformati
ont hef i
rsttimei twa srequestedandne v
e rup dateda nentry,entri
es
i
nt hec achecouldb e-comes tal
e( i.
e.,incorrect
).Tok eept hec ac
hec orrec
t,
s
erversonlys a
vec achedinf or
-ma t
ionwhi lethei nforma ti
oni sv a
li
d onc ea n
i
temb ec
ome sstal
e,as erverremov e
st heitemf romt hec ache.Afterane ntryhas
b
eenr emov e
df romitsc ache,as er
vermus tgob ackt ot hea uthori
tati
vesource
a
ndob tai
nt hebindi
ngt os ati
sfysubseque
ntr equests.
Thek eyt oDNSs ucce
s sari
sesbec
auseas e
r ve
rdoesnota ppl
yas inglefix
e d
timeout toa l
le ntr
ies.I nst
e a
d,DNS a llowst he authorit
yf or a ne nt r
yt o
config
ureit sti
me out.Thati s
,whe nev
era na uthori
tyre s
pondst oar eque s
t,the
authorit
yi ncl
udesaTi meToLi ve(TTL)v alueint her e
s ponsethats p
ec i
fieshow
l
ongt heb i
ndingwi l
lre mai
nv ali
d.Thus,aut horiti
escanr educenet workov erhe
a d
bys peci
fyi
ngl ongt i
me out sforentri
est hatt he yexpectt orema inunc hanged,
whil
es peci
fyingshortt imeout
sf orentr
iest hatt heyexpectt oc
ha nge.
Cachi
ngisi mpor
tantinhostsa
swella
si nloc
alnamese
rvers
.Mostres
olv
er
s
oft
wa recac
he sDNSe nt
rie
sinthehos
t.Thus,ifauserl
ooksupthesamename
r
e-pea
tedl
y,s ubse
quentlookup
sc a
nb eresol
vedfrom t
heloca
lc a
chewit
hout
us
ingt
hene
twor
k.
498 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

23.
14Doma
inNa
meS
yst
em Me
ssa
geFor
mat

Lookinga tt hede tai


lso fme ssagese xc ha ngedb etwe enc l
i
e ntsa nddoma i
n
na mes erverswi llhe l
pc lar
ifyhowt hes ys
t e
m op er
atesf romt hev iewofat ypical
app l
icat
ionp r ogram.Wea ssumet hataus eri nvokesa na pp l
icationp rog rama nd
sup pl
iest he na me ofa de sti
na tion ma chine wi th whicht he a ppli
cat i
on mus t
communi c
a te.Be for eitc anus ep r otocol
sl i
k eTCPorUDPt oc ommuni c a
t ewith
the s peci
f i
ed ma chine,t he a p pl
ica -ti
on pr og ram mus tf ind t he ma c hi
ne
sI P
addr es
s.I tp assest hedoma i
nna met oal ocalr esol
vera ndr eque stsa nI Pa ddress
.
Thel ocalr esolverc heck sitsc ache ,a ndr etur nst hea nswe rifonei sp resent.If
thel ocalresolverdoe snotha vea na nswer,itf orma t
same ssagea nds endsi tt oa
na mes erver( i.e
.,t hel ocalr e
solv erb ecomesac l
ie
nt).Althoug houre xamp leonly
involvesonena me ,t heme ssa g
ef or mata l
lowsac li
entt oa skmul tip
leque sti
onsin
as ingleme ssa ge.Ea chque sti
onc ons i
stsofadoma i
nna mef orwhi c
ht hec li
ent
seeksa nI Pa ddress,as pecifi
ca ti
onoft heque ryc l
ass( i
.e.,i nter-net),a ndt he
typ eofob j
ec tde sired( e.
g.,a ddr ess).Thena mes erverr espondsb yr etur n-i
nga
similarme ssaget ha tc ontainsa ns we rstot heque sti
onsf orwhi cht hes e rverhas
bindings.I ft he na me s erverc a nnot answe ra l
lque stions,t he resp onse will
cont ai
ni n-for mationa bouto therna mes erv erst hatt hec l
ientc anc ont ac
tt o
obt ai
nt hea nswe rs.
Res
pons
esa l
soc ontai
ni nf
orma
tion a
bout t
he na
me se
rverstha
ta r
e
a
uthor
iti
esfortherepli
esa ndtheIPaddr
ess
esofthos
ese
rvers
.Fig
ure23.
5
s
howsthemess
agefor
ma t.

0 1
6 31
I
DENTI
FICATI
ON PARAMETER
NUMBEROFQUES
TIONS NUMBEROFANS
WERS
NUMBEROFAUTHORI
TY NUMBEROFADDI
TIONAL
QUES
TIONSECTI
ON
...

ANS
WERSECTI
ON
...

AUTHORI
TYS ECTI
ON
...

ADDI
TIONALI
NFORMATIONS
ECTI
ON
...

Fi
gur
e23.
5Doma i
n name ser
v e
r mess
agef ormat. The QUESTI
ON,
ANSWER,AUTHORITY,andADDI
TI ONALINFORMATION
s
ect
ionsa
rev
ari
abl
ele
ngt
h.
Sec
.23.
14 Doma
inNa
meS
yst
emMe
ssa
geFor
mat
499

Ast hefi
gureshows,eachme s
sageb e
ginswithaf i
xedhea de
r.Theheade
rc on
-ta
insauni queIDENTIFICATIONf i
eldthatthec l
ientusestoma tchresp
onsesto
queries
,a nda PARAMETER f ie
ldt hatspeci
fie
st heop era
tion reque
ste
da nda
res
p onsecode.Fig
ure23. 6g i
vesthei nterp
retati
onofb i
tsi nthePARAMETER
fi
eld.

Bi
tofPARAMETERf
iel
d Me aning
0 Operati
on:
0Que ry
1Res ponse
1-4 QueryTyp e:
0S t
a ndard
1Inv erse
2S e
r vers tatusr equest
4Not ify
5Up da t
e
5 Setifa nswe raut horitativ
e
6 Setifme ss
ag etr uncated
7 Setifre cursionde sir
e d
8 Setifre cursiona vail
able
9 Setifda tai saut henticated
10 Setifche ckingisdi sabled
1
1 Reserved
12-15 ResponseTyp e:
0Noe rror
1For ma te rrorinque ry
2S e
r verf ai
lur e
3Na medoe snote xist
5Re fused
6Na mee xis
tswhe ni tshoul
dnot
7RRs ete xis
t s
8RRs ett hats houlde xis
tdoesnot
9S e
r vernota uthor i
tati
veforthezone
10Na menotc ontainedinzone

Fi
gur
e23.
6Theme a
ningofbi
tsofthePARAMETERfi
el
dinaDNSs
erv
er
me
ssa
ge.Bitsa
renumbe
r e
dlefttori
ghts
tart
inga
t0.

I
nFigure23.5,thefiel
dslab
eledNUMBEROFe ac
hgiveacountofentri
esin
thecorre
spondi
ngsec
t i
onsthatoccurla
teri
nt hemes
sag
e.Forexampl
e,thefie
ld
l
a b
eld NUMBER OFQUES
e TI
ONS give
st hecountofentri
estha
ta pp
earint he
QUESTIONSECTIONoft heme s
sag
e.
TheQUES
TIONSECTI
ON cont
ainsquer
iesf
orwhic
ha ns
wer
saredesi
red.The
c
li
entfil
l
sino nl
ytheques
tionsecti
on;theser
verret
urnstheque
sti
onsa nd
a
nswe
rsi
n
500 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

i
tsres
ponse
.Eachque
sti
oncons
issofaQUERYDOMAI
t NNAMEf
iel
dfol
l
owe
dby
QUERYTYPEandQUERYCLASSfi
elds
,asFi
gur
e23.
7shows
.

0 1
6 31
QUERYDOMAI
NNAME
...

QUERYTYPE QUERYCLAS
S

Fi
gur
e 23.
7 The formatofe ntr
iesint he QUESTI
ON SECTI
ON ofa
domainna mes er
verme ssa
ge.Thedoma i
nna meisvar
iabl
e
le
ngth.Ac l
ientfi
ll
sint heques
tions
;as er
verret
urnsthe
ques
tionsalongwithanswers.

Althought heQUERYDOMAI NNAMEf ieldhasv a


ria
blelength,wewi l
lseei n
thene xts e
ct i
on thatt hei nt
ernalrep resentati
on ofd oma i
n name sma kesi t
possi
blef orther ec
eivert oknowt heexac tlength.TheQUERYTYPEf ieldencodes
thet ypeoft heque st
ion( e.
g.,whethert heque stionrefer
st oama chinena meor
ama iladdress).The QUERY CLAS Sf ie
lda ll
owsdoma i
n na mest obeus edf or
arbi
tr ar
yob jectsbecauseof fi
-ci
alInternetna me sa reonlyonep ossi
bleclass
.I t
shoul
db enote dthatalthoughthedi-agrami nFigure23.7f oll
owsourc onvention
ofs howingf ormatsin 32- b
itmul ti
pl
es,t he QUERY DOMAI N NAME f ie
ld ma y
containa na rbi
trar
ynumb erofoc tets
.Nop addingisus e
d.The ref
ore ,messages
sentt oorf romdoma inna mes e
rversmayc ontai
na noddnumb erofoc tets
.
I
nadoma innameserv
erme ss
age,e
achoftheANS
WERSECTION,AUTHORITY
SECTION,and ADDITI
ONALI NFORMATI
ON SECTI
ON f
iel
dscons
ist
sofas etof
res
ourcerecor
dsthatdes
crib
edoma i
nnamesandmappi
ngs
.Eachresour
cere
cord
de
scr
ibe
sonena
me.Fi
gur
e23.
8showst
hef
orma
tofar
esour
cer
ecor
d.

0 1
6 31
RES
OURCEDOMAI
NNAME
...

TYPE CLAS
S
TI
METOLI
VE
RES
OURCEDATALENGTH
RES
OURCEDATA
...

Fi
gur
e23.
8Theformatofaresour
cere
cordus
edinl
ate
rse
cti
onsof
me
s-s
agesret
urne
db ydomai
nnamese
rve
rs.
S
ec.23.
14 Doma
inNa
meS
yst
emMe
ssa
geFor
mat 501

TheRES OURCEDOMAI NNAMEf iel


dc ontainst hedoma i
nna met owhi chthis
res
our cerecordrefe r
s.Itma ybea na r bi
traryl engh.TheTYPEf
t ie
ldspeci
fies
thetyp eoft hedataincl
udedi nther es
our cere cor
d;t heCLASSfiel
ds pec
ifi
esthe
data
sc las
s.The TI ME TO LI VE f i
eldc ontai
nsa32- b
itinte
g e
r.Thei nteg
er
spe
cifiesthenumb erofs e
condst hatinforma tioni nther es
ourcer ec
ordc anbe
cac
he d.Cli
entsuset heTIMETOLI VEvaluet os etat i
me outwhent heycachethe
res
our cerecord.Thel as
tt wof i
eldscont ai
nt her esul
t softheb i
nding,withthe
RESOURCEDATALENGTH f ie
ldspe ci
fyi
ngt hec ountofo ct
etsint heRES OURCE
DATAf iel
d.

23.
15Comp
res
sedNa
meFor
mat

Whe nrepre
sent
ediname s
sag
e,doma i
nna mesa restoredasas equenceof
l
abel
s.Eachla
belbegi
nswit hanoctettha
ts pe
c i
fi
esitsle
ng t
h.Thus,ther ece
iver
r
econstr
uctsadomainna meb yrepeat
edl
yr eadi
nga1 -octetleng
th,n,a ndt he
n
r
eadingalabelnoc-tet
sl ong
.Al engthocte
tc onta
iningzeroma rk
st hee ndof
t
hena me.
Domainnames e
r ve
rsofte
nr eturnmul ti
pleanswerst oaque ry,andinma ny
cas
es,suffix
esoft hedoma i
nov er
lap.Toc onserv
esp a
cei nar eplypack
et,ana me
ser
verc ompressesna mesbystori
ngonl yonec opyofe ac
hdoma inname.Whe n
extr
a c
tingadoma i
nna mef r
om ame ss
age,t hecli
ents oftwaremus tcheckea c
h
seg
me ntoft hena met oseewhetheritc onsi
stsofal it
e r
als t
ring(intheformat
ofa1 -oc
tetc ountf oll
owedb ythec haractersthatma keupt hena me)ora
poi
ntert oal i
teralstri
ng.Whenite n-countersap oi
nter,t hec l
i
entmus tfol
low
thepointertof i
ndt heremai
nderoft hena me.
Poi
nte
rsa lwaysocc
ura ttheb egi
nni
ngofs egmentsanda r
ee ncodedinthe
countbyte
.I fthet opt
wob i
tsoft he8-bi
tsegmentcountf i
el
da r
e1s ,t
hecli
ent
mustt a
ket hene xt14bit
sa sanintegerpoi
nter
.I fthet optwob i
tsa r
ezero,
thenext6b it
ss p
e c
ifyt
henumb e
rofc harac
tersi
nt helab
el.

23.
16Ab
bre
via
tionOfDoma
inNa
mes

TheU. S.t el
ephonenumb erhi era
rchyi l
lustratesa nothe rus ef
ulf eat
ureof
l
ocalresol
ut on,na
i meabbr evi
ation.Abbr e
viationp rovi
desame thodofs horteni
ng
nameswhe nt her esolvi
ngp r
oc essc a
ns upp l
yp artoft hena mea utomatical
ly.
Normall
y,as ub s
criberomi tsthea reacodewhe ndia l
i
ngal ocaltelephonenumb er.
Ther e
sulti
ngdi gi
tsf orma na bbrev i
atednamea ssumedt ol i
ewi thint hes a
mea r
e a
codea sthes ubscri
be r
sp hone.Ab b
reviat
iona l
sowor kswe llforma chi
nena me s.
Givenana mel i
kex yz,t her esolvi
ngp rocessc ana ss
umei tliesint hes amel ocal
authori
tya st hema chi
neonwhi chi tisb eingr esolve
d.Thus ,t her esolve
rc a n
suppl
ymi s
singp artsoft hena mea utomatica
lly.Fore xamp l
e ,withint heComp ute r
Sci
encedepa r
tme nta tPur -due,t hea bbr
eviatedna me :
xi
nu
i
sequi
val
entt
othef
ulldoma
inna
me:
502 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

xi
nu.c
s.pur
due.edu
Mostcli
ents oft
wareimple
mentsabbrev
iati
onswithadoma i
nnames uf
fixlis
t.The
l
o-calnetwor kmanagerconf
igure
sal is
tofp os
sibl
es uffi
xestob eappendedto
namesdur-inglookup
.Whe nar esol
verencountersana me,its t
epsthroughthe
l
ist
,a p
pendinge ac
hs uff
ixandlooki
ngupt heresult
ingna me.Forexamp l
e,the
suff
ixli
stfort heComputerSci
encedepar
tme ntatPur dueinc
ludes
:

c
.s.pur
due.edu
pur
. due .
edunul
l

Thus,alocalre s
olv
e rf i
rstappendscs.purdue.edut othena mex inu.Ift hat
l
ookupfail
s,t her esolv
era ppendspurdue.edu ontot hena mea ndt ri
esa g
a i
n.
Thelas
ts uffixint hee x
amp l
el i
stisthenullstr
ing,me ani
ngt hatifa llother
l
ookupsf a
il
,t her esol
verwi l
la tte
mp ttolook up thena mewi t
h no s uffi
x.
Manage
rsc anus et hes uffi
xlisttoma keabbre
viati
onc o
nv e
nie
ntort or estri
ct
appl
i
cati
onp rogramst olocalnames.
We saidtha tthe cli
ent t a
k esr esp
onsi
bil
ityfor the expans
ion of such
abbre
viat
ions,butitshoul
db ee mphasizedthatsuchabbr
eviat
ionsarenotp artof
theDoma i
nNa meS ys
t emits
elf.Thedoma insys
t e
m onl
ya ll
owslookupofaf ul
ly
spe
cifi
eddoma i
nna me.Asac onsequence,progr
amst ha
td ependona bbr
e v
iati
ons
maynotwor kc or
rec
t -
lyoutsidet hee nvi
ronmentinwhicht heywe rebuil
t.We
cansumma ri
ze:

TheDomai nNameSyst
em onl
ymapsful
ldomai
nnamesi ntoad-
dress
es;abbr
evi
ati
onsarenotpartoftheDNSi t
sel
f,butar e
intr
o-ducedbycli
entsof
twaretomakeloc
alnamesconveni
ent
forusers
.

23.
17I
nve
rseMa
ppi
ngs

Wes ai
dt ha
tt heDoma inNa meS ystemc anp rovi
dema ppingsot hert hana
com-puternamet oa nIPa ddres
s.Inversequeriesallowthec l
i
entt oa skas erver
toma pintheoppositedirecti
onb ytakinga nanswe randg e
neratingtheque s
tion
thatwouldp ro-ducet hata nswer.Ofc ourse
,nota l
lanswer shaveauni que
quest
ion.Evenwhe nt heydo,as erv
e rma ynotb ea bl
et oprovideit .Alt
houg h
inv
ersequerie
sha veb e
enp artoft hedoma i
ns yste
ms inceitwa sf i
rstspecifi
ed,
theyareg e
neral
lynotus edb ec
ausethe reisoftennowa ytof i
ndt hes er
vert hat
canresol
vetheque rywithouts ea
rchi
ngt hee ntir
es etofservers.
S
ec.23.
18 Poi
nte
rQue
rie
s 503

23.
18Poi
nte
rQue
rie
s

Onef orm ofi nv ersema ppingi sa na ut hent i


cationme c hanismt ha tas erver
usest ove rif
yt ha tac li
enti sa ut hori
ze dt oa c
c es
st hes erv i
ce:t hes erverma ps
thec li
entsIPa d -dr e
sst oadoma inna me .Fore xamp l
e,as e
r vera tc orporat i
on
exampl e.com mi ghtb econfigur edt oprov i
det hes erviceonl yt oc li
entsf rom t he
samec orpor a
tion.Whe nac li
e ntc ontactst hes e
r ver,t hes er v
e rma pst hec li
e nt
s
IPa ddresst oa ne quiva
lentdoma in namea ndv eri
f iest ha tt hena mee ndsi n
exampl e.com bef oreg rantinga ccess.Re v
e rsel ookupi ss oi mp ortantt ha tt he
doma ins ystems up p ortsas pe ci
a ldoma ina ndas pecialf orm ofque sti
onc al
leda
pointerquer yt op rov i
det hes ervi
c e.Inap oi
nt erque ry,t heque sti
onp r
e sented
toadoma inna mes erversp ecif
iesa nI Pa ddresse ncode da sap rintablestr i
ngi n
thef orm ofadoma inname( i.e.,at e
x tualr epresent ationofdi g i
tss e
p ar
a tedb y
periods).Ap ointe rque r
yr e questst hena mes e r
v ert or e t
ur nt hec or r
e c
tdoma in
namef ort hema c hinewi tht hes pec i
fiedI Pa ddre s
s.
Poi
nterqueri
esa
renotdif
fic
ulttogener
ate.Cons
ide
rI Pv4.Whenwethi
nk
ofa
nI Pv4addr
esswri
tte
nindott
ed-de
cimalf
orm,ithasthefoll
owi
ngfor
mat:

aaa.bbb.c
cc.ddd

Tofor
m ap oi
nterque
ry,thec
li
entrear
rang
est
hedot
tedde
cima
lre
pre
sent
ati
on
oft
hea ddr
essint
oastri
ngofthefor
m:

ddd.c
cc.bbb.aaa.i
n-addr.ar
pa

Thene
wfor
misana
mei
nthes
pec
iali
n-addr.ar
padomai
n.
IPv6ismo recomp l
exandresul
tsinmuc hlong
erna mes
.Toform apoi
nter
query,ac l
i
entr e
p r
e s
entstheIPv6a ddr
essasas e
rie
sofnibbl
es(i
.e.
,4- b
it
quantit
ies
),wr i
tesea c
hni bb
leinhexadeci
mal
,r ev
ersestheor
deranda pp
ends
ip6.
arpa.Forexample,theIPv6a
ddress
:

2001
:18e
8:0808:
0000:
0000:
00d0:
b75d:
19f
9

i
sre
pre
sent
eda
s:

9.
f.9.
1.d.
5.7.
b.0.
d.0.
0.0.
0.0.
0.0.
0.0.
0.8.
0.8.
0.8.
e.8.
1.1
.0.
0.2.
ip6.
arp
a

Be
caus
ethel
oca
lna
mes
erv
eri
snotus
ual
l
ythea
uthor
ityf
ort
hedoma
ins
ar
pa,i
n-addr.ar
pa,ori
p6.ar
pa,t
hel
oca
lna
mes
erv
erwi
l
lne
edt
ocont
act
othernameserver
st ocompletet
heresol
uti
on.Tomaketheres
oluti
onofpoi
nter
queri
eseffi
ci
ent,theI nte
rnetrootdomainser
versmai
nta
inada tab
aseofval
i
d
IPaddres
sesal
ongwi thin-for
mati
onaboutdomainnamese
rve
rst ha
tc a
nres
olve
eachaddre
ssgroup.
Theocte
tsoftheIPaddressmus
tb er
evers
edwhenfor
mingadomai
nna
meb ec
a us
eI P
a
ddres
sesha
vet hemos
tsig
nifi
cantoct
etsfi
rst
,whil
edoma
innameshav
ethel
eas
t-s
ignif
ica
ntoc
tet
s
f
irs
t.
504 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

23.
19Ob
jec
tTyp
esAndRe
sour
ceRe
cor
dCont
ent
s

Weha veme ntionedt hattheDoma i


nNa meS ystemc anbeus edfort ransl
ati
ng
adoma i
nna met oama ile x
cha ngera ddressaswe llasfort ra
ns l
ati
ngahos tname
toa nIPa ddress.Thedoma ins yst
e mi squiteg eneralinthati tcanb eus edfor
arbi
traryhier
ar c
hicalname s.Fore x a
mp le,onemi ghtdecidetos tor
et hena mesof
avai
lab
lec omputa t
ionals er
vicesa longwi thama ppingf r
om e achna met othe
tel
ephonenumb ert oc al
lt of i
ndouta boutt hec orr
espondingser v
ice
.Orone
mightstorename sofp roto-colp r
oduc tsa l
ongwi thama ppi
ngt ot hename sand
addres
sesofv endorsthatof fers uchp roducts.
Re ca
llthatthe domai
ns yst
em a ccommodatesa vari
et y of ma
ppingsby
i
ncl
udingat ypeineachres
ourcerecord.Whens endi
ngar equest,acli
entmust
s
peci
fyt hetyp
ei nitsquery;ser
v e
r sspec
ifyt hedat
at ypeina l
lr es
ourc
e
r
ecordst heyre
turn.Thetypedeterminesthec onte
ntsoft her es
ourcerecor
d
a
ccordingtothetabl
einFi
gure23.9.

Type Meaning Contents


A IPv4Hos tAddres
s 32-bi
tI Pv4a ddr ess
AAAA IPv6HostAddr e
ss 128-bi
tI Pv6a ddr es
s
CNAME Canonic
alNa me Canonicaldoma inna mef ora na l
ias
HINFO CPU&OS NameofCPUa ndop erati
ngs ystem
MINFO Mail
boxI nfo Infor
ma tiona boutama il
b oxorma i
lli
st
MX MailExchanger 16-bi
tp referenc eandna meofhos tthat
actsasma i
le xchangerf orthedoma in
NS NameSer
ver Nameofa uthor itat
iveserv e
rf ordoma i
n
PTR Poi
nte
r Domainna me( likeas ymb oli
clink)
SOA Sta
rtofAut
hor
ity Multi
plef ie
ldst hats pe
cifywhi ch
partsoft hena minghier a
rchy
aserve rimp l
e ments
TXT Ar
bit
rar
yte
xt Unint
e r
pr eteds tri
ngofAS CIIt ext

Fi
gur
e23.
9Af ewex
amp l
esofDNSresour
cer
ecor
dtyp
es.Mo
ret
han
f
ift
ytypeshaveb
eende
fined.

Mos tda tai soft ypeAorAAAA,me ani


ngt hati tconsis
tsoft hena meofa
hosta t-tac
hedt ot heI nternetalongwi t
ht hehostsI Paddress.Thes econdmos t
usefuldoma int ype,MX,i sa s
sig
ne dtona mesusedf ore l
ectronicma ilexchang
er s
.
Itallowsas i
tet os peci
fymul ti
plehostst hataree a chc a
pa bl
eofa c ce
pt i
ngma il
.
Whe ns endi
nge l
e c
tr onicma i
l,theus e
rs peci
fiesane lect
ronicma iladdressint he
form us er@doma i
n- part.Thema i
lsystem us est hedoma ins ystemt or es
olve
domai n-
partwi thque rytyp eMX.Thedoma i
ns ys
t e mr eturnsas e
tofr e
source
rec
or dst hatea chc ont ai
nap ref
e r
encef i
eldandahos t
sdoma i
nna me.Thema i
l
sys
te ms tepst hroug ht hes etfrom highestprefer
e nc etol owest( l
owe rnumb ers
meanhi gherp referenc e).ForeachMXr esourcerecor d,the
Quer
iesc
anspeci
fyaf
ewa
ddi
ti
ona
ltyp
es(
e.g
.,t
her
eisaque
ryt
ypet
hatr
eque
stsa
ll
re
sourc
erecor
ds)
.
S
ec.23.
19 Ob
jec
tTyp
esAndRe
sour
ceRe
cor
dCont
ent
s 505

mail
erext
ract
sthedomai
nnamea ndusesat ypeAort ypeAAAAquer
yt oresol
ve
thatna
met oanIPaddr
ess.I
tt he
nt ri
estoc ontac
tthehostanddel
ive
rma il
.If
thehos
tisunava
il
abl
e,t
hema i
le
rwi l
lcont
inuet r
yingothe
rhostsontheli
st.
Toma kelookupe ff
ici
ent,as er
vera l
waysr eturnsaddi
ti
onalbi
ndi
ngst
hatit
knowsint heADDI TIONALI NFORMATIONSECTI ON ofar es
ponse
.Inthecaseof
MXr ecor
ds,adoma i
ns erv
erc anuset heADDI TIONALINFORMATIONSECTI
ONt o
returntype A or AAAA r esourc
er ecordsf ordoma in na
me srep
ortedi
nt he
ANSWERSECTI ON.Doingsos ubst
antia
llyreducest henumberofqueri
esama i
l
er
sendstoitsdoma i
nserver.

23.
20Ob
tai
ningAut
hor
ityForAS
ubdoma
in

Bef orea ni nstituti


on isg ranteda uthorit
yf or a n off i
ci
als econd- l
evel
domain,i tmus ta greet ooperat eadoma i
nna mes ervert hatme etsI nter
ne t
sta
nda rds.Ofc ourse,adoma i
nna mes ervermus tobe yt hep rotocols tandards
thatspe cif
yme s
sagef ormatsandt herulesforr espondingt or e
que sts
.Thes erver
musta lsok nowt hea ddres
sesofs erver
st hatha ndleeachs ubdoma i
n( ifa nye x
ist)
aswe l
la sthea ddres
sofa tleastoner ootse rver.Int hec urrentI nternet,e a
c h
enterprisedoesnotne edtoop erateit
sownna mes er
v e
r .Instead,comp aniesexist
that,f ora na nnualf ee
,r undoma inna mes erversonb ehalfofot he rs
.I nf act,
suchc omp aniescomp eteforb usiness
:t heyof ferav ar i
etyofr elateds ervi
ces,
sucha sv erif
yingt hatadoma i
nna mei sa va
ilabl
e,r egi
ster i
ngt hena mewi ththe
regi
ona lregist
ries,andr egi
ste
ringinversema ppingsviap ointerqueries.

23.
21S
erv
erOp
era
tionAndRe
pli
cat
ion

Inp r ac
t i
ce,thedoma insystemi smuc hmor ec omp l
ext ha nweha v
eout li
ned.
Inmos tc ases,as i
nglep hysicalserverc anha ndlemor et hanonep artoft he
naminghi er
a r
- c
hy.Fore xamp le
,as i
nglena mes e
rvera tPur dueUni versi
tyonc e
handledb otht hes econd-leveldoma np
i urdue .edu aswel la stheg eographic
doma nl
i af.i n.us .As ub-tre
eofna mesma nagedb yag i
ve nna mese rverfor msa
zoneofaut hori
ty,andt hep roto-col
sp rov i
def orzoned ownl oadwher eac l
ient
canob tainac opyoft hee ntires e
tofna me sandr esourc
er ecordsfr om as erver.
Anotherp ractic
alc omp li
cati
ona ri
sesb e-causes erversmus tb ea blet o ha ndle
ma nyre quests,e vent houghs omer equestst akeal ongt imet or esolve.Us ual
ly,
server
ss upportc oncurrenta ctivi
ty,a l
l
owi ngwor kt oproce edonl a terr equests
whileear li
erone sareb e i
ngp rocess
ed.Ha ndli
ngr equestsconc ur re
ntl
yi se special
ly
importantwhe nt hes erverreceivesar ec
ur si
ver equesttha tf orcesitt os e
ndt he
requestont oa nothers erverforr es
oluti
on.
S
erveropera
tionisa l
socompl
ica
tedb eca
usetheInte
rnetauthor
ityr e
qui
res
tha
tt heinformation i
ne ve
ry domain na
mes er
verb erep
lica
ted.Informat
ion
musta p
pearinatl eas
tt woserv
ersthatdonotop er
ateont hesamec omput
e r
.
I
np ra
cti
ce,ther e
quire-
mentsa requit
es tr
ing
ent
:t hes
erver
smusthaveno
s
ing
lecommonpointoff a
il
ure.Avoi
dingcommonpoi
ntsoff
ail
ureme
anstha
tthe
t
wona meser
ver
sc annotbothatt
a c
h
506 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

tot hes amenet work;t heyc annote venobtainelect


rica
lp owerf rom t
hes a
me
source.Thus,tome e
tt her equirements,asit
emus tfinda tle
astoneot he
rs i
te
thata gr
eestoop erateab a
ckupna meserv
er.Ofc ourse,ata nyp oi
ntinthetree
ofse r
vers,ana mes ervermus tk now how tolocat
eb otht heprimaryandbackup
names erversfors ub-doma i
ns,a ndt heserve
rmus tdirectque ri
estoab ackup
names erveri
ft hep r
imar ynames erv
erisunavail
abl
e.

23.
22Dyna
micDNSUp
dat
eAndNot
ifi
cat
ion

Ourdisc ussi
onsofNATi nCha pter19a ndDHCPi nCha p
ter22b othme ntion
thene edf ori nteract
ionwithDNS .I nt hec aseofaNAT b oxtha tobtainsa
dynamicad- dressfrom anISP,as erve
rc anonl ybep l
acedbehindtheNATb oxi f
thedoma inna mes er
verandt heNATs ystemc oordi
nate.Int hec a
s eofDHCP,
whenahos tob tai
nsadyna mica ddres
s,t heDNSs erve
rf ort hehos tmus tb e
updatedwitht hehostsc
urrentaddress.Toha ndlethesitua
tionsdescri
beda bove
andt op ermi tmultipl
ep art
iestos harea dminis
trati
on( e.
g.,t oal
low mul tipl
e
regi
strar
st oj ointl
yma nageat op
-leve
ldoma in),theIETFde vel
opedat echnology
knowna sDyna micDNS.
Therea retwoa s
pectsofDyna micDNS :updateandnot i
fic
ation.Ast hename
im-pli
es,Dyna micDNSup datep ermitsc hangest ob ema dedyna mic
a l
l
yt ot he
informati
ont hataDNSs ervers t
or es.Thus ,wheni ta s
sig
nsa nI Pa ddr esstoa
host,aDHCPs erv
erc anus et hedyna micup dateme c
hanismt oi nformt heDNS
servera bout t he assi
g nme nt. Not ifi
cation me ssagess olv
et he p rob l
em of
propagati
ngc hanges.Inp a r
ticul
a r
,ob servet hatbe c
auseDNSus esb ackups erv
ers,
changesma deint hep ri
ma rys e
r v
e rmus tb ep ropagatedt oeachb ac
kup .Whe na
dynamicc hangeoc curs
,t hep rimarys ervers endsanot ifi
cati
onme ssaget ot he
backups e
rv e
rs,whicha l
lowse achb ackups ervertor equestanup da teoft hezone
informati
on.Be causei ta voidss endingc op i
esunne cessari
l
y,no- t i
fic
ationt akes
l
e s
sb andwidththanme relyus ingas malltimeoutf orup dates
.

23.
23DNSS
ecur
ityExt
ens
ions(
DNS
SEC)

Bec auseiti samongt hemos timportantasp


e c
tsofI nternetinfras
tructure,
t
heDoma i
nNa meS ys
temi softenc i
te dasac rit
icalmechanismt ha
ts houl
db e
p
rotected.I np art
icul
a r
,i fahos tisg iv
ingincorr
ecta nswerst oDNSque ri
es,
a
ppli
cations oftwareorus erscanb ef ool
edintob el
iev
ingimp os
terwe bs i
tesor
r
eveal
ingc onfident
ialinfor
-ma t
ion.Tohe l
pp r
otectDNS ,theIETFha sinventeda
t
echnologyk nowna sDNSS e-curi
ty(DNSSEC).
The primaryse rvic
esp r ov
idedb y DNSSEC inc
lude authent
icat
ion of t
he
messageoriginandint egri
tyoft heda t
a.Thatis,whe nitus esDNSSEC,ahost
ca
nv eri
fyaDNSme ssagedidi ndee
dor ig
ina
t eata na ut
hor i
tat
iveDNSs erve
r
(
i.e
.,t heserverres
p onsibl
ef ort henameintheque ry)andt hatthedatainthe
messagea r
rivedwithoutb e
ingc hanged.Furt
he r
more,DNS SECc anauthent
icat
e
nega
tiveanswe
rs ahos
tc anobt
aina
naut
hent
ica
tedme
ssa
get
hats
tat
esa
pa
rticul
ardomai
nna
medoesnote
xis
t.
S
ec.23.
23 DNSS
ecur
ityEx
tens
ions(
DNS
SEC) 507

De spi
teof feri
nga uthenticat
iona ndinte
g ri
ty,DNS SECdoe snots ol
veallprob
-l
e ms.I np arti
cular,DNS SECdoe snotp rov
idec onfidenti
al
ity,nordoe sitf end
offde nial-
of-servi
ceat tac
k s.Thef ormerme anstha tevenifahos tus e
sDNS SEC,
anout -sideob se
rversnoop i
ngonane tworkwi l
lbea bletok nowwhi chname sthe
hostloo ksup( i
.e.,theob ser
verma ybea blet og uesswhyag i
venb usi
nessis
beingc ontacted).Thei nabil
itytof e
ndof fde ni
al-of-ser
vicea t
tacksme a
nst hat
evenifahos tands er
v erb othuseDNS S
EC,t hereisnog uaranteethatme ss
ages
sentbe twe e
nt hemwi l
lb er e-cei
ved.

Top r
ov i
dea uthent i
cati
ona ndda taintegri
t y,DNS SECus esadi gitalsignatur e
me cha ni
smi nadditiont ot her equestedi nforma t
ion,ar epl
yf rom aDNS SEC
serverc ontainsadi gi
t alsi
gnatur et hata l
lowst her eceivert ov er i
f yt hatt he
cont entsoft heme ss
a gewe renotc hanged.Oneoft hemos ti nt e
re sti
nga s
pec ts
ofDNS SECa risesfrom t hewa yt hedigitalsignatureme chanismi sa dminis
tere d.
Like ma ny s ec
urity me c
ha-nisms ,t he DNS SEC me chanism us esp ubli
c key
encrypt ion technology.Thei ntere s
tingt wisti st hatt odistributep ubli
ck eys ,
DNS SECus est heDoma i
nNa meS ystem.Tha ti s
,ane wt ypeha sb eende fi
nedt ha t
all
owsana met oma pt oap ub l
ick ey.Eac hs erverc ontainst hep ub li
ck eysf or
zone sf urtherdownt hehierarchy( e.g.,thes er v
e rfor.c om c ontainst hep ublic
keyf ore xampl e.c om) .Tog uar a
nt eesecurityf ort hee nt i
res ystem,t hep ublic
keyf ort het opl e
v eloft hehi erarchy( i
.e.,thek eyf orar oots er ver)mus tb e
ma nua ll
yc onfigure
di nt oar es
olver .

23.
24Mul
ti
cas
tDNSAndS
erv
iceDi
scov
ery

BecausetheDoma i
nNa meSyst
emp ermi
tsarb
itr
a r
yr ecordtypestob eadded,
s
ever
alg roups havec rea
ted na
me sfor obj
ects othert hanc omputers
.One
p
arti
cul
arus estandsout.Knownasmulti
cas
tDNS( mDNS),t heservi
ceisintende
d
f
orne t
wor ksthatdonotha vededi
cat
edDNSs ervers.Fore xampl
e,c ons
idera
p
airofsma rtphonesthathaveWi
-Fiint
erfa
ces
.
InsteadofusingaDNSs er
ver,mDNSusesI Pmul
tic
ast
.S upposehostAne eds
t
ok now t he I
Pa ddr
essofhos t B.Host A multi
cas
tsitsr equest
.Al lhosts
p
art
icipa
t i
nginmDNSr e
ceivethemulti
cas
t,a ndhostB mul
t i
castsitsrepl
y.I n
a
ddi
tion,ahostt hatpartic
ipat
esinmDNSc achesmDNSrepl
ie
s ,whichme a
nst hat
t
hebindingcanbes ati
s-fi
edfromt hec
ache.
I
naddi
ti
ont
odoma
inna
mer
esol
uti
on,mDNSha
sbe
ene
xte
nde
dtoha
ndl
e
DNSSer
vic
eDis
cov
ery(DNS-
SD)
.Thebasi
cideai
sstr
aig
htf
orwa
rd:c
reatese
rvi
ce
name
sintheDNShie
rarc
hyusi
ngt l
he.ocals
uff
ix,a
ndusemDNStolookupthe
name.Thus,asmartphonecanuseDNS
-SDtodis
coverothe
rc e
llphonesi
nthe
ar
e athata
rewil
li
ngtop ar
tic
ipa
tei
nagive
napp
li
cati
on.Thephonesonlyne
edto
ag
r eeonanamefortheservi
ce.
Thec hi
efdi s
adva
ntageofusi
ngmDNSf orserv
icedi
scov
eryar
isesfrom the
tr
afficgenerated.Ins
tea
doft wosma
rtp hones,i
magineasetofNsmartp hones
.
Eacha dv
er -
tis
esi t
sel
fasoffer
ingaser
vicea ndthenwait
st obesynce
dwi tha
v
ari
ety ofappl
ic
a-t
ions
.Now i
mag
inet
hes
itua
tion whe
reN i
sla
rgea
ndt
he
p
honesareus
ingaflat(
i.e
.,
508 TheDoma
inNa
meS
yst
em(
DNS
) Cha
p.23

non-routed)openwirel
essnet
work
,s uchasaWi -Fihot
spotinac offe
es hopona
busystreeti nacit
y.Eachphonethatconnectss
endsamul t
ica
stf orthes e
rvi
ces
itoffers,a ndothersres
pondbyc onne
cting
.UnlessN issmall
,t het r
afficca
n
dominatet henet
-work.

23.
25S
umma
ry

Hier
archi
calnamings yste
msa l
low de l
egat
ionofa uthori
tyforna mes
,ma k i
ng
it possi
ble to ac c
ommoda te a n a rbi
trari
l
y l a
rge s et of na mes without
overwhel
mingac en-tralsit
ewi thadministr
ativ
edut i
es.Alt
houghna meresol
ut i
on
isseparatefrom delega-
t i
onofa uthorit
y,i tispossi
blet ocrea
t ehie
rarchical
namingsystemsinwhi c
hr e
solut
ionisa ne f
fic
ientproces
st ha
tstartsatthel ocal
serv
er,e venthoughde le
g ati
onofa ut hori
tya l
waysf l
owsf rom thetopoft he
hie
rarchydownwa rd.
Wee xamine dtheI nternetsDoma in NameS ystem( DNS )a ndsawt ha tit
offersahiera
rc hi
calnamings cheme.DNSus esdis
tri
butedl ookupinwhichdoma in
names er
versma peachdoma inna met oanI Paddres
sorma i
lexchange
ra ddr ess
.
Cl
ientsbe-gi
nb yt ryi
ngt or esol
vena mesl oca
ll
y.Whe nt helocalserv
erc a nnot
res
olvethena me ,t hec l
ie
ntmus tc hooset owor kt hrought het reeofna me
se
rversitera
tivelyorr equestt heloc
a lnames ervertodoi tr e
cursi
vel
y.Fi nall
y,
wes awt hattheDoma inNa meS ys-t
e ms upportsav ari
etyofb indi
ngsincluding
bi
ndingsfromI Pv4orI Pv6a ddress
estohi gh-l
evelnames.
DNSSEC prov
ides a mec
hani
sm tha
tc an be usedtos ecur
e DNS;it
a
uthenti
cat
esrepl
iesandgua
rante
estheinte
grit
yoft heanswe
r s
.DNSSECuses
p
ubli
c-k
eye nc
ryp-ti
on,andarr
angest
ous eDNSt odis
tri
but
et hesetofpub
li
c
k
eys.
Mul
tica
stDNS( mDNS )al
lowst wohostsona ni s
ola
tednetwor ktoobtai
nt he
I
Paddre
ssofhos tsont henet workwithoutr el
yingonaDNSs erver.Anextensi
on
t
omDNS ,DNS-SD,pr ovi
desgeneralservi
cediscovery.As mar
tp honecanuseDNS -
S
Dtodiscoverothers martphonesi nit
sv i
cini
tyt hata rewil
li
ngt opart
ici
patein
agi
vena ppl
ic
ati
ons erv
ice.Thec hiefdisa
dv a
nta g
eofmDNSa ndDNS -
SDa r
ise
s
f
romthet r
af-fi
cg eneratedwhe nane tworkcont a
insma nynodes.

EXERCI
SES

23.
1 Thenameofac omput
ershoul
d ne
verb
ebound i
ntoa
n op
era
ting s
yst
ema
t
comp
il
eti
me.Ex
pla
inwhy.
23.
2 Woul
dyoupref
ert ous
eac omp
ute
rtha
tob
tai
nedi
tsna
mef
rom ar
emot
efi
l
eor
fr
omaconf
igurat
ionse
rve
r?Why?
23.
3 Whydoesea
chnameser
verk
now t
heI
Paddr
essofi
tsp
are
nti
nst
eadoft
he
doma
inna
meofi
tspar
ent?
Ex
erc
ise
s 509

23.
4 Devi
seana mi
ngs chemet hattoler
ateschange
st othenami
nghierar
chy.Asa n
ex
a mpl
e,c ons
idert wo lar
gec ompanie
st hateac
h hav
ea ninde
pendentnaming
hi
erarc
hy,a ndsup-
p os
et hecompanie
sme r
g e
.Canyouarra
ngetohaveallp
rev
ious
namessti
l
lwor kcorrectl
y?
23.
5 Re
adthesta
ndardandfi
ndouthow t
heDoma
inNa
meS
yst
em us
esS
OAr
ecor
ds.
Whati
sthemot
ivat
i orS
onf OA?
23.
6 TheInt
erne
tDoma
inNa
meS
yst
emc
ana
lsoa
ccommoda
tema
il
boxna
mes
.Fi
ndout
how.

23.
7 The st
andar
ds ugges
tst hatwhen aprogram nee
dst of i
nd the doma
in na
me
ass
oci
ated
withanIPa ddres
s,i
ts houl
dsendani
nv e
rsequeryt otheloc
alserverfi
rstand
usedomani
i n-addr.arpaorip6.ar
paonlyifthatfai
l
s.Why?
23.
8 Howwouldyoua c
commodateabbr
eviat
ionsinadomai
nna mi
ngs
che
me ?Asanexam
-pl
e,show t
wos i
testha
ta rebothr egi
ste
redunder.eduandat ople
velse
rve
r.
Expl
ai
nhowe ac
hs i
tewouldtre
ate a
cht ypeofabb
revi
ation.
23.
9 Obta
intheof f
ici
alde
scri
pti
on oft heDoma i
n Na
meS
yst
ema
nd b
uil
d ac
li
ent
pr
ogram.Lookupthenamexinu.
cspur
. due.
edu.
23.
10 Ext
endtheex
erci
seabovetoi
ncl
udeap
oint
erque
ry.Tr
ylook
ingupt
hedoma
in
na
mef ora
ddr
ess128.
10.
19.
20.
23.
11 Fi
ndac op
yoft hedi
gappl
i
cat
ion,a
ndus
eitt
olookupt
hena
mesi
nthet
wo
pr
evi
ousexer
cis
es.
23.
12 Ifwee xtendedt hedoma i
n names ynt
axt oinc
ludeadotaf
terthetop-
level
domai
n,name sanda b
br e
via
tionswouldbeunambi
guous
.Wha
taretheadv
antag
es
anddi
sad-
vantagesoft heextens
ion?
23.
13 ReadtheRFCsontheDomainNa meSyst
em.Whatar
et hemaxi
mum a
ndmi
nimum
pos
sib
leval
uesaDNSs e
rverc a
ns tor
eint heTI
ME-TO-LI
VE f
iel
dofare
sourc
e
rec
ord?Whatist
hemotiva
tionforthechoi
ces
?
23.
14 S
houl
dtheDomai
nNameSys
temp e
rmi
tpa
rti
alma
tchque
rie
s(i
.e.
,awi
l
dca
rda
s
p
artofana
me)?Whyorwhynot
?
23.
15 The Comp
uterS
cienc
e depa
rtment a
t Pur
due Uni
ver
sit
yc ho
set
opl
acet
he
fol
l
owingt eAr
yp es
ourcer
ecorde
ntryini
tsdoma
innames er
ver:
l
oca
lho
st.
cs.
pur
due
.ed
u 1
27.
0.0.
1
Expl
ai
nwha twil
lha
ppenifar
emot
esi
tet
rie
stop
ingamac
hinewi
thdoma
inna
me
l
ocal
host
.cs
.pur
due.
edu.
Chapt
erCont
ent
s
24.
1 Introduc t
ion,51 1
24.
2 ElectronicMa il
,511
24.
3 Ma i
lboxNa me sAndAl i
ases,512
24.
4 Ali
asEx p a
nsionAndMa i
lFor warding,513
24.
5 TCP/IPS t
anda rdsForElectroni
cMa i
lServi
ce,514
24.
6 SimpleMa ilTr ans
ferProtocol(SMTP) ,515
24.
7 Ma i
lRe trie
va lAndMa i
lboxMa ni
p ula
tionProtocol
s,51
7
24.
8 TheMI MEEx tensi
onsForNon- AS CI
IDa ta,519
24.
9 MI MEMul ti
pa r
tMe ssa
ge s
,521
24.
10Summa ry,522
24

El
ectr
onicMai
l(SMTP,
POP,IMAP,MIME)

24.
1Int
roduc
tion

Thischapterc ont i
nuesoure xp l
ora
tion ofi nt e
rnetworki
ng byc ons
ideri
ng
ele
ctronicma i
ls e
rvicesandt heprotocol
st hatsup portma ilt
ransfe
ra nda c
cess.
Thec hapte
rde scrib
eshow ama ilsystemisor g
a nized,e xp
lai
nshow ma i
lsystem
softwareusest hecli
e nt-s
erv
e rpar
a di
gmt otransfe re ac
hme ssa
ge,andde s
crib
es
me s
sager epr
esentation.Wewi l
lseet hate mailillustr
atessevera
lk e
yi deasin
appl
icati
onp r
otocolde si
gn.

24.
2El
ect
roni
cMa
il

Ane lec
tronicmail(emai
l)syst
ema l
l
owsuserst
ot rans
fermemosacrossthe
Inter-
ne t
.Ema ili
sawi del
y-use
da ppl
ica
tions
ervi
cetha
tof fe
rsafas
t,conveni
ent
me t
hodoft ra
nsferri
nginformati
on,accommoda
tessmal
lnotesorl
argefil
es,and
all
owsc ommuni-cat
ionb et
weenindivi
dual
soramongag roup
.
Ema i
ldiff
ersfunda ment a
ll
yf rom mostot herusesofne twor ksb ecaus
eama i
l
sys-t
e m mustp rov
idef ori nsta
nceswhe nt her e
mot edest
inationi st emporari
ly
unreachabl
e.Toha ndlede layedde l
ivery,ma ilsys
temsuseat e chniquek nowna s
spool
ing.Whenaus e
rs e
ndsa ne ma i
lme ss
a ge
,t heuser
sl ocals ystemp la
cesa
copyi ni tspriv
ates torage( call
ed as pool)a l
ong withide ntifica
tion oft he
sender,r ec
ipi
ent,destination machine,a nd timeofde posit.Thes ystemt hen
i
nitia
t esthet r
ansfert ot her emot ema c
hinea sab ackgr
ounda c
t i
vity,all
owing
these ndertop r
oceedwi thot herc omputati
ona lact
ivi
ti
es.Figure24. 1ill
ustr
ates
theconc e
p t
.

Ama
ils
poola
reai
ssome
time
sca
ll
edama
ilqueueev
ent
houg
hthet
ermi
ste
chni
cal
l
yina
ccur
ate
.
51
1
51
2 El
ect
roni
cMa
il(
SMTP,POP,I
MAP,MI
ME) Cha
p.
24

us
ers
endsmai
l outgoing clie
nt TCPc
onnec
tion
........ mai
ls p
ool (
background
a
r ea tr
a ns
fer) f
orout
goi
ngmai
l
user
i
nter
-f
ace
mai
lboxe
s
us
err
eadsmai
l ser
ver
for TCPc
onnec
tion
........ (
toaccept
inc
oming
mai
l) f
ori
ncomi
ngmai
l
mail

Fi
gur
e24.
1Concept
ualc omponent
sofa nel
ect
roni
cma ils
ystem.The
us
eri nvok
es a ma i
li nter
faceapp
li
cat
ion to de
posi
t or
re
tri
evema i
l;allt
ransf
e r
soccuri
nthebackg
round.

Theb ackgroundma iltransf e


rp r oce s
sb ecome sac lientt hatus e st heDoma in
NameS ystemt oma pt hede sti
na ti
onma chinena met oa nI Pa ddress.Thec li
e nt
thena ttemptst of orm aTCPc onne ctiont ot hema ilse rveront hede sti
na ti
on
ma chine.I fthec onnec- t
ions uc c
eeds ,t hec li
entt ra nsfersac op yoft heme s
sa ge
tot her emotes erver,whi c
hs toresac opyoft heme s
sag et emp orari
ly.Onc et he
cl
ienta nds e
rve ragreet hatt het rans ferisc omplete ,t hec l
ie
ntr e
mov esthel oc a
l
copya ndt hes ervermov esitsc opyt ot heus ersma ilb
ox .Ift hec lientc annot
form aTCPc onne ct
ionori ft hec onne cti
onf ail
s,t hec l
ie ntr ecordst het imeof
thea ttempta ndt erminates.Thes endi nge ma i
lsys- te ms we epst hroug ht hes pool
areap eri
odical
ly,typicall
yonc ee very30mi nutes,c he ck-ingf orunde li
veredma il
.
Whe ne veritf i
ndsame ssag
eorwhe ne veraus e
rde p osi
tsne w out goingma il,t he
backg roundp rocessa ttemptsde l
ive
r y.I fitf i
ndst ha tama i
lme s
sa gec annotb e
deli
v ereda fteraf ew hour s,t hema ils oftwareinf or mst hes ender;a ft e
ra ne x-
tende dt i
me( e.g.
,3da ys)
,t hema i
ls oftwa reusua l
lyr etur nst heme s s
a getot he
sende r.

24.
3Ma
il
boxNa
mesAndAl
ia
ses

The r
ea r
et hr
eeimporta
nti de
ashiddeni
noursi
mpl
i
sticdesc
rip
tionofma i
l
del
i
ve ry.Fir
st,userss
peci
fye a
chr ec
ipi
entbygi
vi
ngatextstr
ingthatcont
ains
twoite mssepar
atedbyanat-si
gn:
us
er@ domai
n-name
whe
red
omai
n-namei
sthedoma
inna
meofama
ilde
sti
nat
iont
owhi
cht
hema
il
s
houl
db edel
i
v e
r ed,and useristhenameofama
il
boxont
hatma
chi
ne.For
e
xampl
e,theauthor
se l
ect
ronicma
iladdr
essi
s:

c
omer@ pur
due.edu

Techni
cal
l
y,t
hedoma
inna
mes
pec
ifi
esama
ilexc
hanger
,nota
hos
t.
S
ec.24.
3 Ma
il
boxNa
mesAndAl
i
ase
s 51
3

Second,t hena mesusedins uchs peci


fica
tionsa reindepende ntofot he rna mes
as-si
gnedt oma chines.Typical
l
y,ama i
lboxist hesa mea saus erslogini d,a nda
comput e
rsdoma inna mei sus eda st hema i
lde st
ination.Howe ve r
,ma nyot her
desi
gnsa r ep os
sibl
e .Fore xamp l
e ,ama il
boxc an de si
gna t
eap osi
ti
on s ucha s
department -
head.Bec auset heDoma i
nNa meS ystemi ncludesas epar
a teque ry
typef orma ildesti
na t
ions,itisp oss
ibl
et ode couplema i
lde s
tina ti
onna me sfrom
theus ualdoma i
n na mesa ssi
gnedt o ma c
hines.Thus ,ma ilse ntt o aus era t
example.com maygot oadi fferentma chinetha nap ingr equests entt ot hes a me
name .Thi r
d,ours i
mp l
i
sticdiagramf ai
lst oa c-countf o r ma ilforwar ding,i n
whichs ome ma i
lt hata rri
veson a g iven ma chi
ne i sf or-wa rdedt oa nother
comput e
r.

24.
4Al
ia
sExp
ans
ionAndMa
ilFor
war
ding

Mos
temai
lserv
e r
spr
ovdema
i i
lforwar
dingsoft
wa r
etha
temploysamai
lal
i
as
ex-
pansi
onmecha
nism.Aforwa
rde
ra l
l
owse achincomi
ngmess
aget obes
entto
oneormoredesti
nati
ons.Typ
ical
l
y,afor
warde
rusesadata
baseofmai
lal
ia
sesto
mapanin-
comingr e
cip
ientaddr
essi
ntoase
to fa
ddres
se,S
s ,andt
henforwa
rds
acopytoeac
ha d-dr
essinS.
Becaus
et heyc anb emany-to-oneorone -
to- many,ali
asma pp
ingsi nc
reas
e
mailsystemf uncti
onal
ityandc onvenie
ncesubs
ta nti
al
ly.As ingl
eus erc anha v
e
multip
lema i
lidentif
iers
,orag roupc anhaveas i
nglema i
la l
ias
.I nt helatte
r
cas
e,t hes e
to fr e-ci
pi
entsass
oc i
atedwithani denti
fie
ri sc a
ll
eda ne l
ectr
onic
mail
ing li
st.Figure 24.2il-
lus
t ra
t esthe c
ompone ntso f a mails ys
t e
m t ha
t
supportsmailal
ia
sesandlis
texpansion.

al
ia
s
da
tabase

al
ia
s
us
ers
endsmai
l outgoi
ng clie
nt
........ exp
ansion
mai
lspool (
background
and
a
re a tr
a nsfe
r)
f
orwarding
user
i
nter
-f
ace
ma
il
boxe
s
us
err
eadsmai
l f
or
s
erv
er
........ (
toa
cce
pt
i
ncomi
ng
ma
il
)
ma
il
Fi
gur
e 24.
2 An e xt
ens
ion of the mai
ls ystem i
n Fi
gure 24.
1t hat
sup
portsma i
la l
ias
esa nd f
orwa rdi
ng.Eac
hi nc
oming and
outgoi
ng me s
-sa
gep a
s s
est hrough the al
i
ase xpans
ion
mechani
sm.
51
4 El
ect
roni
cMa
il(
SMTP,POP,I
MAP,MI
ME) Cha
p.24

Asthef i
gureshows,a nincominga ndoutgoingma ilme s
sagep a
ssesthrough
thema i
lforwarderthate xp
andsa l
ias
es.Thus,ift hea l
i
a sdatabas
es pe
cif
iesthat
mailad-dre
ssxma pst oreplac
eme nty,a l
ia
se xp ans
ionwi l
lr e
wr i
tede s
tinat
ion
addresx
s ,c hang-
ing itt o y.The a li
ase xp
ans i
on p rog
ram t hen dete
r mi
nes
whetherys peci
fi
esal ocalorr emoteaddres
s,soi tk nowswhe thert oplacethe
messageintheloca
lusersmail
boxors endittot heout goi
ngma ilqueue.
Mailal
ia
se xp
ansi
onc anbedang er
ous.S uppos
et wosit
esestabl
i
shc onfl
ic
ting
al
ias
es.Fore xa
mp l
e,assumetheali
a sdat
ab aseatsiteAma psmailaddresxi
s nto
mailaddre
ssy@ B,a ndthea l
ia
sda tabasea tsiteB mapsma i
laddressyi nto
addresx@ A.Anyma
s i
lme s
sag
es enttoa ddressxa ts
iteAwillbef or
wa r
dedt o
si
teB,t he
nb acktoA,a ndsoon.

24.
5TCP/
IPS
tanda
rdsForEl
ect
roni
cMa
ilS
erv
ice

Recallthatt heg oaloft heTCP/ I


Pp rot
ocolsui
ted es
ignist oprovi
def or
i
nter
oper-abil
i
tya crosst hewides
tr a
ng eofcomputersystemsandne tworks
.To
ex
tendt hein-teroper
a bil
it
yofe le
ctronicmai
l,TCP/I
Pdi vi
desit
sma ilsta
nda rds
i
ntotwos e
ts.Ones t
a ndard,gi
veninRFC2822,s pec
ifi
est hesynt
acticforma t
us
edf orma ilme ss
ages;t heothers ta
ndardspec
ifi
esthede ta
ilsofe l
ectronic
mai
lexchangeb e
twe ent woc om-
puters.

Accordingt oRFC2822,ama i
lme ssagei sr epres
e nt edast exta ndi sdi vided
intot wop a r
ts,ahe ade ra ndab ody,whi cha res e
pa ra te
db yab lankl ine .The
standardf orma ilme ssagess peci
fiesthee x actf ormatofma i
lhe ade r saswe llas
thes e
ma nt i
ci n-t erpretationofe achhe ade rf i
e l
d;itl eavest hef or matoft he
bodyupt ot hes e nder.I np artic
ular,thes t
a ndards pec i
fiestha the ade rscont a i
n
reada bl
et e xt,di videdi ntol i
nest hatc onsistofak eywor df oll
owe db yac olon
fol
lowe db yav al
ue .S omek eywordsa rer e
qui red,ot he rsareop ti
ona l
,a ndt he
resta reuni nte rpreted.Fore xamp l
e,thehe adermus tc ontainal inet hats p
e cifi
es
thede stina ti
on.Thel ineb egi
nswi thTo:a ndc ont a
inst hee l
ectronicma ila ddre s
s
oft hei nte ndedr ecipi
entont her emainderoft heline .Al inet ha tb e
ginswi th
From:c ont ai
nst hee lectronicma i
la ddressoft hes ende r
.Op tionall
y,t hes ender
ma ys pecifya na ddr esst owhi char epl
ys houl db esent( i.
e.,toa l
low t hes ender
tos pecifyt hatar epl
ys houl dbes enttoa na ddressothe rthant hes ender
sma il
-
box).I fp r esent,al inet hatb egi
nswi th Re ply-to:s p eci
fie
st hea ddressf ora
reply.Ifnos uc hlinee x i
sts,ther eci
pientwi l
lus einfor ma ti
onont heFr om:l ine
ast her etur na d-dr e
ss.

Thema i
lme s
sagef or
ma tischose
ntoma keiteasytop roc
essa ndtransp ort
a
cros
she ter
ogeneousma chi
nes
.Ke epi
ngthema i
lheaderformats trai
ght
for wa rd
a
ll
owsitt obeusedonawi der a
ngeofsyst
ems.Restri
cti
ngme ssagestoreada b l
e
t
exta voi
dst he prob
lemso fs ele
cti
ng a s
tandar
db inaryr epr
e s
entat
ion a nd
t
rans
lati
ng b e
tweent he sta
n-dardr e
pres
entati
on and t he localma chine
s
r
epres
entati
on.
Inpra
cti
ce,mostmailforwarder
st e
rmi
nat
emess
a g
esafte
rthenumberofexc
hangesr
e a
che
sa
pre
de t
er-mi
nedthr
eshol
d.
Theori
gi
nalsta
ndardwa sspeci
fi
edinRFC822;theIETFdel
aye
diss
uingtherep
lac
ementunti
l
RFC2822t omakethenumb e
r scor
relat
e.
S
ec.24.
6 S
imp
leMa
ilTr
ans
ferPr
otoc
ol(
SMTP) 51
5

24.
6Si
mpl
eMa
ilTr
ans
ferPr
otoc
ol(
SMTP)

Ina dditi
on t o me ss
agef ormats,t he TCP/IPp rotocols uites pe
c i
fiesa
standar df ort he e x cha nge ofma ilb etwe en machines.Tha ti s,t he standard
specifi
est hee xa c
tf orma tofme ssa
g esac l
ientononema c
hineus est otransfer
ma iltoas e
rv erona not he r
.Thes t
a ndardt ransfe
rp rotocolisk nowna st he
SimpleMai lTr ansferPr otocol(SMTP) .Ast hena meimp li
es,S MTPi ss i
mplert han
thee a
r l
i
erMa ilTr ansf erPr otocol(MTP) .TheS MTPp r
otocolfoc usesspeci
f i
cal
ly
onhow t heunde rlyingma ildeliv
erys ys temp assesme ssagesa c
r ossa ninternet
from onema chinet oa not her.I tdoesnots peci
fyhow t hema ilsystema ccepts
ma ilfrom aus erorhowt heus erint e
r facep re
sentst heus erwithi ncomi
ngma il
.
Also,S MTPdoe snots pe cifyhowma ilisstor e
dorhowf requentlyt hema i
lsys te
m
atte mptstos endme s s
a g es
.
SMTPi ss urp r
isi
ng l
ys traig
ht forwa rd.Communi cationf ollowsade s
ig nt hati s
preval
e ntinma nya ppli
ca tion-l
a yerp rotoc ols
:a llc ommuni cationb etweenac l
i
e nt
andas er
ve rc onsistsofr eadableAS CI It ext.Ea chl ineb eginswi t
hac omma nd
name ,whi c
hc anb ea na b breviatedna meor3- dig i
tnumb er;t her ema ini
ngt ex ton
thel i
nee i
the rg i
vesa rg ume ntsf ort hec omma ndort e x
tt ha thuma nsus et o
debugma i
ls oftwa re.Alt houg hS MTPr igidl
yde fine sthec omma ndf orma t,huma ns
cane asil
yr eadat ran-s criptofi nteract i
onsb etwe enama i
lc l
ienta ndas e rver
becausee achc omma nda p pearsonas epar ateline.I nitiall
y,t hec li
e nte sta bl
ishesa
rel
iables t
re amc onnectiont ot hes erve ra ndwa itsf ort hes e r
vert ose nda220
READYFORMAI Lmes sage .(Ift hes erve ri sov erloaded,i tma yde l
ays e ndingt he
220c omma ndt emp ora r
ily.)Up onr e
-ce i
p toft he220c omma nd,t hec l
ients endsa
HELOc omma nd( ift hec l
ients up p
or tst hee xtens i
onsde fi
ne di nRFC2821 ,t he
cl
ients endsa na lternative,EHLO) .Thee ndofal i
nema rksthee ndofac omma nd.
Thes er ve
rr espondst oaHELO b yide ntifyingi t-sel
f.Onc ec ommuni c at i
onha s
beene s t
ablished,t hec l
ientc ant ra
ns mi toneormor ema i
lme s sa
g esa ndt he n
termina t
et hec onne c
t i
on.Thes e
r vermus ta c k
nowl edg ee achc omma nd.Ac l
i
e nt
cana bortt hee nt i
rec onne c t
ionora bortt hec urre ntme ssaget rans f
e r.

A mes
saget r
a ns
ferb egi
nswi h a MAI
t Lc omma nd tha
tg i
vesthe sender
ide
nt i
fic
a-ti
onaswe l
lasaFROM:f i
el
dt hatconta i
nstheaddresstowhicherrors
shouldb ere-
ported.As er
verp r
eparesitsdatas truc
tur
est or e
cei
veane w mail
message,andr e
pli
e stoaMAI Lc omma ndb ysendingtheresponse250.Respons
e
250meanst hata l
liswellandthecli
ents houl
dp rocee
d.Thefullresp
onseconsi
sts
oft hetext250OK.
Afteras uc
cessulMAI
f Lc ommand,t he cl
i
ent i
s s
uesa ser
ies of RCPT
comma nds tha
ti denti
fyr e
c i
pie
nts of the mailmessage
. The se
rver must
acknowledg
ee ach RCPT c
omma ndbys e ng 250 OK orb
ndi ys e
ndi
ngt hee rr
or
message550Nos uchuserhere.
Aftera llRCPTc ommandsha v
eb eena ck
nowledged,t hecli
entis
suesaDATA
comma nd.Ine s
sence,aDATAc omma ndinformsthes erverthatthecl
ientisrea
dy
tot ra
ns fert heb odyofama i
lme s
sage.Thes e
r v
err espondswithme s
sage354
Startmai linput,a ndspeci
fie
st hesequenceofc hara
ct e
rsus e
dt oterminat
et he
ma i
lme ss
a g
e .Thet erminat
ions equenceconsi
stsof5c harac
ters:c
arri
agereturn,
li
nef e
e d,pe r
iod,c ar
riageret
ur n,andl i
nefeed.
HELOi
sana bbre
via
tionfor
he l
lo.

SMTPusesCR-LF(carr
iag
ereturnf ol
l
owedbyl
i
nef ee
d)t
ote
rmi
nat
eal
i
ne,a
ndf
orb
idst
he
b
odyofama i
lme s
sagetohaveaperiodonal i
neb
yits
elf
.
51
6 El
ect
roni
cMa
il(
SMTP,POP,I
MAP,MI
ME) Cha
p.24

Ane
xamp
lewi
l
lcl
ari
fyt
hec
ommuni
cat
ioni
nanS
MTPe
xcha
nge
.Sup
pos
eus
er
SmithathostAl
pha.
edu s
endsame ss
aget ouse
rsJones
,Gr een,andBrownat
hostBeta.
gov
.TheS MTPcli
ents oft
wa r
eonhos tAl
pha.
edu conta
ctstheSMTP
ser
versoft
wareonhostBet
a.gov
,a ndbeginst
heexc
hangeshowninFigur
e24.3.

S:220Beta.
govSi
mpl
eMa
ilTr
ans
ferS
erv
iceRe
adyC:HELO
Al
pha.
edu
S:250Beta
.gov

C:MAILFROM:
<Smi
th@Al
pha
.edu>
S:250OK

C:RCPTTO:
<Jone
s@Be
ta.
gov
>
S:250OK

C:RCPTTO:<Gr
een@Be
ta.
gov
>
S:550Nosuchuse
rher
e

C:RCPTTO:
<Br
own@Be
ta.
gov
>
S:250OK

C:DATA
S:354S ta
r tma i
linp
ut;e ndwi t
h<CR><LF>.
<CR><LF>
C:...
sendsb odyofma i
lme ss
a g
e...
C:...
conti
nue sforasma nylinesasmes
sagecont
ainsC:
<CR><LF>.<CR><LF>
S:250OK

C:QUIT
S:221Bet
a.g
ovS
erv
icec
los
ingt
rans
mis
sionc
hanne
l

Fi
gur
e24.
3Ex amp l
eofa nS MTPt ra
nsferfrom Al
pha.e
dut oBeta
.gov
dur-i
ngwhichr e
cip
ientGreenisnotr e
cogni
zed.Li
nesthat
beg
inwi thC:aret r
ansmit
tedb ythecli
ent(Alp
ha)
,a nd
l
inesthatbe
g i
nS:aretrans
mitt
e dbytheserve
r.

Int he e x
amp le
,t he serv
e rrej
ectsr ec
ipi
ent Gr een becaus
ei tdoe snot
recognizet hena mea sav al
idma i
ldest
inati
on(i.e
. ,Gr eenisne i
theraus ernora
ma i
li
ngl ist).TheS MTP protocoldoesnots peci
fyt hed etail
sofhow ac l
ient
handless uche rrors t hec l
ie
ntmus tde ci
de.Al thoughac li
entc ana bor
tt he
deli
veryi fa ne rroroc c
urs,mos tcli
entsdo not .I nste
ad,ac l
ientc ontinues
deli
veryt oa l
lvali
dr ec
ipie
ntsa ndthenr e
-portsp roblemst otheor i
ginalsender.
Usuall
y,t he c l
i
ent r e
portse rror
s using el
ectroni c mail
.The e rror me ssage
containsas umma r
yoft heerrora swellasthehe a deroft hema i
lme s
saget hat
causedt hep robl
em.
S
ec.24.
6 S
imp
leMa
ilTr
ans
ferPr
otoc
ol(
SMTP) 51
7

Oncei t hasf i
nis
heds endi
ng al
lma ilmessag
es,a cl
ient i
ss s a QUI
ue T
c
omma nd.Thes erverr e
spondswithcomma nd 221
,which meansita g
ree
sto
t
erminate
.Bot hsi
desthenc l
osetheTCPconnec
tiongra
cef
ull
y.
SMTPi smuc hmor ecomp l
e xtha nweha veout li
nedhe re.Fore xample,ifa
userha smov ed,thes erve
rma yk now t heusersne w ma i
lboxa ddres
s.S MTP
all
owst hes e
rv ertoinfor
mt hec li
enta boutthene wa ddre
sss ot hec l
ientca nuse
thea ddressinf u-turecorres pondence.Whe ninformingt hec l
ienta b
outane w
address,thes erve
rma yc hoos et of orwardthema i
lt hatt r
iggeredt heme ssa
ge,
ori tma yr eques
tt hatt hec li
entt ak
et her e
spons i
bi
li
tyf orf orwa r
ding.I n
addit
ion,S MTPi ncl
udesTrans portLayerSe- cur
ity( TLS)extensionst hatallow an
SMTPs essi
ont ob eencrypted.

24.
7Ma
ilRe
tri
eva
lAndMa
il
boxMa
nip
ula
tionPr
otoc
ols

TheSMTPt ra nsf
e rschemede s
cribeda b
ov eimpliestha tas ervermus tremain
r
eadyt oac
cepte maila talltimes.Thes cenariowor kswe lli
ft hes er
verr unsona
c
om-puterthatha sap erma nentInternetc onnection,b uti tdoesnotwor kwe l
l
f
orade vi
cethatha si ntermittentconnectivi
ty( e.g.,as mar tphonet hatisoften
p
owe r
eddownorot herwiseuna vai
labl
e).I tma k
esnos ensef orade vic
ewi th
i
nter
mitte
ntc onne c
tivityt or unane ma i
ls erverb ecauset heserverwi l
lonlyb e
a
vail
abl
ewhiletheus e r
sde viceisconnected a llot hera t
t emptstoc ontactthe
s
erverwil
lfail
,a nde ma i
ls entt otheus erwi llrema inunde l
ive
re d
.Theque st
ion
a
ris
es:howc a
naus erwi thoutap e
rma nentc on-nectionr ecei
vee mail
?
Theanswe rtotheque s
tionlie
si natwo-stagedel
iver
yp roces
s.Int hefi
rst
sta
g e
,e ac
hus erisass
ignedama i
lb
oxonac omputerthatisa l
wa ysona ndhasa
permanentI nt
ernetconnect
ion.Thec omputerrunsac onventionalSMTPs er
ver,
whichrema i
nsr e
adyt oaccepte mai
l.Inthes ec
ondstage,t heus erconnect
st o
theI nt
erneta ndrunsap r
ot oc
olt hatret
rie
vesme s
sagesf rom t hepermanent
mail
box.Figure24.4il
lust
ratestheidea.

i
nter
faceapp e
ma i
lse
rver
us
er
sdevi
ce c
ontactsser
ver (al
wayson)
(
someti
meson)
I
NTERNET

int
erf
ace s
erv
erhas
app us
er
smail
box

Fi
gur
e24.
4I l
l
ustra
tionofemai
lacc
esswhe
nt heemai
lserv
era
ndus
er
s
mai
lb
oxa renotl
oca
tedontheuse
r
scomput
er.
51
8 El
ect
roni
cMa
il(
SMTP,POP,I
MAP,MI
ME) Cha
p.24

Av ar
iet
yoft e
chnique
sha vebee
nus edtopermitause r
sma i
lboxt or e
side
onar emotec omput er
.Fore xa
mp l
e,manyI S
Psthatoff
ere mailserv
icep rovi
dea
we b
-basedinterfacet oe mail
.Tha tis,a userlaunc
hesa we bb r owsera nd
connect
st oas pecia
lwe bpagethatdis
pla
yse ma
il
.Companiesli
keMi crosoftoffer
propri
etar
yme chanis
mst hatall
ow anorgani
zati
ontoha v
eas ing
lee ma i
lserver
thatuserscana cc
e s
sr emote
ly.
Remot ea cc
esswa sp i
oneeredbyt heI ETF,whi chde f
inedt woprotocol
st hat
a
ll
owar emotea ppl
icati
ont oacces
sma ili
nap e
rma nentma i
lboxthatisstoredon
aserve
r .Althought heyha vesimil
arf unctional
ity,t hep r
otocolstakeoppos i
te
a
pproaches
:onea l
lowst heus e
rt odownl oadac opyofme ssag
e s
,andt heot her
a
ll
owsaus ert ov i
ewa ndma nip
ulat
eme s
sageson t heserver.Thene xtt wo
s
ecti
onsde s
cribethet wop rot
o-cols
.

24.
7.1Pos
tOf
fic
ePr
otoc
ol

Themostp opul
a rp r
otocolus edtot ransfere mailmess
agesf rom aperma nent
re-motema i
l
boxt oal ocalcomp uterorp orta
b ledevic
eisk nowna svers
ion3of
thePos tOffi
cePr otocol( POP3);as ecurev ersionoft hep rotocolisknowna s
POP3S.Theuserinv okesaPOP3c l
ientap p
lic
ation,whi c
hc r
eatesaTCPc onne ct
ion
toaPOP3s erveront hema i
lboxc omp uter.Theus erfir
sts endsal ogin anda
pas
s wordtoauthent i
catet hesess i
on.Onc eaut henti
cati
onha sbe e
na cce
pted,t he
cl
ientsendscomma ndst or etri
eveac opyofoneormor eme ssagesandt ode l
ete
the me ss
age
sf r
om t he p erma nent ma il
box. The me ssagesa res toreda nd
tra
ns fe
rredastextf i
lesint hes tandardforma ts pe
cifi
edbyRFC2822.
Notet hatthec omputerwitht hepermanentma i
lboxmus tr unt wos erver
s
anSMTPs ervera ndaPOP3s erver.TheSMTPs ervera c
c ept
sma ilsentt oaus e
r
andp l
acese achincomingme ss
agei ntheuser
sma il
box.ThePOP3s e
r v
era l
l
owsa
use
rt oe xaminee achme ss
ageint hei
rma i
lb
ox,saveac op yont hel ocalcomputer,
and delet
et he me ss
agef rom the mail
box ont he s e
r ve
r.To e nsurec orrec
t
oper
a t
ion,t het wo s erv
ersmus tc oor
dinateuseoft hema il
b oxs ot hatifa
messagea rri
v e
sv i
aS MTP whi l
e a userise xtr
acting me ss
agesv i
a POP3,t he
mail
boxisle f
ti nav ali
dstate.

24.
7.2I
nte
rne
tMe
ssa
geAc
ces
sPr
otoc
ol

Versi
on4oft heI nternetMes sageAccessPr otocol(IMAP4)isana l
ternati
ve
toPOP3t hata ll
owsus e r
st ov ie
wa ndma ni
p ul
ateme ss
ageson thes erve
r;a
secureversi
onofI MAP4ha sa l
sobeende fi
ned,a ndisk nowna sIMAPS.LikePOP3,
IMAP4de f
inesa na b
stracti
onk nowna sama i
lbox;mai l
boxesarelocate
dont he
same comp utera sa s e
r ver.Alsol i
ke POP3,a us err unsa nappli
cati
on that
becomesa nI MAP4 c l
ie
nt .The a ppli
cati
on c ontactst he ser
vert ov i
ew a nd
manipulat
eme ss
ages.UnlikePOP3,howe v
-er,I MAP4a l
lowsaus ertoa cc
essma i
l
mes s
agesfrom mult i
pl
el ocati
ons(e.g.,from wor ka ndf rom home),ande ns
ures
thata l
lcopie
sa resynchronizedandc ons
iste
nt .
IMAP4 a l
sop rovi
dese x
tendedfunct
ionali
tyf or mess
ager e
trie
vala nd
p
roces
sing.A usercanob t
aininfor
mat
iona boutame s
sag
eore xamineheader
f
iel
dswi t
houtretr
iev-
ingtheenti
remess
age.Ina ddi
ti
on,auserca
ns ear
chfora
s
peci
fi
eds tr
ingandretri
eve
S
ec.24.
7 Ma
ilRe
tri
eva
lAndMa
il
boxMa
nip
ula
tionPr
otoc
ols 51
9

p
orti
ons of a mess
age
.Pa r
tia
lretr
iev
alisespe
cial
l
y us
efulf or s
low-
spe
ed
c
onnect
ions be
caus
ei t me
ans a us
er doe
s not needto downloa
d usel
ess
i
nfor
mation.

24.
8TheMI
MEExt
ens
ionsForNon-
ASCI
IDa
ta

TheI nternets tandardsf ore ma i


lwe recre atedwhe ne ma i
lme s
sa gesconsi
sted
oft ex t.Usersli
ke dema i
l,butwa ntedawa yt os enda t t
achment s(i.e.,datafiles
)
along wi tha ne mailme ssage.Cons eque ntl
y,t he I ETF c rea ted Mul ti
purpose
Inter netMai lEx-tensions( MIME)t op ermittr ansmis
sionofnon- ASCIIda taitems
throug he ma i
l.MI MEdoe snotc ha
ng eorr epl
a ceprot ocolssuc ha sS MTP,POP3,
andI MAP4.I nstead,MI MEa l
lowsa rbi
traryda tat ob ee ncodedi nAS CIIandt hen
transmi ttedinas t
anda rde ma ilme ss
a ge.Toa ccommoda tea rbitrar ydatat ypes
and r epr
es e
ntations,e a
c h MI ME me s s
agei nc l
udesi nforma ti
on t hatt el
lst he
recipientt hetypeoft heda taa ndt hee ncod-ingus ed.MI MEi nf orma ti
onr esi
des
int heRFC2822ma i
lhe a der t heMI MEhe ade rli
ne ss peci
fyt heMI MEv ers
ion,
theda tat ype,a ndt hee ncodingt hatwa susedt oc on- v
e rtt heda tatoAS CI I
.
Mos tus ersne vers e
et heMI MEe ncodingb ecauseat yp i
calma ilr ea
de ra p
p l
ic
ation
remov esorhidess uchde ta i
l
s.
Fig
ure 24.
5i l
lus
tratesa MIME messaget ha
tcont
ainsa p hot
ogr
aphin
st
andadJPEGr
r epre
sentati
on.TheJPEG imag
eha sb
eenc onv
ert
e dtoa7-b
it
ASCI
Irepr
esen-
tat
ionusingthebas
e64encodi
ng.

From:b i
l
l@a col
leg
e.edu
To:john@e xample.
com
MIME- Vers
ion:1.0
Content-Type:image/j
peg
Content-Transf
er-Encodi
ng:b
ase
64

.
..
dat
afort
hei
magegoesher
e..
.

Fi
gur
e24.
5Ane xamp
leofthehe
aderi
naMIMEmes
s a
ge.Headerl
i
nes
i
dent
ifythet
ypeoftheda
taa
swel
lastheencodi
ngused
.

Inthef igure,thehe ade


rlineMI ME-
Versi
on:decl
are
st hattheme ss
agewa s
com-pose
dus ingv er
sion1 .
0oft heMIMEp rot
oc .TheCont
ol ent-Type:dec
larat
ion
speci
fi
est hatt heda t aisaJPEG i mage
,a ndthe Content -
Transfer
-Encodi
ng:
headerdecla
rest hatb as
e64encodingwasusedtoconv
ertt heima getoASCII.
Theb ase64encodingisa nal
ogoust ohexadeci
ma lbecauseita l
lowsa rbi
trary
bina
ryv al
uest ob ere p
resentedus i
ngp ri
ntabl
ec haracters.Inst
e adofs i
xteen
charac
t er
s,b as
e64use ssi
xty-four,whichma k
est her e
sulti
ngf i
lesma l
le
r .Base
64
wa sc hosen t op r
ovide sixty-f
our AS CIIc haracter
st hat hav et he same
repres
e nta
tiona c
rossv ari
ousv ers
ionsofI SO Engli
shc haract
e rse t
s.Thus ,a
recei
verc anb eguaranteedt hattheim- a
gee xtr
a c
tedf rom thee ncodedda tais
exactl
yt hes a
mea stheor i
ginali
ma ge.
JPEGistheJointPictur
eEnc
odi
ngGroupsta
ndar
dus e
df ordi
git
alpic
tur
es.
Thechar
acte
rsc onsi
stof26upp
erc
asel
ett
ers,26lowerc
asele
tters
,tendig
its
,thep
luss
ign,
a
ndt
hes l
ashc
haract
e r.
520 El
ect
roni
cMa
il(
SMTP,POP,I
MAP,MI
ME) Cha
p.24

Ifonewe
retoe xa
minethedataac
tuall
yt r
ansfe
rred,i
twoulda p
pea rtobe
anon-s
ens
estr
eam ofchar
acte
rs.Forexa
mp l
e,Fig
ure24. 6showsthefirstfe
w
l
ine
sfrom aj
pegimagethathasbeenencodedinBa s
e64f ortra
nsmis
sionwith
MIME.
/
9j/
4AAQS
kZJRg
ABAQEAYABg
AAD/
4QBERXhp
ZgAATU0AKg
AAAAg
AA0AAAAMAAAABAAAAAEABAAEA
AAABAAAAAEACAAI
AAAAKAAAAMg
AAAAB0d2l
tZy5j
b20A/
9sAQwANCQoLCg
gNCws
LDw4NEBQhFRQS
EhQoHR4YI
TAqMj
EvKi
4tNDt
LQDQ4Rz
ktLk
JZQk
dOUFRVVDM/
XWNc
UmJLU1
RR/
9sAQwEODw8UERQn
FRUnUTYuNl
FRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFR
/
8AAEQg
AgACAAwEi
AAI
RAQMRAf
/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAg
MEBQYHCAk
KC/
/EALUQ
AAI
BAwMCBAMFBQQEAAABf
QECAwAEEQUS
ITFBBhNRYQc
icRQyg
ZGhCCNCs
cEVUt
HwJDNi
coI
JChYX

Fi
gur
e24.
6Ex a
mp l
eoftheb
ase64e
ncodi
nguse
dwi
thMI
ME.Thel
i
nes
a
ret a
kenfr
omal a
rgej
pegfi
le.

Toviewt hei ma g
ei naf i
gure,arece
ive
rsmai
lappl
ic
ationmus tfirs
tc onvert
from bas
e64enc odingb ac
kt obinaryandthenrunana ppl
icat
iont hatdis
p l
aysa
JPEG imag e on t he user
ss cr
een.In moste mai
lsystems,t he conver
s i
on is
perf
ormeda ut omat i
cal
ly;ausers e
esic
onsora c
tua
lf i
l
estha thaveb e
ena ttache
d
toane mailme ss
a ge.
How doe
sama ili
nterf
acea pp
li
cati
onk now how t
oha ndl
ee a
chattac
hment?
TheMIMEs tandards pe
cifi
esthataCont ent-Typedecl
ara
t i
onmus tc
ontaintwo
i
dent
ifi
er,ac
s ontenttypeandas ubt
ype,s ep
aratedbyas las
h.InFigur
e24.5,
i
mageisthecont e
ntt ype,andjpegisthesubtype.
TheMI MEs t
andar ddefi
ne ss
evenb as
iccontenttypes,theva
li
ds ubtype
sf or
e
ach,andt ransfe
re ncodi
ng s
.Fore xample
,a l
thoughanimagemus tbeofs ubtype
j
peg orgi f;contentt ypet extcannotus ee i
thersubtype.Inaddi
t i
ont ot he
s
tandardt ypesands ub-
type s
,MI ME per mi
tsas endera ndrec
eive
rt odefine
p
rivat
ec ontenttypes.Figure24.7list
st hesevenbas
iccontentt
ypes.

ContentType Us edWhe nDa taInt heMe ssa


geI s
text Te
xt ual(e .g.adoc ume nt).
i
ma ge Astil
lp hot ogra phorc omp uter-ge
ne ratedimage
audio Asoundr ec ording
vi
deo Avideor ec ordingt hati ncl
udesmot ion
appl
icat
ion Rawda t af orap r
ogram
multi
part Multip
leme ss
a gesthate a
chha veas eparat
econtent
typea nde ncoding
me
ssa
ge Ane nti
r ee ma ilme ssa
ge( e.g.
,ame mot hathasb e
en
forwa r ded)ora ne xternalref
e r
e nc
et oa
me s
s age( e .g.
,a nFTPs er
v erandf i
lename )
Fi
gure
24.7 Theseve
nb a
s i
ctyp
estha
tc anapp
eari MECont
naMI ent
-Type
dec
lar
ationandthe
irmeani
ngs.
Toav
oidpot
enti
alna
mec onfl
ic
ts,thestanda
rdr
equi
rest
hatna
mesc
hos
enf
orp
riv
atec
ont
ent
t
ype
se a
chbegi
nwiththetwo-
c ha
racte
rs t
ringX-.
S
ec.24.
8 TheMI
MEEx
tens
ionsForNon-
ASCI
IDa
ta 521

24.
9MI
MEMul
ti
par
tMe
ssa
ges

The MI ME mul tip


a rtc ont entt ypei sus efulb ecausei ta ddsc onsiderabl
e
flexi
b i
li
t y.Thes tanda rdde fine sf ourp os si
bl
es ubtypesf oramul tipartme ssage;
ea c
hp r ovide si m- por tantf unct i
ona li
ty.S ubtyp emi xedal l
owsas i
ng leme ssageto
cont ai
nmul t iple,in- depende nts ub me ssagest ha te achc anha v
ea ni ndependent
typ ea nde nc oding.Mi xedmul tipartme ssagesma keitp ossi
b let oi ncl
udet ext,
gr ap
hics,a nda udi
oi nas i
ng l
eme s-sage ,ort os endame mowi tha ddi
tionalda t
a
segme nt sa t tache d,s i
mi l
art oe nclosuresi ncl
ude dwi t
hab usinessl etter.Sub t
ype
alternat i
veal lowsas i
ng l
eme ssaget oi ncludemul ti
p l
er epr
esent ationsoft hes ame
da ta
.Al terna t i
v emul t
ipartme s
sag esa reus efulwhe ns endingame mot oma ny
re c
ipie
nt s who do not a l
lus et he s ame ha rdwa ref aci
li
- ti
es or a ppl
icati
on
softwa re .Fore xa
mp l
e,onec a
ns endadoc ume nta sb othp l
ainAS CIIt exta ndin
forma tte df or m,a llowingr ec i
pient swhoha v
ec omp uterswithg raphicc apabi
li
ties
tos el
ec tt hef orma ttedf or mf orv i
ewi ng.S ubtypep arallelper mitsas ingl
e
me ssaget oi ncludes ub p
art st hata ret ob edi s pl
ayedt ogethe r( e.g.,v i
deoa nd
audios ub -p ar tsmus tb ep layeds imul taneously).Fi nal
ly,subtyp edi gestper mitsa
singl
eme ssag et oc onta i
nas etofot herme ssages( e.g.
,ac ollectionoft hee mail
me ssagesf r omadi s- c
us s
ion).
Fig
ure24.
8ill
ust
rat
esane
ma i
lme
ssa
gethatcont
ainst
wop
art
s.Thef
irs
tis
ame
ssag
einpl
ai
ntextandt
hesec
ondi
sanimag
e .

From:bil
l
@a c
oll
ege
.eduTo:
john@exampl
e.c
omMI ME-
Versi
on:1.
0
Cont
ent
-Typ
e:Mul
ti
par
t/Mi
xed
;Bounda
ry=S
tar
tOf
Nex
tPa
rt

--S
t ar
tOfNe
xtPartConte
nt-Typ
e:
tex
t /
plai
nConte
nt-Trans
fer
-
Encodi
ng:7bi
tJohn,
He
rei
sthep
hot
oofourr
ese
arc
hla
btha
tIp
romi
sedt
ose
ndyou.You
c
ans
eet
hee
qui
pme
ntyo
udona
ted.

Tha
nksa
gai
n,
Bi
ll

--S
tart
OfNext
Par
tCont
ent
-
Type:i
mage
/gi
f
Cont
ent
-Tr
ans
fer
-Enc
odi
ng:b
ase
64
.
..
dat
afort
hei
mage.
..

Fi
gur
e24.
8Ane x
ampleofaMIMEmix
edmulti
par
tme s
sage.Eac
hpa
rt
ofthemessag
ehasani
ndepe
nde
ntconte
ntt yp
ea nd
sub
type.

Ma
nye
mai
lsys
temsus
ethea
lter
nat
iveMI
MEs
ubt
ypet
ose
ndame
ssa
gei
nbot
hAS
CIIa
nd
HTMLf
orma
ts.
522 El
ect
roni
cMa
il(
SMTP,POP,I
MAP,MI
ME) Cha
p.24

Figure24.8i l
lustra
tesaf ew de ta i
l
sofMI ME.Fore xa
mp l
e,e a
chhe aderline
canc ontainparametersoft hef orm X=Ya fterb a
sicde cl
arati
ons.Thek eywor d
Boundar y=fol
lowingt hemultip
ar tc ontentt ypede c
larationint heheaderde f
ines
thest ri
ngus e
dt os eparat
ep art
soft heme ssa
g e.Int hee xample,thesenderha s
sel
ectedt hes tr
ingS tar-t
OfNext Partt os ervea stheb oundary.De cl
ara
tionsof
the c ontent typea nd t r
ansfe re ncodi
ng f or a s ub mess
a ge,i fincluded,
immediat e
lyfoll
ow theb oundaryl ine.I nt hee xample
,t heseconds ubmessag
ei s
decl
ar edtobeaGr aphic
sI nt
erchangeFor mat(GI F)ima g
e .

24.
10S
umma
ry

El
ectroni
cma ili
samongthemos twi del
yavai
l
ableappli
cat
ionserv
icesont he
In-ter
net.Likemos tTCP/I
Pserv
ices
,e ma i
lfol
l
owst hecli
ent-
serve
rp ar
adig
m.A
ma i
lsyst
emb uffe
rsoutgoi
ngandincomingme s
sages
,a l
l
owingt hetra
nsferfrom
cli
entands er
v e
rt ooc
curinba
ckground.
TheTCP/ IPp rotoc olsui tep r
ovidestwos eparatestandardst ha tspeci
fyt he
ma i
lme ssa
gef or mata ndma i
lt ransferde tai
ls
.Thema i
lme ssagef ormat,defined
nRFC 2822,us
i esab lankl inet ose p
arateame ss
agehe adera ndt hebody.The
Simpl
eMa i
lTr ans f
erPr otoc ol( SMTP)de fineshow ama i
ls yst
e m ononema chine
transf
er sma iltoas e rveron a nother.Ve rsi
on 3oft hePos tOf fi
ceProtocol
(POP3)a ndv ersion4oft heI nternetMe ss
ag eAccessPr otocol(I MAP4)s pe
c i
fy
how aus erc anr etr
iev et hec ontentsofama i
lbox;theya ll
ow aus ertoha vea
permanentma il
boxonac omp ute rwithc on-tinuousInterne tconne cti
vit
ya ndt o
acces
st hec ontentsf romac omp uterwithi ntermit-te
ntc onnectivi
t y.
TheMult
ipurpos
eI nt
ernetMailExtens
ions(MI
ME)prov
idesame c
hanis
mt hat
al-
lowsarbi
traryda t
at ob etra
ns f
erredus i
ngSMTP.MIME a ddslinestot he
headerofanema i
lme s
sagetodefi
net hetypeofthedat
aa ndthee ncodi
ngused.
MIMEsmixedmul ti
parttypepermitsas i
ng l
emessa
getoc ont
ainmul ti
pledata
types.

EXERCI
SES

24.
1 Fi
ndouti
fyourcomp
ut i
ngsyst
emall
owsyo utoinv
okeSMTPdire
ctl
y.
24.
2 Bui
ldanS
MTPcli
entanduseittot
ransf
e rama i
lmess
age.
24.
3 Seei
fyouca
nsendma i
lthr
oughamailforwar
derbacktoyour
sel
f.
24.
4 Ma keali
stofmai
laddre
ssfor
mat
sthatyoursi
teha
ndl
es,a
ndwr i
teasetofr
ule
s
forp a
rsi
ngthe
m.
24.
5 FindouthowaLinuxsyst
emcanbec
onfi
guredtoac
tasama i
lfor
warde
r.
24.
6 Findouthow of
tenyourl
oca
lma
ils
yst
ema
tte
mpt
sde
li
ver
y,a
ndhow l
ongi
twi
l
l
con-t
inuebe
foregi
vi
ngup.
Ex
erc
ise
s 523

24.
7 Somemailsys
temsa l
l
ow user
st odir
ecti
ncomingma ilt
oap rogra
minst
ea dof
stor
ingi
tinama i
l
box.Buil
dap r
ogr
amt ha
ta cce
ptsyourinc
omingmai
l,p l
ace
s
yourmai
linafil
e,andthe
ns endsare
plyt
ot el
lthesende
ryoua r
eonvac
ation.
24.
8 Readt
heSMTPstanda
rdc a
r e
ful
l
y.ThenuseTELNETtoconnec
tt otheSMTPpor
t
onar e
mot
ema c
hinea ndtypethecommandstoasktheremoteSMTPs e
rve
rto
ex
pandamai
lal
i
as.Verifythatt
heserve
rretur
nsthec
orrectexp
ansi
on.
24.
9 Aus e
rr ece
ive
sma ilinwhic
ht heTo:fi
el
dspeci
fiest
hes t
ringimport
ant-peopl
e.
Thema i
lwassentfromac omputeronwhi
chtheali
asi
mportant-
peopl
einc
lude sno
val
idma i
l
boxidenti
fie
rs.ReadtheSMTPspec
ifi
cat
ioncar
efull
yt oseehow sucha
si
tuati
onispossi
bl
e.

24.
10 POP3sepa
ratesmessa
geretri
eva
landde l
eti
onbya ll
owingausertore
tri
evea
nd
vi
ew ame ss
agewithoutdel
eti
ngitf r
om thep er
ma ne
ntma i
lb
ox.Whatarethe
adva
nta
gesanddis
advanta
gesofsuchsep
arati
on?
24.
11 Readab
outPOP3.Howdoe stheTOPcommandoperate,andwhyisi
tus
eful
?
24.
12 Readabout I
MAP4. How doesIMAP4 g
uara
nte
ec ons
ist
enc
y whe
n mul
ti
pl
e
conc
urr
entcl
ie
ntsac
ces
sagivenma
ilb
oxatthes
ameti
me?
24.
13 ReadtheMIMERFCsc
are
ful
l
y.Wha
tse
rve
rsc
anb
esp
eci
fi
edi
naMI
MEe
xte
rna
l
re
fere
nce?
24.
14 Ifyouuseas ma
rtp
honewithali
mitont
henumberofda
tab
yte
sre
cei
vede
ach
month,woul
dyoupref
erPOP3orI
MAP4?Exp
lai
n.
24.
15 Todisgui
sethereci
pie
nts
,s p
am mess
agesoftenli
stUndis
clos
edRec i
pi
ent
si nthe
To:fie
ld.Doesyouremai
linter
fac
ea l
low youtosendame s
sagetoaus erthat
showsupintheuser
smai
lboxasbe
ingsenttoUndi
scl
osedReci
pient
s?Expl
ain.
Chapt
erCont
ent
s
25.
1 I ntroduc ti
on,525
25.
2 I mpor t
a nceOfTheWe b,525
25.
3 Ar chitecturalComp one nts,526
25.
4 Uni formRe sourceLoc ators,526
25.
5 AnEx amp l
eHTMLDoc ume nt ,527
25.
6 Hyp e r
te xtTr ansfe
rPr ot ocol,528
25.
7 HTTPGETRe quest,528
25.
8 Er rorMe ssages,529
25.
9 Pe rsis
te ntConne ctions,530
25.
10 Data Le ngth And Pr ogram Out put,
530
25.
11 LengthEnc odingAndHe ade rs,531
25.
12 Negot i
at i
on,532
25.
13 ConditionalRe quests,533
25.
14 ProxyS erversAndCa c
hing,533
25.
15 Caching,534
25.
16 OtherHTTPFunc tionalit
y,535
25.
17 HTTP, S ecurity, And E- Comme r
ce,
535
25.
18S umma r y,536
25

Wor
ldWi
deWeb(
HTTP)

25.
1Int
roduc
tion

Thi
sc ha
pterc onti
nuest he di
scus
sion of appl
i
cations that use TCP/
IP
te
chnologyb yf oc
usingon thea ppl
i
cati
on thatha shadt hemos timp a
ct:the
WorldWi deWeb ( the Web).Afte
rab ri
e foverv
iew ofc onc
ep t
s,t hechapt
er
exa
mi nesthep r
imaryprotoc
olusedtot r
ansferawe bpageb et
we enas er
verand
a we bb rowser
.The discuss
ion c
oversc ac
hing aswe l
la sthe b a
sict r
ansf
er
mechanis
m.

25.
2Imp
ort
anc
eOfTheWe
b

Duri
ng t
he ear
ly hi
stor
y oft he I
nte
rne
t,dat
at rans
fersusi he Fi
ng t l
e
Tr
ansf
erPro-toc
ol(FTP)ac c
ount
edf orappr
oxi
mat
ely one t
hir
d ofInte
rnet
traf
fic,moret hananyotherappl
ic
a t
ion.From i
tsincep
tioni
nthee ar
ly1990s,
howev e
r,theWe bhashadahighgrowthr a
te.By1995,we btr
aff
icovert
ookFTP
tob ecome the larg
estconsumer of Inte
rnetb a
c k
bone ba
ndwidt
h,a nd ha
s
remainedt
hel e
a di
ngapp
li
cati
on.
TheimpactoftheWe bcannotbeunderst
oodfrom traf
ficsta
tis
tic
sa lone
.
Morepeop
leknowaboutandusetheWebt ha
na nyothe
rI nte
rnetappl
ica
tion.In
fa
ct,formanyuse
rs,theInt
ernetandt
heWe ba r
eindi
sti
nguis
habl
e.
52
5
526 Wor
ldWi
deWe
b(HTTP) Cha
p.25

25.
3Ar
chi
tec
tur
alComp
one
nts

Conc
eptual
ly,theWe bc onsi
stsofalar g
es e
tofdoc uments,cal
ldwe
e bpages,
thatareacces
sibl
et oInternetus e
rs.Eachwe bp a
gei scl
ass
ifi
eda sahyp ermedi
a
document.Thep refxhyp
i eri susedb ec
auseadoc umentcanc ontans
i elect
abl
e
l
inksthatrefertoothe rdocume nt
s,andt hesuffxme
i di
aisusedt oindic
at etha
t
awe bdocumentcanc on-tai
ni t
emsot he
rt hantext( e
.g.
,graphic
sima g
es).
Twoma inbui
ldi
ngb locksareusedtoi mpl
ementt heWe bontopoft heg lobal
In-terne
t:awe bbr ows
erandawebs erver.Ab rowsercons
ist
sofa na pp
li
c ati
on
programt hataus erinvokestoa c
cessanddispl
ayawe bpage.Ab r
ows e
rb ecomes
ac l
i
e nttha tcont
a c
t st
hea pp
ropri
atewe bservert oobt
ainac op
yofas pecifi
ed
page.Be c
a useag ivense r
verc anma nag
emor et hanonewe bp age
,ab rowser
musts pec
ifyt heexactpagewhe nma ki
ngar equest.
The da t
ar e p r
esentation standard usedf or a we bp a
g e dependson i ts
contents. For e x amp l
e,s tandardg raphi
csr ep r
esenta tions s ucha s Gr aphi
cs
InterchangeFor mat( GI F)orJoi ntPi c
tureEnc odingGr oup( JPEG)c a
nb eus ed
forap aget hatc ontainsas i
nglegraphi
csima ge.Pagest ha tcont a
inami xtur eof
texta ndot heri temsa rer eprese
ntedus -i
ngt he Hyp er TextMar kupLanguage
(HTML) .An HTML doc ume ntc onsi
stsofaf i
l
et hatc ont ai
nst ex ta l
ongwi th
emb e
dde dc omma nds ,call
edt ags,thatgiveguideli
nesf ordi s
play.At a
gi senc l
osed
i
nl ess-thana ndg reater-thans ymbols
;somet agscomei np ai
r sthata ppl
yt oa l
l
i
t e
ms b etwe e
nt he p ai
r. For e xample,t he t wo c omma nds <CENTER> a nd
</CENTER>c aus
ei temsb etwe enthec omma ndst ob ec e nteredi nt heb rows er
s
window.

25.
4Uni
for
m Re
sour
ceLoc
ator
s

Eachwe bp ag
ei sass
ignedauniquena met ha
ti sus edtoi denti
fyit.The
name , whic
hi sc al
l
ed a Uni f
orm Resourc
e Locator (URL), begins witha
spe
c i
fi
cation o
ft he sc
heme us edt
oa c c
essthe page.I ne ff
ec t
,t he scheme
spe
c i
fi
est hetrans
ferprotocol
;thefor
ma tofther emainderoft heURLde p e
nds
ont hescheme.Forexampl
e ,aURLthatfoll
owstheht t
ps chemehast hefoll
owing
form:

ht
tp /hos
:/ tname[
:por
t]/pat
h[;
par
amet
ers
][?quer
y]

whe r
ei tal
i
cde not e
sa nitemt ob es uppli
eda ndb ra
ck etsdenotea nopt i
onali t
em.
Fornow,i ti ss uffici
entt ounde rstandt hatt hehos tnames tri
ngs p e
c i
fi
e sthe
doma i
n name ,do ttedde ci
malI Pv4a ddress
,orc olon hexI Pv6a ddressoft he
comput eronwhi cht heserverfort hep ageop erat
es,: portisanop ti
ona lprotocol
portnumb erne ededonl yinc as
eswhe ret hes e
rverdoe snotus et hewe l
l-
k nown
we bpor t(80) ,p athisas t
ringt hati denti
fiesonep arti
cula
rdoc ume ntont he
serve,;
r paramet er sisa n opti
ona ls tri
ng t hatspe c
ifie
sa dditi
onalp arame ters
suppl
iedb yt hec li
ent,and?que r
yi sanop tionalstringus edwhe nt heb rows er
sendsaque stion.Aus erisunli
kelye vertos eeorus et heo p-ti
onalpartsdire c
tly.
Instead,URLst hataus erentersc ontainonlyahos tnameandpat h.
AURLi sasp
eci
fi
ctypeofthemoreg
e ne
ralUni
for
mRes our
ceIdent
ifi
er
(URI).S
omeofthel
it
erat
ureref
erstotheini
ti
alst
ri ,ht
ng tp:
,asa
pragma.
S
ec.25.
4 Uni
for
mRe
sour
ceLoc
ator
s 527

Fore
xamp
le,t
heURL:

ht
tp:
//www.
cs.
pur
due
.edu/
peop
le/
come
r/

spec
ifi
e st hea uthor
swe bp ageatPurdueUnivers
ity.Theserverop erat
eson
comput er
bw . cs.pur due.
edu,andt hedocumentisnamed/p eopl
e/ c
omer /.
Thep rotocolstandardsdisti
ngui
shb et
we ent he abs
olutef orm ofaURL,
i
llustr ated
above,a ndar elati
vef orm.Ar el
ati
veURL,whichiss el
dom seenbyaus er
,isonly
meaningf ula ftercommuni cati
onha sbeenesta
bli
shedwi thas pecifi
cwe bser
ver.
For ex amp le,whe nc ommunicati
ng withserver www. cs
.purdue.edu,onlyt he
str
ing/p eople/comer/isne ededtospeci
fythedoc umentna medb yt heabs
olute
URLa bov e.Wec ans umma ri
ze:

Eachwebpagei sassi
gnedauni queident
ifi
erknownasaUni f
orm
ResourceLocator( URL).Theabs ol
uteform ofaURLc ontai
nsa
ful
ls peci
fi
cati
on;ar el
ati
vef ormt hatomitstheaddressoft he
ser
v erisonl
yus efulwhent heserverisi
mpli
cit
lyknown.

25.
5AnExa
mpl
eHTMLDoc
ume
nt

Ane xamplewil
li l
l
ustr
atehow aURLi sp r
oducedf rm as
o el
ect
ableli
nki na
doc-ument.Fore a
chs el
ect
ableli
nk,adocume ntcontainsap ai
rofv al
ues:a nite
m
tobedi s
playedont hescre
ena ndaURLt of oll
owi ftheus ersele
ctstheitem.I n
HTML,ap a i
roft ags<A> a nd </
A>,whicha rek nowna sana nchor,de fi
nea
sel
ectabl
el i
nk;aURLi sadde dtot hefi
rstt ag,andi temst ob edispl
ayeda re
pl
acedb et
we enthet wotags.Forexampl
e,thef ol
lowingHTMLdoc umentc ontai
ns
aselect
ableli
nk:

<HTML>
Thea
uthoroft
hist
exti
s
<AHREF="
htt
p:/
/www.
cs.
pur
due
.edu/
peop
le/
come
r">Doug
las
Come
r.</
A>
</
HTML>

Whe
nthedoc
ume
nti
sdi
spl
aye
d,as
ing
lel
i
neoft
exta
ppe
arsont
hes
cre
en:

Thea
uthoroft
hist
exti
sDoug
lasCome
r.

The browse
r underl
i
nest he phrae Doug
s l
as Comer t
oi ndi
cat
et ha
ti t
cor
re s
pondstoas e
lect
abl
eli
nk.Inte
r nal
l
y,t hebrowserst
orest
heURLf r
om the
<A>t ag,whic
hitfol
lowswhentheuse rs
ele
ct st
helink.
528 Wor
ldWi
deWe
b(HTTP) Cha
p.25

25.
6Hyp
ert
extTr
ans
ferPr
otoc
ol

Thep rot
ocolusedforcommunic
ati
onbetweenabrowserandawe bs e
rveror
be
t weeni ntermedi
ate machi
nesand webs e
rver
si sknown ast he Hyper
Text
TransferProtocol(
HTTP).HTTPhasthefol
l
owingsetofchar
acte
ris
t i
cs:

Appl
i
cat
ionLayer
.HTTPoper
ate
satt
hea
ppl
i
cat
ionl
aye
r.I
tas
-
sumesar
eli
abl
e,conne
cti
on-or
ient
edtrans
portprot
ocolsuch
a
sTCP,but doesnot prov
ide re
li
abi
l
ity or r
etra
nsmis
sion
i
tse
lf.
Reques
t / Res
pons
e. Onc
eat
rans
por
tse
ssi
on ha
sbe
en
e
stab
li
she
d,onesi
de(usual
l
yab rowser
)mus
tse
nda
nHTTP
r
equestt
owhic
htheothersi
der
esponds
.
St
atel
ess
.Eac
hHTTPr
eque
sti
sse
lf-
cont
aine
d;t
hes
erv
erdoe
s
notk
eepahi
stor
yofp
rev
iousr
eque
stsorp
rev
iouss
ess
ions
.
Bi
-Di
rec
tionalTr
ans
fer
.Inmos
tca
ses
,ab
rows
err
eque
stsa
webpag
e,a ndt heservertr
ans
fer
sac opytot
heb r
owser
.
HTTPal
soal-l
owst ra
nsferfr
om abrows
ertoaser
ver(e
.g.
,
whenause
rs upp
lie
sda t
a).
Capabi
l
ityNegot
iat
ion.HTTPal
l
owsb
rows
ersa
nds
erv
erst
o
negoti
atedeta
ilssuchasthec har
act
ers e
tt ob eusedduri
ng
tr
ansfers.Asendercansp
ecifythecapa
bil
iti
esitoff
ers,anda
re
-c e
iverca
nsp ec
ifythecap
abil
iti
esi
taccepts
.
Suppor
tForCac
hing.To i
mpr
over
esp
ons
eti
me,ab
rows
er
cac
hesac opyofeachwebp ageitret
rie
ves
.Ifaus e
rr e
quests
ap ageag a
in,the browse
rc aninter
rog
atet he s
erverto
dete
rminewhetherthecontentsofthepageha
sc ha
ngedsinc
e
thecopywascached.
Suppor
tForInt
ermedi
ari
es.HTTPal
lowsamachi
nea l
ongthe
pathbetwe
enabrowse
ra ndaser
vertoac sap
ta roxyser
ver
t
hatcac
heswe
bpa
gesa
nda
nswe
rsab
rows
er
sre
que
stf
rom
i
tsc
ache.

25.
7HTTPGETRe
que
st

Int hes i
mp l
estc a
se,ab rowsercontactsawe bserverdir
ectlytoob t a
ina
page.Theb rows e
rb egi
nswithaURL,e xtractsthehos t
names ec
tion,usesDNSt o
ma pthena mei ntoane quiv
ale
ntI Paddress
,a ndus e
st heres
ulti
ngI Pa ddres
sto
form aTCPc onne c
tiontot hewe bserve
r.Onc et heTCPc onnecti
oni sinp l
ace
,
theb rowsera ndwe bs e
rverus eHTTP t oc ommunicate;theb rowsers endsa
requesttor etrie
veas peci
ficpage,andthes erve
rr esp
ondsb ysendingac opyof
thepag e
.
Ab r
owse
rs endsan HTTP GET c
ommand t
or e
questawebp a
gefr
om a
s
erv
er.The re
que s
tconsi
stsofa sing
leli
ne oftex
tt ha
tbeg
inswi
ththe
k
eywordGETandis

Thestanda
rdus
est
heob
jec
t-or
ient
edt
erm me
thodi
nst
eadof
command.
Sec
.25.
7 HTTPGETRe
que
st
529

f
oll
owedb yaURLandanHTTPversi
onnumb e
r.Fore x
amp l
e,tor
etr
iev
etheweb
p
agei nt heexa
mpl
ea b
ovefrom ser
verwww. cs
.pur
due.edu,abr
owserca
nsend
t
hef ol
lowingr
eque
stwitha
na bs
oluteURL:

GET ht
tp:
//www.
cs.
pur
due
.edu/
peop
le/
come
r/HTTP/
1.1

OnceaTCPconnec
tioni
sinpl
ace
,therei
snoneedt
ose
nda
nab
sol
uteURL t
he
fol
l
owingr
ela
tiveURLwil
lre
tri
evethesa
mepag
e:

GET /
peop
le/
come
r/HTTP/
1.1

Tos
umma
rize
:

The Hypert
ext Transf
er Protocol(HTTP)i s used between a
browserandawebs er
ver
.Thebr ows
ers endsaGETr equestto
whichaserverr
espondsbysendingtherequestedpage.

25.
8Er
rorMe
ssa
ges

Hows houldawe bserverres


p ondwhe nitrecei
vesanill
egalrequest?I nmost
ca
ses,therequestha sbee
ns entb yab rowser,andt hebrowserwi l
la t
t e
mptt o
di
spl
aywha te
vert heser
verr e
turns.Consequentl
y,server
sus ual
l
yg e
nerateerror
mess
agesinv al
idHTML.Fore xamp l
e,ones erve
rg enerat
est hef ol
lowingerror
mess
ageasar esponsewhenevertheserve
rc annothonorar equest:

<HTML>
<HEAD><TITLE>400Bad
Reques
t</
TITLE></HEAD>
<BODY>
<H1>ErrorInReque
st</
H1>Yourbrows
ers
entar
eque
stt
hat
thi
ss e
rv e
rcoul
dnotund e
rst
and.
</
BODY>
</
HTML>

Theb rowseruse
st hehe
adoft hedocument(i.
e.,theite
msb et
we e
n<HEAD>a nd
</HEAD>)inter
nall
y,andonlyshowstheb odyoft hedocume
ntt ot heuse
r.The
pairoft a
gs<H1>a nd</H1
>c aus
estheb r
owsert odis
plyEr
a r
orI nRequestasa
headi
ng( i.
e.,lar
gea ndbold)
,r e
sul
tingint wol i
nesofout puton theuser
s
sc
r ee
n:

Er
rorI
nRe
que
st
Yourbrowsers
entar
eque
stt
hatt
hiss
erv
erc
oul
dnot
under
stand.
530 Wor
ldWi
deWe
b(HTTP) Cha
p.25

25.
9Pe
rsi
ste
ntConne
cti
ons

Thef i
rstversi
onofHTTPus esap aradi
gm ofoneTCPc onne
ctionperdata
t
rans
f e
r.Ac li
entop e
nsaTCPc onne
c t
iona ndsendsaGET r eques
t.Thes erv
er
s
endsac opyoft herequest
edpagea ndclosestheconnect
ion.Thep ara
dig
m has
t
hea dvan-tageofb ei
nguna mbi
guous t hec l
ie
ntme re
lyr ea
dsunt i
lane ndof
f
il
econdit i
onisencounter
ed,andthenc l
osesitsendoftheconnecti
on.
Versi
on1.
1ofHTTPc ha
ngestheb asi
cp aradigminaf unda
me nta lway:inst
ead
ofusingaTCPc onnect
ionpert r
ans f
er,versi
on1 .
1adop sap
t ersistentconnecti
on
ap-proa
cha sthede f
ault.Thatis,onc eac li
e ntope nsaTCPc onne c
tiontoa
parti
cul
arwe bserver
,t hec l
i
entl eave
st hec onne c
tioni nplac
edur ingmul t
ipl
e
request
sa ndrespons
es.Whe ne i
t herac lie
ntors erverisr e
a dy toc l
osethe
connecti
on,i
tinformstheotherside,andt hec onnecti
oni scl
osed.
Thec hie
fa d
v a
nta g
eofp ers
ist
entc onnecti
onsl i
e sinre ducedov er
he ad
fewer TCP c onnecti
onsme anslowerr e
sponsel ate
nc y,les
sov erhead on t he
underlyi
ngne t-works,lessmemoryus edforb uffers
,a ndles
sus eofCPUt i
me .A
browserusingap er-si
stentconnecti
onc anfurtherop t
imizebyp i
pel
ini
ngr eque s
ts
(i
.e.,s e
ndr equestsba c
k-to-ba
ckwi thoutwa iti
ngf orar e
sp onse)
.Pipeli
ningi s
especi
all
ya tt
r a
ctiveins i
tuati
onswhe remul t
ipl
ei magesmus tb er etr
ieve
df ora
gi
v e
nwe bpage,a ndt heunderl
yinginter-nethasb othhight hroughputa ndl ong
dela
y.
Thec hiefdi sadvantageofus i
ngap ersi
stentconnecti
onl ie
si nt hene edt o
i
denti
fytheb eg inninga ndendofe achit
ems entov erthec onne c
tion.The r
ea re
t
wop ossi
bletec hnique stohandl
et hesi
tuati
on:e i
thersendal engthf ol
lowedb y
t
heitem,ors endas enti
nelval
ueaftertheitemt oma rkthee nd.HTTPc annot
r
eserveas enti
ne lvalueb e-c
ausetheitemst rans
mittedincludeg ra p
hic
si mages
t
hatc a
nc ontai
na rbi
trarysequenc
esofoctets.Thus,toavoida mb i
g ui
tyb etween
s
enti
nelvaluesa ndda ta,HTTPus e
sthea pp
roachofs endi
ngal engthf ol
lowedb y
a
ni t
emoft hats ize.

25.
10Da
taLe
ngt
hAndPr
ogr
am Out
put

Itma yb ei nconv e ni
entore v
eni mp ossi
blef orawe bs ervertok now t he
l
e ngthofawe bp ag eb eforesendingt hep age.Tounde rst
andwhy,onemus t
knowt ha tma nywe bp a gesarege neratedup onr eques t.Thatis,theserverusesa
technologys ucha st heCommonGa tewayI nterface( CGI )thatall
owsac omp uter
programr unningont hes e r
verma chi
net oc reateawe bp a
ge.Whe nar equest
arriv
e st hatc orrespondst o a CGI- generatedp age ,t he webs erve
rr unst he
appropriateCGIp rog ra m,a nds endst heout putf r
om t hep r
ogramb ackt ot he
cli
ent a sa r e s
pons e.Dyna mic we bp ageg e
ne ra
-t ion all
owst he creati
on of
informa t
iont hatisc urr e
nt( e.
g.,al i
stoft hec urrents coresinsporti
nge vents
oral i
stofs i
test ha tma tchas e a
rc ht er
m) ,b utt hes erverma ynotk now t he
exactda tas i
zei na dv ance.Furthe r
mor e,s avi
ngt heda tatoaf i
l
eb efor
es ending
itisunde sir
a bl
ef ort wor e a
sons:itus esr esourcesa tt hewe bserverandde l
ays
t
rans
mis-
sion.Thus,t
opr
ovi
de f
or dyna
mic we
bpa
ges
,the HTTP s
tanda
rd
s
peci
fi
esthatifthe
S
ec.25.
10 Da
taLe
ngt
hAndPr
ogr
amOut
put 531

s
erv
erdoe snotknowthel
eng
thofap aeap
g r
ior
i,theser
verca
ninfor
mthe
b
rowse
rt hatitwil
lcl
oset
heconne
cti
onaft
ertrans
mitt
ingthepag
e.To
s
ummarize:

Toal l
ow aTCPc onnecti
ont oper s
istthroughmulti
pl
er eques
ts
andr espons
es,HTTPs endsal engthbeforeeac hres
ponse.Ifit
doesnotknow t helength,aserverinformst hecl
i
ent,sendsthe
respons
e,andt henclos
est heconnecti
on.

25.
11Le
ngt
hEnc
odi
ngAndHe
ade
rs

Wha tr epres
entati
on s houldas er v
er uset os end l
e ngt hi nf
orma tion?
Interes
tingl
y,HTTPb or rowst hebas
icformatf r
om e mai
l,usingt hesamef orma t
speci
fie
di nRFC2822f orema ilmes
sagesandMI MEEx tensi
ons .Li keas ta
nda rd
RFC2822e ma i
lme s
sage ,eachHTTPt ransmi
ssi
onc ontai
nsahe ade r,ablankline,
andt hedocume ntbe- i
ngs ent.Furthe
rmor e
,e achlineinthehe adercontainsa
keyword,ac olon,andi nfor
- mati
on.Fig
ur e25.1li
stsaf ew oft hep os
sib
leHTTP
headersandt hei
rme ani
ng .

He
a der Meaning
Cont
ent-Length: Sizeofdocumenti nocte
ts
Cont
ent-Type: Typeoft hedocume nt
Cont
ent-Encoding: Encodi
ngusedfordoc ument
Cont
ent-Langua ge
: Language(
s)usedindoc ument

Fi
gur
e25.
1Ex ample
she ader
sthatcana
ppea
rbefor
eadoc ument
.The
Content-Type:andCont
ent
-Enc
odi
ng:header
saretake
n
di
rectl
yf romMI ME.

Asanexampl
e,conside
rFi
gur
e25.2whi
chshowsaf e
w ofthehea
der
sthat
a
reusedwhenas hortHTMLdocument(
34c ha
ract
ers
)istrans
fer
redac
ros
sa
p
ers
ist
entTCPconne
ction.
Cont
ent
-Length: 34
Cont
ent
-Langua g
e:en
Cont
ent
-Encoding:a
sci
i
<HTML>At
riv
iale
xamp
le.</
HTML>

Fi
gur
e25.
2Ani l
lustr
ationofa nHTTPt r
ansfe
rwit
hheaderl i
nesused
t
os pecif
ya ttri
bute
s,ab l
ankli
ne,andt
hedocume ntits
elf
.
A Content-Lengt
h:headerisrequi
redi
fthec onnect
ionis
p
er -
sist
ent.
S
e et
hep
rev
iousc
hap
terf
oradi
scus
sionofe
mai
land
MIME.
532 Wor
ldWi
deWe
b(HTTP) Cha
p.25

Ina ddi
tiont othehe a
derslis
tedi nFigur
e25. 1,HTTPi ncludesawidev ari
ety
ofhe aderstha tall
ow ab rowsera nds er
vert oe xchangeme tainformation.For
example,ifas erve
rdoe snotk now t helengt
hofap a
g e
,t hes er
verclosesthe
connecti
on a fters end-
ing the document.Howe ver,t he serve
r doesnot a ct
withoutwa rning t heserverin-formstheb rowsert oe xpectac l
ose
.Todos o,
thes erverinc l
udesa Conne ct
ion:headerbef or
et hedoc umenti np l
aceofa
Content-Length:header:

Conne
cti
on:c
los
e

Whenitrecei
vesaconne
ctionheader,t
heb rowserk nowsthattheserverintends
tocl
osetheconnect
ionaf
te rthetra
nsfer;t
heb rows eri
sforbi
ddenfrom sending
fur
therr e
-quest
s.The ne xts e
cti
ons des
crib
et he purpos
es of other HTTP
hea
ders
.

25.
12Ne
got
iat
ion

Ina dditi
ont os peci
f yi
ngde t
ail
sa b
outadoc umentb ei
ngs ent,HTTPus es
headerst op ermitac lient a nd se
r vert o negoti
atecapabi
li
tie
s .The s e
t of
negoti
ablec a
pa bi
l
iti
esi nc l
udes a wi de v ar
iet
y of c ha
racter
ist
icsa bout t he
connecti
on( e.g.,whethera ccessisaut henti
cated)
,r e
pres
entati
on( e.
g.,whe ther
graphi
csima gesinJPEGf orma tareac cept-
ableorwhichtypesofc ompress
ionc an
beus e
d),c ontent(e.g.
,whe thertextf il
esmus tbeinEng l
is
h),andc ontr
ol( e.
g .
,
thelengthoft imeap ager emainsval
id).
Therearet wob as
ict ypesofne g
ot i
ation:server-dri
ven and agent-driven
(i
.e.,browse
r -
dr i
ven).Server-dri
venne goti
a ti
onb eginswi t
har equestf rom a
browser.Ther equestspeci
fiesal is
tofp reference
sa l
ongwi ththeURLoft he
desi
reddocume nt.Thes ervers e
lect
s,from a mongt hea v
ail
ablerepres
entat i
ons,
onet hatsati
sfiestheb rowsersprefer
ences.I fmul tipl
edoc umentssatis
fyt he
browser
spreferences,t
hes erverusesal ocalpoli
cytos elec
tone .Fore xa
mp le,if
ad ocumentiss tor
e dinmul ti
plelanguagesa ndar e
que stspeci
fie
sap ref
e rence
forEngli
sh,thes er
verwillsendt heEngli
shv er-si
on.

Agent-dri
venne got
iationme anst hatab r
owse rusesat wo-ste
pp rocessto
performt hes e
lec
t i
on.First ,theb rowsers endsar e
questt ot heservert oa s
k
whati savai
labl
e.Thes e
rv err e
t ur
nsal i
stofp oss
ibi
lit
ies
.Theb r
ows e
rs el
e c
tsone
oft hep ossi
bi
li
tie
s,a nds e ndsas e
c ondr equestt oob t
aint hedoc ume nt.The
dis
advantage of a gent-driven ne g
ot ia
tion ist ha titr equire
st wo s erve
r
int
er a
cti
ons;thea dvant
ag ei sthatab rows e
rr e-t
ainscontroloverthec hoice.
Ab rowser usesa n HTTP Acc
ept: header t
os pe
cif
y which medi
a or
r
epr
ese
nta t
ions ar
ea c
cep
tabl
e. The he
a de
rl is
ts na
mes of f
ormats wi
tha
p
ref
erenc
ev alueas
sig
nedtoe ac
h.Forexample,

Ac
cep
t:t
ext
/ht
ml,t
ext
/pl
ai
n;q=0.
5,t
ext
/x-
dvi
;q=0.
8
s
peci
fie
st hattheb
rowseri
swill
i
ngtoacc
eptthetext
/ ht
mlmedi
at ype,buti
f
t
het ypedoesnotex
ist
,thebr
owserwi
l
lacce
pttext
/x-dvi
,andi
ft hatdoe
snot
e
xis
t,text/pl
ai
n.
S
ec.25.
12 Ne
got
iat
ion 533

Thenume ri
cv aluesassoc
iatedwiththes ec
onda ndt hi
rde ntrycanbethoug htof
asap referencelevel
,whe renov al
ueise qui
v a
lenttoq=1 ,a ndav aueofq=0
l
meanst het yp
ei suna ccep
table.Forme di
at ypeswhe re qual
it
yisme aningf
ul
(e.
g.,a
udi o
) ,thev aueofqc
l anbeinterprete
da sawi ll
ingnesstoacc
eptag i
ven
mediat
yp ei fi
ti stheb e
sta va
il
abl
ea ft
erot herformsa r
er educedi
nqua l
i
t ybyq
perc
ent.
Av ar
ieyofAc
t ceptheader
se xi
stthatc
orre
spondt
ot heContentheader
s
de
scr
ibe
de ar
li
er.Forexampl
e,ab r
owserca
nsendanyofthefol
l
owing:

Ac
cep
t-Encodi
ng:
Ac
cep
t-Charse
t:
Ac
cep
t-Language
:

t
ospec
ifywhic
hencodi
ngs
,chara
cters
ets,a
ndlanguage
stheb
rows
eri
swi
l
li
ngt
o
a
cce
pt.
Wecansummar
izethedi
scuss
iona
boutneg
otia
t i
on:

HTTPus esMIME-l
ikeheader
st oc arrymetainfor
mat i
on.Both
browsersands
erv
er ss
endheaderst hatal
low t
hem tonegoti
ate
agreementonthedocumentr epr
esentat
ionandenc odi
ngtobe
used.

25.
13Condi
ti
ona
lRe
que
sts

HTTPa l
lowsas e
nde rtoma kear equestcondi
tional.Thatis,whenab rowser
sendsar equest,iti ncl
udesahe a derthatqua l
if
iesc ondi
tionsunderwhicht he
requestshoul dbehonor ed.I fthes pe
cif
iedcondit
ioni snotme t,theserve
rdoe s
notr eturnt her equested docume nt.Conditi
onalr equestsa l
l
ow ab rowsert o
optimi
zer etrie
valb ya voidi
ngunne c
essa
ryt ransfer
s.Oneoft hemos tuseful
condit
ionsus esanI f-
Modi fi
ed-Since:request i ta ll
owsab r
owsertoa void
transf
e r
ringadoc ume ntunl essitha sb eenupdateds inceas peci
fi
eddate.For
example,ab rows e
rc anincludet hehe ader
:

I
f-Modi
fi
ed-
Sinc
e:Mon,01Ap
r201
305:
00:
01GMT

wi
thaGETr
eque
stt
oav
oidat
rans
feri
fthedoc
ume
nti
sol
dert
hanAp
ril1
,201
3.

25.
14Pr
oxyS
erv
ersAndCa
chi
ng

Proxys
erv
ersa rea nimporta
ntp artoft hewebarchitectureb eca
uset hey
prov
ideanopti
mizati
ont hatc
a ndecrea
sel atencyandre
duc et heloadons erv
e rs
.
Twof ormsofprox
ys e
r v
ersexi
st:nontransparentandtransparent.Ast hena me
i
mp l
ie,anont
s ran-sparentse
r v
eri svis
iblet oaus er t heus erc onfig
uresa
browse
rt oc ont
ac ttheproxyins
teadoftheori
gi
nalsourc.At
e rans
par
entproxy
doesnotrequirea nycha
ng e
stoab rows
er
sconfi
gur
ation.Ins
tea
d,at r
ansp
arent
proxyexa
mi nesallTCPconnect
ions
534 Wor
ldWi
deWe
b(HTTP) Cha
p.25

t
hatpas
st hroughthep
rox
y,andi
nter
cept
sanyconnect
iontop or
t80.I
nei
the
r
c
ase
,ap roxyc a
che
swebpage
sandanswe
rssub
sequentreque
stsforapa
gef
rom
t
hecac
he.
HTTP incl
ude se x
p li
cits upportf or p roxys erv
ers.The p rotocolsp eci
fi
es
exactl
yhow ap roxyha ndlese ac
hr equest,how he adersshouldb eint er
pretedb y
proxi
es,howab rowserne g
otiateswithap roxy,andhowap roxyne gotiat
e swith
as er
ver.Further-more ,severalHTTPhe ader shavebeende signeds peci
fi
ca l
l
yf or
useb yproxi
es.Fore xamp le,onehe aderallowsap r
oxyt oaut hentic
a t
ei t
se l
ftoa
serve
r,a nda nothera ll
owse achp roxyt hatha ndlesawe bp aget or ecordits
i
de nt
itys otheul timater eci
pientr e-ce
ivesal i
stofa l
li ntermediatep roxies
.
Fi
na l
l
y,HTTPa ll
owsas e
r vert ocontrolhow p r
oxieshandlee achwe bpag e.For
example,aservercani ncludet heMa x-Forwar ds
:headerinar esponset oli
mi tthe
numb erofp r
ox i
esthatha ndleap ageb eforei tisdeli
veredt oab rowser.I fthe
serve
rs pec
ifi
esac ountofone ,a si
n:

Ma
x-For
war
ds:1

a
tmostoneprox
ycanha
ndlethepag
ea l
ongthep
a thfrom t
hes e
rve
rtot
he
b
rows
er.Ac
ountofze
ropr
ohi
bi
tsanyprox
yfromhandl
ingthepag
e.

25.
15Ca
chi
ng

Theg oa
lofc a
chingi simprovede f
fici
ency:ac acher educesbothlat
enc yand
net-workt r
aff
icb ye l
i
mi nati
ngunne cessar
yt r a
nsfers
.Themos tob vi
ousa spe
ct
ofc ac
hingisstorage.Whe nawe bp ageisinit
iall
ya cc
es s
ed,ac opyiss t
or e
don
dis
k,e i
therbyt heb r
ows er,ani nte
rme di
atep roxy,orb oth.Subseque
ntr equest
s
forthes a
mep ag ecans hort-c
ircui
tt helookupp roce
ssandr e
trie
veac opyoft he
pagefromt hecacheinst eadoft hewe bserver.
Thec entr
a lquesti
oni na l
lcac
hingschemesconce
rnstiming:how l
ongshould
a
nit emb ekepti nac ache?Ononeha nd,keep
ingac ac
hedc op
yt oolongr
e s
ults
i
nt hec opybe c ngs
omi tale,whichme ansthatchangestot heor i
gi
nalar
enot
r
efl
e c
t e
dint hec achedc opy.Ontheot herhand,ifthecachedcopyisnotk ept
l
onge nough,ineffi
cie
n-cyr e
sul
tsbecausethenextreques
tmus tg obacktot he
s
erver.
HTTPa l
lowsawe bservert oc ontrolcachingi nt wowa ys.Fir s
t,whe ni t
answersar e q
uestf orap age,as e r
verc a
ns pecifyc a
chingde t
ails
,i ncluding
whe t
herthep agec anbec acheda ta ll,whetherap roxyc ancac
het hep age,t he
communitywi thwhichac achedc opyc anbesha red,t heti
mea twhi cht hec ached
copymuste xpire
,a ndlimit
sont r a
ns formati
onst ha tcanb eapp
liedt ot hec opy.
Second,HTTPa l
l
owsab r
ows ert of orcereval
idation ofapage.Todos o,t he
browsersendsar equestfort hep ag e,andus esahe a
dert os pe
cifyt hatt he
ma xmum a
i ge( i.
e.,t het i
mes inc eac opyoft hep agewa sstored)c annotb e
greaterthanze ro.Noc opyoft hep ageinac achec anb eusedt os atisfyt he
requestbecausethec opywi llhav eanonze roa g e.Thus,onlyt heor igi
na lwe b
s
erv
erwil
lanswerthereques
t.Inte
rmedi
atep
r oxi
esalongt
hewaywillr
ece
ivea
f
res
hcop
yf orthei
rcac
hea swil
lthebr
owserthatiss
uedthere
que
st.
S
ec.25.
15 Ca
chi
ng 535

Tos
umma
rize
:

Cachi
ngi skeytot heeffic
ientoperati
onoft heWeb.HTTPall
ows
webs er
v erstocontrolwhetherandhow apagec anbecac
hedas
wellasitslif
etime;abr owsercanf or
cear eques
tf orapageto
bypasscachesandobt ai
naf res
hc opyf r
om theservert
hatowns
thepage.

25.
16Ot
herHTTPFunc
tiona
li
ty

Ourdescri
pti
onofHTTPha sf ocusedexclus
ivel
yonr e
tri
evalinwhichac l
ient,
t
ypi
call
yab rowser
,issuesaGETr equesttor etri
eveac opyofawe bpagef r
om a
s
erve
r.Howe ver,HTTPi ncl
ude
sf ac
il
iti
est hata l
low morec omp l
exinterac
tions
b
etweenac li
enta nds e
rver
.Inp artic
ular,HTTPof fe
rsPUT a ndPOS T methods
t
hatal-l
ow ac l
i
entt osenddatat oas er
ver.Thus ,itisposs
ibl
et obuil
das c r
ipt
t
hatpromptsaus erfora nIDandp as
sworda ndt hentransf
erst here
sultstot he
s
erve
r.
S
urpr i
si
ng l
y,althoughitp ermi
tst ra
nsferine i
therdirec
tion,theunde r
lying
HTTP protocolr e
ma insstatel
ess(i.
e.,doesnotr equi
reap ersi
stenttransport
l
ayerc onnection tor ema i
ni np l
ace during ani nt
eracti
on).Thus ,additi
onal
i
nformationi softenus edt oc oor
dinateas e
rie
soft r
ansfers.Fore x
amp l
e,i n
res
ponset oa nIDa ndp as
sword,as erv
ermi ghtsendanidentif
yingintege
rk nown
asacookiet hatthec li
entreturnsinsuc-ce
s s
ivetra
nsfers
.

25.
17HTTP,S
ecur
ity,AndE-
Comme
rce

Al
thoughi tde f
inesame chani
smt hatc anbeus edt oa cce
s swebp a
g es,HTTP
doesnotp r
ov i
dese curi
ty.Thus ,bef
or et heyma k ewebp urchasestha trequiret he
tra
nsferofi nforma ti
ons ucha sac r
e ditc ardnumb er,us e
rsne eda ssurancet hat
thet r
ansacti
oni ss afe
.The r
ea ret woi ss
ues:c onf
idential
ityoft heda tab eing
tra
nsferreda nda uthentica
- t
ionoft hewe bs i
teof fe
ringi temsf ors ale.Aswe
wil
lseeinCha pter29,e ncrypti
onisus edt oe nsureconfidenti
a l
it
y.I na dditi
on,a
cer
tifi
cateme cha
ni s
mc anb eus edtoa u- thenti
catetheme rchant.
As ecurit
yt echnologyhasbeende v i
sedforusewithwe bt r
a ns
acti
ons.Known
asHTTPov erSSL ( HTTPS),thet echnologyrunsHTTPov ert heS ecureSock
et
Layer( SSL)pr otocol
.HTTPSs olvesb oths e
curi
tyissuesrel
atedt oe -commerce:
becauset heyar eencrypted,datatrans f
ersareconf
identi
al
,a ndb eca
us eSS
Lus es
ac e
r t
ific
a t
et ree,ame r
chantisauthe nti
cat
ed.
53
6 Wor
ldWi
deWe
b(HTTP) Cha
p.25

25.
18S
umma
ry

TheWor l
dWi deWe bco
nsis
t sofhyperme di
adoc umentsstoredonas etof
webs erve
r sa nda c
ces
sedbyb rowse
rs.Eachdoc umentisa s
signedaURLt hat
uni
que l
yi dentif
iesit;the URL speci
fi
est he p rot
ocolusedt oretri
evethe
document,t helocati
onoft heserve
r,a ndt hep atht othedoc umentonthat
ser
v e
r.
TheHyperTextMa r
kupLanguage
,HTML,a l
lowsadoc
umenttocont
aint
ext
al
ongwit
he mbeddedcommandsthatcont
rolf
ormatt
ing
.HTMLal
soal
l
owsadocu-
menttoconta
inlink
stootherdocuments
.
Ab r
ows erand s e
rver usethe HyperText Trans
fer Protocol
,HTTP,t o
t
ransfe
ri n-forma
tion.HTTPisa napp
li
cati
on-le
velprotocolwithex p
li
ci
ts upport
f
orne gotia
tion,proxys e
rvers
,c a
chi
ng,a ndp er
sis
tentc onnecti
ons.A r e
late
d
t
echnol
ogyk nowna sHTTPSusesSSLtoprovidesec
ureHTTPc ommunicat
ion.

EXERCI
SES

25.
1 Rea
dthesta
ndar
dforURLs
.Whatdo
esi
tme
anwhe
nap
ounds
ig #)i
n( sfol
l
owe
d
byast
ringa
ttheendofaURL?
25.
2 Ex
tendthepre
viouse
xer
cis
e.I
sitl
ega
ltos
endt
hep
ounds
igns
uff
ixonaURLt
o
awebse
r v
er?Whyorwhynot?
25.
3 How doe sab r
owserdisti
nguis
hb etweenadoc umentthatcont
ainsHTMLa nda
docu-mentt hatconta
insa rbi
traryt ex
t? To f i
nd out
,e xp
eri
me ntby us
ing a
browsert oreadfrom af i
le
.Doe stheb rowserus ethenameoft hef
il
eort he
contentstodeci
dehowt ointerpr
ett hefil
e?
25.
4 Wha tisthepurpos
eofa nHTTPTRACEc omma nd?
25.
5 Whatist he di
ffe
r encebetweenan HTTP PUT c
omma
nd a n HTTP POS
nd a T
comma
nd?Whe nise achusef
ul?
25.
6 Wheni nHTTPKe
sa ep-Al
iv
eheaderus
ed?
25.
7 Cananarbi
trar
ywe bse
rverfunc
tionasap
roxy?Tof
indout
,c hoos
eana
rbi
trar
y
webserve
ra nd c
onfi
gureyourb rows
erto us
eitasap rox
y.Do theres
ults
sur
pri
seyou?
25.
8 Downloa
dandinsta
llt
heSqui
dt r
ans
par
entprox
yca
che
.Wha
tne
twor
kingf
aci
l
iti
es
i
nt heOSdoe
sS qui
duset
oc ac
hewebpages
?
25.
9 Re
adabo smus
utHTTP t
-r ev
ali
dat
ec ac
hecont
roldi
rec
tiv
e.Gi
vea
nex
amp
leofa
webp
agetha
twouldus
es uchadirec
tiv
e.
25.
10 Supposeyouworkf orac ompanythatconf
iguresyourl
aptopcomput
eralwaysto
uset hecompany
sp roxy webs e
rver.Expl
ain whathapp
e nsifyou t
rave
la nd
connecttotheIn-
te r
neta tahotel
.
25.
11 Ifab r
owse
rdoe snotse nHTTP Cont
nda ent
-Lengt
h:headerbef
orear
eque
st,
howdoesaser
verres
pond?
25.
12 ReadmoreaboutHTTPSandexpl
ai
ntheimp
actofHTTPSonc a
chi
ng.Unde
rwha
t
ci
r-cums
tanc
escanaprox
yc a
chewebpag
eswhenus
ingHTTPS
?
Ex
erc
ise
s 537

25.
13 Readt
heHTTPs
peci
fi
cat
ionc
are
ful
l
y.Ca
nHTTPb
eus
edf
ors
tre
ami
ngv
ide
o?Ex
-
pl
ai
nwhyorwhynot.
25.
14 Conside
r a denia
l-of-s
ervi
cea tt
ack on a webs e
rverin whi
chap er
p e
tra
tor
arrangestoha
v ema nycli
entsf
orm aconnec
tiontotheserv
erandrep
eatedl
ysend
requestsf
ornon-exist
entwe bpages
.Howcans uc
ha natt
ackbepre
vente
d?
25.
15 Becaus
e many webp ag
esinclude ads,mo s
t webp a
gesc ont
aina tleastsome
dynamicc
ontent(i.
e.,c
ontentt hatisgener
ate
dwhe nt hepag
ei sfetc
hed).How
shoul
dawe bdes
ignerar
rang
es uc hpage
st omaxi
mizeca
chingeff
ecti
veness
?
Chapt
erCont
ent
s
26.
1 I ntroduc t
ion,539
26.
2 Di gi
tizingAndEnc oding ,539
26.
3 Audi oAndVi de oTr ans missi
onAndRe produc
tion,540
26.
4 Ji t
te rAndPl ayb ac
kDe lay,541
26.
5 Re al
- ti
meTr a nsportPr otocol(RTP),542
26.
6 S treams ,Mi xing,AndMul ti
c as
ting,544
26.
7 RTPEnc apsulation,544
26.
8 RTPCont rolPr otocol( RTCP) ,545
26.
9 RTCPOp er a
tion,545
26.
10I PTe lephonyAndS i
g na li
ng,546
26.
11 QualityOfS er v
iceCont roversy,549
26.
12 QoS,Ut i
li
zation,AndCa pac
ity,550
26.
13 Emer gencyS e rvic
esAndPr eemp ti
on,551
26.
14I ntServAndRe sourceRe servati
on,551
26.
15 Dif
fS ervAndPe r-HopBe havior,553
26.
16 TrafficS cheduling,553
26.
17 TrafficPol i
cingAndS ha pi
ng,555
26.
18S umma r y,556
26

Voic
eAndVi deoOv
erI
P
(RTP,RSVP,QoS)

26.
1Int
roduc
tion

Previ
ousc hapter sconsiderappl
ica
t i
onsthattransfere mailmessagesanddata
fi
les.Thisc hapt
erf ocusesont het ransfe
rofr e
al-ti
meda t
a ,sucha svoiceand
vi
de o overa nI P ne twork .Ina dditi
on to dis
cus s
ing the protocolsusedt o
transpor
ts uchda ta,t hec hapterconsi
derstwob roade ris
sues.Fir
st,ite xami
nes
protocol
sa ndt echnologiesus edforc omme r
cia
lI Pt elep
hones ervi
ce.S ec
ond,it
examinestheque stionofhow r outersina nIPne twor kcang uara
nte esuffi
ci
ent
quali
tyofs e r
vic
et op r
ovidehigh-qual
ityvideoanda udioreproduct
ion.

26.
2Di
git
izi
ngAndEnc
odi
ng

Beforevoiceorv ideocanbes e
ntov erapack
etne t work,hardwareknowna s
ac oder/dec oder( codec)mustb eusedt oconve
r tt heana l
ogs i
gnaltodi gi
tal
form.The mos tc ommon type of codec,a wa veform c oder,me as
ur esthe
amp l
it
udeoft hei nputs i
gna
la tregul
arinter
val
sandc onve
rt seachsampl
ei ntoa
dig
italval
ue(i.e.,ani n-t
eger
).Att herecei
vi
ngside,ac odeca c
ceptsase que
nce
ofi nteg
ersa sinp uta ndcreate
sac onti
nuousanalogs ig
na lthatma tchesthe
dig
italval
ues
.
S
everaldigitale ncoding sta
nda r
ds exi
st, wit
ht he maint radeof
fb ei
ng
between qua
li
ty of r eproduct
ion and the si
ze of di
gi
talreprese
ntati
on.For
exampl
e,t he conven-tionalt e
lephone s
yste
m us esthe Pul
se Code Modul
ati
on
(PCM)standardt hats pecifi
estakingan8-bitsampleevery125 s ec
onds(i
.e.
,
8000timespers econd).Asar e
sul
t ,a

Anal
ter
nati
veknownasavoi
cec
oder/dec
oder(
voc
odec
)re
cog
nize
sande
ncode
shuma
nsp
eec
h
r
athert
hangene
ralwave
for
ms.
53
9
540 Voi
ceAndVi
deoOv
erI
P(RTP,RS
VP,QoS
) Cha
p.26

digi
ti
zedte
lephonecal
lp r
oduce
sdataatarat
eof64Kbps.ThePCM e
nc odi
ngp r
o
-ducesasurpris
inga mountofoutput stor
inga
n uncompr
ess
ed1 28-sec
ond
audiocl
i
prequiresoneme ga
byteofmemor
y.
Therea ret hreewa yst or educet hea mountofda tag ene ra
tedb ydi gi
t a
l
encoding:t akef e we rsa mp lespers econd,us ef ewe rb itst oe nc odee ac
hs ample,
orus eadi gitalc omp ressions chemet or educet hes izeoft her e
sulti
ngout put.
Variouss ystemse xisttha tus eoneormor eoft het e c
hnique s,ma ki
ngi tp oss
ib l
e
tof indpr oductst ha tproduc eencodeda udi
oa tar ateofo nly2. 2Kb ps
.Howe ver,
eacht echniqueha sdi s
adv a ntages
.Thec hiefdisadv a
nt ageoft ak i
ngf ewe rs amples
orus ingf ewerb itst oe nc odeas amp l
ei slowe rqua l
itya udio t hes ystemc annot
reproducea sla rgear a ng eofs ound f re-quencies.Thec hiefdi sadvantageof
comp ress
ion isde lay di giti
zedout putmus tb ehe ldwhi l
ei ti scomp ressed.
Furthe r
mor e,b eca usegr ea terreductioni nsizer equiresmo rep rocessi
ng,t heb est
comp ress
ion e ithe rr equi r e
sa f ast CPU or i nt roducesl ong er delay. Thus ,
comp ress
ioni smos tuse fulwhe nde layi suni mporta nt( e
. g.,whe nt heout -
p ut
fromac ode cisb eings tore dinaf ile)
.

26.
3Audi
oAndVi
deoTr
ans
mis
sionAndRe
produc
tion

Manya udioa ndv i


de oa ppl
ic
ationsa reclassi
fieda sr eal-
timebec auset hey
requiretime lyt ransmissi
ona ndde l
ivery.Fore xamp l
e ,inte r
a c
tivet elep
honec a l
l
s
ands trea
m- i
ngv ideosar eclas
sifi
eda sreal-
timeb e c
aus ea udioa ndv ideomus tb e
deli
v er
edwi t houts igni
ficantdelayorus ersfindt her esultuns atisfactory.Time l
y
transferme ansmor et hanl ow del
ayb e
causet her esulti
ngs i
gna lisuni nte
ll
igibl
e
unlessitisp resentedi ne x-
actlythes ameor dera st heor iginala ndwi the xa
c tl
y
thes amet imi ng.Thus ,ifas end-i
ngs ystemt ak
e sas amp lee very1 25s ec
onds .A
receivi
ngs yst em mus tc onvertdigi-
t a
lv al
uestoa nal
oga te xactlyt hes amer ate
ast heywe res a
mp l
ed.
How c a
nane tworkg uar
anteet hatt hes t
r eami sde l
iv
ereda te xa
c t
lyt he
samer atet ha
tt hes enderused?Theor igina
lU. S.t ele
phones yst
emi ntroduced
one answer:a ni sochronousarchite
cture.I sochronousde si
gn me anst hatt he
entir
es yst
em,i ncl
udingt hedi
g i
talci
rcuit
s,mus tb ee ngineer
edt ode l
i
verout put
withe x
a c
tlythes amet imingaswa susedtog ene r
a t
ei nput.Thus,anisochronous
system withmul ti
plep athsbetweena nyt wop ointsmus tb ee ngi
neereds oa l
l
pathshavee xa
ct l
yt hesamede l
ay.
TCP/ I
Pt e
chnologya ndt heglobalInternetar enoti sochronous .Weha vesee n
thatda t agramsc anb edup li
cate
d,de layed,ora rr
iveoutofor der.Variancei n
del
a y,k nowna sj i
tter,isespeci
all
yp ervasi
v einIPne twor ks.Toa l
lowme aningful
transmiss i
on a nd re p
roduction of digiti
zeds ignal
sa crossa ne twork withI P
sema nti
c s,additionalprotocolsupportisr equi
red.Toha ndleda ta
g ram dupl
icati
on
andout - of-orderde li
very,e ac
ht ransmiss
ionmus tc ontainas eque ncenumb er.To
handlej itter,e acht r
ansmissi
onmus tconta nat
i i
mes t
ampt hatt ellsthereceiv
e r
atwhi cht i
met heda taint hep acketshouldb ep l
aye db ack.Sepa rati
ngsequenc e
andt i
mi ngi nformat i
ona ll
owsar eceiv
e rt orecon- s
truc tthes igna lac
curately,
i
ndepe
nde
ntofhow thepac
ketsar
riv
e.Suc
ht i
minginfor-ma
tion i
ses
pec
ial
l
y
c
rit
ica
lwhenada
tag
ramisl
ostori
fthese
nders
topsencodi
ngdur-

Ti
mel
ine
ssismor
eimpor
tantthanre
li
abi
l
ity;t
her
eisnot
imef
orr
etr
ans
mis
sion da
tat
hat
doe
snotar
riv
einti
memustbeski
pped.
S
ec.26.
3 Audi
oAndVi
deoTr
ans
mis
sionAndRe
produc
tion 541

ingp
eri
odsofsi
le
nce
;ital
lowstherec
eiv
ertopaus
edur
ingp
layb
ackt
hea
mount
ofti
mespeci
fi
edbythet
imesta
mp s
.Tosummar
ize:

Bec ausean IPi nternetisnoti sochronous,addi t


ionalprotocol
suppor ti
sr equiredt odeli
verr eal-
t i
medat as uc
hasaudi oand
video.I n ad-di
tion to bas
ics equencei nfor mati
on t hatall
ows
detec t
ionofdupl i
cateorr eorderedpac kets,eac hpac ketmus t
carr yaseparatet i
mestampt hatt el
lsther eceiv
ert heexacttime
atwhi chthedat aint hepacketshouldbepl ayed.

26.
4Ji
tte
rAndPl
ayb
ackDe
lay

How ca
nar ece
ive
rrecr
eateasi
gnalacc
ura
telyifthenetwor
kintr
oduces
j
itt
er?Therec
eiv
ermusti
mple ntap
me l
aybac
kbufferasFi
gur
e26.1il
l
ustr
ate
s.

i
temsi
nser
teda
t i
temsext
rac
ted
avari
abl
erat
e a
taf i
xedrate

Fi
gur
e26.
1Thec onc
eptualorg
aniza
tionofap l
ayb
ac kb
uffe
rtha
t
compen-
sat
e sforji
tter
.Theb uf
ferholdsKti
meuni
tsof
data
.

Whe nas essi


onb egi
ns,therece
iverdel
aysp l
ayb
a c
ka ndp l
acesi
ncomingda t
a
i
ntheb uffer.Whenda tainthebufferrea
chesap redet
erminedthre
shold,known
a
sthep laybackpoint
,out putbeg
ins
.Thep la
ybackpoint,la
b e
ledKint hefigure,
i
sme a
sur edint i
meuni tsofda tatob ep l
ayed.Thus,p l
aybackbegi
nswhe na
r
ece
iverha saccumu-la
tedKt imeunit
sofda ta
.
Ap pl
icati
onstha tp lays tre a
minga udioorv ideous uall
yp resentus erswitha
g
raph- icalrepres
entationofp laybackb uffe ri
ng.Typ i
call
y,t hedisplayc onsi
stsof
ahor izont a
lb artha tr ep res
e ntst het imer equiredt od i
splayt heob ject
.For
e
x a
mp l
e ,ifaus erp layst hev i
deof ora30- minut et el
evisi
ons how,t hedi spl
ay
r
epre sentst i
mef rom ze rot o30mi nut es.Ata nyt ime,s hadi
ngi sus edt odivi
de
t
heb ari ntot hre
es eg me nts.As egme ntont hel efts howst hea mountoft he
v
ideot hatha sbeenp l
a yed,t hene xts egme ntshowst hea mountoft heunp l
ayed
v
ideot hatha sbeendownl oade d,andt het hirds egments howst hea mountoft he
v
ideot hatmus tsti
llbedownl oaded.Weus et het ermp lay-backpoi ntt or eferto
t
hep ointi nthev i
deoc urr e
nt lybeingdi splayeda ndt het e
rm downl oadpointt o
r
efert ot heamountoft hev ideoc urrentlydownl oaded.Figure26. 2s howshowa
p
layba ckdi s
playmighta ppe art oaus erwit ht hes egmentsl abe
led.
Apla
ybac
kbuf
feri
sal
soc
all
edaj
itt
er
buf
fer.
542 Voi
ceAndVi
deoOv
erI
P(RTP,RS
VP,QoS
) Cha
p.26

al
ready downloaded,but
pl
ayed notyetpl ayed

0:
00 0:
30

pl
aybac
k download
poi
nt poi
nt

Fi
gur
e26.
2I l
lus
trati
onofadi
spl
aythats
howspl
aybac
kb uf
feri
ngfora
30-minut
estr
eami
ngvide
owithse
gment
sa ndpoi
ntsla
bel
ed.

Aspla
ybackp roceeds,datag
ramsc onti
nuet oar r
ive
.I ft hereisnoj itt
er,new
da
tawi llarr
ivea te x
ac t
lyt hesamer ateoldda taisbeinge xt
racteda ndp l
ayed
,
meaningthebuf f
erwi l
la lwayscontaine xa
c t
lyKt imeunitsofunp l
a yedda t
a.Ifa
da
tag rame x
pe r
i-encesas malldelay,p laybackisuna ffect e
d.Theb uffersi
ze
de
cre as
essteadi
lya sda t
ai sextract
e d,andp laybackcontinuesunint e
rr upt
edfor
Ktimeunits.Whe nade l
ayedda ta
grama rri
ves,theb uff
eri sr ef
il
led.
Ofcourse
,ap l
aybac
kbufferca
nnotcompensat
ef ordatag
raml os
s.I
ns uch
ca
ses,p l
aybac
ke ve
ntual
lyre
achesan unf
il
le
dp os
iti
on i
nt he buf fe
r.Int he
fi
gure,thep l
ay-
backpoi
ntreac
hesthedownl
oadp oi
nt.Whe nplaybackexhaus
ts
al
lav a
il
abledata
,out-putmustpauseforat imep er
iodcorres
p ondi
ngt othe
mis
singdata.
Thec hoiceofKi sac ompromisebetweenlossanddelay.I fKi stoos mal
l,a
sma l
la mountofj i
tte
rc aus
est hesystemt oexhaustthep l
ayb ac
kb uf f
erb efore
theda taar r
ives.IfKi stoolarge,thesystemremainsimmunet ojitt
e r,butt he
ext r
a de l
a y,whe na ddedt ot he transmi
ssi
on del
ayi nt he ne t
wor k,ma yb e
not i
ce a
blet ous ers
.De sp
itethedi s
advanta
ges,mosta ppl
i
c a
tionst hats endrea l
-
timeda taa crossa nIPi nte
rne tdependonp l
aybackbufferinga st hep ri
ma ry
solutionforj itt
e r
.

26.
5Re
al-
timeTr
ans
por
tPr
otoc
ol(
RTP)

Thep rotocolusedt ot r
ansmitdigiti
zeda udi
oorv ideos i
gnal
sov e
ra nI P
interneti
sk nowna st heReal-t
imeTr anspor
tPr ot
oc ol(
RTP) .Inter
estingl
y,RTP
doesnotc ontai
nme c
hanismsthatensurep ac
ketstravers
ea ni nt
ernetinat i
mely
ma nner;s
uchg uaran-tees
,iftheye xi
st,mus tbema debyt heunde rl
yings ys
tem.
Instead,RTPp rovi
dest wok eyfaci
li
ties
:as equencenumb e
ri neachp acketthat
all
owsar ece
ivertode tectout-of-
orde rdeli
veryorl os
s,a ndat imestampt hat
all
owsar ecei
v e
rt ocontrolpl
aybac
k.
Be
causeRTPi sdesi
gnedtoc a
r ryawi devar
ietyofr eal
-ti
meda t
a,i ncludi
ng
b
othaudioandvideo,RTPdoesnote nforceaspeci
fi
ce ncodi
ngfordata.I nstea
d,
e
achpack-e
tb eginswithahe ader;init
ialfi
el
dsi nt heheaderspec
ifyhow t o
i
nte
rpre
tr emai
ningheaderfi
eldsa ndhow tointerpr
ett hepayl
oad.Figur e26.3
i
l
lus
tra
testheforma tofRTP
she ader.
Al
thoug
hne t
worklos
sa ndji
tterc
anb
eus
edt
ode
ter
mineav
al orK dyna
uef mic
all
y,ma
ny
p
layb
ackbuff
eri
ngsche
mesuseaconst
ant
.
S
ec.26.
5 Re
al-
timeTr
ans
por
tPr
otoc
ol(
RTP) 543

01 3 8 1
6 31
VER P X CC M PTYPE S
EQUENCENUM
TI
MES
TAMP
S
YNCHRONI
ZATI
ONS
OURCEI
DENTI
FIER
CONTRI
BUTI
NGS
OURCEI
D
...

Fi
gur
e26.
3I l
lustrat
ion oftheheaderuse
dwi t
h RTP.Eac h messa
ge
begins with thi
s hea
de r
;t he e
xactint e
rpr
e t
ation of
rema i
ningfi
eldsi
ntheme s
sag
edepe
ndsont hepayl
oadt ype,
PTYPE.

Ast hefigur es hows ,e achp acketbeginswi t


hat wo- bitRTPv ers
ionnumb er
i
nf i
e dVER;t
l hec ur rentv ersi
oni s2.ThePb i
ts peci
fieswhe therze rop adding
fol
lowst hepa yload;i tisus edwi the ncryptiont hatr equiresdatat ob ea ll
ocated
i
nf i
x ed-si
zeb loc k
s.S omea ppli
cationsde f
inea nop ti
ona lhe a
dere xtensiont ob e
pla
ce db etwee nt hehe aders howna boveandt hep ayload.I fthea ppli
c a
t i
ont ype
all
owsa ne xt
e nsion,t heXb itisus edt ospe cif
ywhe thert heextensioni spresent
i
nt hep acket.Thef our-b tCCf
i iel
dc ontainsac ountofc ontri
but i
ngs ourceI Ds
i
nt hehe ader.I nterp r
et a
t i
onoft heM ( mar ker)b i
tde pendsont hea pp l
icat
ion;it
i
sus edb ya pp l
icationst ha tnee dt oma rkp ointsint heda tastream( e.g.
,t he
beginningofe ac hfr amewhe ns endingv i
deo) .Thes ev e
n- b
itPTYPEf ieldspec i
fi
es
thep a
yloadt yp eb eings entint heme s
sage;i nterpret
a -ti
onofr emainingf i
eldsin
thehe ade randp ayloadde p
endsont hev al
uei nPTYPE.Thes i
xteen-bitS EQUENCE
NUM f iel
dc ont ainsas e
que ncenumb erfort hep acket
.Thef irs
ts equencenumb er
i
nap arti
cula
rs essi
oni sc hosena trandom.
The p ayl
oadt ypea ff ectsthe i nt e
r pr
e tation of t he TI MESTAMP f iel
d.
Conc eptual-y,at
l i
mes tampi sa32- bi
tv aluet hatg ivest het i
mea twhi cht he
firstoc tetofdi gi
tizedda tawa ssamp led,wi t
ht hei ni
tialtime stampf oras ess
ion
chose na tr andom.Thes ta n-dards p e
cifi
e st hatt het i
me sta mpi sincreme nted
continuous l
y,e vendur ingp eri
odswhe nnos i
g nalisde tect eda ndnov a
luesa re
sent,b utt he standard doe snots p eci
fyt he e x actg ranula ri
ty.I nstead,t he
granul ari
tyisde terminedb yt hepa yloadt ype,whi c
hme anst ha te achapplic
ation
canc hooseac l
ockg ranula ritytha ta ll
owsar e c
e i
vert op o-sit
ioni temsi nt he
out putwi tha cc
urac yap prop r
iatet ot hea ppl
ic ati
on.Fore x amp l
e,ifas tr
e am of
audioda taisbeingt ransmit tedove rRTP,al og i
calt i
me s
tampg ranular
ityofone
cl
oc kt ickpersamp l
emi ghtb ea ppropr i
ate.Thus ,ana udiot i
me stampmi ghtha ve
ag ra nular
ityofonet i
ckf ore ach1 25s ec
onds .Whe nas tr ea
mc ontai
nsv ideo
data,as amplemi g
htc or re
s pondt oonef rame .Howe ver,ag r anulari
tyofonet i
ck
perf rame wi l
lb e unde s
ira b
le a hi gherg ranularity wi l
la c
hieves moot her
playba c
k .
Thesep
arati
onofs equencenumberandtimest
ampisimport
antforc a
ses
wher
eas ampl
es pa
nsmul ti
plepac
kets
.I npar
tic
ular,t
hestanda
rda l
l
owst he
ti
mesta
mpsintwop ac
ket
st ob ei
dent
icali
nthecasewheret
wop ack
etscont
ain
da
tat
hatwa
ssa
mpl
eda
tthes
amet
ime
.

The TI
MESTAMP i
ssomet
ime
sr efe
rredtoa sa MEDI
A TI
MESTAMP t
oemp
has
ize t
hati
ts
g
ranul
ari
tydepe
ndsonthet
ypeofsi
gna
lb e
ingme
asure
d.
544 Voi
ceAndVi
deoOv
erI
P(RTP,RS
VP,QoS
) Cha
p.26

26.
6St
rea
ms,Mi
xing,AndMul
ti
cas
ting

Ak eyp arto fRTP i si tss up portf ortrans l


ati
on and mi xing.Tr ansl
ati
on
referst oc ha
ng ingt hee ncodi ngofas t reama ta nintermediates tati
on( e.g
.,to
reduc et her esolu-tion ofav i
de ob r
oa dcas
tb eforesendingt o ac ellphone).
Mixingr eferst ot hep roc e
ssofr ec e
ivi
ngs t
reamsofda tafr om mul ti
plesources,
comb ini
ngt hemi ntoas ingl
es tream,a nds endingt heresul
t .Tounde rstandthe
needf or mixing ,i magine t hati ndivi
- dual
sa t mul ti
plesit e
sp arti
cipateina
confe re
nc ecal
lus i
ngI P.Tomi nimi zet henumb e rofRTPs treams,t heg roupcan
desi
g nateami xer ,anda rrang ef ore ac hs i
tetoe sta
bli
sha nRTPs ess
iont othe
mixer .Themi xerc omb i
ne sthea udi ostr eams(possibl
yb yconv er
tingt hemb ackto
analoga ndr es
a mp l
ingt her esulti
ngs igna l
),ands endsther e
s ul
ta sas i
ngledigi
tal
stream.
Fie
ldsi nt he RTP he aders upport mi xi
ng byi ndi ca
ting tha t mixing ha s
occurreda ndi dentifyingt hes ourcesofda ta.Thef i
eldi nFigur e26.3l abe l
ed
SYNCHRONI ZA- TION SOURCEI DENTIFIER sp e
cifi
esthes ourceofas t
rea m.Ea ch
sourcemus tc hooseauni que32- bitidentifi
er;thep rotocolincl
ude same cha nism
forresolvingc on- f
lictsifthe yaris
e.Whe nami xercomb inesmultiplestreams ,t he
mixerbe come st hes ynchronizati
ons ourcef orthene ws tream.Inf ormationa bout
theor i
gina lsour c
esi snotl ost,howe ve
r ,becausethemi x erusesthev a r
iab l
e- si
ze
CONTRI BUTI NG SOURCEI Df iel
dt op rovi
det hes ynchronizati
onI Dsofs tre ams
thatwe remi x edt ogether.Thef our-bitCC f i
eldg i
vesac ountofc ont ributing
sources
,whi chme anst hatama xi
mumof1 5sourcescanb eli
ste
d.
RTP isde si
g nedt o wor k withI P multica
sti
ng,a nd mi xi
ng i
se s
pe c
ial
ly
attract
ive in a mul tic
ast e nvi
ronme nt. To unde rst
and why, i magine a
tele
confere
nc etha tincl
udesma nyparti
c i
pants.Uni
cast
ingr equire
sas tationt o
sendac opyofe achout g
oingRTPp acke
tt oe achparti
cipant
.Wi thmul t
icasti
ng,
howe v
er,as ta
tiononl yne edst osendonec opyoft hep acke
t,whi chwi l
lb e
deli
veredtoa l
lp arti
cipa
nt s
.Fur ther
mor e,ifmi x-i
ngi sus ed,allsourcesc an
unicas
tt oami xer,whichc ombinesthemi ntoas i
ngl
es t
r e
amb ef
oremul t
icasti
ng.
Thus,t hec ombinati
on ofmi xi
ng and mul ti
castresul
tsi ns ubst
ant
iall
yf ewer
datagramsbeingde l
iv
e r
edt oe a
chp art
ici
p a
tinghost.

26.
7RTPEnc
aps
ula
tion

Itsna me impli
est hat RTP isa t rans
portl e
v elp r
otocol
.I nde ed,ifi t
functionedl ikeac onv
e nti
onalt ra
nspor
tp rotocol
, RTP woul dr equiree a
ch
messa get ob eencaps
u-l
a te
ddi re
ctlyinanI Pda tagr am.Inf act,thena mei sa
misnome rb ecauseRTP doe snotf uncti
on li
keat ranspor
tp rotocol.Tha ti s,
dir
e c
te ncaps
ulati
onofRTPme s
sagesinIPda tag
r a
msdoe snotoc curi np ra
ctice.
Instead,RTPr unsoverUDP,me a
ningthate a
chRTPme s
sageisenc ap
s ul
atedi na
UDP da t a
gram.The c hi
e fa dv
antage ofus i
ng UDP i sc oncurrency as ingl
e
comp uterc anhavemulti
p l
ea pp
li
cati
onsusingRTPwi thoutin-te
r f
e r
enc e.
Unl
i
kemanyoftheap p
lic
ationprotocolswehaveseen,RTPdoesnotusea
r
ese
rvedUDPpor
tnumber.Inste
a d,aporti sal
l
oca
tedforusewi t
he a
chses
sion,
a
nd the r
emoteap
pli
cat
ion mus tb ei nformedabout the p
ort numb
er.By
c
onv
ent
ion,RTP

ThenameReal
-ti
meTr
ans
ferPr
otoc
olwoul
dha
veb
eenmor
e
appr
opr
iat
e.
S
ec.26.
7 RTPEnc
aps
ula
tion 545

c
hoos
esa neven numbe
red UDP p
ort
;the fol
l
owing s
ect
ion ex
pla
inst
hata
c
ompani
onpr
otocol
,RTCP,us
esthenex
tse
quenti
alp
ortnumber.

26.
8RTPCont
rolPr
otoc
ol(
RTCP)

Our de scripti
on of r eal-ti
me t ransmis
sion hasf ocused on t he p r
ot ocol
me cha ni
smst ha tall
ow as endert oa ssociateat i
me st
ampwi thr eal
-timeda taa nd
all
ow a r eceivert or eproducet he c ontent. Anot hera s
p e
ct of r ea
l- ti
me
transmi ssioni se qual
lyimp ortant:moni tori
ngoft heund er
lyingne tworkdur i
ng
the s e s
sion a nd p r
ovi ng out
di -of-band c ommuni cat
ion b etweent he e ndpoints.
Suchame c
hani s
mi se speci
all
yi mport antinc aseswhe rea daptivecodings cheme s
areus ed.Fore xamp l
e,a na ppli
cati
onmi g
htc hooseal ower-bandwidthe nc odi
ng
whe nt heunde r
lyi
ngne t
wor kb ecome sc ongested,orar ec
e i
vermi ghtv aryt he
si
zeofi tsp l
ayb ackbuf f
erwhe nne twor kde l
ayorj itte
rc hang es
.Fina l
ly,anout -
of-ba ndme cha nis
mc anb eus edt ose ndi nfor
ma tioninp aral
lelwitht her ea
l- ti
me
data( e .
g. ,capt i
onstoa ccomp anyav i
de ostream).
Ac ompa
nionpr
otocola
ndi nt
egralpar
tofRTP,k nownastheRTPControl
Pr
oto-
col(RTCP)
,provi
destheneede
dc ont
rolf
unc
tional
it
y.RTCPal
l
owssende
r s
and re- c
eive
rst ot ra
nsmi ta se
riesofr e
portst o one a
not he
rt hatc onta
in
addi
tionalinfor
ma ti
ona boutt
heda tabei
ngt r
ansferr
e dandt heperfor
ma nceof
thene twork.RTCPme s
sa g
esareencap
sul
atedinUDPf ortransmi
ssi
on,a ndare
sentusingap ortnumb e
roneg reat
erthanthep or
tnumb eroft heRTPs tr
e a
mt o
whicht heypertai
n.

26.
9RTCPOp
era
tion

Fi
gure26.
4l i
ststhefiv
ebasi
cmess
aget
ype sRTCPus
est
oal
l
ows
ende
rsa
nd
r
e-c
e i
ver
stoexchangeinf
ormat
ionab
outases
sion.

Type Me a
ning
200 Senderreport
201 Recei
verreport
202 Sourcedescr
ipti
onmessa
ge
203 Byeme ss
age
204 Appli
cat
ionspeci
ficme
ssage

Fi
gur
e26.
4Thef i
veRTCPme s
sagetypes
.Eachmess
ageb
egi
nswi
tha
f
ixe
dhe a
dertha
tidenti
fie
st het
ype.

The la
stt wo me ss
ageson the lis
ta reeasi
estto unde
r s
tand.A s ender
tr
ansmi
tsab yemes sa
gewhe nshut
tingdownas t
reamandana ppl
icati
onspecifi
c
mess
aget ode-fineane w me
ssaget ype.Forexampl
e,tos endc los
ed-
caption
i
nforma
tionalongwi thav i
deostream,a nappl
i
cati
onmightchooset odefinea
newRTCPme ssag
et ype.
Be
caus
esomemess
age
sa r
es hor
t,t hest
anda
rda
ll
owsmul
ti
pl
eRTCPme
ssa
gest
obec
omb
ine
d
i
ntoasi
ngl
eUDPdat
agr
amf ort
ransmis
sion.
546 Voi
ceAndVi
deoOv
erI
P(RTP,RS
VP,QoS
) Cha
p.26

Receiversp e riodical
lyt ra nsmitr ec eiverr eport mes s
agest hati nform t he
sourceab outc ond i
t i
onsofr ece pti
on.Re ceiverr ep
ortme s
sagesa rei mpor tantf or
twor easons.Fi rst,t heme s
sa gesa l
low e a c
hr ec
eive
rp artici
pati
ngi nas ess
ion,a s
we l
lasas ender,t ol earna boutr ec ep
t ionc onditi
onsofot herre c e
ive
r s.Se cond,
theme ssa ge
sa l
low r e-cei
verst oa daptt he i
rr ateofr eporti
ngt oa v oidus ing
excess
ive b and widt h a nd ov erwhe l
mi ng t he s e
nde r
. The a dapti
v e s cheme
guaranteest hatt het otalcont rolt ra
f ficwi llremainlesst han5% oft her ea l-
timeda tat ra
ff i
ca ndt hatr ece i
verr epor tsg enera
tel es
st han75%oft hec ontr ol
traffi
c.Ea chre ceiverr e
porti dentifie
soneormor es yn-chroni
zat ionsour ces,a nd
contai
nsas epara tes ecti
on f ore a chs ource.A s ecti
on s pe
ci-fiest hehi ghes t
sequencenumb erp a cketr ece
iv edf r
om t hes ource,thec umulativ
ea ndp e r
ce ntag e
packetlosse xperienc ed,t het imes i
nc et hel astRTCPs enderr epor tarrivedf rom
thesource ,andt hei nterarri
v aljit
te r
.
Se
nde r
sp eriodi
ca l
lyt ransmitas ender r eport messa
get hatp rovi
desa n
absolutet i
mestamp .Tounde rstandt hene edf orat imest
amp ,recal
lt hatRTP
al
lowse a c
hs treamt oc hooseag ranular
ityf oritst i
me s
tampa ndt hatthef irs
t
ti
me stampi schose na tr an-dom.Thea bsolutet i
me s
tampi nas e
nderr eporti s
es
s enti
alb eca
usei tp rovidest heonl yme chani
s m ar ece
iverhast os ynchroni
ze
mul ti
pl
es trea
ms .Inp a
rticular
,b ec
a useRTPr e
qui r
esas epara
tes trea
mf ore a
ch
me di
at ype,thet r
ansmis s
ion ofv ideoa nd ac -
companying audior e
quirest wo
st
r eams.Thea bs
olutet ime st
ampi nforma t
iona ll
owsar ecei
vert op l
ayt het wo
st
r eamss i
multaneously.
I
naddi
ti
on t
othep
eri
odi
cse
nde
rre
por
tme
ssa
ges
,se
nde
rsa
lsot
rans
mit
s
our
cedes
cri
pti
onmes
sag
est
hatp
rov
ideg
ene
rali
nfor
mat
iona
boutt
heus
erwho
ownsor c on-
trol
st he sour
ce.Ea c
h me s
sag
ec ontai
nsone sect
ion f
or eac
h
outgoi
ng RTP stre
am;t he contentsa reintendedf or huma
nst or ea
d.For
exa
mp l
e,theonl yrequi
redf i
eldc onsi
stsofa c anoni
calname f
ort hestr
eam
owner,acharac
terstri
nginthef orm:

us
er@ hos
t

wher ehos ti
se i
thert hedoma i
nna meoft hecomp
uterori tsIPaddres
si ndotte
d
de-ci
ma lorhe xcolonf orm,andus erisal ogi
nname.Optionalfi
el
dsint hesourc
e
descri
ptionc ont
ainf urtherdetail
ss ucha stheuser
se ma i
laddres
s(whi c
hma y
dif
ferf r om theca nonic
alname )
,t ele
phonenumb er
,t heg eogr
aphiclocat
ionof
thes i
te,t hea p-p
licati
onp rogr
am ort oolusedtocreatet hestr
eam,orot her
textualnot e
sa b
outt hesour
ce.

26.
10I
PTe
lep
honyAndS
igna
li
ng

Oneaspec
tofr eal
-ti
met ra
nsmiss
ionstandsouta se
speci
all
yimp or
t a
nt:the
us
eofIPa sthefounda
tionfortel
ephoneservi
ce.KnownasIPt el
ephonyorVoice
ov
erIP(VoIP),t
hea ppr
oachisnow employe
db yma nytel
ephonec ompani
es.The
question aris
es: whata dditi
ona lt echnol
ogie
sa r
e neededbefore VoI
Pc a
n
comp l
e t
elyrepla
cet heexi
sti
ngi sochronoustelephonesystem?Al
thoughnos i
mple
answe re xi
sts
,t hr
eeb asi
cc ompone ntsa reneede d.Fi
rst,weha v
es eenthata
protocollike RTP isrequir
e d whe nt ransf
erri
ng r ea
l-t
ime da
taa cr
ossa nIP
inte
r net.Thep r
otocoll
abel
se ac
hs a mplewitha
S
ec.26.
10 I
PTe
lep
honyAndS
igna
li
ng 547

ti
mesta
mpt hata l
lowsarece
ivertor ecre
ateana nal
ogoutputsi
gnalt
hatexactl
y
matc
hest heor i
ginali
nputsi
gnal.Second,ame chani
smisneede
dt oesta
bli
shand
te
rminatete l
ephonecal
ls
.Third,res
ea r
chersa
rei nve
sti
gat
ingwaysanIPinter
net
ca
nb ema det ofuncti
onli
kea nis
ochronousnetwork.
Thet e l
ephonei ndus t
ryuse st het erms ignal
ingt or ef
ert ot heproc e
ssof
establ
is
h- i
ngat e
lephonec a
ll
.S pecifi
call
y,t hes ignal
ingme chanis
m usedi nthe
conventi
ona l
Publi
c Swi tched Telephone Net wor k( PSTN)i sS ignali
ng Sys t
em 7 ( SS7);SS7
performsc allroutingb ef
oreaudi oiss ent.Gi venap honenumb er,SS7f ormsa
cir
cuitt hroug hthene twork,r i
ngst hede s
ignatedt elephone,a ndconnectsthe
cir
cuit whe nt he p hone isa nswe r
ed.S S7a l
so ha ndl
e s det
a il
ssucha scal
l
forwardinga nde rr
orc ondi
ti
onss ucha st hedesti
na ti
onp honeb eingbus
y.
BeforeIPc anb eus edtoma kep honec al
ls,signa
li
ngf uncti
onali
tymus tb e
avail
-abl
e.Furthermore,t oenabl
eadoptionb ythep honec omp ani
es,thes igna
li
ng
s
ys tem use
db yI Pt el
ephonymus tbec omp at
ibl
ewi the x
t antt el
ephones ig
nali
ng
i tmus tbep ossibl
ef ort heIPt ele
p hony syst
e mt oi nteroper
atewi t
ht he
conventi
onalphones ystema ta l
lleve
ls.Thus ,i tmus tbep ossi
bl
et ot ra
nslate
betweent hes i
gnali
ng us ed wi
thI Pa nd S S
7,j usta sitmus tbep ossi
blet o
transl
atebetweent hev oi
ceencodi
ngus edwi t
hI Pa ndstanda r
dPCM e nc odi
ng.As
ac onse
quence,thet wos i
gnal
ingmechanismswi l
lhaveequiva l
entfunctionali
ty.
Theg ene r
ala ppr
oacht oint eropera
bili
ty usesa g ateway betwe ent heI P
p
ho nes ys-t
e ma ndt hec onvent i
ona lphones ystem.A c allcanb ei niti
atedon
e
ithers ide of the g a
tewa y.Whe n as i
gna l
i
ng r eques
ta r
rives
,t he g ate
wa y
t
ranslatesa nd forwardst he r e-quest;t he gatewa y musta ls
ot ra ns
latea nd
f
orwa rdt her esponse
.Fina ll
y,a fters i
gna l
ingisc omp l
etea ndac al
lha sb een
e
sta b
li
shed,t heg at
ewaymus tf orwa rdvoiceinb othdirecti
ons,transl
a t
ingfrom
t
hee ncodingus edonones idet othee nc
odingus e
dont heothe r
.
Twogroupsha vepropos
eds t
andardsforIPtel
ephony.TheI TUhasde
fineda
s
uit
eofp r
ot oc
olsknowna sH.323,andt heIETFha
sp ropos
edas ig
nal
ingp
rotocol
k
nowna stheS ess
ionInit
iati
onPr ot
ocol(SI
P).Thenex tsect
ionssummar
izethe
t
woa pp
roaches
.

26.
10.
1H.
323S
tanda
rds

TheI TUor i
gina l
lyc reatedH.
323t oa ll
owt het r
ansmi ssionofv oic
eov e
rl oc a
l
areane tworkt echnologies.Thestandardha sbeene xtendedt oall
ow t ransmis
s i
on
ofv oiceoverI Pi nt er
ne ts,andtel
ephonec ompanieshavea dop tedit.H. 323isnot
as i
ng l
ep roto-col.I nstead,itspe
cifi
eshow mul ti
pleprot ocolsc anb ec omb i
nedt o
form af uncti
ona lI Pt el
ephonysystem.Fore xamp l
e,i na dditi
ont og atewa ys,
H.323de finesde vicesk nowna sgatekeeperstha
te achp rov ideac ontactp oi
ntf or
tel
ep honesus i
ngI P.Toob -
tainpermis
siontop la
ceout g
oingc a
ll
sa nde nabl
et he
phone s yste
m t o di recti ncomi
ng c al
lst othe c orrec t de sti
na ti
on,e ac
hI P
tel
ep hone mus tr egis
ter wi thag atek
eeper
. H. 323 i nc ludest he ne ce
ssa ry
regi
st rat
ionp rotoc ol
s.
548 Voi
ceAndVi
deoOv
erI
P(RTP,RS
VP,QoS
) Cha
p.26

Ina ddi
ti
ont os pe
cifyingap rotocolfort het ransmis
sionofr eal
-ti
mev oic
e
a
ndv ide o,theH. 323f r
ame workp rovi
desp rotocolsthatspeci
f yhow p ar
tici
pa nts
t
ransfera nds har edata.Ofp articul
ars ig
nificanceisda t
as haringr el
atedt oa
r
eal-
t i
met e
leconf e
rence.Fore xa
mp l
e,ap a i
rofus e
rse ngagedina na udi
o- v
ideo
c
onfere nc ecana lsosharea non-s
cr eenwhit eb
oa rd,sendsti
llimage s
,ore xchange
c
opiesofdoc ume nts.
Fig ur e26.5liststhef ourmajorp rotocol
st hatfor mtheb uil
dingblock
sof
H. 323.

ProtocolPurposeH.225.0S i
gnal
ingusedto
establ
ishaca l
l
H.245 Contr
ola ndfeedbac
kduringthecal
l
RTPRe al-t
imeda tatr a
nsfer(s
equenc
ea ndti
ming)T.
120
Exchangeofda taassociat
edwithac a
ll

Fi
gur
e26.
5Thef
ourb
asi
cpr
otoc
olst
hatH.
323us
esf
orI
Pte
lep
hony.

Takent oget
her,thesuiteofH.323p r
otoc
olscove
rsalla
spect
sofI Ptel
ephony,
i
nclud-
ing phone reg
ist
rati
on,signal
i
ng,r e
al-
time da
tae nc
oding a
nd t
ransfer
(b
ot hvoic
ea ndvi
deo),andcont
rol.
Fig
ure 26.6il
lus
trate
sr el
ati
onshi
psamong t
he prot
oc ol
stha
tc onst
itut
e
H.323.Asthef i
gur
es hows,t
hee nti
resui
teult
imate
lydependsonUDPa ndTCP
runningov
erI P.

data
a
udi
o/v
ide
oappl
ic
ati
ons s
igna
li
nga
ndc
ont
rol a
ppl
ic
ations
vi
deo audi
o
c
odec c
odec H.
225.0 H.225.0 H.245 T.
120
RTCP
Regi
str
. Si
gnal
ing Contr
ol Data
RTP

UDP TCP

I
P

Fi
gur
e26.
6 Rela
tionship
sa mongma jorprot
ocolst hatconsti
tutet
he
ITUs H.323 IPt el
ephony st
andard. Protocol
st ha
ta r
e
omitted ha ndl
e de tai
ls suc
h a s s e c
urit
y a nd FAX
trans
mi s
sion.

26.
10.
2Se
ssi
onI
nit
iat
ionPr
otoc
ol(
SIP)

TheIETFhaspr
opos
eda
na l
ter
nati
vetoH.
323,call
e heS
dt es
sionIni
ti
ati
on
Pr
oto-c
ol(SI
P),tha
tonlycov
erssig
nal
ing
;SIP doe
snotr e
comme nd s
peci
fi
c
code
csnordoesitr
equi
ret heuseofRTPforr
eal
-ti
met
rans
fer
.Thus
,SI
Pdoe
s
notprov
idea
llthef
unc-
tional
it
yofH.323.
Sec
.26.
10 I
PTe
lep
honyAndS
igna
li
ng
549

SIPusescli
e nt- ser
ve rinteracti
on,wi ths er
v ersbeingdivi
dedintot wot ypes.
Aus eragentserv err unsinaS IPt elep
hone .Eachus era g
ents e
rverisa s
signedan
identi
-fi
er(e.
g ,us
. er@ s i
te),a ndc anr e
ceiveincomingc al
ls
.Thes econdt ypeof
serverisanint er mediates ervert hati sp l
acedb etwe entwoS I
Pt elephonesto
handletaskss
uc ha sc al
ls etupa ndc allforwarding.Ani ntermedia
tes ervercan
functi
ona sap roxys ervert ha
tc a
nf orwa rdani ncomingc a
llrequesttot henext
proxys e
rveralongt hep at
hort ot hec al
ledphone .Ani ntermedia
tes ervercan
als
of uncti
ona sar edi
rects ervert hatt el
lsac all
erhow t or eac
ht her equest
ed
desti
nati
on.
Top
rov
idei
nfor
mat
iona
boutac
all
,SI
Pre
li
esonac
omp
ani
onp
rot
ocol
,the
Ses
-si
onDes
cri
pti
onPr
otoc
ol(
SDP)
.SDPi
ses
pec
ial
l
yimp
ort
anti
nac
onf
ere
nce
c
allbe
-caus
eitper
mit
spart
ici
pant
stojoi
nandlea
veacal
ldynami
cal
ly.S
DPa l
so
s
peci
fi
esdetai
l
ssuc
hasthemediaenc
odi
ng,p
rot
ocolp
ortnumbe
rs,andmult
ica
st
a
ddress
.

26.
11Qua
li
tyOfS
erv
iceCont
rov
ers
y

The t em Qua
r l
ity of Ser vice( QoS) r ef
er st os t ati
sti
calp erforma nc e
guara nteesthatane twor ks ystemc anma ker egardingl oss,delay,t hroug hput ,
and j i
tter. An i sochro-nous ne twor kt hati se ng i
ne ered t o me ets t
r i
c t
perfor manceb oundsi ss ai
dt op rovideQoSg uarantee s
,whi l
eap ack e
ts witche d
networ kt hatus esb este ffor tdeliveryiss ai
dt op r
ov i
denoQoSg uarantee.I s
guara nteedQoSne ededf orr e al
-timet ransferofv oicea ndv ideoov erI P?I fs o,
how s houldi tb ei mp l
eme nted? A ma j
or cont roversys ur-rounds t he t wo
questions.Ononeha nd,e nginee r
swhode si
gnedt het elephones ystemi nsistt ha t
tol
l-qua l
ityv oic
er eproductionr equire
st heunde rl
yings ystemt op rovideQoS
guara nteesaboutde laya ndlo ssfore a
chp honecall.Ont heot herha nd,e nginee rs
who de si
gnedI Pi nsistt hatt heI nternetwor ksr easonab l
y we l
lwi thoutQoS
guara nteesandt hata ddi
ngp er-fl
ow QoSi sinfeasi
b l
eb ec
a userout erswi llma k e
thes ystemb othe x-pensivea nds l
ow.
The QoS c ont r
oversy hasp roduc ed many pr op osal
s,i mp le
me ntations ,a nd
experi-ment s.Althoughitop erateswi thoutQoS ,t heI nte rne tisalreadyus edt o
send a udioa nd vi
deo.Comme r c
ialp rovi
dersof ferI Pt elephone s e
rvic es,a nd
tele
phonec omp ani
esa r
ound t hewor lda reswitc hing t oI P.Ma ny e ff ortst o
provideQoSha veb eenunsuc -
ce s
sful.Fore xamp l
e,As ync hronousTr ansf erMode
(ATM) ,whi ch wa screatedb yt el
e-phone comp aniesa sa na lter
na ti
vet ot he
Interne t
,ha salmostdis
appea r
ed.ATM a t-te
mp tedt op r
ov ideQoSg uarant eesf or
eachi ndivi
dua lconnecti
on( i
.e.,eachf low).Aftera ne ffor tk nowna sI nt egrated
Servi
c es( I
nt Serv)investi
gated de fi
ning per-f
low qua li
ty ofs ervi
ce,t heI ETF
chang eddir ecti
ona nda doptedac onse rv
ati
veDi ff erentiatedSer vices( DiffServ)
approa cht hatdi vi
dest raf
fici ntos eparateclass
e s.Thedi f f
erentiateds ervic
es
scheme ,whi chs acri
fi
cesf ine g ra
inc ontr
olf or l e s
sc omp lexf orwa rding,i s
somet imesc all
edaCl as
sofSer vice(CoS)appr oa
ch.
550 Voi
ceAndVi
deoOv
erI
P(RTP,RS
VP,QoS
) Cha
p.26

26.
12QoS
,Ut
il
iza
tion,AndCa
pac
ity

Thede ba t
eov erQoSi sr eminis
centofe ar
lierde batesonr e
sourcea ll
ocati
on,
sucha st hosewa gedov e
rop e r
atings yste
mp olici
e sforme morya ll
oc ati
ona nd
proces
sors che duling.I nthee arl
ierde bat
es,p rop onentsa r
guedt hati mp r
oved
resourcea l
l
oc ationwoul dop t
imizet heov er
allthr oughputofac omp utingsystem,
therebygivingus ersb e
tterser v
ice.Thea rgume ntha sint
uiti
vea pp
e a
l,a ndmuc h
resear
ch wa sc onducted.Unf ortunately,none of t he proces
sor and me mory
ma nag
eme nts c heme swor ke
dwe llinp rac
tice.Us ersr emai
neddissati
sf i
ed.Af te
r
decades,howe v er,comp uti
ngdi dimp roveandus e rswe reha p
pywi tht her es
ults.
Wha tchang ed?Pr oces
sorsbecamemuc hf as
tera ndme moriesbecamemuc hlarger.
Instea
dofr e l
yingons cheduli
nga lgor
ithmst of indt heb estwayt os hareas low
proces
sor a mong ma ny comp utati
ons,t he ha rdwa reb ecame sof astt hata
proces
sorc ouldk eepupwi thther equiredcomp uta ti
on.
Thea nal
og ywithne tworkingisstrong.ProponentsofQoSa rema ki
ngt he
sa
mea rgumenta boutnetwor kr e
sourc
es.The yasser
tt hati fnetwor
kr esour
ces
ares chedul
ede ffect
ive
ly( i
.e.,t henetwor kgivess omep acke
tsp ri
ori
ty over
others),userswi l
lbeha p-py.Thep re
mi seisespeci
a l
l
ya t
trac
tivetone twork
operatorsbecause,iftrue,itwi llal
l
ow t hemt osellup g
radedservi
cewit hthe
exis
tingunde r
lyinginfr
a s
tructure.Unfor-tunat
ely,e xperi
encewithne t
wor k
ing
reveals
:

Whenanetwor
khass uffi
ci
entresourc
esforallt
raffi
c,QoScon-
st
rai
ntsar
eunneces
sary;whent r
affi
cexceedsnetworkcapac
ity,
noQoSsys
temcansatis
fyallus
ersdemands
.

The centraliss
ue isut i
lizati
on.On t he one hand,a ne t
wor k with1 %
uti
li
za ti
ondoesnotne e
dQoSb ecaus
enop acketiseverb loc
ke d.Ont heot her
hand,ane tworkwhe reut i
l
izat i
one xc
ee ds100% ofc apaci
tywi llf a
ilunde ra ny
QoS.Ne ver
theles
s,pro-pone
ntsofQoSme chanis
msa sse
rtt hats ophis
tic
a tedQoS
mecha ni
smsshouldb eabletoa chi
evet wog oa
ls.Fir
st,b ydividingt hee xis
ting
resourcesamongmor eus er
s,QoSwi l
lma ket hes yst
em mor ef ai
r.S econd,b y
shapingthetr a
fficfrom eachus er,QoSa l
-lowst hene t
wor kt or una thi gher
uti
li
za ti
onwithoutdangerofc oll
a p
se.
Oneoft hema jorreasonsc omp l
i
cate dQoSme chani
smsha venotb eenwi del
y
adopteda ri
sesfrom increa
s esint heperf ormanceofne tworks.Ne t
wor kcapaci
ty
hasi n-cr
easeddr amati
call
ydur i
ngt hep astt hi
rtyye ars,andwi l
lc onti
nuet o
incre
a s
ei nthef oresee
ablef uture.Asl onga srapidp erformanceincreas
esa ll
ow
capacit
yt oe xceed demand, QoS me cha nis
ms me relyc onsti
tute unnecessa
ry
overhead.Howe ver
,i fdema ndr i
se smorer a p
idlyt hanc apac
ity,QoSma yb ecome
ane conomici s
sue b ya s -
soci
a t
inghi gherp ric
eswi thhigherlevel
sofs e
rvice,
ISPsc anusec osttor ati
onc apaci
t y(andr eaphi ghe rprofi
tsb ec
ausenoi ncreas
e
ininfrast
ructurewi l
lber equir
ed).
S
ec.26.
13 Eme
rge
ncyS
erv
ice
sAndPr
eemp
tion 551

26.
13Eme
rge
ncyS
erv
ice
sAndPr
eemp
tion

Aret herev al
idr e
asonst op r
iori
tizet raff
ic? Ofc ours
e.Fore x a
mp le
,i f
network ma nagementt raf
ficha slow p r
iori
ty,a ma nagermayb e unablet o
diag
nosethes ourceofc ongest
ionort a
kes tepstoc orr
e c
tt hepr
ob l
em.S i
milarl
y,
consi
derane tworkt hatha n-dl
esVoIPt e l
ephones er
v i
ce.Ons uchane twork,
emergencyc all
s( t
o91 1int heU. S
.)shouldnotb eb locke
dwa i
t i
ngfornor mal
traffi
c.Thus ,packet
st hatc a
r r
yv oi
ces am-plesfrom ane mergencycallshould
havep r
ior
ity.
It ma ys eem t hatt he examp lesp rovi
de a str ong a rgume nt f or a QoS
mechanismt hatunde rstandst hep ur poseofe achf l
ow.Asal aters ecti
one xpl
ains,
ap er-
flow me ch-anismisnotne ede d.Eme rg
encyc al
lsa ndne twor kma na geme nt
traff
icc anb eha ndl
e dbyas ystemt hatha sonlytwoort hr eelevelsofp r
iori
t y.
Morei mp ortant ,aQoSme ch-anismt hatonl yg uarant eesap erce
nta geoft he
underl
ying ne twor kc a
p acit
y ma y not wor ki ft he c apac i
tyi sr e
duc ed.For
example,c onsideraQoSs ystemt ha tr es
e rv
es1 % oft hene tworkc a pac i
tyf or
manageme ntt raf f
ic.In nor ma ls ituations,1 % ma yb e mor et hans uf fi
cie
nt .
However ,cons i
derwha tha ppensifane twor kha r
dwar ef ail
ur eb egi
nst oc orrup t
afe wb itsinp a c
k etsrandoml y.TheQoSg uaranteeme anst ha ta fterane t-wor k
manageme ntp acketissent ,ninety- nineot herp a
cketswi llbes entb eforea nothe r
network ma nageme ntp ack etiss ent( e.
g .
,a r etransmi s
sion).Thus ,t he time
between s uccessive ne twork ma na g
eme nt p acket
s i s l ong.I f s uccessive
manageme ntp acketsa rec orrupted,t het imer equi
re dt odi agnoset hep roblem
canbel ong.
Whatisne ededt oha ndl
ecase
sl i
ketheonea bov
eisnotat ypica
lQoSs ystem,
buta nabsol
utep riori
tys c
heme.Inp art
icul
ar,wene edame chani
smt hata l
lows
emergenc
yt raffictop reemptthene twork.Unde
rap reempti
onp ol
icy,emergency
traf
ficisg r
ant ed hig
he stp r
ior
ity,whi ch means t
hati fap acketc ar
rying
emergenc
yt ra
ff i
ca rri
v es,thepacketiss entimmediat
elywithoutwa it
ingf or
othertra
ff i
c.

26.
14I
ntS
ervAndRe
sour
ceRe
ser
vat
ion

Two de c
adesa go,t he IETF b egant oc onsi
dert he que stion ofr esource
al
loca tion.Specifi
cal
ly,t heI ETFb e
ga nwitht heque s t
ion:i fQoSi sne eded ,how
cana nI Pne t-workp r ovi
dei t?Att het i
me ,ma nyg roup sa rguedf orf ine-grain
QoS ,whi chledt heI ETFt oap rogram ofr esearc
hc all
edI nt egr at edSer vi
ces
(IntSer v).TheI ntServa p
- p
roachha st wop a
rt s
.Be foreda t
ai st rans ferred,t he
endp ointsmus tspecifyt her esourcesne eded,a nd a l
lr outer sa long t hep ath
betwe e nt heendpointsmus tagre etos upplyt heresourc e
s ;thep roce dur ec anb e
vi
e we da saf orm ofs i
gnali
ng.Sec ond,a sda tagramst rave rs
et hef low,r outers
needt omoni tora ndc ontroltr af
ficf orwarding.Moni t
o ri
ng,s ome time sc al
led
traff i
cpol ic
ing,isne e dedt oe nsuret hatt het raffics entonaf low doe snot
excee dt hespecifi
edb ounds .
QoSg uaranteesareespe
cia
ll
ydi f
fic
ultinapacketswit
chi
ngnetworkbecause
traf
-ficisoftenb urs
ty.Forexample,af l
owthatspe
cifi
esana v
era
gethroughput
of1Mb p
sma yha v
e2Mb psoft ra
ffi
cf ortenmil
l
ise
condsfol
lowedbynot raffi
c
fortenmi l-l
is
e c
onds.Alt
hought heroutermustcontendwithaf l
oodofp a
ckets
fortenmi l-
552 Voi
ceAndVi
deoOv
erI
P(RTP,RS
VP,QoS
) Cha
p.26

l
i
seconds,t hef l
ow st
il
lme et
st herequi
reda ve
rage.Toc ontr
olqueuei
ngand
f
orwa r
d- i
ng,ar out
ert hatof
fersQoSusual
lyimple
me nt
same chani
smtohandl
e
p
acketb urst s
.Theidea,whichisknowna straffi
cshaping,ist osmootheac
h
b
urst.Tos moothbursts,aroutertempora
ril
yque uesincomingdatagr
amsand
t
hens endst hematasteadyrateof1Mb p
s.

26.
14.
1Re
sour
ceRe
Ser
Vat
ionPr
otoc
ol(
RSVP)

Aspartoft heIntS
ervwor k,theI ETFde vel
opedt woprotocol
st op rov
ide
QoS:the
ResourceReSerVati
onProtocol(RSVP)t or e
serveresourc
esa ndtheCommonOp en
Pol
icyServices(COPS)
p rotocoltoe nf orc
ec onst
ra i
nts
.Bot hp r
ot ocol
sr equi
re
changestotheb asi
cInter
ne tinfras
truct ur
e a l
lrout e
rsmus tag r
e etor eser
ve
res
o ur
ces(e.g.
,linkca
paci
t y)foreachf l
owb e
tweenap ai
rofe ndpoi
nt s.
RS VPha ndl
esr es
er v
a ti
onr e
que stsa ndr epl
ies.Iti snotar outep ropagati
on
proto-col,nordoe site nforcep oli
cie sonc eaf low hasb eene s
ta bl
is
he d.Instead,
RSVP op eratesb ef
or ea ny d atai ss ent.To i niti
atea ne nd- to-end f l
ow,a n
endpoint firstsendsa n RS VP p ath mes saget o de termine t he p atht othe
desti
na ti
on;t hedatagramc a
r ryi
ngt heme ss
ageus esar outeral er topt i
on( IPv
4)
oras p ec
ialhop-by-hophe ader( IPv 6)t og uaranteet ha tr outerse xa
minet he
me s
sage .Afteritr eceivesar epl
yt oi t
sp athme s- s
age ,t hee ndp oints endsa n
RSVPr equestmes sagetor eserver esour cesfort heflow.Ther e
que sts pe
cifie
sthe
QoS b ounds d es
ired;e a c
hr outert hatf orwa r
ds t he r e questa l
ong t ot he
desti
na ti
onmus tag r
eet or eservet her e
sourcest her eque sts peci
f i
es.I fany
routera l
ong the p a
th de niest he r equest,the r outerus esRS VP t os e
nd a
negati
v er epl
yb ackt ot hesour ce.I fa l
lsystemsa l
ongt hep atha greet ohonor
ther e
que st,RSVPr e-turnsap osi
tiver epl
y.

EachRS VPfl ss
ow i implex(i.
e.,uni
dire
ctional
).I fap ai
rofc ommunic
ati
ng
appl
i
- ca
tionsrequir
esQoSg uarantee
sint wodi re
ctions,e
a c
he ndp
ointmustuse
RSVPt or e-ques
taf l
ow.Be ca
useRS VPus ese xi
stingforwa r
ding,ther
ei sno
guaranteetha tthetwo f l
owswi llpas
st hrought hesamer out
ers,nordoes
appr
ov a
lof a f low i
n one direc-ti
on i
mp l
ya ppr
ov a
lint he other
.We c an
summa ri
ze:

Anendpoi ntus esRSVPt orequestasimpl


exflow t hr
oughanI P
inter
- netwi t
hs peci
fiedQoSbounds.I feac
hr outeral ongt he
path agr ees to honor the reques
t,t he flow i s approved;
otherwise,thef l
ow isdeni
ed.Ifapairofappli
c at
ionsneedsQoS
int wodi recti
ons,eac hendpoi
ntmus tuseRSVP t or eques
ta
separatef l
ow.

26.
14.
2Int
Ser
vEnf
orc
eme
nt(
COPS
)

Whe
nan RS
VP r
eque
sta
rri
ves
,a r
out
er mus
tcons
ide
rtwo a
spe
cts
:
fe
asibi
l
ity(i.
e.,whe t
hert herouterhast
her es
ource
sne c
es s
a r
yt osati
sfyt he
re
quest)and poli
cy( i
.e.
,whe therthereque
stl i
eswithi
np ol
icyconstr
aint
s )
.
Feas
ibi
li
tyisalocaldeci
si
on ar oute
rcandeci
dehowt oma nagetheb a
ndwidth,
memory,andp roc
essi
ngp owertha
tis

ThenameCOPSi
sme
anta
sahumor
ousr
efe
renc
etot
raf
fic
pol
ic
e.
S
ec.26.
14 I
ntS
ervAndRe
sour
ceRe
ser
vat
ion 553

av
ail
abl
e.Howe
ver,pol
i
cye nf
orce
me ntre
qui
resg
lob
alc
oop
era
tion a
llr
out
ers
mustagre
etothesa
mes e
tofp ol
i
cie
s .
Toimplementg loba
lp oli
ci
e s
,t heI ETFa rchit
ectureusesat wo-l
evelmodel
withcli
ent-s
erverinteracti
onb etweent hele vel
s.Whe nar out
errecei
vesanRSVP
reques
t,itb ecomesac li
entt hatc onsul
tsas e rve
rk nowna saPolic
yDec i
si
on
Point(PDP)tode termi
newhe therther e
que stme etspoli
cycons
trai
nts.ThePDP
doesnothandlet r
af-fi
c;itme r e
lye val
uatesr equeststoseeiftheysati
sfygl
obal
poli
ci
es.Ifa PDP a pprovesa r equest,t he r outermus toperat
ea sa Polic
y
Enforc
ementPoi nt(PEP)t oensuret raf
f i
ca dherest otheappr
ovedpol
icy.
TheCOPSp rotocolde finest
hecli
ent-s
erverinte
r a
cti
onb e
t weenar outerand
aPDP( orb etwe enar outera ndaloca
lPDPi fanor gani
zati
onha smultipl
elevel
s
ofpoli-
c ys er
v ers)
.Alt houghCOPSde fi
nesitsownme s
sageheader
,t heunderlyi
ng
for
ma ts haresma nyde t
ailswithRSVP.Inp ar
tic
ular,COPSuse sthesamef ormat
asRS VPf ori ndivi
dua litemsi narequestmessage.Thus,whenar outerreceiv
es
anRS VPr equest,i tc ane x t
racti
temsr el
atedt opoli
cy,pla
c ethemi naCOPS
message,a nds endt her esulttoaPDP.

26.
15Di
ffS
ervAndPe
r-HopBe
hav
ior

Af t
ermuc h wor k on RS VP a nd I ntS er v,t he I ETF de cidedt op ur sue an
entirel
ydi fferenta pproach:insteadofl ook ingf ort echno l
ogie
st hatp rovideQoS
fore achi ndivi
-dua lf l
ow,t hene w wor kf oc usesong roup soff lows .Tha ti s,a
sma l
ls etofc a tegoriesi sc reated,a nd e a chf l
ow i sa ssi
gne dt o one oft he
categorie
s.Ther esultisDi ffSer
v,whi c hdi f fersf rom I ntServi nt wos ignifi
cant
ways.Fi rst ,inst e
a d of s pe
cif
ying r esour c es nee dedf or ani ndi
vidualf l
ow,
DiffServa l
locatess ervi
c et oac l
ass( i.e.
,as etoff lowst hatma tc
has p e
cifiedset
ofp arame ters)
.S econd,unl iketheRS VPs che mei nwhi char eser v
ationi sma de
end-to-end,Di ffS e
r va l
lowse achnodea l
ongt hep atht ode -fi
net hes ervi
c ethat
ag i
venc lasswillr eceive.Fore xamp le,ar out erc anc hoos etodi vi
deb andwi dthso
thatt heDi ffServc lassk nowna sEx peditedFor warding( EF)re- ceives50% oft he
bandwidtha ndt her ema ining50% i sdi videda mongt hec lass
est ha ta r
ek nowna s
AssuredFor warding( AF).Thene xtr out era l
ongt hep a thc anc hoos et og i
v ethe
EFc l
a s
s90%oft heb andwi dthanddi vi
det heAFc lassesa mongt her ema i
ning1 0%.
Weus et hep hr asep er-hopbehav iort ode sc ribet hea pproacha ndt op ointout
thatDi ff
S ervdoe snotp rov i
deend- to-e ndg ua rantees.

26.
16Tr
aff
icS
che
dul
ing

To imp l
ement any f
orm of QoS ,a router needst oa s
sig
np r
iorit
iest o
outgoi
ngt raf-f
icandchoosewhichpacke
ttos e
nda tag i
ventime.Thep roces
sof
sel
ecti
ngf r
om amongas etofp ack
etsisknowna straffi
cs c
hedul
ing,andt he
me c
hanis
mi scal
ldat
e raffi
cschedul
er.The
r earef ouraspect
st oconsiderwhe n
constr
uctingat raf
fics
chedul
er:
Cha
pter7de
scr
ibe
stheDi
ffS
ervme
cha
nis
mandt
heda
tag
ramhe
ade
rfi
el
d
i
tuses.
554 Voi
ceAndVi
deoOv
erI
P(RTP,RS
VP,QoS
) Cha
p.26

Fai
rnes
s.Thes
che
dul
ers
houl
dens
uret
hatt
her
esour
ces(
i.
e.,
b
andwi
dth) cons
ume dbyaf
low f
allwi
thi
nthe a
mount
a
ssi
gne
dt otheflow.
Del
ay.Pac
ket
sonag
ive
nfl
ows
houl
dnotb
ede
laye
dex
ces
siv
ely.
Adapt
abi
l
ity.I
fag
ive
nfl
ow doe
snotha
vep
ack
etst
ose
nd,
t
hes c
hedule
rs houl
ddiv
idet
hee x
trabandwidt
hamongot
her
f
lowspropor
tionalt
othei
ras
sig
nedres
ources
.
Comput
ati
onalOv
erhead.Bec
aus
eitop
era
tesi
nthef
astp
ath,
aschedule
rmus tnotincurmuchc omputati
ona
love
rhead.In
pa
rtic
u- l
ar, t he
oreti
cala l
gor
ithms s uch as Gener
ali
zed
Pr
ocessorSchedul-
ing(GPS)c
annotb eused.

The mos
tst
rai
ght
for
war
dpr
act
ica
ltr
aff
ics
che
dul
i
ng s
che
me i
s na
med
Wei
ght
edRoundRobi
n(WRR)bec
aus
eita
ssi
gnse
achf
low awe
ighta
nda
tte
mpt
s
tosendda t
af rom theflow accor
dingtothef l
ow
swe ight.Forexampl
e,wec a
n
i
ma gi
net hr
eef l ,A,B,a
ows ndC,wi thweights2,2,a nd4,r es
pec
tiv
ely.Ifal
l
thr
eef l
owsha vep a
ck-et
swa i
tingtobesent,theschedule
rs houl
dsendt wi
ceas
muchf r
omf low C(weig
ht4)a sfrom AorB( e
achwithwe ight2).
Itmayse
emt ha
taWRR s che
dule
rc oul
dac
hie
vet
hede
sir
edwe
ight
sby
s
ele
cti
ngf
romflowsinthef
oll
owi
ngorder:

CCAB

Tha
tis
,thes
che
dul
err
epe
ate
dlyma
kess
ele
cti
ons
:

CCABCCABCCAB...

Thep atternapp ea
rst oachi
evethedesi
redweight
sb ec
auseoneha l
foft he
s
ele
c-tionscomef rom f ow C,onequa
l rt
erc omefrom B,andonequa rt
e rcome
f
rom A.Fur ther
mor e,t he pat
ternserv
ice
se ac
h que ue atregul
ari nter
va l
s
t
hroughoutt hes e-quence,whichmeansthatnof low isdel
aye
dunne c e
ssar
ily
(
i.
e.,ther a
tea twhi c
hp ack-
etsarese
ntfromag i
venf l
owiscons
tant).
Al
thoug hthesequenceab
ovedoesma k
et hepacketra
tema tchtheass
igned
weights
,t heWRRa ppr
oachdoesnotachi
evet hegoalofmakingthedatarat e
s
matcht hewe i
ghtsbecaus
edatagr
amsa r
enotuni formsi
ze.Fore xa
mple
,ift he
aver
a g
eda -tag
rams i
zeonf ow Ci
l shal
foft heave
r a
gedatag
ra msi
zeonf ow A,
l
se
lecti
ngf low C t
wicea sof
tena sfow A wi
l l
lma kethedatar a
teoft het wo
fl
owse qual.
Tos ol
v etheprobl
em,amodi fi
e dal
g ori
thm wasinve
ntedt hatacc
ommoda tes
varia
b l
e-si
ze packe
ts. Known a s Defi
cit Round Robin( DRR),the a l
gorit
hm
comp uteswe i
ghtsi
nt ermsoft otaloct
e tssentratherthannumb e
rofp acket
s.
Ini
t i
all
y,thea l
go-r
ithm al
l
ocate
sanumb erofo cte
tst oeac
hf lowprop
ortionalto
theb andwidththeflowshoul
dr ece
ive.Whe naf l
owi sse
lecte
d,DRRt ransmitsas
ma nyp acketsaspossi
bl
ewi t
houte xceedingthea l
l
ottednumb e
rofoc te
t s
.The
alg
or i
thmt hencomputesthe
Thr
oughoutthiss
ect
ionwedis
cusssc
hedul
i
ngamongfl
ows;therea
dershouldunder
sta
ndt
hat
whe
nDiffSe
rvisus
e d,t
hesamet
echni
quesareus
edf
ortraf
fics
che
duli
ngamongc l
ass
es.
S
ec.26.
16 Tr
aff
icS
che
dul
i
ng 555

remainder( i
.e.
,t hedif fere
nceb etweenthenumb erofoc te tst hatwasa l
l
ocated
andt hes i
zeoft hep acketsa ctua l
l
ys ent
),anda ddsther e
ma indertothea mount
thatwi llbes enti nt hene xtr ound.Thus,DRR k ee
psar unningtotaloft he
defic
itt hateachf l
ow s houldre ceiv
e.Eveni fthede fi
ci
tg ai
ne donag iv
enr ound
issma l
l,thev aluewi l
lg row thr oughmul t
ipl
er oundsunt iliti sla
rgeenought o
accommoda teane x
tr ap acket
.Thus ,overtimet hep r
op ortionofda t
at hatDRR
sendsfromag i
v enf lowa p p
roac hesthewe i
ghtedv al
uef ort hef l
ow.
Round- r
obinscheduli
nga l
gori
thmss uc
ha sWRRa ndDRRha vea dva
ntag esand
dis
advantages.Thec hie
fa dva
ntagearisesfrom ef
fic
iency:oncewe i
ghtshaveb een
as-s
igned,lit
tlecomp utati
onisrequi
re dtoma keap ack
e tse
lecti
on.Inf a
ct ,ifal
l
packetsar ethes ames izeandwe i
ghtsares el
ecteda smultipl
es,thewe i
ghted
sel
ecti
on c anb ea chie
vedt hrought heus eofa na rrayrathert hant hrough
computation.
Despi
tet headv a
nt a
ges,round-r
obinalgori
thmsdoha vedrawbacks.Firs
t,t he
de-l
ayt hatag ivenf l
ow e xp
eri
encesdependsont henumb erofot herflowst hat
havetraffi
ct os e
nd.I nt heworstcase,ag iv
enf l
ow mayne edtowa itwhilet he
sc
hedulers endso neormor epacketsfrom e ac
h oft heot he
rf l
ows.S econd,
beca
uset heys endab urstofp acke
tsf r
om ag i
venqueuea ndt hende l
aywhi l
e
se
rvici
ngot herque ues,roundrobinal
-gori
thmsc anint
roducejit
ter.

26.
17Tr
aff
icPol
ic
ingAndS
hap
ing

At raffi
cpolic
eri sr equi
re dtov eri
fyt hata r
rivi
ngt ra
ffi
cdoesnote xce
ed
i
tss tate
ds t a
tis
tic
alp rofi
le.S upposeas chedule
ra l
locat
es25% oft heoutgoi
ng
bandwidtht oaDi ff
Se rvclas,Q.I
s fthreeincomingf l
owsa l
lmapt oc l
assQ,the
fl
owswi llc ompetef ort heb andwidtha ll
ocatedto Q.I ft hesyst
e m doesnot
monitorincomingt r
af f
ic,oneoft heflowsmi ghttakea l
lthebandwidthall
ocat
ed
toc l
assQ.S o,ap olic
ingme cha -
nismp rotectsotherf l
owst oins
ur ethate ac
h
re
c ei
vesitsf a
irshare.
Sev
eralme c
ha nismsha veb eenpropose
df ortrafficpolic
ing .Ing ener
al,t he
i
de ai
st osl
owdownt r affi
ctoa nagreedrate
,thet raffi
cs hapingide amentioned
above
.Ane ar
lyt ra f
fics hapi
ngme chani
sm,basedont heleakybuc ketapproach,
usesacountertoc ontrolthep a
cketra t
e.Concep
tually,thea l
g ori
thmi nc
reme nts
thecounterp er
iodical-ly;eachtimeap ac
ketarriv
es,t hea lgorit
hm de c
reme nts
thecounter.Ift hec ounterbe-comesne g
ati
ve,thei ncomingf l
ow ha sexc
e eded
i
tsa l
l
ocate
dp acketr at e.
Usi
ngap acketrat
et os hapetraffi
cdoe snotma kesenseint heI nter
net
be
causeda -tagramsvar
yi ns i
ze.Thus,mor esophi
sti
cat
edp ol
ici
ngsc hemeshave
be
enp roposedt oacc
ommoda tevari
abl
e-si
zep a
ckets
.Fore x
amp l
e,at okenbucket
mechani
sme x t
endstheapproachoutli
nedabovebyma ki
ngthec ount
erc orres
pond
tob itsr athert hanp ac
k -
ets. The counteri sincr
ementedp eriodic
all
yi n
ac
cordancewi ththedesi
redda t
ar at
e,andde cre
mentedbyt henumb erofb i
tsin
ea
cha rri
vingp ac
ket.
I
npr
act
ice
,thep
oli
ci
ngme
cha
nis
msde
scr
ibe
ddonotr
equi
reat
ime
rto
p
eri
odical-
lyupdateacounter.Ins
tea
d,eac
ht imeap ac
ketar ri
ves,thep ol
i
cer
e
xaminest hecl
ocktodetermi
nehow muchtimeha se l
apse
dsincet heflow was
p
rocess
edl as
t,andusesthea mountofti
met oc omputea nincrementf orthe
c
ounter.Comp ut
inganincrementhasle
ssc o
mp utat
ionalove
r head,andma kes
t
raff
icp ol
ici
ngmoreef
fic
ient.
556 Voi
ceAndVi
deoOv
erI
P(RTP,RS
VP,QoS
) Cha
p.26

26.
18S
umma
ry

Re
al-
timedatac onsi
stsofa udioorvideoi
nwhicht hep l
aybac
kofas amp l
e
mustma t
chthet i
mea twhi c
ht hes ampl
ewa scap
tured.Aha rdwareunitknown
asac odecencodesa nal
ogd atas uchasa udi
oin digi
talform.Thet el
ephone
st
andardfordi
gitala
udioe ncoding,Puls
eCodeModulati
on( PCM),produc
esdigita
l
val
uesat64 Kb ps
;ot here ncodingssacr
ifi
cesomefidel
ityt oachi
e vel
owe rb i
t
rat
es.
RTP isus edt ot ransfe
rr eal-
t i
meda taa cr
ossa nIP networ k.Each RTP
me ss
agecont a
inst wok eypiecesofi nformati
on:as e
que ncenumbe randame di
a
timestamp.Ar eceiverusest hes eque ncenumb ert oplaceme s
sagesinor derand
detectlos
tda tagrams.Ar eceive
rus esat i
mestampt ode termi
newhe ntop l
aythe
encodedv alues. An a ss
oci
-a tedc ont rolpro t
ocol, RTCP, is us e
dt os uppl
y
informati
ona bouts ourcesandt oa ll
ow ami xert oc omb i
neseveralstre
a ms.To
accommoda t
eb urstines
sa ndjittera na ppl
ica
tiont hatp l
aysreal
-timedataus esa
playbac
kb ufferandi ntr
oduce saslightde l
ayb efor
ep layi
nga nite
m.
Commerci
alI Pte l
ephone s
ervi
cese x
istthat use VoI
Pt ec
hnol
ogy;most
te
lephonecompaniesa
r emov i
ngtoI P.Twostanda
rdshaveb ee
nc reat
edforus
e
wit
hI Pt e
lepho-ny:theI TUcreat
edt heH.323standa
rda ndt heIETFcre
ate
d
SI
P.
A de
batec onti
nuesov e
rwhe therQua li
tyofS erv
ice( QoS)guara
nteesare
neededtop rovider e
al-t
ime service
s.I nit
ial
ly,t he I
ETF f ol
lowedap r
ogr
am
knowna sInteg
r at
-edS er
vices(IntServ)thate xpl
oredp e
r- f
low QoS
.La t
er,the
IETF dec
idedt o movet o a Dif f
erentia
tedS e
rvice
s( DiffSer
v)a p
proachthat
provi
desQoSamongc las
sesoff l
owsr atherthanindivi
dualflows.
Impl
eme nt
ati
on ofQoSr e
quiresat ra
fficschedul
ing me chani
s mt os el
ect
pac
ke tsfrom outg
oingque uesa ndt raff
icp ol
i
cingt omoni tori ncomingf lows.
Becauseiti scomputational
lye f
fic
ienta nd handl
esv ariabl
e-size packets,t he
Defi
citRoundRobina l
-gorit
hm isamongt hemos tpracti
calfortr aff
ics cheduli
ng.
Thel e
akyb uck
etalgori
thm isamongt hemostp rag
ma ti
cf ort r
a ffi
cp oli
cinga nd
sha
ping.

EXERCI
SES

26.
1 Reada b
out the Re
al-
Time St
rea
ming Pr
otoc
ol, RTS
P. Wha
tar
ethe ma
jor
di
ffer
encesb
etweenRTSPandRTP?
26.
2 FindouthowtheS
kyp
evoi
cet
ele
phones
erv
iceop
era
tes
.How doe
sits
etupa
conne
c-t
ion?
26.
3 Networ
koper
ator
sha v
eanada
g e
:youcana
lwaysb
uymor
eba
ndwi
dth,b
utyou
ca
ntbuyl
owerdel
ay.Wha
tdoesthea
dag
emean?
26.
4 I
fanRTPme s
sagearr
iveswithase
que
ncenumb
erf
arg
rea
tert
hant
hes
eque
nce
e
xpe
ct-
ed,whatdoe
st heprot
oco
ldo?Why?
26.
5 Cons
ide
rav
ide
oshotf
rom yourc
ellp
honea
ndt
rans
fer
redov
ert
heI
nte
rne
tin
r
ealt
ime
.How muchc a
p a
cit
yisr
equi
red
?(Hi
nt:wha
tist
her
esol
uti
onoft
he
c
amer
ainyo
urcel
lphone?)
Ex
erc
ise
s 557

26.
6 Consi
deraconfe
renc
et el
ephonecal
ltha
tusesRTPtoc
onne
ctNus
ers
.Gi
vet
wo
poss
i-b
lei
mple
mentat
ionsthatcoul
dachi
evet
hecal
l
.
26.
7 Amovieusua
ll
yhastwoconc
eptua
lstreams
:avide
ost
rea
ma nda
naudi
os t
rea
m.
HowcanRTPb eus
edtot
ransfe
ramov ie
?
26.
8 Areseque
ncenumber
sneces
saryin RTP,orc
an ati
mesta
mpbeusedins
tead?
Exp
lai
n.
26.
9 Anengi
neeri
nsi
stst
hatSI
Pisforchi
l
dren;gr
own-up
sal
lus
eH.323.Whatdoe
s
theeng
ine
ermean?Gues
sthetypeofcompa
nyforwhi
cht
heeng
ineerwork
s.
26.
10 WhenVoIPwasfir
stint
roduce
d,s
omecountr
iesdecide
dtoma k
et het
echnol
ogy
i
ll
egal
.Fi
ndoutwhy.
26.
11 Wouldyo
uprefe
ranInterne
twher
eQoSwa srequi
redfora
llt
raffi
c?Whyorwhy
not
?
26.
12 Meas
uretheuti
li
zat
iononyourconne
cti
ontotheI
nternet
.Ifa
llt
raf
ficr
equi
red
QoSres
erv
ati
on,woulds
erv
icebebett
erorwor
se?Exp
lain.
26.
13 Suppos
e you ar
ea s
kedt os etup DiffSer
vc la
sse
sf ora cableISP.The ISPs
network,whi
chonlyusesIPv6,mus thandl
e:b r
oadca
stt e
lev
isi
onchanne
ls,voic
e
(i
.e.
,Vo I
P),movi
edownload,res
identi
alInter
netservi
ce,andstre
amingvide
oon
demand.Howdoyoua s
signDif
fServcl
asse
s?Why?
26.
14 Ift heinputt o atra
fficshape
ri se xtr
emelybur
sty( i
.e.
,s por
a di
cb ur
stsof
pack
e t
swit hfair
lyl
ongp er
iodsofnot r
affi
c),t
heoutputf rom theshaperma y
notb este
a dy.Whattechni
quecanb eus edtoguar
ante
es moot hout p
ut?( Hi
nt:
cons
iderame thodde
scri
bedinap re
viouschap
ter.
)
Chapt
erCont
ent
s
27.
1 Introduction,559
27.
2 TheLe velOfMa nagementPr otocols,559
27.
3 ArchitecturalModel,561
27.
4 ProtocolFr amework,562
27.
5 Examp le
sofMI BVa ri
ables,564
27.
6 TheS tructureOfMa nag e
me ntInf or mati
on,564
27.
7 Forma lDe fi
nit
ionsUsingAS N.1
,565
27.
8 StructureAndRe pr
esent at
ionOfMI BOb j
ectName
s,
566
27.
9 MI BCha ngesAndAddi tionsForI Pv 6,571
27.
10S impleNe tworkMa nag e
me ntPr otoc ol,571
27.
11S NMPMe ss
ageFor mat,574
27.
12 AnEx amp leEncodedS NMPMe ssage ,577
27.
13S ecurityI nSNMPv 3,579
27.
14S umma r
y,580
27

Networ
kManagement
(SNMP)

27.
1Int
roduc
tion

Ina ddi
t i
ont oprot oc
olstha tp rovidenetworkleve
ls ervi
cesa ndappl
ic
ation
pro-gramst hatuset hoses e
rvices,as ubs
ystemisneededt hata l
lowsama nager
toc onfi
gureane t
wor k,controlr outing,debugprobl
ems,a ndidentif
ysituat
ions
i
n whi chc omp ut
ersv i
ola
tep ol i
cie
s.We r efert osucha c
tivi
ti
e sas net
wor k
management . This c hapter c on-si
de rs the ideas behind TCP/ I
P ne t
wor k
ma nage
me nt,andde s
cr i
besap rotocolus edfornetworkma nagement.

27.
2TheLe
velOfMa
nag
eme
ntPr
otoc
ols

Whe n data ne twor k


sf irsta ppeared, d esig
ne r
sf oll
owe d a ma nageme nt
approa chuse dint el
ephones ystemsb yde s
igni
ngs pec
ialma na g
e me ntme chani
sms
intot hene t-work.Fore xamp le
,widea r
e ane twor ksusua l
lyde finedma nageme nt
me ssagesa sp art of t heirl i
nk-l
ev e
lp rotocol.I fap acke ts wit chb e
ga n
misbeha vi
ng,ane tworkma na gercouldi ns tr
uctane ig
hb oringp a ckets witcht o
sendi tas p ec
ialcontrolpac ket.Ani n-comi ngc ontrolpa cketc a us e
dt her e
ceiver
tos uspendnor malop erati
ona ndrespondt othec omma ndi nt hec ont rolp acket.A
ma nagerc ouldinterrogateap a
ckets witch,e x-amineorc ha nger oute s,t estone
oft hec ommuni c
ationi nterfaces,orr eboott hes witch.Onc et hep roblem wa s
repaired,a ma nagerc ouldi nstructt he s witcht or esume nor ma lop erati
ons.
Becaus ema nagementt oolswe repartoft helowe st-l
evelp rot ocol,ma na gerswe re
oftena blet ocontrolswitche sevenifhi gher-lev
e lprotocolsf ail
ed.
55
9
560 Ne
twor
kMa
nag
eme
nt(
SNMP) Cha
p.27

Unlikeahomog eneouswi dea r eane t


wor k
,t heI nter netdoe snotha veas i
ng l
e
l
ink-levelp rotocol
.I nstead,t heI nt er
ne tconsis
t sofmul t i
plep hysic
alne twor k
typesa ndde vi
cesfr om mul ti
plev endors.Asar es
ult ,theI nt ernetr equire sane w
networ kma nageme ntp ar a
digmt hatof fersthreei mp ortantc apabil
i
t i
es.Fi rst,a
si
ngle ma nagermus tb ea blet oc ontrolma ny t ypesofde vi
ces,i ncluding I P
router s
,b ridges
, mode ms , wor kstati
ons,a nd p r i
nter s.S e
cond, b eca uset he
Internetc ontai
nsmul tipletyp esofne t-works,t hec ontr oll
ede ntiti
eswi l
lnot
shareac ommonl i
nk -le
ve lprotocol.Third,thes etofma chinesama na gerc ontr ol
s
ma ya ttac ht oav a ri
etyofne twor ks.Inp a r
ticular,ama nagerma yne e
dt o
controloneormor ema chinestha tdonota ttacht ot hes a mep hy-sicalne twor k
ast he ma nager
sc omp uter.Thus ,i tma y notb ep ossi
b lef ora ma na g e
rt o
communi c atewi t
hma c
hinesunl esst hema nageme nts of twar eus esprotoc olst hat
pro-vide e nd-to-end c onne c
t i
vi
t ya c
rossa ni nter net.Asa c onseque nce ,t he
networ kma nageme ntp rotocolus edwi thTCP/ IPop er atesa bovet het r ansport
l
e ve
l:

InaTCP/ I
Pi nter
net,amanagerneedst oexamineandc ontr
ol
hosts,routers,andot hernet workdevi
ces
.Becausesuchdevi
ces
attachtoar bitr
arynetwor ks
,pr ot
ocol
sfornet
wor kmanagement
operateatt heappli
cationlayerandc ommuni
cateusingTCP/IP
transpor
tlayerpr o-t
oc ols
.

Designingne twor kma nageme nts oftwa r


et oop eratea tt hea ppl
ic
ationl evel
hass eve
ra la dv antag es
.Be ca
us et hep rotocolscanb ede s
ignedwi t
houtr egardt o
theunde r -l
yi ngne twork,ones etofp rotocol
sc anb eus edf ora l
lne twor ks.
Becauset hep rotoc ol
sc anb ede signedwi t
houtr egardt ot heha r
dwa reont he
mana gedde vice ,thes amep roto-colsc anb eusedf orallma nagedde vi
ces.Fr om a
mana ger
sp ointofv i
ew,ha vi
ngas i
ngl
es etofma nageme ntp rotocol
sme ans
uniformity a l
lr outer
sr espond t oe xactl
yt he same s e
t of c omma nds.
Furthermor e,b e c
a uset hema na geme nts oftwareus e
sI Pf orc ommuni c
a t
ion,a
mana gerca nc ontrolt herout ersa crossane ntir
eTCP/ IPint ernetwithoutha vi
ng
dir
ec tattachme ntt oeveryp hysi
ca lnetwor korr outer
.
Ofc our s
e,b uil
di
ngma nageme nts oftwa r
ea tt hea pp l
icati
onl eve lals
oha s
dis
ad- va
nt a
ge s
.Unlesst heop eratings yste m,IPs oft ware,a ndt ranspor tprotocol
softwarewor kcorrectl
y,t hema nagerma ynotb ea bletoc ont ac
tar outert hat
needsma na g
ing.Fore xa mple,ifar out ersforwa r
dingt ab
leb e
come sda ma g
e d
,i t
mayb eimpossibl
etoc or re
ctt het ableorr e
boott hema chinef rom ar e motesite.
Ift heop erati
ngs ystem onar out erc ra s
hes,itwi l
lb eimp os
sib
let or eac
ht he
appl
icati
onp rogr
amt hati mp l
eme nt sthei nternetma nageme ntp rotocols,eveni f
ther outerc anstil
lproc es
sha rdwa rei nte r-
rup t
sa ndf orwa rdp ackets.Whe nt he
ide
aofb uil
dingne t
wor kma nageme nta tt hea p-pli
cationlaye rwa sfirstp roposed,
manyne tworke ngi
nee r
sde cl
aredt hatt hewhol ea p -proachwa sfla
we d .Inf act,
manyne tworkr es
earchersa ls
or aiseds eriousob j
ections.
S
ec.27.
3 Ar
chi
tec
tur
alMode
l 561

27.
3Ar
chi
tec
tur
alMode
l

Despi
tet he pot e
nt i
aldisadva
ntage s
,ha ving TCP/IP managements oftware
oper
a t
ea tt hea p
plicat
ionl eve
lhaswor kedwe l
linp ra
ctice
.Themos ts ig
nifi
cant
adv
ant ag
e ofp lacing net work manag
e mentp rot
ocolsa ta highlevelb ecomes
app
ar e
ntwhe nonec on-sidersalargeinternet,whe reama nager
scomp uterdoes
not needt oa t t
ac h dir
e ct
lyt oa l
lp hysic
alne twor kst ha
tc ont
a i
n ma naged
ent
ities
. Figure 27. 1s hows a ne xa mplei n-tra
ne tt hat hel
pse xp l
aint he
manageme ntarchi
te c
ture.

MA Dev
icesbei
ngmanaged
MA

MA

MA MA

MC

MA MA
Manager
sHos
t

Rout
erbei
ngmanaged

Ot
herdev
ices

Fi
gur
e27.
1Ex ampl
eofne tworkma na
ge mentwhereama na
gerinvokes
manag
eme nt cl
ient (MC) s oft
ware tha
t c an contact
manag
eme nt a
gent (MA)s oftwarethatruns on devi
ces
thr
oughoutanintra
net.

As the figures hows,c lie


nt s of
tware usua
ll
yr uns on the ma na
ger
s
works
tati
on.Ea chp ar
tici
pati
ngma nagedsyste
m,whi chc anbear outerora
net
work de v
ice,r uns a ma nagement ser
ver. In I ETF te
rminolog
y, the
managementserve
rs oft
wa reiscall
edama nagementagentormer el
ya nagent.A
manageri
nvokescli
entsoftwareont hel
oca
l
Weusethetem ma
r nagedsys
tem toi
ncl
udeconve
nti
onalde
vic
ess
ucha
srout
ersa
ndde
skt
op
c
omp
ut-
ers
,aswel
lassp
eci
ali
zeddevi
cess
uchaspr
int
ersandse
nsor
s.
562 Ne
twor
kMa
nag
eme
nt(
SNMP) Cha
p.27

hostcomputera ndspe
cifi
esana gentwithwhichi
twi s
hestocommuni
cate.Af
ter
thec l
i
entc onnectstot hes p
eci
fiedagent,thema nag
ercanr e
ques
tt hatthe
cl
ient sof
twares end queri
est o obtai
ni nf
ormati
on or s
end commandsthat
confi
gureandc ontr
olthema nage
dde v
ice.
Ofc our se,nota l
lde vi
cesinal a
r g
ei nter
netf al
lunde ras ingl
ema nage r
.
Mostma nage r
sonl ycontrolde vi
cesatt heirloca
ls i
tes;al arges i
tema yha ve
multipl
e ma nage rs
. Ne twork ma nagement software us esa n a uthentication
me c
hanismt oe nsureonlya uthori
zedma nagerscana cc
essorc ontrolap art i
cular
devi
ce.S ome ma nagement protocol
ss upport multi
plel ev
elsof a uthorization,
all
owing ama na g
ers peci
ficp ri
vi
legeson e ac
h device
.Fore xamp l
e,as pecifi
c
routermi ghta llow se
v e
ralma nagerstoob tai
ninformation,whil
eonl ya l
lowinga
sel
ectsub s
e tofma nagerstoc hangeinfor-mati
onorc ontroltherouter.

27.
4Pr
otoc
olFr
ame
wor
k

TCP/IPnetwor kma nageme ntp rotocol


sdi vi
det hema nageme ntp rob
lemi nto
twop art
sa ndspe ci
fys epa
rat estanda rdsfore achp art.Thef i
rstp artconcerns
communica-ti
on be t
we enc l
ients oftwa rer unni
ng in ama nagershos tand a n
agentrunninginama nagedde vic
e .Thep r
otocoldefinest hef ormata ndme aning
ofme ssagescli
entsa nd serverse xc hangea swe lla st hef orm ofna me sa nd
addres
ses.Thes econdp artconc e
rnst hespe c
ifi
cde vic
e sb ei
ngma naged.Wewi ll
seethatt heprotocolspecif
iesas etofda taitemsama nagedde vicemus tma ke
avai
lab
let oama na ger
,t hena meofe achda taite
m,t hes yntaxus edt oexpre s
s
thena me,a ndt hes emantic
sa s
socia t
e dwitha ccessi
ngormodi f
yingt heda ta
ite
m.

27.
4.1TheTCP/
IPPr
otoc
olForNe
twor
kMa
nage
ment

The S i
mple Network Management Protoc
ol( SNMP) ist he st
anda
r dfor
networkma nagementint heTCP/IPprotocolsuite
.S NMPha sevolve
dt hr
ough
threege ner
a -
tions
.Consequentl
y,thecurrentv er
sionisknowna sSNMPv3.The
changesa mongv ers
ionshavebeenrela
tive
lymi nor a l
lthreeversi
onsusethe
sameg eneralframe-work
,a ndmanyfeature
sa r
eb ackwardcompati
bl
e.
Inaddi
ti
ont os pe
cifyi
ngdet a
il
ss uchastheme ssageforma
ta ndt heuseof
trans -
portprotocol
s,theS NMP s ta
ndarddefinesas e
tofop era
t i
onsa ndt he
me aningofeach.Wewi llseetha
tt hea ppr
oac
hi sminimal
ist
ic afewop era
tions
providea l
lfuncti
onal-i
ty.Wewi l
ls tar
tb yex a
miningS NMPforI Pv4;al ater
se
c tionsummarize
st hechange
sf orIPv6.

27.
4.2AS
tanda
rdForMa
nage
dInf
orma
tion

A de
v i
ceb e
ing mana
ged mai
ntai
nsc ontroland st
atusi nf
ormati
on t
hata
mana
gerc a
na cc
ess.Forexa
mp l
e,ar out
erk eepssta
tist
icsont hestat
usofi t
s
ne
tworkinter
facesal
ongwithcount
sofi ncomingandout g
oingp a
cke
ts,drop
ped
da
tag
rams
,ande
rrorme
s-
S
ec.27.
4 Pr
otoc
olFr
ame
wor
k 563

sagesg ene r
a t
ed. A mode m k eepss tatisti
csa bout t he numb er of bits(or
character
s )senta ndr eceiveda ndt hes ta
t usoft hec arri
er( whet herthemode m
att heot here ndoft hec onnec t
ioni sresponding).Althoughi ta l
lowsama nag
er
toa cces
ss tati
stics
,S NMPdoe snots peci
fye xactl
ywhi c hdatac anb eacc
essedon
whichde vice
s.I nstea
d,as epara t
es tandards peci
fiesthed etail
sf ore ac
ht ypeof
devi
c e
.Knowna saMa nagementI nformat i
onBas e( MIB),t hes tandardspeci
fies
theda tai temst hate achma nagedde v
icemus tk eep,t heop e
rationsall
owe don
eachda taitem,a ndt heme aningoft heop erat
ions.Fore x
amp le,t heMIBf orIP
speci
fiesthatt hes oftwaremus tk eepac ountofa lloctetst hata rri
veovere a
ch
networki nte r
facea ndt hatne tworkma nagements of t
wa rec an onlyr eadthe
count.
TheMI BforTCP/IPdi
vide
sma nagementinformati
onintomanycateg
ori
es.
Thec ho
iceofc at
egor
iesi
si mpor
tantb ec
auseidenti
fi
ersusedtospe
cifyite
ms
i
ncludeac odeforthecate
gory.Figur
e27. 2lis
tsaf ewex a
mpl
esofc a
tegor
ies
use
dwi thIPv4.

MI
Bc ategory I
nc lude sI nf orma t i
onAb out
sys t
em Thehos torr out erop er a
t ings ystem
i
nter faces Indi
vidualnetwor ki nte rfac es
at Addresstransla
t ion( e.g.,ARPma ppi
ngs)
ip Inter
ne tProtoc ols oft wa rev e
rs i
on4
ip v6 Inter
ne tProtoc ols oft wa rev e
rs i
on6
icmp Inter
ne tCont rolMe s
sa gePr otocolsoftwarev
ers
ion4
ipv6Icmp Inter
ne tCont rolMe s
sa gePr otocolsoftwarev
ers
ion6
tcp Transmiss
ionCont r olPr ot ocols oftware
udp UserDa ta
gramPr ot ocols of t
wa r e
os pf OpenS hortes
tPa thFi rsts of twa re
bgp BorderGa tewayPr otoc ols oftwa re
rmon Remot enetwor kmoni toring
rip-2 RoutingInforma tionPr otoc ols oftware
dns Domainna mes ys te ms of twa re
Fi
gure
27.
2 Exa
mplec
ategori
esofMIBi
nformat
ion.Theca
teg
oryi
senc
od-
edint
heide
nt i
fi
eruse
dtospec
ifyanobjec
t.

Keepingt heMI Bdefiniti


oni ndependentoft hene twor kma na ge
me ntp rotocol
hasa dvantagesf orb ot
hv endorsa ndus ers.Av endorc ani ncludeS NMPa gent
softwarei nap r
oduc tsucha sar oute r
,wi tht heg uaranteet hatt hes oftwa re
willcontinuet oa dheret ot hes ta
nda rdafterne w MI Bite msa rede fi
ned.A
customerc a
n us et he same ne twork ma nageme ntc li
ents oftwa ret o ma nag e
mul t
ipl
ede vicesthatha ves l
ightl
ydi ffere
ntv er-s
ionsofaMI B.Ofc our s
e ,a
devicetha tdoe snotha v ene w MI Bi temsc annotp rovidet hei nformat i
onf or
thoseitems .Howe ver,b ecausea llma nagedde vic
esus et hes a
mel anguagef or
communi cati
on,e ac
hde vicec anp arseaque rya nde itherp r
ov i
det her e-ques t
ed
informati
onors enda ne rrorme s
sagee xpl
ai
ningt her equestedi temi snota v a
il-
a
ble
.
564 Ne
twor
kMa
nag
eme
nt(
SNMP) Cha
p.27

27.
5Exa
mpl
esofMI
BVa
ria
ble
s

Earlyv ers
ionsofS NMPc oll
ectedv ari
able
st ogethe
ri nas ingl
el ar
g eMI B,
witht he e nti
res e t docume ntedi n as i
ngle RFC.To a v
oid having t he MI B
spec
ifi
cationb e-comeunwi e
ldy,t heI ETFde c
idedt oa l
lowt hepub l
icationofma ny
indi
vi
dua lMI Bdoc -ume ntsthate achs peci
fyas etofMI Bv ari
abl
e sforas p e
c i
fi
c
typeofde vic
e.Asar e s
ult,mor et ha n100s epa ra
teMI Bdoc ument sha veb een
defi
neda sp art of t he st a
n- dardsp rocess
;t heys pecif
y mor et han1 0,000
indi
vi
dua lvariabl
es.Fore xamp l
e,s eparateRFCsnow e x
istt hats pe
c i
f ytheMI B
vari
abl
esa s
sociat
e dwi thde vi
c essucha s
:aha rdwa rebridge,a nuni nterruptibl
e
powers uppl
y,a nEt hernetswit c
h,a ndac ab
lemode m.Ina dditi
on,ma nyv endors
havedef i
nedMI Bv a ri
ablesfort hei
rs peci
fichardwa reors oftwarep roducts.
Examini
ngafew oftheMIBda
tai
temsass
oci
ate
dwithTCP/I
Pp rot
ocol
swil
l
hel
pc la
rif
yt hec
onte
nts.Fi
gur
e27.3l
i
stsex
ampleMIBv
aria
ble
sa l
ongwiththe
ir
ca
teg or
ies
.

Mostoft hei temsl is


tedi nFi gure27.3ha venume r
icv alues e achc anb e
storedi nas inglei nteger. Howe ver,t he MI Ba l
so de fi
nes mor ec omp lex
structures.Fore x-amp l
e,t heMI Bv ar
iabei
l pRouti
ngTabler ef
e r
st oa ne ntire
forwa rdi
ngt abl
e .Addi -ti
onalMI Bv a
riab
lesunde rt het a
b l
e( notl i
stedi nt he
figure)definet hec ontentsofaf orwardi
ngt abl
ee ntry,a nda ll
ow thene twor k
ma nagementp rotocolst oref e
rencea nin-divi
dualent ryint hef orwardingt a b
le,
i
nc l
udingt hep refi
x,a ddressma sk
,a ndnexthopf i
elds.Ofc ours e
,MI Bv ariables
presentonlyal og i
calde fi
nit
ionofe achdatai temt heinter naldatastruct ures
ar outer usesma y differf rom t he MIBd efi
nit
ion.Whe n a que r
ya rrives,
softwar einthea ge
ntont her oute risresponsi
bleforma pp i
ngb e
t we
ent heMI B
variabl
er efer
enc esint heque rya ndt heinternaldatas t
ruc turet heroute rus es
tos toretheinfor mation.

27.
6TheS
truc
tur
eOfMa
nage
mentI
nfor
mat
ion

Ina ddi
t i
ont othes tandardst ha tspe ci
f yMI Bv ari
ablesandt hei
rme anings,a
separates tandards p eci
fiesa s e t of r ule sus edt o de fi
ne a nd ident i
fy MI B
vari
ables.Ther ulesa r
ek nown a st he S tructureofManagementI nf ormat i
on
(SMI)s p
e c
ifica
t i
on.Tok eepne twor kma na gementp r
otocolssimple,theS MIp lac
es
restr
icti
onsont het ypesofv ariabl
e sallowe dint heMI B,s peci
fiesther ulesfor
namingMI Bv ari
a bl
es,a ndc re
a tesr ulesf orde fini
ngv ariabl
et yp es
.Fore xa mple
,
theS MIs tandardi ncludesde fi
nitionsoft het erm Count er( defini
ngitt ob ea n
32
i
nt e
ge rint her angeof0t o2 1 )a ndt heter mI netAddress( de
fini
ngi tt obe
as tr
ingofoc tets),a nds peci
fiest hatt hede f
initionofMI Bv ariabl
ess houldus e
thet erminology.Mor ei mportant ,t her ulesint heS MIde s c
ribehow t heMI B
referstot ablesofv alues(e.g.,a nI Pv4r out i
ngt a
b l
e).
WhentheMIBwa sde
fine
d,t
het
ermi
nol
ogyr
out
ingt
abl
ewasus
edi
nst
eadof
for
wardi
ngtabl
e.
S
ec.27.
6TheS
truc
tur
eOfMa
nag
eme
ntI
nfor
mat
ion 565

MI BVa riable Me
ani
ng
Ca
tegor ysys t
e m
sysUpTime Ti
mes
inc
ela
str
eboot
Ca
tegor ysys t
e m
ifNumb er Numb
erofnet
wor ki
nterf
ace
s
ifMtu MTUfora
ninter
face(I
Pv4)
ipv6IfEffectiveMt u MTUfora
ninter
face(I
Pv6)
Ca
tegor yip
ipDefaultTTL Val
ueIPv4use sa saTTL
ipv6DefaultHop Limit Val
ueIPv6usesa sahopl i
mit
ipInReceives NumberofIPv4da tagramsr ecei
ved
ipv6IfStatsInRe c
e i
ves NumberofIPv6da tagramsre c
e i
ved
ipForwDa tagrams NumberofIPv4da tagramsf orwarded
ipv6IfStatsOutFor wDatagr
ams NumberofIPv6da tagramsfor warde
d
ipOutNoRout es Numberofrout ingf ai
lure
s
ipReasmOKs Numberofdat agramsr eass
emb led
ipFragOKs NumberofIPv4da tagramsf ragmented
ipv6IfStatsOutFr agOKs NumberofIPv6da tagramsfr a
gme nted
ipRoutingTa bl
e IPv
4forwardingt a
ble
ipv6Route Table IPv
6forwardi
ngt able
ipv6AddrTa ble IPv
6inter
facea ddr esstabl
e
ipv6IfStatsTable IPv
6stati
sti
csf ore achinterface
Ca
tegor yicmp
icmpInEchos Numb
erofI
CMPEc
hoRe
que
stsr
ecv
d
Ca
tegor ytcp
tcpRtoMi n Mini
mum re
transmis
siontimeforTCP
tcpMa xConn Maxi
mum TCPc onnec
t i
onsal
lowed
tcpInSegs NumberofsegmentsTCPha srec
eive
d
Ca
tegor yudp
udp I
nDa tagrams Numb
erofUDPda
tagr
amsr
ece
ive
d

Fi
gur
e27.
3Ex
amp
lesofMI
Bva
ria
ble
sal
ongwi
tht
hei
rca
teg
ori
es.

27.
7For
malDe
fini
ti
onsUs
ingAS
N.1

The S MIs t
andards peci
fiest hata l
lMI Bv a
r i
abl
esmus tb e defi
neda nd
referencedus ingISOsAb s
tractSynt axNot ati
on1( ASN.1).AS N.1isaf or
ma l
l
a nguagetha thastwoma infe a
ture s
:anot ati
onus edind ocume ntst hathuma ns
reada ndac ompac
te n- c
odedr epresentat
ionoft hes amei nformat i
onus edi n
communi ca
t i
onp rotoc
ols.Inb othca s
es,theus eofap reci
sea ndf or
ma lnotati
on
remov esamb igui
tyf rom b otht he represent
ation and me aning.For e xample,
i
ns t
e a
dofs ayingthatav ari
a b
lec ontai
nsa nintegerv al
ue ,ap rotocoldesig
ne r
whous e
sAS N.1musts ta
t ethee xac
tf orma ndrange
ASN.
1isus
ual
l
ypr
onounc
edb
yre
adi
ngt
hedot
:A-
S-Ndot
1
.
566 Ne
twor
kMa
nag
eme
nt(
SNMP) Cha
p.27

of e a
c h numeric value. Such pre
cis
ion is es
pec
ial
l
y i
mpor
tant when
impl
ementati
onsincl
udehe te
roge
neouscomput
erstha
tdonotal
lusethesame
rep
resenta
tionsf
orda t
ai t
ems.
I
na ddit
iont ospec
ifyi
ngt henameandc ontentsofeachite
m,AS N.1def
inesa
s
etofBa s
icEncodingRules(BER)thatspec
ifyp r
ecis
elyhowt oenc
odeb othnames
a
nddatai temsiname ssage.Thus,oncethedoc umentati
onofaMI Bha sbeen
e
xpr
essedusingAS N.1
,v ari
ablescanbetransl
a t
eddirectl
ya ndmechanic
all
yinto
t
heencodedf or
mus edinme ssage
s.Insumma ry:

TheTCP/IPnet
workmanagementprotocolsuseaf ormalnot
ati
on
cal
l
ed ASN.1to defi
ne namesand typesf or variabl
esinthe
manage-
mentinformati
onbase.Thepr ec
isenotationmakesthe
for
mandc on-t
entsofvari
abl
esunambiguous.

27.
8St
ruc
tur
eAndRe
pre
sent
ati
onOfMI
BOb
jec
tNa
mes

Wes ai
dt hatAS N.
1s pecifi
eshow t or e pr
ese
ntbothda t
ai temsandna me s.
How- ever,underst
andingt hena me sus e
df orMI Bvari
abl
esr equi
resust ok now
aboutt heunde rl
yingna me s
p ac
e .Na mesf orMI Bvari
abl
esa ret ak
enf rom the
objectidenti
fi
ernames pacea dminister
edb yI SOandITU.Thek eyideabehindthe
objectidenti
fiername sp
ac eist hati tprovidesanamespac
ei nwhi chal
lp ossi
bl
e
objectscanb ede s
ignat-ed.Thena mespacei snotre
stri
ctedtov ari
abl
esus edin
networ k management i ti n-cludesna me sforarbi
trar
y ob je
cts(e.
g .,e ac
h
inter
na ti
onalprot
ocolstandarddoc umentha saname).
Theob je
cti denti
fi
ernamespac sa
ei bsol
ute( gl
obal
),me ani
ngt hatna mesare
str
uc -
tur edtoma k ethemg l
obal
lyunique.Lik
emos tna mespace
st hata rela
rge
anda bsol
ute,theob jecti
denti
fi
ername sp
a c
eishi erar
chica
l.Aut horityf orpart
s
oft hena mespa
cei ssubdi
vi
deda teac
hl evel
,all
owingi ndi
vidualg r
oup st oobtai
n
authori
t ytoa s
signsomeoft henameswi t
houtc onsul
tingac entrala uthori
tyfor
eachassignment.
Fi
gure27. 4ill
ust r
atesp ert ine ntp ar t
soft heob jec
ti denti
fierhi erarchya nd
shows t he p osit
ion of t he mg mt and mi b nodes us edb y TCP/ IP ne twork
ma nagementp roto-cols.Ther ootoft heob j
ecti de nti
fierhierarc hyi sunna med,
butha sthr eedi rectde sc
en- da nt sma na g edby:I S O,I TU,a ndj oint l
yb yI SOa nd
ITU,a sthet opl eveloft hef ig urei llustra
te s.Ea c
hno dei nt hehi e
rar c
hyi s
assig
ne db othas hortt extualna mea ndauni quei ntegeri dentif
ie r(huma nsus e
thet exts tringt ohe lpunde rs ta ndob jectna me s;c omp uters oft wareus est he
integert of or m ac ompact,e nc odedr epres
ent ationf orus einme ssa
ges).I SO
all
oca t
edt heor gs ubtreef orus eb yot herna ti
ona lori nt e
rna t
iona lstan-dards
organizati
ons( i
ncludingU. S.s ta ndardsor ganizations )
.TheU. S .Na t
ionalI nsti
-
tutef orS t anda r
dsa ndTe chnol og y( NIS T)a ll
oca teds ubtreedodunde ror gf or
theU. S.De par t
me ntofDe fens e.Fi na l
ly,t heI ABp e
titi
one dtheDe par
tme ntof
Def e
ns etoa llo-catea nint ernets ubtre eint hena mespacea ndt hent oa ll
ocate
fours ubtre e
s ,includingmg mt .Themi bs ubtreewa sa ll
ocatedunde rmg mt.
Cha
pter23ex
plai
nshowa ut
hori
tyi
sdeleg
a t
edinahi
era
rchi
cal
names
pace
.NIS
Twa sfor
me rl
ytheNat
ionalBur
eauofSt
andar
ds.
S
ec.27.
8 S
truc
tur
eAndRe
pre
sent
ati
onOfMI
BOb
jec
tNa
mes 567

unnamed

j
oint-
i
so i
tu i
so-i
tu
1 2 3

or
g
3

dod
6

i
nte
rne
t
1

e
xpe
ri-
di
rec
tor
y mgmt me
nta
lpri
vat
e34
1 2

mi
b
1

Fi
gur
e27.
4Pa rtofthehi
erarc
hic
alob
jecti
dent
ifi
ernames
pac
euse
dto
nameMI Bvar
iab
les.Anobje
ct
snameb eg
inswithapat
h
throug
hthehi
erarc
hy.

Thena meofa nobjectinthehiera


rchyi
st hesequenceoflabe
lsont henodes
al
ongap athf r
om ther oottot heobjec
t.Thesequenceiswr i
ttenwi t
hp eri
ods
se
p a
r a
ting the indi
vi
dualc omponent
s.Whe ne xpr
e ss
edf or huma ns toread,
textualnamesa reused.Whe nna mesa r
esentinme ss
ages,numericvalue
sa re
usedinste
ad.Fore xample,thestrng1.3.6.1.2.1de
i not
esthenodel abe
led
mib.Becausetheyf a
llundertheMI Bnode,al
lMIBv ari
able
shavena mesbegi
nning
withthep refx1.3.6.1.2.1
i .
568 Ne
twor
kMa
nag
eme
nt(
SNMP) Cha
p.27

Ear
li
erwes ai
dt hatt heMIBg roupsv ari
abl
esintocat
egori
es.Theexact
meaningofthecate
goriescannow b
ee x p
lai
ned:thecateg
ori
esarethesubtr
ees
oft hemibnodeoft heobjecti
denti
fie
rna me s
pace.Fi
gure27.
5i l
l
ustr
ate
st he
ide
ab yshowi
ngthefirs
tf e
wnodesfors ubtr
eesunderthemibnode.

.
.
.
l
abelfr
om theroot
t
ot hi
spoi
ntis1.3
.6
i
nte
rne
t
1

e
xperi
-
di
rec
tor
y mgmt ment
al p
riv
ate
1 2 3 4

mi
b
1

i
nter- addr.
s
yst
em faces t
rans. i
p i
cmp t
cp udp
1 2 3 4 5 6 7

Fi
gur
e27.
5Pa rtoftheobjec
tide
ntif
iernames
pac
eunde
rtheIABmib
node
.Eachsubtr
eecorr
espondst
ooneoftheca
teg
ori
esof
MIBvari
-ab
les
.

Twoe xampleswil
lma k
ethena mi
ngsynt
axc l
ear.Fig
ure27. 5showsthatthe
cat
eg orylabel
ediphasbeenas s
ignedthenumeri
cv a
lue4.Thus ,thena mesofal
l
MIBv a
ria
blescorre
spondingtoIPha vea
nidenti
fi
ert ha
tb egi
nswitht hepref
ix1
.3.6.1.2.1.4.I fonewa nte
dtowr i
teoutt het e
xtuallabe
lsins
teadof
thenume ricrepr
esentat
ion,thenamewouldbe:

i
so.or
g.dod.i
nter
net.mgmt.mi
b.i
p

AMI
Bv ar
iab
lenamedi
pInRec
eiv
eshasbeenas
sig
nednume
rici
dent
ifi
er3unde
r
hei
t pnodeinthena
mespac
e,soitsna
meis:
S
ec.27.
8 S
truc
tur
eAndRe
pre
sent
ati
onOfMI
BOb
jec
tNa
mes 569

i
so.or
g.dod.i
nter
net.mgmt.mi
b.i
p.i
pInRec
eiv
es

a
ndt
hec
orr
esp
ondi
ngnume
ricr
epr
ese
nta
tioni
s:

1.3.6.1.2.1.4.3

Whenne tworkma nagementp rotocol


susena mesofMI Bvar
iabl
esi
nme s
sage
s,
ea
chna meha sasuffixappended.Fors i
mp l
ev ari
abl
es,thesuf
fix0refe
rstothe
i
nstanc
eoft hevaria
b l
ewitht hatna me.So,whe nitappear
siname s
sag
esentto
arouter,thenumericrep
r e
sentationofipInRecei
vesis:

1.3.6.1.2.1.4.3.0

whichreferstotheinstanceo fipI
nReceivesontha trouter
.Not ethatt hereisno
wayt ogue s
sthenume r
icva l
ueors uffi
xa ss
ignedt oavariab
le.Onemus tconsult
thepub-li
shedstandardstof indwhichnume ricv al
ueshavebeena ss
ignedt oe ac
h
obj
ectt ype.Thus,p rogra
mst hatp r
ovidema ppingsbetweent het extualforms
andunde r
lyi
ngnume r-icvaluesdos oentirel
yb yc ons
ult
ingtablesofe quiv
alences
t hereisnoclos
e d-
formc omp utat
iontha tperformsthetransformation.
Asas ec
ond,morecomp l
exe xa
mp le
,c onsi
dertheMI Bv ar
iab
leipAddr
Tabl
e,
whic
hc ontai
nsal i
stoft heI Pv4a ddres
sesf ore ac
h networkint
e rf
ace.The
var
iableex-is
tsinthenamespaceasas ubtr
e eunderip,andhasbeenassi
gnedthe
nume r
icv a
lue20.Ther
efor
e ,ar e
ferencetoi thasthepref
ix:

i
so.or
g.dod.i
nter
net.mgmt.mi
b.i
p.i
pAddr
Tabl
e

wi
thanume
rice
qui
val
ent
:
1.3.6.1.2.1.4.20

Inp rog r
a mmingl ang uaget er
ms ,wet hinkoft heI Pa ddresstab l
ea saone -
dimensiona larray,whe ree ache l
e mentoft he ar r
ayc onsis
tsofa s tructure
(rec
ord)t hatconta i
nsf i
v eitems:a nIPa ddres
s,t heintegerindexofa ninterface
correspondingt ot hee nt ry,anI Ps ubnetma s
k ,a nIPb roadcas
ta ddress
,a nda n
inte
g ert hatspecif
iest hema xi
mumda tagramsizet hatther outerwi l
lreass
emb l
e.
Ofc ourse ,itisunl i
ke l
yt ha
tar outerha ssucha na rra
yi nme mor y.Ther outer
ma yk eept hisinforma tioni nma nyv ariabl
esorma yne edt of ol
l
ow p oi
nterst o
findit.Howe ver,t heMI Bp r
ovidesana mef ort hea rraya sifite xis
ted,a nd
all
ows ne twork ma nage ment soft ware on i ndi
vidualr outerst o ma pt ab l
e
reference sint
oa pprop ri
at einter
na lva
r i
able
s.Thep ointis:

Alt
hought heyappeartos peci
fydet ai
lsaboutdat astr uct
ures,
MIBs tandardsdonotdictat etheimpl ementati
on.I ns
t ead,MIB
defi
nit
ionspr ovi
deauni form,v ir
tuali nterfac
et hatmanager s
usetoac cessdata;anagentmus tt ranslat
ebet weent hev i
rtual
it
emsinaMI Bandthei
nter nali
mplement ati
on.
570 Ne
twor
kMa
nag
eme
nt(
SNMP) Cha
p.27

Us
ingAS
N.1s
tyl
enot
ati
on,wec
ande
finei
pAddr
Tabl
e:

i
pAddr
Tab
le:
:=S
EQUENCEOFI
pAddr
Ent
ry

wheeS
r EQUENCEandOFar ekeywor
dst hatd e
f i
nea nip
AddrTab
letob eaone-
di
mensi
onalarr
ayofIpAddrEnt
rys
.Eache ntryint hearra
yi sde
fine
dt ocons
ist
offi
vefiel
ds(t
hedef
ini
tionass
umest tI
ha pAddresshasal
readybee
nde f
ine
d).

I
pAddr
Ent r
y: :
=S EQUENCE
{ipAdEntAddr
I
p Addres
s,
i
pAdEntIfIndex
INTEGER,
i
pAdEnt NetMask
Ip Addre
ss,
ipAdEntBc a
stAddr
Ip Addre
ss,
i
pAdEnt
Re a
smMa xSi
ze
INTEGER
(0.
.65535)
}

Fur
therdef
init
ionsmustb egi
ventoass
ignnumer
icval
ue oi
st pAddr
Ent
ry
a
ndtoeac
hit
emi ntheIpAddr
Entr
ys e
que
nce
.Forexampl
e,t
hedef
ini
ti
on:

i
pAddr
Ent
ry{i
pAddr
Tab
le1}

s
pec
ifi
esthatanipAddr
Ent
ryi ri
sunde pAddr
Tabl
e and hasnumer
icv
alue 1
.
S
imi
lar
ly,t
hede
fini
ti
on:
i
pAdEnt
Net
Mas
k{i
pAdd
rEnt
ry3}

a
ssi
gnsi
pAdEnt
Net
Mas
knumer
icv
alue3unde
ripAddr
Ent
ry.
Wes aidt hati pAddrTableislikeaone -dimensionala rray.Howe v
er,the r
ei sa
si
g- ni
ficantdi ffere nceint hewa yp rogra mme rsus earra ysa ndt hewa yne twor k
ma nage-me nts of t
wa reus estable
si nt heMI B.Pr ogra
mme r sthinkofa na rraya s
as e tofe le-
me ntst hatha vea ni nde xus edt os e
lectas pecif
ice l
ement.For
examp le
,t hep rogr am-me rmi g
htwr iex
t yz[3]t os el
ectt het hir
de le
me ntf rom
arrayx yz.ASN. 1s yntaxdoe snotus einte g
eri ndices
.I nste ad,MI Btable
sa ppend
as uffixont ot hena met os e
lectas pe
c i
fice l
eme ntint het able.Foroure xamp l
e
ofa nIPa ddresst abl
e,thes tandards pe ci
fi
e stha tthes uffixus edtos ele
cta n
ite
mc ons i
stsofa nI Pa ddress
.S yntac t
icall
y,t heI Pa dd ress( i
ndot tedde ci
ma l
nota t
ion) i sc onc atenated ontot he e nd of t he ob je c
t na me t of orm t he
reference.Thus ,t os peci
fyt henetwor kma skf i
e l
dint heI Pa ddresstableent ry
correspondingt oa ddress128.1 0.2.3,oneus esthena me :
i
so.
org.
dod.
int
ernet
.mgmt
.mi
b.i
p.i
pAddr
Tabl
e.i
pAddr
Ent
ry.
ipAdEnt
Net
Mas
k.1
28.
10.
2.3
S
ec.27.
8 S
truc
tur
eAndRe
pre
sent
ati
onOfMI
BOb
jec
tNa
mes 571

whi
ch,i
nnume
ricf
orm,b
ecome
s:

1.3.6.1.2.1.4.20.1.3.1
28.1
0.2.3

Al
t houg hconcat
ena ti
ngani ndextotheendofana mema ys eema wkwa r
d,it
providesap owerfultoolthatall
owscl
i
entstose
a r
cht a
ble
swi t
houtk nowingthe
numb e rofite
mso rthetypeofda t
ausedasanindex.Alate
rs ec
tionshowshow
networ kma nageme ntprotocol
susethisfe
atur
et ostepthrough at ableone
el
e me ntatat i
me .

27.
9MI
BCha
nge
sAndAddi
ti
onsForI
Pv6

IPv6cha
nge
st heMI Bs lig
htly.Insteadofus i
ngcurrentMIBv a
riab
lesthat
corr
es p
ondtoIP(e.g.,ac ountofa l
lIPda tagr
amsthatha v
earri
ved)
,theI ETF
deci
dedt ousesepar
atev ariabl
esf orI Pv6.Thus,ne
w name sweredefine
df or
IPv6a ndtheprev
iously-
de f
inedMI Bva r
iabl
esforIPno wr ef
eronlyt oIPv4.
Simi
larl
y,anewcategoryha sbeene sta
blis
hedforICMPv6.
Pa r
toft hemot ivat
ionf orane w MIBs truct
ur ea r
isesbeca useI Pv6didnot
merelyc hanget hesizeofa ddres s
es.Inste
ad,I Pv6c hangesthewa ya ddresse
sa re
ass
igned.I np arti
cul
a r
,I Pv
6a l
lowsmul ti
pleI Pprefixestob ea ssignedt oag iven
i
nter f
a c
es imul-tane
ously.The r
e fore,theI Pv6MI Bmus tb es tructure dinawa y
thatc reatesat abl
e( i.
e.,a na rr
ay)ofe ntri
est hathol da ddr e
s s
es.S i
milar
ly,
becauseI Pv6us esNe i
ghborDi s
c overyinst
ea dofARP,a nI Pv6t a bl
eg i
vesIP-to-
MACa ddressbindi
ngs.Figure27. 6li
ststhet abl
esuse dwithI Pv6a nde xpl
ai
nst he
purposeofe a
ch.

Tabl
e Purp ose
i
pv6IfTabl
e Inf
orma t
iona boutI Pv6interfac
es
i
pv6IfSt
atsTabl
e Traff
icstatis
ticsf oreachinterfa
ce
i
pv6AddrPref
ixTabl
e IPv
6p refi
xesf ore achinterf
ace
i
pv6AddrTabl
e IPv
6a ddressesfore achinterfa
ce
i
pv6RouteTabl
e TheIPv6( uni
c as
t)f orwardi
ngt abl
e
i
pv6NetToMediaTa
ble IPv
6a ddress-to-physi
caladdress

Fi
gur
e27.
6ThesixmajorMIBta
b l
esint
roduc
edf
orI
Pv6a
nda
de
scr
ipt
ionofthe
irconte
nts.

27.
10S
imp
leNe
twor
kMa
nage
mentPr
otoc
ol

Networkmanagementp rotocol
sspeci
fycommuni c
at i
on betwe e
n ane t wor
k
management ap
plic
ati
on running on the ma
na g
e r
sc omp utera nd a net wor
k
manage-mentagent(i.
e.,server)exec
uti
ngonama na
g edde v
ice.Ina ddi
tionto
de
finingtheforma ndme a
ningofme s
sag
esexchangeda ndt hereprese
nt a
tionof
namesandvalue
si nthos
eme
ssa
ges
,ne
twor
kma
nag
eme
ntp
rot
ocol
sal
sode
fine
admi
nis
tra
tiv
er el
ati
on-
572 Ne
twor
kMa
nag
eme
nt(
SNMP) Cha
p.27

shi
psamongr
out
ersb
eingma
nag
ed.Tha
tis
,the
ypr
ovi
def
ora
uthe
nti
cat
ionof
manag
ers.
Onemi ghte xpe
ctne tworkma na g
eme ntp r
ot ocolst oc ontai
nma nyc omma nds.
Somee arlyprotocol
s,fore xa
mp le
,s upportedc omma ndst ha tal
lowedt hemana ge
r
to:r eboot the systm,a
e dd or deleter oute ,di
s s able or enable a par t
icula
r
networ kint
e r
face,andr emovec acheda ddres
sb inding s.Thema indisadvantageof
buil
di
ng ma nagement p r
otocol
sa round c omma nds a ris
esf rom t he r e
sulti
ng
complexit
y.Fore xample,thec omma ndt odelet ear outingt abl
ee ntrydiffers
from thec omma ndt odi s
abl
ea ni nter-face.Asar esult,t hep r
ot ocolmustb e
changedt oaccommoda tenewf unctional
ity.
SNMP t akesa ninteresti
ng alt
er nati
vea ppr oacht o networ k management.
Insteadofde f
iningalargese tofcomma nds,S NMPc astsa l
loperati
onsinaf etch-
storepar a-di
gm.Conc ep
tua l
ly,SNMPc ontai
nsonl ytwoc omma ndsthatallow a
ma nagert of et
chav al
uef rom adatai tem ors toreav al
uei ntoada taitem.All
other op erati
ons a r
e de f
ineda ss ide-effec
t s of t heset wo op erati
ons.For
examp le,a l
thoug hSNMP doe snot ha vea ne xp li
citr eboot operati
on,s yst
em
rebooti sde fi
nedb yde c
lari
ngaMI Bv a
r i
abl
et ha tg i
vest het imeuntilthenext
reboot ,al
lowingama nagert oass
ignt hev ari
ableav al
ue .Ift hema nage
ra ssi
gns
thev alueze r
o,t hedevic
ewi llberebootedinstant ly(i
.e.,thea ssi
gnmenta c
t sl
ike
ar ebootc omma nd).
Thec hiefadvantag e
sofus ingaf etch-storep a
radig
ma r
es tabi
l
ity,si
mp l
ici
ty,
andf l
exibi
li
ty.S NMPi se spec
iall
ys tab
leb eca
us eitsdefi
niti
onr emainsfix
ed,e ven
thoughne w da tai
t emsa rea ddedt otheMI Ba ndne w opera
tionsa r
ede fi
neda s
si
de-effects of s toring intot hosei tems.S NMP i ss i
mp l
et oi mplement,
understand,a nddebugb ec
auseita voi
dst hec omplexi
tyofha vi
ngs peci
alcas
e sfor
eachc omma nd.Fina l
ly,S NMPi se speci
all
yf l
exibl
eb ec
a us
ei tc a
na c
commoda te
arbi
traryf uncti
onalit
yi na ne l
egantframe work.
Fr
om ama na ger
sp oi
ntofv iew,ofc ourse
,S NMPr emainshidden.Theus er
i
nt er-fa
cetone twor kma nage
me ntsoftwarec a
np hra
seo perati
onsasi mpera
t i
ve
comma nds(e.
g.,r eboot)
.Thus,thereisli
ttlevis
ibl
ediff
e r
enceb et
we e
nt hewa ya
ma nagerusesSNMPa ndotherne tworkma nagementprotocol
s.Inf act,vendors
sellnetwor
kma na ge-
ments oft
wa rethatof f
ersag raphi
caluserinterface.Such
softwaredispl
aysdi agramso fne t
workc onnecti
vi
ty,a ndus esap oi
nt- a
nd-cli
ck
styleofint
eraction.
Inp r
actice,S NMPof f
er smoret hanf etcha nds toreop erati
ons.Figure27. 7
l
istst heeightop era
tions.I np racti
ce,onl ys omeoft hema r
ee s
sentia
l.For
example,oper a-
t onsg
i et -
request and set-request

You might also like