lecture08-queueing-delay-switched-Ethernet · lecture08-queueing-delay-switched-Ethernet.key...

Preview:

Citation preview

ComputerNetworks:ArchitectureandProtocols

CS4450

Lecture8

SwitchedEthernet

SpanningTreeProtocol

RachitAgarwal

GoalsforToday’sLecture

• Experience(thebeautyof)SpanningTreeProtocol

• Whydoweneednetworklayer?

• WhynotjustuseswitchedEthernetacrosstheInternet?

2

Recap:LinkLayer

• Originallyabroadcastchannel• MACaddresses(really,names)

• CSMA/CD

• Remember:Exponentialback-off(moreinproblemset2)

• WhydoesEthernetuseframes?

• HowLinkLayerbuildsontopofPhysicalLayer(thatusesbits)• Boundsonnetworklengthand/orminimumframesize

• Duetopropagationdelays

• Morerecently:switchedEthernet

• Broadcaststorm!

3

Recap:Ethernet“Frames”

• Preamble:

• 7bytesforclocksynchronization• 1bytetoindicatestartoftheframe

• Names:6+6bytes(MACnames/addresses)

• Protocoltype:2bytes,indicatinghigherlayerprotocol(e.g.,IP)

• Datapayload:max1500bytes,minimum46bytes

• CRC:4bytesforerrordetection

• +Trailer:1bytetoindicateendoftheframe(rightbeforeCRC)

4

Recap:SwitchedEthernet

• Enablesconcurrentcommunication

• HostAcantalktoC,whileBtalkstoD• Nocollisions->noneedforCSMA,CD

• Noconstraintsonlinklengthsorframesize

5

Recap:Broadcaststorm

6

HowtoavoidtheBroadcastStormProblem?

7

Getridoftheloops!

Letsgetbacktothegraphrepresentation!

8

EasiestWaytoAvoidLoops

• Useanetworktopology(graph)whereloopisimpossible!

• Takearbitrarytopology(graph)

• Buildspanningtree• Subgraphthatincludesallverticesbutcontainsnocycles• Linksnotinthespanningtreearenotusedinforwardingframes

• Onlyonepathtodestinationsonspanningtrees• Sodon'thavetoworryaboutloops!

9

ConsiderGraph

10

MultipleSpanningTrees

11

Questions?

SpanningTreeApproach

• Takearbitrarytopology

• Picksubsetoflinksthatformaspanningtree

• Onlyforwardpacketsonthespanningtree• =>Noloops• =>Nobroadcaststorm

13

SpanningTreeProtocol

• Protocolbywhichbridgesconstructaspanningtree

• Niceproperties• Zeroconfiguration(byoperatorsorusers)• Selfhealing

• Stillusedtoday

• Constraintsforbackwardscompatibility

• Nochangestoend-hosts• Maintainplug-n-playaspect

• EarlierEthernetachievedplug-n-playbyleveragingabroadcastmedium

• Canwedothesameforaswitchedtopology?

14

AlgorithmhasTwoAspects…

• Pickaroot:• Destinationtowhichtheshortestpathsgo• Picktheonewiththesmallestidentifier(MACname/address)

• Computetheshortestpathstotheroot

• Noshortestpathcanhaveacycle• Onlykeepthelinksontheshortestpath• Breaktiesinsomeway

• soweonlykeeponeshortestpathfromeachnode

• Ethernet’sspanningtreeconstructiondoesbothwithasinglealgorithm

15

BreakingTies

• Whentherearemultipleshortestpathstotheroot:

• Choosethepathvianeighborswitchwiththesmallestidentifier

• Onecoulduseanytiebreakingsystem

• Thisisjustaneasyonetorememberandimplement

16

ConstructingaSpanningTree

• Messages(Y,d,X)

• ProposingYastheroot• FromnodeX

• AndadvertisingadistancedbetweenXandY

• Switcheselectthenodewithsmallestidentifier(MACaddress)asroot

• Yinmessages

• Eachswitchdeterminesifalinkisonitsshortestpathtotheroot

• Ifnot,excludesitfromthetree

• dtoYinthemessageisusedtodeterminethis

17

StepsinSpanningTreeProtocol

• Messages(Y,d,X)

• ProposingrootY;fromnodeX;advertisingadistancedtoY

• Initiallyeachswitchproposesitselfastheroot• thatis,switchXannounces(X,0,X)toitsneighbors

• EachswitchXupdatesitsview• Uponreceivingmessage(Y,d,Z)fromZ,checkY’sid

• IfY’sid<currentroot:setroot=Y• Setnext-hop=Z

• Switchescomputetheirdistancefromtheroot

• Add1totheshortestdistancereceivedfromaneighbor

• IfrootchangedORshortestdistancetotherootchanged:• sendneighborsupdatedmessage(Y,d+1,X)

18

GroupExercise:

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

Round2

Receive SendNexthop

1(1,0,1)(3,0,3),(5,0,5),

(6,0,6)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)(1,0,1),(2,0,2),

(5,0,5)(1,1,6) 1

7(7,0,7) (2,0,2),(4,0,4) (2,1,7) 2

Round3

Receive Send Nexthop

1(1,0,1)(1,1,3),(1,1,5),

(1,1,6)1

2(2,0,2)(1,1,3),(2,1,4),(1,1,6),(2,1,7)

(1,2,2)3

(or6)

3(1,1,3) 1

4(2,1,4) (2,1,7) 2

5(1,1,5) (1,1,6) 1

6(1,1,6) (1,1,5) 1

7(2,1,7) (2,1,4) 2

Round4

Receive Send Nexthop

1(1,0,1) 1

2(1,2,2) 3

3(1,1,3) (1,2,2) 1

4(2,1,4) (1,2,2) (1,3,4) 2

5(1,1,5) 1

6(1,1,6) (1,2,2) 1

7(2,1,7) (1,2,2) (1,3,7) 2

Round5

Receive SendNexthop

1(1,0,1) 1

2(1,2,2) (1,3,4),(1,3,7) 3

3(1,1,3) 1

4(1,3,4) (1,3,7) 2

5(1,1,5) 1

6(1,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

25

Questions?

• Protocolmustreacttofailures

• Failureoftherootnode• Failureofswitchesandlinks

• Rootnodesendsperiodicannouncementmessages

• Fewpossibleimplementations,butthisissimpletounderstand

• Otherswitchescontinueforwardingmessages

• Detectingfailuresthroughtimeout(softstate)

• Ifnowordfromroot,timeoutandsenda(Y,0,Y)messagetoallneighbors(inthegraph)!

• Ifmultiplemessageswithanewrootreceived,sendmessage(Y,d,X)

totheneighborsendingthemessage

27

SpanningTreeProtocol++(incorporatingfailures)

Supposelink2-4fails

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

• Why?

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

• 4willnowupdateto(1,4,4)andsendupdatemessage

• Newspanningtree!

28

Questions?

30

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

Eventuallyallnodesarecovered

Onecopyofpacketdeliveredtodesenaeon

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!

(todecidewhetherthepacketisdesenedtothehost)

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• Wewillseeroutingtablesarenothingbut…

Whydoweneedanetworklayer?