34
Local Area Networks: Ethernet, Switching COS 461: Computer Networks Spring 2011 Mike Freedman hDp://www.cs.princeton.edu/courses/archive/spring11/cos461/

Local Area Networks: Ethernet, Switching

  • Upload
    lydiep

  • View
    223

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Local Area Networks: Ethernet, Switching

LocalAreaNetworks:Ethernet,Switching

COS461:ComputerNetworksSpring2011

MikeFreedmanhDp://www.cs.princeton.edu/courses/archive/spring11/cos461/

Page 2: Local Area Networks: Ethernet, Switching

Fully‐connectedlinks2

Page 3: Local Area Networks: Ethernet, Switching

Sharedbroadcastmedium3

Page 4: Local Area Networks: Ethernet, Switching

It’sallaboutresourceallocaMon

4

Page 5: Local Area Networks: Ethernet, Switching

ThreeWaystoSharetheMedia•  ChannelparMMoningMACprotocols:

–  Sharechannelefficientlyandfairlyathighload

–  Inefficientatlowload:unusedgoidle

•  “Takingturns”protocols–  Eliminatesemptyslotswithoutcausingcollisions

–  Vulnerabletofailures

•  RandomaccessMACprotocols–  Efficientatlowload:singlenodecanfullyuMlizechannel

– Highload:collisionoverhead

5

Page 6: Local Area Networks: Ethernet, Switching

Hubs:Joiningbroadcastmediums

6

hub

Page 7: Local Area Networks: Ethernet, Switching

Bridges/Switches:IsolaMngbroadcastmediums

7

switch

Page 8: Local Area Networks: Ethernet, Switching

Ethernet

•  DominantwiredLANtechnology,firstwidelyused

•  Simpler,cheaperthantokenLANsandATM

•  Keptupwithspeedrace:10Mbps–10Gbps

8

Metcalfe’s Ethernet sketch

Page 9: Local Area Networks: Ethernet, Switching

EthernetFrameStructure9

•  Preamble:synchronizaMon:(10101010)710101011

•  Addresses:6‐bytesourceanddestMACaddresses–  AdaptorpassesframetoOSstackifdesMnaMonmatchesadaptororisbroadcastaddress;otherwise,discardframe

•  Type:higher‐layerprotocol(IP,AppleTalk,…)•  ErrordetecMon:CRC:cyclicredundancycheck

•  Besteffort:ConnecMonless,unreliable

Page 10: Local Area Networks: Ethernet, Switching

EthernetUsesCSMA/CD

•  CarrierSense:waitforlinktobeidlebeforetransmit

•  CollisionDetecMon:listenwhiletransmigng– Nocollision:transmissioncomplete

–  Collision:abortandsendjamsignal

•  Randomaccess:exponenMalback‐off– Ajercollision,waitarandomMmebeforeretry

– Ajermthcollision,chooseKrandomlyfrom{0,…,2m‐1}– …andwaitforK*64byteMmesbeforeretry

10

Page 11: Local Area Networks: Ethernet, Switching

LimitaMonsonEthernetLength

•  Latencydependsonphysicallengthoflink–  Timetopropagateapacketfromoneendtotheother

•  SupposeAsendsapacketatMmet– AndBseesanidlelinejustbeforeMmet+d,sotransmits

•  Bdetectsacollision,andsendsjammingsignal–  ButAdoesn’tseecollisionMllt+2d

11

latency d A B

Page 12: Local Area Networks: Ethernet, Switching

LimitaMonsonEthernetLength

•  AneedstowaitforMme2dtodetectcollision–  So,Ashouldkeeptransmigngduringthisperiod– …andkeepaneyeoutforapossiblecollision

•  ImposesrestricMonsonEthernet– Maxlengthofwire:2500meters

– Minlengthofpacket:512bits(64bytes)

12

latency d A B

Page 13: Local Area Networks: Ethernet, Switching

PhysicalLayer:Repeaters•  DistancelimitaMoninlocal‐areanetworks

–  Electricalsignalbecomesweakerasittravels–  ImposesalimitonthelengthofaLAN

•  RepeatersjoinLANstogether–  Analogelectronicdevice– MonitorssignalsoneachLANandtransmitsamplifiedcopies

13

Page 14: Local Area Networks: Ethernet, Switching

