data link layer - electrical engineering and computer sciencesugih/courses/eecs489/... · 2016. 2....
Post on 12-Oct-2020
2 Views
Preview:
TRANSCRIPT
Computer Networks
Lecture22:MediaAccessControl
DataLinkLayer
MACtopics:• framingandMACaddressassignment• LANforwarding• IPtoMACaddressresolution• IPtoMAC:AddressResolutionProtocol(ARP)
• MACtoIP:DynamicHostConfigurationProtocol(DHCP)
• mediaaccesscontrol
application
transport
network
LLC MAC
physical
MultipleAccessProblemBroadcastchannelofrateRbps,sharedmedium• iftwohostssendatthesametime,collisionresultsinnopacketbeingreceived(interference)
• ifnohostissending,channelgoesidle• wewanttohaveonlyonehostsendingatatime
MediaAccessControl:• determineswhichhostgetstosendnext• whattodowhenthere’scollision?
Duplexmode:• halfduplex:onlyoneendcansendatatime• fullduplex:bothendscansendsimultaneously
IdealMultipleAccessProtocol• whenonehostwantstosend,itcansendatrateR • whenMhostswanttosend,eachcansendatanaveragerateofR/M • fullydecentralized:
• nospecialhosttocoordinatetransmissions• nosynchronizationofclocks,slots• distributedalgorithmthatdetermineshowhostssharechannel,i.e.,determinewhenhostcantransmit
• noout-of-bandchannelforcoordination• coordinationaboutchannelsharingmustusethechannelitself!
CategorizationofMACProtocols1. Randomaccess:• SlottedALOHA• ALOHA• CarrierSenseMultipleAccesswithCollisionDetection(CSMA/CD)• CSMA/CAvoidance
2. Tokenpassing3. Channelpartitioning:TDMA,FDMA,CDMA
Standards:• 802.3(CSMA/CD),802.3ab(GigEovertwistedpair),802.3zand802.3ah(fiber)• 802.4(tokenbus)• 802.5(tokenring)• 802.11[bagn](WiFi),802.11a[dc]
RandomAccessMACProtocolCharacteristics:• sendertransmitsatfullchannelrateR bps• nopriorcoordinationamongnodes• bitsarepropagatedalongtheentirenetwork• destinationrecognizesthattheframeisforitself• destinationgrabsframe• whileonehostistransmitting,allothersmustwait
Randomaccessmeans:• reliesoncollisiontocontrolaccess• howtodetectcollisions?• howtorecoverfromcollisions?
Ethernet:CSMA/CD
CarrierSense(CS):1. checkforpresenceofelectricalsignal
(carrier)onwirebeforetransmission2. presenceofcarriermeanssomeone
elseissending,wait3. starttransmissionifnocarrierdetected
Problem:collision
CSMACollisions• collisionsoccursbecauseduetopropagationdelay,twohostsmaynothearofeachother’stransmissionwhentheystarttransmitting(Batt0,Datt1)
• whencollisionoccurs(att2),entireframetransmissiontime(t3-t0or,equivalently,t4-t1)iswasted
• notetheroledistanceandpropagationdelayplayindeterminingcollisionprobability
• acollisionisdetectedifpowerreceivedislargerthanpowertransmitted
spatiallayoutofhosts
collision
t2
t3 t4
CollisionDetection(CD)
4. sendermustcontinuetodetectcollisionaftertransmission• oncollision,framesmustberetransmitted
• problem:morecollision
4. ifadaptordetectscollisionwhiletransmitting,abortsandsendsjammingsignal
5. afteraborting,adaptorentersexponentialback-offperiod
collisiondetecttoaborttime
JammingSignalandExponentialBack-offJammingsignal:makesureallothertransmittersareawareofcollision;48bitsExponentialback-off:senderspickauniformlydistributedrandomdelaybetween[0, 20d]beforeretransmission.Whyrandom?
Ifcollisionoccursagain,pickanotherrandomdelaybetween[0, 21d],[0, 22d],[0, 23d],...hence(binary)exponentialback-off
Retryatmost16times,butcapback-offexponentat10;forminimumframesizeof512bitsat10Mbps,maxwaittimeisabout50msec
TheCSMA/CDalgorithm:1. listenforcarrier2. ifnocarrier,sendframe3. listenforcollisionorjammingsignal4. ifcollisiondetected,sendjammingsignal5. ifcollisionorjammingsignaldetected,retransmitafterexponentialback-off
HistoricalNote:Collisiondetectionandretransmissionwithback-offwasfirstusedintheALOHAandslottedALOHAMACalgorithmsfromtheUniversityofHawaii(1970)foraccesstosatellitechannels,butslottedALOHAhasnoCarrierSenseandislessefficient
CSMA/CDSummary
CarrierSense(CS):listenbeforespeaking,anddon’tinterrupt
CollisionDetection(CD):ifsomeoneelsestartstalkingatthesametime,shoutthemdownExponentialback-off:don’tstarttalkingagainrightaway
Howlongmustasenderlistenforcollision?• letτbethepropagationtimefromoneendofthewiretotheother
• withinτtimeafterthetransmissionofaframe(t),allnodesonthesegmentwouldhavesensedcarrier
• worstcasescenarioforcollision:anodeattheotherendofthewirestartstransmittingattimet +τ − ε
• thenodeclosesttothecollisionsendsoutajammingsignaltoensurecollisionisdetectedbytheothernode
• ittakesanotherτperiodforthecollisiontogetbacktotheoriginalsender
Hencetheoriginalsendermustlistenfor2τperiod
CollisionDetectionTime
t + τ − ε
t + τ
t + 2τ ComerPeterson & Davie
t
MinimumFrameSizewhatiftransmissionendshere?
Whenasenderdetectscollisionhowdoesitknowthatthecollisionwascausedbyitspacket?
Answer:sendermustholdcarrierforaperiodof2τ,i.e.,itmustbetransmittingforthewhole2τperiod�eachEthernetframemustbeatleast2τ*linkspeedlong
Example:• 10MbpsEthernetallowsamaximumof5segments,each500mlong• speedoflight3x108m/s,butcoaxpropagationonly2x108m/s• round-trippropagationdelay(2τ)on2.5kmcoaxis25µsecs• allowingfor4repeatersmakesend-to-enddelay50µsecs• 50µsecsat10Mbpsis62.5bytes• 802.3standardrequiresstationstoholdcarrierfor64bytesor 51.2µsecs
min frame size
CSMA/CDEfficiency(η)tprop=maxpropagationtimebetween2hostsintheLANttrans=timetotransmitmaximum-sizeframe�largerframesizemoreefficient
η = ttransttrans + 5t prop
= 11+ 5 t prop
ttrans
η→1 as t prop → 0 or as ttrans →∞
Tanenbaum
TokenRingMACProtocol• atokengoesaroundaringnetwork• tosenddata,anodemustfirstgrabthetoken• aframesentfromasourceispassedfromnodetonodearoundthering• destinationrecognizesownaddressandmakesacopyofframe• senderremovesframefromring• eachnodecanonlytransmitoneframeatatime;mustreturntokentotheringaftereachframetransmission
Whyletthesender,insteadofthereceiver,removeframefromthering?
Comer
TokenRingMACProtocol
Token:• aspecialbitpattern• usebit-stuffingifdataresemblestoken• onlyonetokenonringatatime(managedbyamonitor)
IBM’stokenringlinkspeedis16MbpsTokenring:• advantage:nocollision• disadvantage:• requiresamonitor(singlepointoffailure)
• latency
TokenRingPerformance
Halsall
(64 bytes) (1500 bytes)
CSMA/CDEfficiency(η)packet sizes
packet sizes
OtherMACProtocols
FDDI:• operatesat100Mbps• usesthetokenringMACprotocol• forrobustness,usestwocounter-rotatingrings• ifalink/nodegoesdown,thedual-ringcanbereconfiguredtoasingleringnetwork(hencecalledself-healingnetwork)
SLIP/PPP:serialline,point-to-pointprotocol,noneedformediaaccesscontrol,justframingATM/FrameRelay/SONET:forbackbonelinks....
Cormer
top related