ComputerNetworks:ArchitectureandProtocols
CS4450
Lecture11Rou+ng:DeepDive
Spring2018RachitAgarwal
GoalsforToday’sLecture
• LearningaboutRoutingProtocols
• LinkState(Globalview)
• DistanceVector(Localview)
• Maintainsanity:itsoneofthe“harder”lectures
• I’lltrytomakeit-less-hard,but…
• Payattention• Reviewagaintomorrow
• Workoutafewexamples
2
Recap:SpanningTreeProtocol(failuresonlaterslides)
3
• Messages(Y,d,X):ForrootY;FromnodeX;advertisingadistancedtoY
• InitiallyeachswitchXannounces(X,0,X)toitsneighbors
• Switchesupdatetheirview• Uponreceivingmessage(Y,d,Y)fromZ,checkY’sid
• IfY’sid<currentroot:setroot=Y
• Switchescomputetheirdistancefromtheroot
• Add1totheshortestdistancereceivedfromaneighbor
• IfrootchangedORshortestdistancetotherootchanged,sendallneighborsupdatedmessage(Y,d+1,X)
• Easytodesignroutingalgorithmsfortrees
• Nodescan“flood”packettoallothernodes
• Amazingproperties:
• Noroutingtablesneeded!• Nopacketswilleverloop.• Atleast(andexactly)onepacketmustreachthedestination
• Assumingnofailures
• Threefundamentalissues:
• Unnecessaryprocessingatendhosts(thatarenotthedestination)• Higherlatency• Loweravailablebandwidth
Recap:RoutingviaFloodingonSpanningTree…
Each Switch stores a table indicating the next hop for corresponding destination of a packet (called a routing table)
• SupposepacketfollowsPath1:Cornell-S#1-S#3-MIT
Recap:RoutingviaRoutingTables
Cornell
Harvard
MIT
Switch#1
Switch#2
Switch#3L1
L2 L3
L4
L5 L6
DESTINATION NEXT HOPCORNELL L1
MIT L3HARVARD L4
DESTINATION NEXT HOPCORNELL L2
MIT L5HARVARD L5
DESTINATION NEXT HOPCORNELL L5
MIT L6HARVARD L3
• Routingstate:collectionofroutingtablesacrossallnodes
• Twoquestions:• Howcanweverifygivenroutingstateisvalid?• Howcanweproducevalidroutingstate?
• Lastlecture:globalroutingstatevalidifandonlyif:• Therearenodeadends(otherthandestination)• Therearenoloops
• Today:Howtoproducevalidroutingstate?
Recap:RoutingTables
Questions?
• Easytoavoiddeadends
• Avoidingloopsishard
• Thekeydifferencebetweenroutingprotocolsishowtheyavoidloops!
ProducingValidRoutingState
• CreateTree,routeontree• E.g.,Spanningtreeprotocol(switchedEthernet)• Good:easy,no(persistent)loops,nodeadends• Not-so-good:unnecessaryprocessing,highlatency,lowbandwidth
• Obtainaglobalview:• E.g.,Linkstate(today)
• Distributedroutecomputation:
• E.g.,Distancevector• E.g.,BorderGatewayProtocol
• WewilltrytofinishLinkstateandDistancevectortoday
Fourflavorsofprotocols
RoutingMetrics
• Routinggoals:computepathswithminimumX
• X=numberof“hops”(nodesinthemiddle)
• X=latency• X=weight• X=failureprobability• …
• Generallyassumeeverylinkhas“cost”associatedwithit
• Wewanttominimizethecostoftheentirepath
• WewillfocusonasubsetofpropertiesX,where:
• Costofapath=sumofcostsofindividuallinks/nodesonthepath• E.g.,numberofhopsandlatency
Globalview
TwoAspectsofGlobalViewMethod
• Protocol:Whatwefocusontoday
• Wheretocreateglobalview
• Howtocreateglobalview• Disseminatingroutecomputation(ifnecessary)
• Whentorunroutecomputation
• Algorithm:computingloop-freepathsongraph
• Straightforwardtocomputelowestcostpaths
• UsingDijkstra’salgorithm(pleasestudy;algorithmscourse)
• Wewon’tspendtimeonthis
Wheretocreateglobalview?
• Oneoption:Centralserver• Collectsaglobalview• Computestheroutingtableforeachnode
• “Installs”routingtablesateachnode• Software-definedNetworks:laterincourse
• Secondoption:Ateachrouter• Eachroutercollectsaglobalview• ComputesitsownroutingtableusingLink-stateprotocol
• Link-stateroutingprotocol• OSPFisaspecificimplementationoflink-stateprotocol
• IETFRFC2328(IPv4)or5340(IPv6)
OverviewofLink-StateRouting
• Everyrouterknowsitslocal“linkstate”• Knowsstateoflinkstoneighbors• Up/down,andassociatedcost
• Arouterfloodsitslinkstatetoallotherrouters• Usesaspecialpacket—LinkStateAnnouncements(LSA)
• Announcementisdeliveredtoallnodes(nextslide)
• Hence,everyrouterlearnstheentirenetworkgraph
• Runsroutecomputationlocally
• Computingleastcostpathsfromthemtoallothernodes
• E.g.,usingDijkstra’salgorithm
HowdoesFloodingWork?
• “Linkstateannouncement”(LSA)arrivesonalinkatarouter
• Thatrouter:• Remembersthepacket
• Forwardsthepacketoutallotherlinks• Doesnotsenditouttheincominglink
• Why?
• Ifapreviouslyreceivedannouncementarrivesagain…
• Routerdropsit(noneedtoforwardagain)
Link-StateRouting
S1
S2
S3
S7S5
S6
S4
Host A
Host B
Host C
Host DHost E
EachNodeThenhasaGlobalView
S1
S2
S3
S7S5
S6
S4
Host A
Host B
Host C
Host DHost E
WhentoInitiateFloodingofannouncements?
• Topologychange• Linkfailures• Linkrecovery
• Configurationchange• Linkcostchange(whywouldonechangelinkcost?)
• Periodically• Refreshthelink-stateinformation
• Typically(say)30minutes
• Correctsforpossiblecorruptionofdata
MakingFloodsReliable
• ReliableFlooding• Ensureallnodesreceivesamelinkstateannouncements
• Noannouncementsdropped
• Ensureallnodesusethelatestversion
• Supposewecanimplementreliableflooding.Howcanitstillfail?
• Canyoueverhaveloopswithlink-staterouting?
• Again:Canyoueverhaveloopswithlink-staterouting?
AreLoopsStillPossible?
55
5 35
51
1
A
D E
F
CB
55
5 35
5
1
A
D E
F
CB
A and D think this is the path to C
E-C link fails, but D doesn’t know yet
E thinks that this the path to C
E reaches C via D, D reaches C via E Loop!
TransientDisruptions
55
5 35
5
1
A
D E
F
CB
55
5 35
5
1
A
D E
F
CB
• Inconsistentlink-stateviews• Someroutersknowaboutfailurebeforeothers
• Theshortestpathsarenolongerconsistent• Cancausetransientforwardingloops
• Transientloopsarestillaproblem!
Convergence
• Allroutershaveconsistentroutinginformation
• E.g.,allnodeshavingthesamelink-statedatabase
• Forwardingisconsistentafterconvergence• Allnodeshavethesamelink-statedatabase
• Allnodesforwardpacketsonsamepaths
• Butwhilestillconverging,badthingscanhappen
TimetoReachConvergence
• Sourcesofconvergencedelay?• Timetodetectfailure
• Timetofloodlink-stateinformation(~longestRTT)
• Timetorecomputeforwardingtables
• Performanceproblemsduringconvergenceperiod?
• Deadends• Loopingpackets• Andsomemorewe’llseelater….
LinkStateisConceptuallySimple
• Everyonefloodslinksinformation
• Everyonethenknowsgraphofthenetwork
• Everyoneindependentlycomputespathsonthegraph
• Allthecomplexityisinthedetails
DistributedRouteComputation
• Eachnodecomputingtheoutgoinglinksbasedon:
• Locallinkcosts• Informationadvertisedbyneighbors
• Algorithmsdifferinwhattheseexchangescontain
• Distance-vector:justthedistance(andnexthop)toeachdestination• Pathvector:theentirepathtoeachdestination
• Wewillfocusondistance-vectorfornow
DistributedComputationofRoutes
Recall:RoutingTables=CollectionofSpanningTrees
27
• Canweusethespanningtreeprotocol(withmodifications)?
• Messages(Y,d,X):ForrootY;FromnodeX;advertisingadistancedtoY
• InitiallyeachswitchXannounces(X,0,X)toitsneighbors
• FordestinationX:eachswitchZannounces(X,d_x,Z)toitsneighbors
• Switchesupdatetheirview• Uponreceivingmessage(Y,d,Y)fromZ,checkY’sid
• IfY’sid<currentroot:setrootdestination=Y
• Switchescomputetheirshortestdistancefromtherootdestination
• Addlinkcostctotheshortestdistancereceivedfromaneighbor
• IfrootchangedORshortestdistancetotherootdestinationchanged,sendallneighborsupdatedmessage(Y,d+c,X)
Letsfocusononedestination=Zfirst
28
• Messages(Y,d,X):ForrootY;FromnodeX;advertisingadistancedtoY
• InitiallyeachswitchZannounces(Z,0,Z)toitsneighbors
• Switchesupdatetheirview• Uponreceivingmessage(Z,d,Y)fromY,checkY’sid
• IfY’sid<currentroot:setrootdestination=Z
• Switchescomputetheirshortestdistancefromtherootdestination
• Addlinkcostctotheshortestdistancereceivedfromaneighbor
• IfrootchangedORshortestdistancetotherootdestinationchanged,sendallneighborsupdatedmessage(Z,d+c,X)
GroupExercise:
LetsruntheProtocolonthisexample
(destination=1)
Round1
Receive Send
1 (1,0,1)
2
3
4
5
6
7
Round2Receive Send
1(1,0,1)
2
3 (1,0,1) (1,1,3)
4
5 (1,0,1) (1,1,5)
6 (1,0,1) (1,1,6)
7
Round3Receive Send
1(1,0,1)(1,1,3),(1,1,5),
(1,1,6)
2 (1,1,3),(1,1,6) (1,2,2)
3(1,1,3)
4
5(1,1,5) (1,1,6)
6(1,1,6) (1,1,5)
7
Round4Receive Send
1(1,0,1)
2(1,2,2)
3(1,1,3) (1,2,2)
4 (1,2,2) (1,3,4)
5(1,1,5)
6(1,1,6) (1,2,2)
7 (1,2,2) (1,3,7)
Round5Receive Send
1(1,0,1)
2(1,2,2) (1,3,4),(1,3,7)
3(1,1,3)
4(1,3,4) (1,3,7)
5(1,1,5)
6(1,1,6)
7(1,3,7) (1,3,4)
GroupExercise:
LetsruntheProtocolonthisexample
(destination=2)
• Thesamealgorithmappliestoalldestinations
• Eachnodeannouncesdistancetoeachdest• Iam4hopsawayfromnodeA
• Iam6hopsawayfromnodeB
• Iam3hopsawayfromnodeC
• …
• Nodesareexchangingavectorofdistances
WhynotSpanningTreeProtocol?WhyDistance“Vector”?
Letssee…
37
• Messages(Y,d,X):ForrootY;FromnodeX;advertisingadistancedtoY
• InitiallyeachswitchXannounces(X,0,X)toitsneighbors
• FordestinationX:eachswitchZannounces(X,d_x,Z)toitsneighbors
• Switchesupdatetheirview• Uponreceivingmessage(Y,d,Y)fromZ,checkY’sid
• IfY’sid<currentroot:setrootdestination=Y
• Switchescomputetheirshortestdistancefromtherootdestination
• Addlinkcostctotheshortestdistancereceivedfromaneighbor
• IfrootchangedORshortestdistancetotherootdestinationchanged,sendallneighborsupdatedmessage(Y,d+c,X)
• Protocol:• Exchangingthatroutinginformationwithneighbors
• Whatandwhenforexchanges
• RIPisaprotocolthatimplementsDV(IETFRFC2080)
• Algorithm:
• Howtousetheinformationfromyourneighborstoupdateyour
ownroutingtables?
TwoAspectstoThisApproach
• Assumelinkbetweennodesx,yhascostc(x,y)
• Nodeufindsminimalcostpathsusingthefollowing
1.Neighborstellmetheirdistancetoallnodesv
• Eachneighborwgivesmea“distancevector”d(w,v)forallv
• “Distance”meanstotalcostoverpath
2.Nodeu’scosttoagivendestinationvisthen:• d(u,v)=Min_{nbrsw}[c(u,w)+d(w,v)]
3.Nodeutellsneighborsaboutd(u,v)…andprocessrepeats
GeneralApproachtoAlgorithm
ThreeNodeNetwork
x
y
z
2 1
7
x y zx 0 2 7y 2 0 1z 7 1 0
min { d(x,z) = cost (x,z),cost (x,y) + d(y,z)}
from
to
ThreeNodeNetwork
x
y
z
2 1
7
x y zx 0 2 3y 2 0 1z 7 1 0
min { d(x,z) = cost (x,z),cost (x,y) + d(y,z)}
from
to
MoreGenerally
x
y
u
2
7
min { d(x,z) = cost (x,y) + d(y,z),cost (x,u) + d(u,z),
}
z
w1
cost (x,w) + d(w,z)Bellman Ford equation
• Algorithm:
• NodesuseBellman-Fordtocomputedistances
• Protocol• Nodesexchangedistancevectors• Updatetheirownroutingtables• Andexchangeagain…• Details:whentoexchange,whattoexchange,etc….
FromAlgorithmtoProtocol
ThreeNodeNetwork
x
y
z
2 1
7
x y zx - - -y 2 0 1z - - -
x y zx 0 2 7y - - -z - - -
x y zx - - -y - - -z 7 1 0
This is y’s “distance vector”
from
to
ThreeNodeNetwork
x
y
z
2 1
7
x y zxy 2 0 1z
x y zx 0 2 7yz
x y zxyz 7 1 0
This is y’s “distance vector” 2 0 1
7 1 0
0 2 72 0 1
0 2 7
7 1 0
from
to
ThreeNodeNetwork
x
y
z
2 1
7
x y zxy 2 0 1z
x y zx 0 2 3y 2 0 1z 7 1 0
x y zxyz 7 1 0
This is y’s “distance vector”
0 2 72 0 1
0 2 7
7 1 0
from
to
ThreeNodeNetwork
x
y
z
2 1
7
x y zxy 2 0 1z
x y zx 0 2 3y 2 0 1z 3 1 0
x y zxyz 3 1 0
This is y’s “distance vector”
0 2 32 0 1
0 2 3
3 1 0
from
to
• Thethreenodenetwork:• Everyonewasneighborswitheveryoneelse
• Whathappensinalargernetwork?
• Iwillshowyouagraph• Workoutfirstfewstepsyourself
• Thenwecangooverthemtogether
AMoreComplicatedCase
FourNodeNetwork
x
y
v
1 1
2
x y v zxy 1 0 3z
z3
x y v zyvz 3 1 0
x y v zxv 2 0 1z
x y v zx 0 1 2yv
AfterFirstExchange
x
y
v
1 1
2
x y v zx 0 1 2y 1 0 3z 3 1 0
z3
x y v zy 1 0 3v 2 0 1z 3 1 0
x y v zx 0 1 2v 2 0 1z 3 1 0
x y v zx 0 1 2y 1 0 3v 2 0 1
RecomputingTables
x
y
v
1 1
2
x y v zx 0 1 2y 1 0 3z 3 1 0
z3
x y v zy 1 0 3v 2 0 1z 3 1 0
x y v zx 0 1 2v 2 0 1z 3 1 0
x y v zx 0 1 2y 1 0 3v 2 0 1
3
33
3
3
3
33
33
3
3
DoThisOneYourself
x
y
v
7 1
2
x y v zxy 7 0 3z
z3
x y v zyvz 3 1 0
x y v zxv 2 0 1z
x y v zx 0 7 2yv
Answers
x
y
v
7 1
2
x y v zx 0 6 2 3y 6 0 4 3z 3 3 1 0
z3
x y v zy 6 0 4 3v 2 4 0 1z 3 3 1 0
x y v zx 0 6 2 3v 2 4 0 1z 3 3 1 0
x y v zx 0 6 2 3y 6 0 4 3v 2 4 0 1
• Whendoyousendmessages?
• Whenanyofyourdistancesd(u,v)change
• Whataboutwhenc(u,v)changes
• Periodically,toensureconsistencybetweenneighbors
• Whatinformationdoyousend?
• Couldsendentirevector• Orjustupdatedentries
• Doyousendeveryonethesameinformation
• Considerthefollowingslides
OtherAspectsofProtocol
ThreeNodeNetwork
x
y
z
2 1
7
x y z
y
z
x y z
y
z
2 0 1
3 1 0
3 1 0
2 0 1
What happens now?
4
routing loop!
4
ThreeNodeNetwork
x
y
z
1
7
x y z
y
z
x y z
y
z
0 1
3 1 0
3 1 0
0 14
routing loop!
4
5
5
6
6
7
7
8
8
“Count to infinity scenario if c(x,z) was infinite
• Whywouldyouadvertiseapathbacktothepersonwhohasadviseditto
you?
• Tellingthemaboutyourentrygoingthroughthem
• Doesn’ttellthemanythingnew
• Perhapsmisleadsthemthatyouhaveanindependentpath
• Solution:ifyouareusinganext-hop’spath,then:• Tellthemnottouseyourpath(bytellingthemcostof\inf)
• Called“poisonedreverse”
• Anditiseasytogetthemconfused
HowCanYouFixThis?
ThreeNodeNetwork
x
y
z
2 1
7
x y z
y
z
x y z
y
z
2 0 1
1 0
3 1 0
2 0 1
∞Poisoned reverse ∞
∞7
7
8
Poisoned reverse
• Distancevectorprotocolscanconvergeslowly• Whilethesecornercasesarerare
• Theresultingconvergencedelayscanbesignificant
Convergence
• Senddistancevectorsbasedontimers:
• EverysooftensendcompleteDVtoyourneighbors
• Follow“splithorizon”rule:• Ifuseneighborforpathtox,don’tsendaroutingentryforxtotheneighbor
• WhenanyvaluesinyourDVchange,sendupdates
• Onlysendelementsthatchanged
• Specialcases:• Poisoningtheroute:send∞ when no longer have path• Poisonreverse:send∞ to neighbor you go through for path
MoreCompleteVersionofProtocol
ThreeNodeNetwork
x
y
z
1
7
x y z
y
z 1 0
0 1
∞Poisoned reverse∞Poisoning route
• Poisoningandsplithorizonhavesimilargoals
• Buttheyareusedindifferentcontexts
• Anditiseasytogetthemconfused
Poisoning,SplitHorizon,etc.
• Splithorizononlyworkswhensendingfullupdates
• Silenceaboutrouteisinterpretedaslackofroute• Whichonlymakessensewhensendingfullupdate
• Ifalwayssendfullupdates,noneedforpoison
• Lackofroutetodestinationhasclearmeaning
• Don’tsendthosepacketstome!
• CouldbebecauseIhavenoroute,orbecauseOhavearoutethroughyou
SplitHorizon:WhenandWhy
• Poisonnecessarywhensendingpartialupdates
• Silencewithpartialupdatesmeansnochange
• Itdoesnotmean“noroute”
• Mustexplicitlytellneighborsnottouseroute
• Poisoningaroute:tellingthetruthaboutabsenceofpath• Poisonreverse:haveapath,butlieaboutitsinceitgetsthroughthatneighbor
• Butonlyhavetopoisonifyouhaveeveradvertisedthatroute!
Poison:WhatandWhy
• Whynotalwayspoisoning?
• Nopossibleconfusion• Veryclearimplementation
• ConsiderthecaseofBerkeley’sedgerouter• Doesitwanttoadvertiseallroutesintheuniversetothenext-hopexternalrouter
• Allofthesepaths(exceptBerkeleydestinations)alwaysgothroughthatrouter
• Easierandmoreefficienttojustbesilentaboutthem
• Youneveradvertisetheseroutes,soyouneverhavetopoison
WhyUseSplitHorizonAtAll?
• IfIpostanewlectureschedule,anditcontainsnomidterm,youknow
thatthereisnomidterm
• IfIpostasmallchangetothelectureschedule,thefactthatIdonot
mentionamidtermdoesnotimplythatthereisnomidterm
• Wouldhavetoexplicitlysaythemidtermwascancelled
• ButifI’venevermentionedmidtermsinmyfullschedule,youcanassume
thatthereisstillnomidtermifImakeaminorchangetomyschedule
ExampleinRealLife
• Whenadvertisetoneighbors,sendthemyourpaths
• Whythismightbehelpful?
• Thispreventsloops,evenwhennotminimizingmetric
• Looppreventionisnowseparatefromroutinggoal
• Whatfoalsmightthisaccommodate?
• Policychoices
PathVector
• Everyroutercanmakeitsowndecisionsabout:
• Whichofitsneighborspathstouse(ifany)
• Whichofitspathstotelleachneighbor(ifany)
• Whatcouldgowrongwithsuchanalgorithm?
• Gotalktoyourfriendsforafewminutes
• ThenI’llaskforvolunteers
WhatMightGoWrongWithPV?
• Lackofconnectivity• IfBerkeleyrefusestouseroutesfromStanford,mightnotbeableto
reachsomeplacesintheInternet
• Lackofconvergence:• Theroutingalgorithmisnotguaranteedtoconverge
• Willdiscussthiswhenwegettointerdomainrouting
PossibleIssues
• Link-State:• Globalflood:eachrouter’slink-state(#ports)• Senditonceperlinkevent,orperiodically
• DistanceVector:• Sendlongervector(#dest)justtoneighbors
• Butmightenduptriggeringtheirupdates
• SenditeverytimeDVchanges(whichcanbeoften)
• Tradeoff:• LS:Senditeverywhereandbedoneinpredictabletime
• DV:Sendlocally,andperhapsiterateuntilconvergence
ComparisonofScalability
Top Related