lecture09-switched-Ethernet -network-layer · Built on top of reliable delivery Built on top of...

Preview:

Citation preview

ComputerNetworks:ArchitectureandProtocols

CS4450

Lecture9WhyNetworkLayer?

FundamentalsofRou:ng

RachitAgarwal

Announcements

• Iamback!

• Allemailsanswered,caughtuponsleep,readytoroll!

• Livecodingsessiononthe27th.Pleasebringyourlaptops.

• Prelimwillbe"inclass”on03/26.Nomakeup.

• ProblemSet2solutionsareposted(Piazza)

• Project1posted(coursewebpage)

• Emails:Pleasepleaseplease

• ccyourTAs(Katie,Qizhe)

2

GoalsforToday’sLecture

• Weareatastagewhereyouhaveastrongfoundationinnetworks

• Sharingnetworks,architecturalprinciples,designgoals• And,youmaynotrealize,butyouunderstandmanynewtradeoffs

• Whydoweneednetworklayer?

• WhynotjustuseswitchedEthernetacrosstheInternet?

• Whatdoroutingtableslooklike?

• Therightwaytothinkaboutroutingtables….

• Correctnessdefinitionforroutingtables

• Ourfirstnetworklayerprotocol:LinkState

3

RecapofLinkLayersofar

4

• TraditionalLinkLayer:BroadcastEthernet

• CSMA/CD

• Randomaccessonabroadcastchannel

• ExponentialBackoff

• WhyFrames?

• Toincorporatesentinelbitsforidentifyingframestart/end

• Toincorporatelinklayersourceanddestinationnames

• ToincorporateCRCforcheckingcorrectnessofreceivedframes

• ModernLinkLayer:SwitchedEthernet

• Why?ScalabilitylimitsoftraditionalEthernet

• Why?Detectingcollisionsonabroadcastchannel

Recap:Linklayer

5

Recap:SpanningTreedefinition

• Subgraphthatincludesallverticesbutcontainsnocycles• Linksnotinthespanningtreearenotusedinforwardingframes

6

Recap:SpanningTreeProtocol

• Messages(Y,d,X)

• ProposingrootY;fromnodeX;advertisingadistancedtoY

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

• AteachswitchZ:WHENEVERamessage(Y,d,X)isreceivedfromX:

• IFY’sid<currentroot• THENsetroot=Y;next-hop=X

• IFShortestdistancetoroot>d+distance_from_X

• THENsetshortest-distance-to-root=d+distance_from_X

• IFrootchangedORshortestdistancetotherootchanged:• Sendallneighborsmessage(Y,shortest-distance-to-root,Z)

7

8

TheendofLinkLayer….

Andthebeginningofnetworklayer:-D

Builtontopofreliabledelivery

Builtontopofbest-effortforwarding

Builtontopofbest-effortrouting

Builtontopofphysicalbittransfer

Questions?

• Whynotjustusespanningtreesacrosstheentirenetwork?

• Easytodesignroutingalgorithmsfor(spanning)trees

• Step1:Sourcenode“floods”itspacketonitsspanningtreelinks

• Step2:Wheneveranodereceivesapacket:

• Forwardsincomingpacketouttoalllinksotherthantheonethatsentthepacket

Whydoweneedanetworklayer?

• Sendspackettoeverynodeinthenetwork

• Step1:IgnorethelinksnotbelongingtotheSpanningTree

• Step2:Sourcesends“flood”packetouteverylink(onspanningtree)

• Step3:Sendincomingpacketouttoalllinksotherthantheonethatsentthepacket

FloodingonaSpanningTree

FloodingExample

Source

Desgnagon

1

3

2

7

6

5

4

FloodingExample

Source

Destination

1

3

2

7

6

5

4

Eventuallyallnodesarecovered

Onecopyofpacketdeliveredtodes:na:on

1

2

4

7

5

6

• Easytodesignroutingalgorithmsfor(spanning)trees

• Step1:Sourcenode“floods”itspacketonitsspanningtreelinks

• Step2:Wheneveranodereceivesapacket:

• Forwardsincomingpacketouttoalllinksotherthantheonethatsentthepacket

• Amazingproperties:

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

• Assumingnofailures

RoutingviaFloodingonSpanningTree…

Threefundamentalissues!

Source

Desgnagon

1

3

2

7

6

5

4

1

2

4

7

5

6

Issue1:Eachhosthastodounnecessarypacketprocessing!(todecidewhetherthepacketisdes:nedtothehost)

Source

Desgnagon

1

3

2

7

6

5

4

Threefundamentalissues!

Issue2:Higherlatency!(Thepacketsunnecessarilytraversemuchlongerpaths)

Source

Desgnagon

1

3

2

7

6

5

4

Threefundamentalissues!

Issue3:Wastedbandwidth!(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?

EachSwitchstoresatableindica:ngthenexthopforcorrespondingdes:na:onofapacket(calledarou:ngtable)

• 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

Seesomethinginteres:ng?

• 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

Rou:ngtableentriesforapar:culardes:na:onforma(directed)spanningtreewiththatdes:na:onastheroot!!!!

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

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

Fourflavorsofprotocols

RoutingMetrics

• Routinggoals:computepathswithminimumX

• X=numberof“hops”(nodesinthemiddle)

• X=latency• X=weight• X=failureprobability• …

• Generallyassumeeverylinkhas“cost”associatedwithit

• Wewanttominimizethecostoftheentirepath

• WewillfocusonasubsetofpropertiesX,where:

• Costofapath=sumofcostsofindividuallinks/nodesonthepath• E.g.,numberofhopsandlatency

#1:CreateaTree

• Removeenoughlinkstocreateatreecontainingallnodes

• Soundsfamiliar?Spanningtrees!

• Ifthetopologyhasnoloops,thenjustmakesurenotsendingpacketsbackfromwheretheycame

• Thatcausesanimmediateloop

• Therefore,ifnoloopsintopologyandnoformationofimmediateloopsensuresvalidrouting

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

#1:CreateTreeOutofTopology

#2: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

MakingFloodsReliable

• ReliableFlooding• Ensureallnodesreceivesamelinkstateannouncements

• Noannouncementsdropped

• Ensureallnodesusethelatestversion

• Supposewecanimplementreliableflooding.Howcanitstillfail?

• Canyoueverhaveloopswithlink-staterouting?

• Again:Canyoueverhaveloopswithlink-staterouting?

• Aglobalviewofthenetworkmakescomputingpathswithoutloopseasy

• Manygraphalgorithmsforcomputingloop-freepaths

• Fore.g.,Dijkstra’sAlgorithm

• But,but,but…..

• Gettinganaccurateglobalviewofnetworkischallenging!• Especiallyina“timely”manner

• Asthenetworkischanging

FundamentalChallengewithobtainingaGlobalView

AreLoopsStillPossible?

55

5 35

51

1

A

D E

F

CB

55

5 35

5

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

E thinks that this the path to C

E reaches C via D, D reaches C via E Loop!

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!

Convergence

• Allroutershaveconsistentroutinginformation

• E.g.,allnodeshavingthesamelink-statedatabase

• 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

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

Recommended