PhysicalLayer:Hubs•  JoinsmulMpleinputlineselectrically

–  DesignedtoholdmulMplelinecards–  Donotnecessarilyamplifythesignal

•  Verysimilartorepeaters–  Alsooperatesatthephysicallayer

hub hub hub

hub

14

Page 15: Local Area Networks: Ethernet, Switching

LimitaMonsofRepeatersandHubs•  Onelargesharedlink

–  Eachbitsenteverywhere,aggregatethroughputlimited

•  CannotsupportmulMpleLANtechnologies– Doesnotbufferorinterpretframes–  So,can’tinterconnectdifferentratesorformats

•  LimitaMonsonmaximumnodesanddistances

15

Page 16: Local Area Networks: Ethernet, Switching

SwitchingforresourceisolaMon

16

Page 17: Local Area Networks: Ethernet, Switching

17

LinkLayer:BridgesandSwitches•  ConnectstwoormoreLANsatthelinklayer

–  ExtractsdesMnaMonaddressfromtheframe–  LooksupthedesMnaMoninatable,forwardstoappropriate

•  Eachsegmentcancarryitsowntraffic–  ConcurrenttrafficbetweenLANs/host:AtoBwhileDtoC

•  Bridge:connecMngLANs;Switches:connecMnghostshost host host

host host host

host

host

Bridge switch

A

B

C

D

Page 18: Local Area Networks: Ethernet, Switching

Bridges/Switches:TrafficIsolaMon

•  SwitchbreakssubnetintoLANsegments

•  Switchfilterspackets–  Frameonlyforwardedtothenecessarysegments

–  Segmentscansupportseparatetransmissions

hub hub hub

switch/bridge

segment

segment

segment

18

Page 19: Local Area Networks: Ethernet, Switching

High‐densityswitching19

SNSgroup“rack” Facebookrack

• Eachrackhas42U(“pizzaboxes”)• Typicallyservers+1‐2“top‐of‐rack”switch(es)

48‐portswitch

Page 20: Local Area Networks: Ethernet, Switching

AdvantagesOverHubs/Repeaters•  Onlyforwardsframesasneeded

–  E.g.todesMnaMonsegmentsorforbroadcasttraffic–  Reducesunnecessarytrafficonsegments

•  Extendsthegeographicspanofthenetwork–  Ethernetcollisions(anddistancelimitaMons)onlyonsegment

•  ImprovesprivacybylimiMngscopeofframes–  Hostscanonly“snoop”thetraffictraversingtheirsegment

•  Canjoinsegmentsusingdifferenttechnologies

20

Page 21: Local Area Networks: Ethernet, Switching

DisadvantagesOverHubs/Repeaters•  Delayinforwardingframes

–  Bridge/switchmustreceiveframe,parse,lookup,andsend–  Storingandforwardingthepacketintroducesdelay–  Sol’n:cut‐throughswitching(startsendajerreceiveheader)

•  Needtolearnwheretoforwardframes–  Forwardingtable:desMnaMonMACoutgoinginterface–  Needstoconstructforwardingtable,ideallyw/ostaMcconfig–  Sol’n:self‐learning

•  Highercost– Morecomplicateddevicesthatcostmoremoney

21

Page 22: Local Area Networks: Ethernet, Switching

SelfLearning:BuildingtheTable

•  Whenaframearrives–  InspectsourceMACaddress

– Associateaddrwithincominginterface/port– Storemappinginforwardingtable– UseTTLfieldtoeventuallyforgetmapping

A C

D

SwitchlearnshowtoreachA

B

22

Page 23: Local Area Networks: Ethernet, Switching

SelfLearning:HandlingMisses•  WhenframearriveswithunfamiliardesMnaMon

– Forwardframeoutallinterfacesexceptsource

– Hopefully,won’thappenveryojen

A C

D

Whenindoubt,shout!

B

23

Page 24: Local Area Networks: Ethernet, Switching

SwitchFiltering/Forwarding

Whenswitchreceivesaframe:

indexswitchtableusingMACdestaddress

if(entryfoundfordesMnaMon)thenif(destonsegmentfromwhichframearrived)then

droptheframeelse

forwardtheframeoninterfaceindicatedelseflood

forwardonallbuttheinterfaceonwhichtheframearrived

24

