lecture09-switched-ethernet -network-layer › courses › cs4450 › 2019sp ›...
TRANSCRIPT
ComputerNetworks:ArchitectureandProtocols
CS4450
Lecture9SpanningTreeProtocolWhyNetworkLayer?
RachitAgarwal
GoalsforToday’sLecture
• FinishSpanningTreeProtocol
• Whydoweneednetworklayer?
• WhynotjustuseswitchedEthernetacrosstheInternet?
2
RecapofLinkLayersofar
3
• TraditionalLinkLayer:BroadcastEthernet• CSMA/CD
• Randomaccessonabroadcastchannel
• ExponentialBackoff• WhyFrames?
• Toincorporatesentinelbitsforidentifyingframestart/end
• Toincorporatelinklayersourceanddestinationnames
• ToincorporateCRCforcheckingcorrectnessofreceivedframes
• ModernLinkLayer:SwitchedEthernet
• Why?
• ScalabilitylimitsoftraditionalEthernet
• Why?
• Detectingcollisionsonabroadcastchannel
Recap:Linklayer
4
Recap:SwitchedEthernet
• Enablesconcurrentcommunication
• HostAcantalktoC,whileBtalkstoD• Nocollisions->noneedforCSMA,CD
• Noconstraintsonlinklengthsorframesize
5
Recap:Broadcaststorm
6
Recap:AvoidingBroadcastStormProblem
7
Gettingridofloops
using
SpanningTreeProtocol
Recap:SpanningTreedefinition
• Subgraphthatincludesallverticesbutcontainsnocycles• Linksnotinthespanningtreearenotusedinforwardingframes
8
Questions?
AlgorithmhasTwoAspects…
• Pickaroot:• Picktheonewiththesmallestidentifier(MACname/address)
• Computetheshortestpathstotheroot
• Onlykeepthelinksontheshortestpath• Breaktiesinsomeway
• soweonlykeeponeshortestpathfromeachnode
• Oneapproach:Choosethepathvianeighborswitchwiththesmallestidentifier
• Ethernet’sspanningtreeconstructiondoesbothwithasinglealgorithm
10
StepsinSpanningTreeProtocol(assumingalldelays=1)• Messages(Y,d,X)
• ProposingrootY;fromnodeX;advertisingadistancedtoY
• Initiallyeachswitchproposesitselfastheroot• thatis,switchXannounces(X,0,X)toitsneighbors
• Switchesupdatetheirview;eachswitchZ:• Uponreceivingmessage(Y,d,X)fromX,checkY’sid
• IfY’sid<currentroot:setroot=Y• Setnext-hop=X
• Switchescomputetheirdistancefromtheroot;eachswitchZ:
• Shortestdistancetoroot=d+distancefromX=d+1
• IfrootchangedORshortestdistancetotherootchanged:• SwitchZsendsneighborsupdatedmessage(Y,d+1,Z)
11
LetsruntheSpanningTreeProtocolonthisexample
(assumealllinkshave“distance”1)
Round1
Receive Send Next-hop
1 (1,0,1) 1
2 (2,0,2) 2
3 (3,0,3) 3
4 (4,0,4) 4
5 (5,0,5) 5
6 (6,0,6) 6
7 (7,0,7) 7
Round2Receive Send
Nexthop
1(1,0,1) (3,0,3),(5,0,5) 1
2(2,0,2)(3,0,3),(4,0,4),(6,0,6),(7,0,7)
2
3(3,0,3) (1,0,1),(2,0,2) (1,1,3) 1
4(4,0,4) (2,0,2),(7,0,7) (2,1,4) 2
5(5,0,5) (1,0,1),(6,0,6) (1,1,5) 1
6(6,0,6) (2,0,2),(5,0,5) (2,1,6) 2
7(7,0,7) (2,0,2),(4,0,4) (2,1,7) 2
Round3Receive Send Nexthop
1 (1,1,3),(1,1,5) 1
2(1,1,3),(2,1,4),(2,1,6),(2,1,7)
(1,2,2) 3
3(1,1,3) 1
4(2,1,4) (2,1,7) 2
5(1,1,5) (2,1,6) 1
6(2,1,6) (1,1,5) (1,2,5) 5
7(2,1,7) (2,1,4) 2
Round4Receive Send Nexthop
1 1
2(1,2,2) (1,2,6) 3
3 (1,2,2) 1
4 (1,2,2) (1,3,4) 2
5 (1,2,6) 1
6(1,2,6) (1,2,2) 5
7 (1,2,2) (1,3,7) 2
Round5Receive Send
Nexthop
1 1
2 (1,3,4),(1,3,7) 3
3 1
4(1,3,4) (1,3,7) 2
5 1
6 1
7(1,3,7) (1,3,4) 2
AfterRound5:WehaveourSpanningTree
• 3-1• 5-1• 6-1• 2-3• 4-2• 7-2
18
Questions?
SpanningTreeProtocol(++Incorporatingdistances)• Messages(Y,d,X)
• ProposingrootY;fromnodeX;advertisingadistancedtoY
• Initiallyeachswitchproposesitselfastheroot• thatis,switchXannounces(X,0,X)toitsneighbors
• Switchesupdatetheirview;eachswitchZ:• Uponreceivingmessage(Y,d,X)fromX,checkY’sid
• IfY’sid<currentroot:setroot=Y• Setnext-hop=X
• Switchescomputetheirdistancefromtheroot;eachswitchZ:
• Shortestdistancetoroot=d+distanceTo(X)
• IfrootchangedORshortestdistancetotherootchanged:• switchZsendsneighborsupdatedmessage(Y,d+distanceTo(X),Z)
20
• Protocolmustreacttofailures
• Failureoftherootnode• Failureofswitchesandlinks
• Rootnodesendsperiodicannouncementmessages
• Fewpossibleimplementations,butthisissimpletounderstand
• Otherswitchescontinueforwardingmessages
• Detectingfailuresthroughtimeout(softstate)
• Ifnowordfromroot,timeoutandsenda(Y,0,Y)messagetoallneighbors(inthegraph)!
• Ifmultiplemessageswithanewrootreceived,sendmessage(Y,d,X)totheneighborsendingthemessage
21
SpanningTreeProtocol++(incorporatingfailures)
Example:Supposelink2-4fails
• 4willsend(4,0,4)toallitsneighbors• 4willstopreceivingannouncementmessagesfromtheroot
• Why?
• Atsomepoint,7willrespondwith(1,3,7)
• 4willnowupdateto(1,4,4)andsendupdatemessage
• Newspanningtree!
22
Questions?
24
TheendofLinkLayer….
Andthebeginningofnetworklayer:-D
Builtontopofreliabledelivery
Builtontopofbest-effortforwarding
Builtontopofbest-effortrouting
Builtontopofphysicalbittransfer
• Whynotjustusespanningtreesacrosstheentirenetwork?
• Easytodesignroutingalgorithmsfor(spanning)trees
• Nodescan“flood”packettoallothernodes
Whydoweneedanetworklayer?
• Sendspackettoeverynodeinthenetwork
• Step1:IgnorethelinksnotbelongingtotheSpanningTree
• Step2:Originatingnodesends“flood”packetouteverylink(onspanningtree)
• Step3:Sendincomingpacketouttoalllinksotherthantheonethatsentthepacket
FloodingonaSpanningTree
FloodingExample
Source
Deshnahon
1
3
2
7
6
5
4
FloodingExample
Source
Destination
1
3
2
7
6
5
4
Eventuallyallnodesarecovered
Onecopyofpacketdeliveredtodesdnadon
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
Issue1:Eachhosthastodounnecessarypacketprocessing!(todecidewhetherthepacketisdesdnedtothehost)
Source
Destination
1
3
2
7
6
5
4
Threefundamentalissues!
Issue2:Higherlatency!(Thepacketsunnecessarilytraversemuchlongerpaths)
Source
Destination
1
3
2
7
6
5
4
Threefundamentalissues!
Issue3:Lowerbandwidthavailability!(2-6and3-1packetsunnecessarilyhavetosharebandwidth)
Questions?
• Networklayerperforms“routing”ofpacketstoalleviatetheseissues
• Usesroutingtables
• Letsunderstandroutingtablesfirst
Whydoweneedanetworklayer?
WhatpathwillapackettakefromCornelltoMIT?
• Routingtablesallowfindingpathfromsourcetodestination
RoutingPacketsviaRoutingTables
Cornell
Harvard
MIT
Switch#1
Switch#2
Switch#3
• Findingpathforapacketfromsourcetodestination
RoutingPacketsviaRoutingTables
Cornell
Harvard
MIT
Switch#1
Switch#2
Switch#3
HowtospecifywhetherthepacketshouldtakePath1orPath2?
EachSwitchstoresatableindicadngthenexthopforcorrespondingdesdnadonofapacket(calledaroudngtable)
• SupposepacketfollowsPath1:Cornell-S#1-S#3-MIT
RoutingTable
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
Seesomethinginteresdng?
• Letsfocusononedestination-MIT
RoutingTable:Therightwaytothinkaboutthem
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
Roudngtableentriesforapardculardesdnadonforma(directed)spanningtreewiththatdesdnadonastheroot!!!!
• Letsfocusononedestination-MIT
RoutingTable:Therightwaytothinkaboutthem
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
• Routingtablesarenothingbut….• Acollectionof(directed)spanningtree• Oneforeachdestination
• RoutingProtocols• “n”spanningtreeprotocolsrunninginparallel
RoutingTable:Therightwaytothinkaboutthem
• 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
L5L6
DESTINATION NEXTHOP
CORNELL L1
MIT L2
HARVARD L4
DESTINATION NEXTHOP
CORNELL L2
HARVARD L5
DESTINATION NEXTHOP
CORNELL L5
MIT L6
HARVARD L3
NoforwardingdecisionforMIT!
DeadEnd!PacketneverreachesMIT
Example:RoutingwithLoops
Cornell
Harvard
MIT
Switch#1
Switch#2
Switch#3L1
L2 L3
L4
L5L6
DESTINATION NEXTHOP
CORNELL L1
MIT L3
HARVARD L4
DESTINATION NEXTHOP
CORNELL L2
MIT L2
HARVARD L5
DESTINATION NEXTHOP
CORNELL L5
MIT L5
HARVARD L3
• SupposepacketwantstogofromCornelltoMITusinggivenstate:
Loop!PacketneverreachesMIT
• 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
LeavesSpanningTree:Valid
Example2:
Example2:
Isthisvalid?
Example3:
Example3:
Isthisvalid?
• 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(nextlecture)• Routing(usingavarietyofprotocols;severallectures)
Nextlecture!