lecture10-spt-routing-fundamentals · fundamentals of rou:ng spring 2018 rachit agarwal. my tuesday...
TRANSCRIPT
ComputerNetworks:ArchitectureandProtocols
CS4450
Lecture10
SpanningTreeProtocol
FundamentalsofRou:ng
Spring2018
RachitAgarwal
MyTuesdayeveningandWednesday….
• Wallowingintheshameoffailure
• Ileftyouconfusedattheendoflastlecture…• IfeltlikeIhavefailed,yetagain,asateacher…• Ifeltlikemyclassmusthateme,yetagain…
• Today’sgoals:• Redeemmyesteem,oratleast,tryit…
• Seeifmystudentscanloveme(again?)
2
• Firstattempt
• I(almost)emptiedmyqueues:-)
• Answeredalltheemails
• Updatedthewebsite(socketslides/code,PS2,…)• Thingsshould(hopefully)begooduntilthespringbreak!
• ProblemSet2solutionsreleasedonPiazza
• Quizsolutionswillbereleasedbythisweekend
3
MyTuesdayeveningandWednesday….
GoalsforToday’sLecture
• Bringusbackintoourloveforcomputernetworks(andme?)…
• QuickReview:SpanningTreeProtocol(+Failures)
• Whydoweneedroutinglayer?
• Whynotjustusespanningtreeprotocol?
• StartonFundamentalsofRouting
4
Recap:SpanningTreeProtocol(failuresonlaterslides)
5
• 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)
GroupExercise:
LetsruntheSpanningTreeProtocolonthisexample
Round1
Receive Send
1 (1,0,1)
2 (2,0,2)
3 (3,0,3)
4 (4,0,4)
5 (5,0,5)
6 (6,0,6)
7 (7,0,7)
Round2Receive Send
1(1,0,1)(3,0,3),(5,0,5),
(6,0,6)
2(2,0,2)(3,0,3),(4,0,4),(6,0,6),(7,0,7)
3(3,0,3) (1,0,1),(2,0,2) (1,1,3)
4(4,0,4) (2,0,2),(7,0,7) (2,1,4)
5(5,0,5) (1,0,1),(6,0,6) (1,1,5)
6(6,0,6)(1,0,1),(2,0,2),
(5,0,5)(1,1,6)
7(7,0,7) (2,0,2),(4,0,4) (2,1,7)
Round3Receive Send
1(1,0,1)(1,1,3),(1,1,5),
(1,1,6)
2(2,0,2)(1,1,3),(2,1,4),(1,1,6),(2,1,7)
(1,2,2)
3(1,1,3)
4(2,1,4) (2,1,7)
5(1,1,5) (1,1,6)
6(1,1,6) (1,1,5)
7(2,1,7) (2,1,4)
Round4Receive Send
1(1,0,1)
2(1,2,2)
3(1,1,3) (1,2,2)
4(2,1,4) (1,2,2) (1,3,4)
5(1,1,5)
6(1,1,6) (1,2,2)
7(2,1,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)
AfterRound5:WehaveourSpanningTree
• 3-1• 5-1• 6-1• 2-3• 4-2• 7-2
12
Questions?
• Protocolmustreacttofailures
• Failureoftherootnode• Failureofswitchesandlinks
• Rootnodesendsperiodicannouncementmessages
• Fewpossibleimplementations,butthisissimpletounderstand
• Otherswitchescontinueforwardingmessages
• Detectingfailuresthroughtimeout(softstate)
• Ifnowordfromroot,timeoutandsenda(Y,0,Y)messagetoallneighbors(inthegraph)!
• Ifmultiplemessageswithanewrootreceived,sendmessage(Y,d,X)
totheneighborsendingthemessage
14
SpanningTreeProtocol++(incorporatingfailures)
Supposelink2-4fails
• 4willsend(4,0,4)toallitsneighbors• 4willstopreceivingannouncementmessagesfromtheroot
• Why?
• Atsomepoint,7willrespondwith(1,3,7)
• 4willnowupdateto(1,4,4)andsendupdatemessage
• Newspanningtree!
15
Questions?
17
TheendofLinkLayer….
Andthebeginningofnetworklayer:-D
Builtontopof
reliabledelivery
Builtontopofbest-
effortforwarding
Builtontopof
best-effortrouting
Builtontopof
physicalbittransfer
• There’sonlyonepathfromsourcetodestination
• Howdoyoufindthatpath?Ideas?
• Easytodesignroutingalgorithmsfortrees
• Nodescan“flood”packettoallothernodes
Whydoweneedanetworklayer?
• Sendspackettoeverynodeinthenetwork
• Step1:IgnorethelinksnotbelongingtotheSpanningTree
• Step2:Originatingnodesends“flood”packetouteverylink(onspanningtree)
• Step3:Sendincomingpacketouttoalllinksotherthantheonethatsentthepacket
FloodingonaSpanningTree
FloodingExample
Source
Destination
1
3
2
7
6
5
4
FloodingExample
Source
Destination
1
3
2
7
6
5
4
Eventually all nodes are covered
One copy of packet delivered to destination
1
2
4
7
5
6
• There’sonlyonepathfromsourcetodestination
• Howdoyoufindthatpath?Ideas?
• Easytodesignroutingalgorithmsfortrees
• Nodescan“flood”packettoallothernodes
• Amazingproperties:
• Noroutingtablesneeded!• Nopacketswilleverloop.• Atleast(andexactly)onepacketmustreachthedestination
• Assumingnofailures
RoutingviaFloodingonSpanningTree…
Threefundamentalissues!
Source
Destination
1
3
2
7
6
5
4
1
2
4
7
5
6
Issue 1: Each host has to do unnecessary packet processing! (to decide whether the packet is destined to the host)
Source
Destination
1
3
2
7
6
5
4
Threefundamentalissues!
Issue 2: Higher latency! (The packets unnecessarily traverse much longer paths)
Source
Destination
1
3
2
7
6
5
4
Threefundamentalissues!
Issue 2: Lower bandwidth availability! (2-6 and 3-1 packets unnecessarily have to share bandwidth)
Questions?
• Networklayerperforms“routing”ofpacketstoalleviatetheseissues
• Usesroutingtables
• Letsunderstandroutingtablesfirst• Wewillseeroutingtablesarenothingbut…
• Guess?• Acollectionof(carefullyconstructed)spanningtrees
• Oneperdestination
Whydoweneedanetworklayer?
What path will a packet take from Cornell to MIT?
• Routingtablesallowfindingpathfromsourcetodestination
RoutingPacketsviaRoutingTables
Cornell
Harvard
MIT
Switch #1
Switch #2
Switch #3
• Findingpathforapacketfromsourcetodestination
RoutingPacketsviaRoutingTables
Cornell
Harvard
MIT
Switch #1
Switch #2
Switch #3
How to specify whether the packet should take Path 1 or Path 2?
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
RoutingTable
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
• Globalroutingstateisvalidif:• italwaysresultsindeliverpacketstotheirdestinations
• GoalofRoutingProtocols• Computeavalidstate
• Buthowtotellifaroutingstateisvalid?…• Thinkaboutit,whatcouldmakeroutingincorrect?
“ValidRoutingTables”(routingstate)
• Globalroutingstatevalidifandonlyif:• Therearenodeadends(otherthandestination)• Therearenoloops
• Adeadendiswhenthereisnooutgoinglink• Apacketarrives,but..
• theroutingtabledoesnothaveanoutgoinglink• Andthatnodeisnotthedestination
• Aloopiswhenapacketcyclesaroundthesamesetofnodesforever
ValidityofaRoutingState
• SupposepacketwantstogofromCornelltoMITusinggivenstate:
Example:RoutingwithDeadEnds
Cornell
Harvard
MIT
Switch #1
Switch #2
Switch #3L1
L2 L3
L4
L5 L6
DESTINATION NEXT HOPCORNELL L1
MIT L2HARVARD L4
DESTINATION NEXT HOP
CORNELL L2
HARVARD L5
DESTINATION NEXT HOPCORNELL L5
MIT L6HARVARD L3
No forwarding decision for MIT!
Dead End!Packet never reaches MIT
Example:RoutingwithLoops
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 L2HARVARD L5
DESTINATION NEXT HOPCORNELL L5
MIT L5HARVARD L3
• SupposepacketwantstogofromCornelltoMITusinggivenstate:
Loop!Packet never reaches MIT
• Howcanweverifygivenroutingstateisvalid?
• Howcanweproducevalidroutingstate?
TwoQuestions
• Checkvalidityofroutingstateforonedestinationatatime…
• Foreachnode:• Marktheoutgoinglinkwitharrowfortherequireddestination
• Therecanonlybeoneateachnode
• Eliminatealllinkswithnoarrows
• Lookwhat’sleft.Stateisvalidifandonlyif• Remaininggraphisaspanningtreewithdestinationassink
• Whyisthistrue?
• Tree->Noloops• Spanning(tree)->Nodeadends
CheckingValidityofaRoutingState
Example1
Example1:PickDestination
Example1:PutArrowsonOutgoingPorts
Example1:RemoveunusedLinks
Leaves Spanning Tree: Valid
Example2:
Example2:
Is this valid?
Example3:
Example3:
Is this valid?
• Simpletocheckvalidityofroutingstateforaparticulardestination
• Deadends:nodeswithoutarrows
• Loops:obvious,disconnectedfromdestinationandrestofthegraph
CheckingValidityofaRoutingState
• Howcanweverifygivenroutingstateisvalid?
• Howcanweproducevalidroutingstate?
TwoQuestions
• Easytoavoiddeadends
• Avoidingloopsishard
• Thekeydifferencebetweenroutingprotocolsishowtheyavoidloops!
• Trytothinkaloopavoidancedesignforfiveminutes
CreatingValidRoutingState
• Removeenoughlinkstocreateatreecontainingallnodes
• Soundsfamiliar?Spanningtrees!
• Ifthetopologyhasnoloops,thenjustmakesurenotsendingpacketsbackfromwheretheycame
• Thatcausesanimmediateloop
• Therefore,ifnoloopsintopologyandnoformationofimmediateloopsensuresvalidrouting
• However…threechallenges• Unnecessaryhostresourcesusedtoprocesspackets• Highlatency• Lowbandwidth(utilization)
#1:CreateTreeOutofTopology
• Aglobalviewofthenetworkmakescomputingpathswithoutloopseasy
• Manygraphalgorithmsforcomputingloop-freepaths
• Fore.g.,Dijkstra’sAlgorithm
• Gettingtheglobalviewofnetworkischallenging!
#2:ObtainaGlobalView
• Oftengettingaglobalviewofthenetworkisinfeasible• Distributedalgorithmstocomputefeasibleroute
• ApproachA:Findingoptimalrouteformaximizing/minimizingametric
• ApproachB:Findingfeasiblerouteviaexchangingpathsamongswitches
#3:DistributedRouteComputation
WelcometotheNetworkLayer!
• THEfunctionality:deliveringthedata
• THEprotocol:InternetProtocol(IP)• Toachieveitsfunctionality(deliveringthedata),IPprotocolhasthreeresponsibilities
• Addressing(nextlecture)• Encapsulatingdataintopackets(actuallydatagrams;nextlecture)
• Routing(usingavarietyofprotocols;severallectures)
Nextlecture!