Data Link Layer - Electrical Engineering and Computer Sciencesugih/courses/eecs489/... · 2016. 2....

5
Computer Networks Lecture 22: Media Access Control Data Link Layer MAC topics: framing and MAC address assignment LAN forwarding IP to MAC address resolution IP to MAC: Address Resolution Protocol (ARP) MAC to IP: Dynamic Host Configuration Protocol (DHCP) media access control application transport network LLC MAC physical Multiple Access Problem Broadcast channel of rate R bps, shared medium if two hosts send at the same time, collision results in no packet being received (interference) if no host is sending, channel goes idle we want to have only one host sending at a time Media Access Control: determines which host gets to send next what to do when there’s collision? Duplex mode: half duplex: only one end can send at a time full duplex: both ends can send simultaneously Ideal Multiple Access Protocol when one host wants to send, it can send at rate R when M hosts want to send, each can send at an average rate of R/M fully decentralized: no special host to coordinate transmissions no synchronization of clocks, slots distributed algorithm that determines how hosts share channel, i.e., determine when host can transmit no out-of-band channel for coordination coordination about channel sharing must use the channel itself!

Transcript of Data Link Layer - Electrical Engineering and Computer Sciencesugih/courses/eecs489/... · 2016. 2....

Page 1: Data Link Layer - Electrical Engineering and Computer Sciencesugih/courses/eecs489/... · 2016. 2. 25. · Data Link Layer MAC topics: • framing and MAC address assignment • LAN

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!

Page 2: Data Link Layer - Electrical Engineering and Computer Sciencesugih/courses/eecs489/... · 2016. 2. 25. · Data Link Layer MAC topics: • framing and MAC address assignment • LAN

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

Page 3: Data Link Layer - Electrical Engineering and Computer Sciencesugih/courses/eecs489/... · 2016. 2. 25. · Data Link Layer MAC topics: • framing and MAC address assignment • LAN

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

Page 4: Data Link Layer - Electrical Engineering and Computer Sciencesugih/courses/eecs489/... · 2016. 2. 25. · Data Link Layer MAC topics: • framing and MAC address assignment • LAN

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

Page 5: Data Link Layer - Electrical Engineering and Computer Sciencesugih/courses/eecs489/... · 2016. 2. 25. · Data Link Layer MAC topics: • framing and MAC address assignment • LAN

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