lecture10-spt-routing-fundamentals · fundamentals of rou:ng spring 2018 rachit agarwal. my tuesday...

52
Computer Networks: Architecture and Protocols CS4450 Lecture 10 Spanning Tree Protocol Fundamentals of Rou:ng Spring 2018 Rachit Agarwal

Upload: others

Post on 14-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

ComputerNetworks:ArchitectureandProtocols

CS4450

Lecture10

SpanningTreeProtocol

FundamentalsofRou:ng

Spring2018

RachitAgarwal

Page 2: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

MyTuesdayeveningandWednesday….

• Wallowingintheshameoffailure

• Ileftyouconfusedattheendoflastlecture…• IfeltlikeIhavefailed,yetagain,asateacher…• Ifeltlikemyclassmusthateme,yetagain…

• Today’sgoals:• Redeemmyesteem,oratleast,tryit…

• Seeifmystudentscanloveme(again?)

2

Page 3: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Firstattempt

• I(almost)emptiedmyqueues:-)

• Answeredalltheemails

• Updatedthewebsite(socketslides/code,PS2,…)• Thingsshould(hopefully)begooduntilthespringbreak!

• ProblemSet2solutionsreleasedonPiazza

• Quizsolutionswillbereleasedbythisweekend

3

MyTuesdayeveningandWednesday….

Page 4: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

GoalsforToday’sLecture

• Bringusbackintoourloveforcomputernetworks(andme?)…

• QuickReview:SpanningTreeProtocol(+Failures)

• Whydoweneedroutinglayer?

• Whynotjustusespanningtreeprotocol?

• StartonFundamentalsofRouting

4

Page 5: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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)

Page 6: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

GroupExercise:

LetsruntheSpanningTreeProtocolonthisexample

Page 7: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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)

Page 8: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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)

Page 9: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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)

Page 10: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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)

Page 11: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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)

Page 12: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

AfterRound5:WehaveourSpanningTree

• 3-1• 5-1• 6-1• 2-3• 4-2• 7-2

12

Page 13: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Questions?

Page 14: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• 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)

Page 15: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Supposelink2-4fails

• 4willsend(4,0,4)toallitsneighbors• 4willstopreceivingannouncementmessagesfromtheroot

• Why?

• Atsomepoint,7willrespondwith(1,3,7)

• 4willnowupdateto(1,4,4)andsendupdatemessage

• Newspanningtree!

15

Page 16: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Questions?

Page 17: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

17

TheendofLinkLayer….

Andthebeginningofnetworklayer:-D

Builtontopof

reliabledelivery

Builtontopofbest-

effortforwarding

Builtontopof

best-effortrouting

Builtontopof

physicalbittransfer

Page 18: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• There’sonlyonepathfromsourcetodestination

• Howdoyoufindthatpath?Ideas?

• Easytodesignroutingalgorithmsfortrees

• Nodescan“flood”packettoallothernodes

Whydoweneedanetworklayer?

Page 19: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Sendspackettoeverynodeinthenetwork

• Step1:IgnorethelinksnotbelongingtotheSpanningTree

• Step2:Originatingnodesends“flood”packetouteverylink(onspanningtree)

• Step3:Sendincomingpacketouttoalllinksotherthantheonethatsentthepacket

FloodingonaSpanningTree

Page 20: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

FloodingExample

Source

Destination

1

3

2

7

6

5

4

Page 21: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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

Page 22: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• There’sonlyonepathfromsourcetodestination

• Howdoyoufindthatpath?Ideas?

• Easytodesignroutingalgorithmsfortrees

• Nodescan“flood”packettoallothernodes

• Amazingproperties:

• Noroutingtablesneeded!• Nopacketswilleverloop.• Atleast(andexactly)onepacketmustreachthedestination

• Assumingnofailures

RoutingviaFloodingonSpanningTree…

Page 23: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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)

Page 24: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Source

Destination

1

3

2

7

6

5

4

Threefundamentalissues!

Issue 2: Higher latency! (The packets unnecessarily traverse much longer paths)

Page 25: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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)

Page 26: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Questions?

Page 27: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Networklayerperforms“routing”ofpacketstoalleviatetheseissues

• Usesroutingtables

• Letsunderstandroutingtablesfirst• Wewillseeroutingtablesarenothingbut…

• Guess?• Acollectionof(carefullyconstructed)spanningtrees

• Oneperdestination

Whydoweneedanetworklayer?

Page 28: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

What path will a packet take from Cornell to MIT?

• Routingtablesallowfindingpathfromsourcetodestination

RoutingPacketsviaRoutingTables

Cornell