Page 25: Local Area Networks: Ethernet, Switching

FloodingCanLeadtoLoops•  E.g.,ifthenetworkcontainsacycleofswitches•  Eitheraccidentallyorbydesignforhigherreliability

•  SoluMon:SpanningTree– Ensurethetopologyhasnoloops– Avoidusingsomeofthelinkswhenflooding– Spanningtree:Sub‐graphthatcoversallverMcesbutcontainsnocycles

25

Page 26: Local Area Networks: Ethernet, Switching

SpanningTrees

•  SoluMon:SpanningTree– Ensurethetopologyhasnoloops– Avoidusingsomeofthelinkswhenflooding– Spanningtree:Sub‐graphthatcoversallverMcesbutcontainsnocycles

26

Page 27: Local Area Networks: Ethernet, Switching

ConstrucMngaSpanningTree•  Distributedalgorithm

–  Switchescooperatetobuild,auto‐adaptonfailures

•  Keyingredientsofthealgorithm–  Switcheselecta“root”(e.g.onew/smallestID)

–  Eachdeterminesifinterfaceisonshortestpathfromroot,excludesifnot

–  Learnedviamessagesfrompeers•  (rootY,distanced,fromX)

–  Reactstoroot/switch/linkfailures•  PathentrieshaveTTL(i.e.sojstate)•  Rootperiodicallyreannounces

root

1 hop

3 hops

27

Page 28: Local Area Networks: Ethernet, Switching

Modernconcern:Spanningtreesdon’tscale•  Floodingforunknowndest’s•  BroadcasMng:“Whohas1.2.3.4?”“01:c4:3b:7d:ad:4fhas1.2.3.4”

•  Highloadonroottreeedges•  Lowavailabilityonfailures•  Lowthroughput:can’tuseparallelpaths

28

Currentapproach:L3indatacentersProposals:L2everywhere,butnoSPnorbroadcast

Page 29: Local Area Networks: Ethernet, Switching

EvoluMonTowardVirtualLANs•  Intheoldendays…

–  Thickcablessnakedthroughcableductsinbuildings–  Everycomputerwaspluggedin

–  AllpeopleinadjacentofficeswereonsameLAN

•  Morerecentlyduetohubsandswitches…–  Everyofficeconnectedtocentralwiringclosets–  FlexibilityinmappingofficestodifferentLANs

•  EvoluMontogroupingusersbasedonorgstructure,notphysicallayoutofbuilding

29

Page 30: Local Area Networks: Ethernet, Switching

WhyGroupbyOrgStructure?•  Security

–  Ethernetisasharedmedia–  Interfacescanbeputin“promiscuous”modetoseealltraffic

•  Load–  SomeLANsegmentsaremoreheavilyusedthanothers

•  E.g.,researcherscansaturateownsegment,butnotothers– MaybenaturallocalityofcommunicaMon

•  E.g.,trafficbetweenpeopleinthesameresearchgroup

•  Butpeoplemove,organizaMonschanges–  Physicalrewiringisahugepain!

30

Page 31: Local Area Networks: Ethernet, Switching

VirtualLANs

RedVLANandYellowVLANSwitchesforwardtrafficasneeded

R RY RY

Y RY

31

Page 32: Local Area Networks: Ethernet, Switching

VirtualLANs

R

Y RY

R

R

R

Y Y Y R Y R R R

Y

Y

Y

RedVLANandYellowVLANSwitchesforwardtrafficasneeded

32

Page 33: Local Area Networks: Ethernet, Switching

MakingVLANsWork

•  SwitchesneedconfiguraMontables–  SayingwhichVLANsareaccessibleviawhichinterfaces

•  ApproachestomappingtoVLANs–  VLANcolorperinterface

•  OnlyifallhostsonsegmentbelongtosameVLAN

–  VLANcolorperMACaddress

•  ChangingtheEthernetheader–  AddingafieldforaVLANtag–  VLANtagadded/removedbyswitches

•  Hostsunaware(backwardscompat),cannotspoof(security)

33

Page 34: Local Area Networks: Ethernet, Switching

34

ComparingHubs,Switches,Routers

Hub /

Repeater

Bridge /

Switch

IP

Router

Traffic isolation no yes yes

Plug and Play yes yes no

Efficient routing no no yes

Cut through yes yes no