ComputerNetworks:ArchitectureandProtocols
CS4450
Lecture10FundamentalsofRou4ng
RachitAgarwal
Announcements
• Quiz1solutionsandgradesposted• Average—26.7/30;median—30/30;std.dev.—6.1
• Livecodingsessiononthe02/27.Pleasebringyourlaptops.
• Prelimwillbe"inclass”on03/26.Nomakeup.
2
GoalsforToday’sLecture
• Recap:WhyNetworkLayer?
• Recap:TherightwaytothinkaboutRoutingTables…
• OurfirstNetworkLayerProtocol:LinkState
• OursecondNetworkLayerProtocol:Distance-vector
3
Recapfromlastlecture
• Whynotjustusespanningtreesacrosstheentirenetwork?
• Easytodesignroutingalgorithmsfor(spanning)trees
• Step1:Sourcenode“floods”itspacketonitsspanningtreelinks
• Step2:Wheneveranodereceivesapacket:
• Forwardsincomingpacketouttoalllinksotherthantheonethatsentthepacket
Recap:Whydoweneednetworklayer?
Recap:RoutingviaFlooding—Anexample
Source
DesVnaVon
1
3
2
7
6
5
4
Eventuallyallnodesarecovered
Onecopyofpacketdeliveredtodes4na4on
1
2
4
7
5
6
• Whynotjustusespanningtreesacrosstheentirenetwork?
• Easytodesignroutingalgorithmsfor(spanning)trees
• Step1:Sourcenode“floods”itspacketonitsspanningtreelinks
• Step2:Wheneveranodereceivesapacket:
• Forwardsincomingpacketouttoalllinksotherthantheonethatsentthepacket
• Threefundamentallimitations:• Unnecessaryprocessingatendhosts• Highlatency• LowBandwidthutilization
Recap:Whydoweneednetworklayer?
Networklayerusesrou4ngtablestoalleviatetheseissues
WelcometotheNetworkLayer!
• THEfunctionality:deliveringthedata
• THEprotocol:InternetProtocol(IP)• Toachieveitsfunctionality,IPprotocolhasthreeresponsibilities
• Addressing
• Encapsulatingdataintopackets
• Routing(usingavarietyofprotocols;severallectures)
Rou4ngtableentriesforapar4culardes4na4onforma(directed)spanningtreewiththatdes4na4onastheroot!!!!
• Letsfocusononedestination-MIT
Cornell
Harvard
MIT
Switch#1
Switch#2
Switch#3L1
L2 L3
L4
L5 L6
DESTINATION NEXTHOP
CORNELL L1
MIT L3
HARVARD L4
DESTINATION NEXTHOP
CORNELL L2
MIT L5
HARVARD L5
DESTINATION NEXTHOP
CORNELL L5
MIT L6
HARVARD L3
Recap:TherightwaytothinkaboutRoutingTables
• Routingtablesarenothingbut….• Acollectionof(directed)spanningtree• Oneforeachdestination
• RoutingProtocols• “n”spanningtreeprotocolsrunninginparallel
Recap:TherightwaytothinkaboutRoutingTables
• Globalroutingstatevalidifandonlyif:• Therearenodeadends(otherthandestination)• Therearenoloops
• Easytocheckvalidityofroutingstate
Recap:ValidityofaRoutingState
• Easytoavoiddeadends
• Avoidingloopsishard
• Thekeydifferencebetweenroutingprotocolsishowtheyavoidloops!
CreatingValidRoutingState
• CreateTree,routeontree• E.g.,Spanningtreeprotocol(switchedEthernet)• Good:easy,no(persistent)loops,nodeadends• Not-so-good:unnecessaryprocessing,highlatency,lowbandwidth
• Obtainaglobalview:• E.g.,Linkstate
• Distributedroutecomputation:
• E.g.,Distancevector• E.g.,BorderGatewayProtocol
Recap:Threeflavorsofprotocols
Questions?
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
AreLoopsStillPossible?
55
5 35
51
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
55
5 35
5
1
A
D E
F
CB
E thinks that this the path to C
E reaches C via D, D reaches C via E Loop!
• Canyoueverhaveloopswithlink-staterouting?
• Again:Canyoueverhaveloopswithlink-staterouting?
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!
ConvergenceinLink-StateRouting
• Eventually,allroutershaveconsistentroutinginformation
• E.g.,allnodeshavingthesamelink-statedatabase
• Here,eventuallymeans“ifnothingchangesafterawhile”
• Forwardingisconsistentafterconvergence• Allnodeshavethesamelink-statedatabase
• Allnodesforwardpacketsonsamepaths
• Butwhilestillconverging,badthingscanhappen
TimetoReachConvergence
• Sourcesofconvergencedelay?• Timetodetectfailure
• Timetofloodlink-stateinformation(~longestRTT)
• Timetorecomputeforwardingtables
• Performanceproblemsduringconvergenceperiod?
• Deadends• Loopingpackets• Andsomemorewe’llseelater….
LinkStateisConceptuallySimple
• Everyonefloodslinksinformation
• Everyonethenknowsgraphofthenetwork
• Everyoneindependentlycomputespathsonthegraph
• Allthecomplexityisinthedetails
#3:DistributedRouteComputation
• Eachnodecomputestheoutgoinglinks(foreachdestination)basedon:
• Locallinkcosts• Informationadvertisedbyneighbors
• Algorithmsdifferinwhattheseexchangescontain
• Distance-vector:justthedistance(andnexthop)toeachdestination• Pathvector:theentirepathtoeachdestination
• Wewillfocusondistance-vectorfornow
DistributedComputationofRoutes
Recall:RoutingTables=CollectionofSpanningTrees
30
• Canweusethespanningtreeprotocol(withmodifications)?
• Messages(Y,d,X):ForrootY;FromnodeX;advertisingadistancedtoY
• InitiallyeachswitchXannounces(X,0,X)toitsneighbors
Distancevector:acollectionof“n”STPinparallel
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)
• Thesameprotocol/algorithmappliestoalldestinations
• Eachnodeannouncesdistancetoeachdestination• Iam4hopsawayfromnodeA
• Iam6hopsawayfromnodeB
• Iam3hopsawayfromnodeC
• …
• Nodesareexchangingavectorofdistances
WhynotSpanningTreeProtocol?WhyDistance“Vector”?
TowardsDistanceVectorProtocol(withnofailures)
38
• Messages(Y,d,X):ForrootY;FromnodeX;advertisingadistancedtoY
• InitiallyeachswitchXannounces(X,0,X)toitsneighbors
• Switchesupdatetheirview• Uponreceivingmessage(Y,d,Z)fromZ,checkY’sid
• IfY’sid<currentroot:setrootdestination=Y
• Switchescomputetheirshortestdistancefromtherootdestination
• Ifcurrent_distance_to_Y>d+costoflinktoZ:• updatecurrent_distance_to_Y=d+costoflinktoZ
• IfrootchangedORshortestdistancetotherootdestinationchanged,sendallneighborsupdatedmessage(Y,d+c,X)
GroupExercise:
LetsruntheProtocolonthisexample
2
1
3
2 1
7
Round1
Receive Send
1 (1,0,1)
2 (2,0,2)
3 (3,0,3)
2
1
3
2 1
7
Round2
Receive Send
1(1,0,1)
(2,0,2),(3,0,3)
(2,2,1),(3,1,1)
2(2,0,2)
(1,0,1),(3,0,3)
(1,2,2),(3,7,2)
3(3,0,3)
(1,0,1),(2,0,2)
(1,1,3),(2,7,3)
2
1
3
2 1
7
Round3
Receive Send
1(1,0,1)(2,2,1),(3,1,1)
(1,2,2),(3,7,2),(1,1,3),(2,7,3)
2(1,2,2),(2,0,2),(3,7,2)
(2,2,1),(3,1,1),(1,1,3),(2,7,3)
(3,3,2)
3(1,1,3),(2,7,3),(3,0,3)
(2,2,1),(3,1,1),(1,2,2),(3,7,2)
(2,3,3)
2
1
3
2 1
7
Round4
Receive Send
1(1,0,1)(2,2,1),(3,1,1)
(3,3,2),(2,3,3)
2(1,2,2),(2,0,2),(3,3,2)
(2,3,3)
3(1,1,3),(2,3,3),(3,0,3)
(3,3,2)
2
1
3
2 1
7
TowardsDistance-vectorprotocolwithnext-hops(nofailures)
44
• Messages(Y,d,X):ForrootY;FromnodeX;advertisingadistancedtoY
• InitiallyeachswitchXannounces(X,0,X)toitsneighbors
• SwitchZupdatesitsview• Uponreceivingmessage(Y,d,X)fromX,checkY’sid
• IfY’sid<currentroot:setrootdestination=Y
• SwitchZcomputesitsshortestdistancefromtherootdestination
• Ifcurrent_distance_to_Y>d+costoflinktoX:• updatecurrent_distance_to_Y=d+costoflinktoX• updatenext_hop_to_destination=X
• IfrootchangedORshortestdistancetotherootdestinationchanged,sendallneighborsupdatedmessage(Y,d+cost-of-link-to-X,Z)
GroupExercise:
LetsruntheProtocolonthisexample
(thistimewithnext-hops)
2
1
3
2 1
7
Round1
Receive Send Next-hops
1 (1,0,1) [-]
2 (2,0,2) [-]
3 (3,0,3) [-]
2
1
3
2 1
7
Round2
Receive Send Next-hops
1(1,0,1)
(2,0,2),(3,0,3)
(2,2,1),(3,1,1)
[-,2,3]
2(2,0,2)
(1,0,1),(3,0,3)
(1,2,2),(3,7,2)
[1,-,3]
3(3,0,3)
(1,0,1),(2,0,2)
(1,1,3),(2,7,3)
[1,2,-]
2
1
3
2 1
7
Round3
Receive Send Next-hops
1(1,0,1)(2,2,1),(3,1,1)
(1,2,2),(3,7,2),(1,1,3),(2,7,3)
[-,2,3]
2(1,2,2),(2,0,2),(3,7,2)
(2,2,1),(3,1,1),(1,1,3),(2,7,3)
(3,3,2)[1,-,1]
3(1,1,3),(2,7,3),(3,0,3)
(2,2,1),(3,1,1),(1,2,2),(3,7,2)
(2,3,3)[1,1,-]
2
1
3
2 1
7
Round4
Receive Send Next-hops
1(1,0,1)(2,2,1),(3,1,1)
(3,3,2),(2,3,3)
[-,2,3]
2(1,2,2),(2,0,2),(3,3,2)
(2,3,3)[1,-,1]
3(1,1,3),(2,3,3),(3,0,3)
(3,3,2)[1,1,-]
2
1
3
2 1
7
DistanceVectorProtocol
50
• Messages(Y,d,X):ForrootY;FromnodeX;advertisingadistancedtoY
• InitiallyeachswitchXinitializesitsroutingtableto(X,0,-)anddistanceinfinitytoallotherdestinations
• Switchesannouncetheirentiredistancevectors(routingtablew/0nexthops)
• Uponreceivingaroutingtablefromanode(sayX),eachnodedoes:
• ForeachdestinationYintheannouncement(distance(X,Y)=d):
• Ifcurrent_distance_to_Y>d+costoflinktoX:• updatecurrent_distance_to_Y=d+costoflinktoX• updatenext_hop_to_destination=X
• Ifshortestdistancetoanydestinationchanged,sendallneighborsyourdistancevectors
• Protocol:• Exchangingthatroutinginformationwithneighbors
• Whatandwhenforexchanges
• RIPisaprotocolthatimplementsDV(IETFRFC2080)
• Algorithm:
• Howtousetheinformationfromyourneighborstoupdateyour
ownroutingtables?
TwoAspectstoThisApproach
GroupExercise:
LetsruntheProtocolagainonthisexample
(thistimewithdistancevectors)
2
1
3
2 1
7
Round1
2
1
3
2 1
7
distance next-hop1 0 -2 infinity3 infinity
distance next-hop1 infinity2 0 -3 infinity
distance next-hop1 infinity2 infinity3 0 -
Round2
2
1
3
2 1
7
distance next-hop1 0 -2 2 23 1 3
distance next-hop1 2 12 0 -3 7 3
distance next-hop1 1 12 7 23 0 -
Round3
2
1
3
2 1
7
distance next-hop1 0 -2 2 23 1 3
distance next-hop1 2 12 0 -3 3 1
distance next-hop1 1 12 3 13 0 -
Round4
2
1
3
2 1
7
distance next-hop1 0 -2 2 23 1 3
distance next-hop1 2 12 0 -3 3 1
distance next-hop1 1 12 3 13 0 -
• Algorithm:
• NodesuseBellman-Fordtocomputedistances
• Protocol• Nodesexchangedistancevectors• Updatetheirownroutingtables• Andexchangeagain…• Details:whentoexchange,whattoexchange,etc….
FromAlgorithmtoProtocol
• Whendoyousendmessages?
• Whenanyofyourdistancesd(u,v)change
• Periodically,toensureconsistencybetweenneighbors
• Whatinformationdoyousend?
• Couldsendentirevector• Orjustupdatedentries
• Doyousendeveryonethesameinformation?
• Nextlecture
OtherAspectsofProtocol
Nextlecture!HappyFebruaryBreak!!