Harvard

MIT

Switch #1

Switch #2

Switch #3

Page 29: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Findingpathforapacketfromsourcetodestination

RoutingPacketsviaRoutingTables

Cornell

Harvard

MIT

Switch #1

Switch #2

Switch #3

How to specify whether the packet should take Path 1 or Path 2?

Page 30: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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

Page 31: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Globalroutingstateisvalidif:• italwaysresultsindeliverpacketstotheirdestinations

• GoalofRoutingProtocols• Computeavalidstate

• Buthowtotellifaroutingstateisvalid?…• Thinkaboutit,whatcouldmakeroutingincorrect?

“ValidRoutingTables”(routingstate)

Page 32: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Globalroutingstatevalidifandonlyif:• Therearenodeadends(otherthandestination)• Therearenoloops

• Adeadendiswhenthereisnooutgoinglink• Apacketarrives,but..

• theroutingtabledoesnothaveanoutgoinglink• Andthatnodeisnotthedestination

• Aloopiswhenapacketcyclesaroundthesamesetofnodesforever

ValidityofaRoutingState

Page 33: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• 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

Page 34: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

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

Page 35: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Howcanweverifygivenroutingstateisvalid?

• Howcanweproducevalidroutingstate?

TwoQuestions

Page 36: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Checkvalidityofroutingstateforonedestinationatatime…

• Foreachnode:• Marktheoutgoinglinkwitharrowfortherequireddestination

• Therecanonlybeoneateachnode

• Eliminatealllinkswithnoarrows

• Lookwhat’sleft.Stateisvalidifandonlyif• Remaininggraphisaspanningtreewithdestinationassink

• Whyisthistrue?

• Tree->Noloops• Spanning(tree)->Nodeadends

CheckingValidityofaRoutingState

Page 37: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Example1

Page 38: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Example1:PickDestination

Page 39: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Example1:PutArrowsonOutgoingPorts

Page 40: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Example1:RemoveunusedLinks

Leaves Spanning Tree: Valid

Page 41: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Example2:

Page 42: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Example2:

Is this valid?

Page 43: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Example3:

Page 44: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Example3:

Is this valid?

Page 45: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Simpletocheckvalidityofroutingstateforaparticulardestination

• Deadends:nodeswithoutarrows

• Loops:obvious,disconnectedfromdestinationandrestofthegraph

CheckingValidityofaRoutingState

Page 46: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Howcanweverifygivenroutingstateisvalid?

• Howcanweproducevalidroutingstate?

TwoQuestions

Page 47: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Easytoavoiddeadends

• Avoidingloopsishard

• Thekeydifferencebetweenroutingprotocolsishowtheyavoidloops!

• Trytothinkaloopavoidancedesignforfiveminutes

CreatingValidRoutingState

Page 48: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Removeenoughlinkstocreateatreecontainingallnodes

• Soundsfamiliar?Spanningtrees!

• Ifthetopologyhasnoloops,thenjustmakesurenotsendingpacketsbackfromwheretheycame

• Thatcausesanimmediateloop

• Therefore,ifnoloopsintopologyandnoformationofimmediateloopsensuresvalidrouting

• However…threechallenges• Unnecessaryhostresourcesusedtoprocesspackets• Highlatency• Lowbandwidth(utilization)

#1:CreateTreeOutofTopology

Page 49: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Aglobalviewofthenetworkmakescomputingpathswithoutloopseasy

• Manygraphalgorithmsforcomputingloop-freepaths

• Fore.g.,Dijkstra’sAlgorithm

• Gettingtheglobalviewofnetworkischallenging!

#2:ObtainaGlobalView

Page 50: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

• Oftengettingaglobalviewofthenetworkisinfeasible• Distributedalgorithmstocomputefeasibleroute

• ApproachA:Findingoptimalrouteformaximizing/minimizingametric

• ApproachB:Findingfeasiblerouteviaexchangingpathsamongswitches

#3:DistributedRouteComputation

Page 51: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

WelcometotheNetworkLayer!

• THEfunctionality:deliveringthedata

• THEprotocol:InternetProtocol(IP)• Toachieveitsfunctionality(deliveringthedata),IPprotocolhasthreeresponsibilities

• Addressing(nextlecture)• Encapsulatingdataintopackets(actuallydatagrams;nextlecture)

• Routing(usingavarietyofprotocols;severallectures)

Page 52: lecture10-SPT-routing-fundamentals · Fundamentals of Rou:ng Spring 2018 Rachit Agarwal. My Tuesday evening and Wednesday ... • 7-2 12. Questions? • Protocol must react to failures

Nextlecture!