Upload
others
View
7
Download
0
Embed Size (px)
Citation preview
LocalAreaNetworks:Ethernet,Switching
COS461:ComputerNetworksSpring2011
MikeFreedmanhDp://www.cs.princeton.edu/courses/archive/spring11/cos461/
Fully‐connectedlinks2
Sharedbroadcastmedium3
It’sallaboutresourceallocaMon
4
ThreeWaystoSharetheMedia• ChannelparMMoningMACprotocols:
– Sharechannelefficientlyandfairlyathighload
– Inefficientatlowload:unusedgoidle
• “Takingturns”protocols– Eliminatesemptyslotswithoutcausingcollisions
– Vulnerabletofailures
• RandomaccessMACprotocols– Efficientatlowload:singlenodecanfullyuMlizechannel
– Highload:collisionoverhead
5
Hubs:Joiningbroadcastmediums
6
hub
Bridges/Switches:IsolaMngbroadcastmediums
7
switch
Ethernet
• DominantwiredLANtechnology,firstwidelyused
• Simpler,cheaperthantokenLANsandATM
• Keptupwithspeedrace:10Mbps–10Gbps
8
Metcalfe’s Ethernet sketch
EthernetFrameStructure9
• Preamble:synchronizaMon:(10101010)710101011
• Addresses:6‐bytesourceanddestMACaddresses– AdaptorpassesframetoOSstackifdesMnaMonmatchesadaptororisbroadcastaddress;otherwise,discardframe
• Type:higher‐layerprotocol(IP,AppleTalk,…)• ErrordetecMon:CRC:cyclicredundancycheck
• Besteffort:ConnecMonless,unreliable
EthernetUsesCSMA/CD
• CarrierSense:waitforlinktobeidlebeforetransmit
• CollisionDetecMon:listenwhiletransmigng– Nocollision:transmissioncomplete
– Collision:abortandsendjamsignal
• Randomaccess:exponenMalback‐off– Ajercollision,waitarandomMmebeforeretry
– Ajermthcollision,chooseKrandomlyfrom{0,…,2m‐1}– …andwaitforK*64byteMmesbeforeretry
10
LimitaMonsonEthernetLength
• Latencydependsonphysicallengthoflink– Timetopropagateapacketfromoneendtotheother
• SupposeAsendsapacketatMmet– AndBseesanidlelinejustbeforeMmet+d,sotransmits
• Bdetectsacollision,andsendsjammingsignal– ButAdoesn’tseecollisionMllt+2d
11
latency d A B
LimitaMonsonEthernetLength
• AneedstowaitforMme2dtodetectcollision– So,Ashouldkeeptransmigngduringthisperiod– …andkeepaneyeoutforapossiblecollision
• ImposesrestricMonsonEthernet– Maxlengthofwire:2500meters
– Minlengthofpacket:512bits(64bytes)
12
latency d A B
PhysicalLayer:Repeaters• DistancelimitaMoninlocal‐areanetworks
– Electricalsignalbecomesweakerasittravels– ImposesalimitonthelengthofaLAN
• RepeatersjoinLANstogether– Analogelectronicdevice– MonitorssignalsoneachLANandtransmitsamplifiedcopies
13
PhysicalLayer:Hubs• JoinsmulMpleinputlineselectrically
– DesignedtoholdmulMplelinecards– Donotnecessarilyamplifythesignal
• Verysimilartorepeaters– Alsooperatesatthephysicallayer
hub hub hub
hub
14
LimitaMonsofRepeatersandHubs• Onelargesharedlink
– Eachbitsenteverywhere,aggregatethroughputlimited
• CannotsupportmulMpleLANtechnologies– Doesnotbufferorinterpretframes– So,can’tinterconnectdifferentratesorformats
• LimitaMonsonmaximumnodesanddistances
15
SwitchingforresourceisolaMon
16
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
Bridges/Switches:TrafficIsolaMon
• SwitchbreakssubnetintoLANsegments
• Switchfilterspackets– Frameonlyforwardedtothenecessarysegments
– Segmentscansupportseparatetransmissions
hub hub hub
switch/bridge
segment
segment
segment
18
High‐densityswitching19
SNSgroup“rack” Facebookrack
• Eachrackhas42U(“pizzaboxes”)• Typicallyservers+1‐2“top‐of‐rack”switch(es)
48‐portswitch
AdvantagesOverHubs/Repeaters• Onlyforwardsframesasneeded
– E.g.todesMnaMonsegmentsorforbroadcasttraffic– Reducesunnecessarytrafficonsegments
• Extendsthegeographicspanofthenetwork– Ethernetcollisions(anddistancelimitaMons)onlyonsegment
• ImprovesprivacybylimiMngscopeofframes– Hostscanonly“snoop”thetraffictraversingtheirsegment
• Canjoinsegmentsusingdifferenttechnologies
20
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
SelfLearning:BuildingtheTable
• Whenaframearrives– InspectsourceMACaddress
– Associateaddrwithincominginterface/port– Storemappinginforwardingtable– UseTTLfieldtoeventuallyforgetmapping
A C
D
SwitchlearnshowtoreachA
B
22
SelfLearning:HandlingMisses• WhenframearriveswithunfamiliardesMnaMon
– Forwardframeoutallinterfacesexceptsource
– Hopefully,won’thappenveryojen
A C
D
Whenindoubt,shout!
B
23
SwitchFiltering/Forwarding
Whenswitchreceivesaframe:
indexswitchtableusingMACdestaddress
if(entryfoundfordesMnaMon)thenif(destonsegmentfromwhichframearrived)then
droptheframeelse
forwardtheframeoninterfaceindicatedelseflood
forwardonallbuttheinterfaceonwhichtheframearrived
24
FloodingCanLeadtoLoops• E.g.,ifthenetworkcontainsacycleofswitches• Eitheraccidentallyorbydesignforhigherreliability
• SoluMon:SpanningTree– Ensurethetopologyhasnoloops– Avoidusingsomeofthelinkswhenflooding– Spanningtree:Sub‐graphthatcoversallverMcesbutcontainsnocycles
25
SpanningTrees
• SoluMon:SpanningTree– Ensurethetopologyhasnoloops– Avoidusingsomeofthelinkswhenflooding– Spanningtree:Sub‐graphthatcoversallverMcesbutcontainsnocycles
26
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
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
EvoluMonTowardVirtualLANs• Intheoldendays…
– Thickcablessnakedthroughcableductsinbuildings– Everycomputerwaspluggedin
– AllpeopleinadjacentofficeswereonsameLAN
• Morerecentlyduetohubsandswitches…– Everyofficeconnectedtocentralwiringclosets– FlexibilityinmappingofficestodifferentLANs
• EvoluMontogroupingusersbasedonorgstructure,notphysicallayoutofbuilding
29
WhyGroupbyOrgStructure?• Security
– Ethernetisasharedmedia– Interfacescanbeputin“promiscuous”modetoseealltraffic
• Load– SomeLANsegmentsaremoreheavilyusedthanothers
• E.g.,researcherscansaturateownsegment,butnotothers– MaybenaturallocalityofcommunicaMon
• E.g.,trafficbetweenpeopleinthesameresearchgroup
• Butpeoplemove,organizaMonschanges– Physicalrewiringisahugepain!
30
VirtualLANs
RedVLANandYellowVLANSwitchesforwardtrafficasneeded
R RY RY
Y RY
31
VirtualLANs
R
Y RY
R
R
R
Y Y Y R Y R R R
Y
Y
Y
RedVLANandYellowVLANSwitchesforwardtrafficasneeded
32
MakingVLANsWork
• SwitchesneedconfiguraMontables– SayingwhichVLANsareaccessibleviawhichinterfaces
• ApproachestomappingtoVLANs– VLANcolorperinterface
• OnlyifallhostsonsegmentbelongtosameVLAN
– VLANcolorperMACaddress
• ChangingtheEthernetheader– AddingafieldforaVLANtag– VLANtagadded/removedbyswitches
• Hostsunaware(backwardscompat),cannotspoof(security)
33
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