You are on page 1of 59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

ThedatalinklayerandtheLocalAreaNetworks
Thedatalinklayeristhelowestlayerofthereferencemodelthatwediscussindetail.Asmentionedpreviously,therearetwotypesofdatalinklayers.
Thefirstdatalinklayersthatappearedaretheonesthatareusedonpointtopointlinksbetweendevicesthataredirectlyconnectedbyaphysical
link.Wewillbrieflydiscussoneofthesedatalinklayersinthischapter.ThesecondtypeofdatalinklayersaretheonesusedinLocalAreaNetworks
(LANs).ThemaindifferencebetweenthepointtopointandtheLANdatalinklayersisthatthelatterneedtoregulatetheaccesstotheLocalArea
Networkwhichisusuallyasharedmedium.
Thischapterisorganisedasfollows.Wefirstdiscusstheprinciplesofthedatalinklayeraswellastheservicesthatitusesfromthephysicallayer.
We then describe in more detail several MediumAccess Control algorithms that are used in LocalArea Networks to regulate the access to the
sharedmedium.FinallywediscussindetailimportantdatalinklayertechnologieswithanemphasisonEthernetandWiFinetworks.

Principles
Thedatalinklayerusestheserviceprovidedbythephysicallayer.Althoughtherearemanydifferentimplementationsofthephysicallayerfroma
technologicalperspective,theyallprovideaservicethatenablesthedatalinklayertosendandreceivebitsbetweendirectlyconnecteddevices.The
datalink layer receives packets from the network layer. Two datalink layer entities exchange frames.As explained in the previous chapter, most
datalinklayertechnologiesimposelimitationsonthesizeoftheframes.Sometechnologiesonlyimposeamaximumframesize,othersenforceboth
minimumandmaximumframessizesandfinallysometechnologiesonlysupportasingleframesize.Inthelattercase,thedatalinklayerwillusually
include an adaptation sublayer to allow the network layer to send and receive variablelength packets. This adaptation layer may include
fragmentationandreassemblymechanisms.

Thedatalinklayerandthereferencemodel

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

1/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Thephysicallayerservicefacilitatesthesendingandreceivingofbits.Furthermore,itisusuallyfarfromperfectasexplainedintheintroduction:
thePhysicallayermaychange,e.g.duetoelectromagneticinterferences,thevalueofabitbeingtransmitted
thePhysicallayermaydelivermorebitstothereceiverthanthebitssentbythesender
thePhysicallayermaydeliverfewerbitstothereceiverthanthebitssentbythesender
Thedatalinklayermustallowendsystemstoexchangeframescontainingpacketsdespitealloftheselimitations.OnpointtopointlinksandLocal
AreaNetworks,thefirstproblemtobesolvedishowtoencodeaframeasasequenceofbits,sothatthereceivercaneasilyrecoverthereceived
framedespitethelimitationsofthephysicallayer.
Ifthephysicallayerwereperfect,theproblemwouldbeverysimple.Thedatalinklayerwouldsimplyneedtodefinehowtoencodeeachframeasa
sequenceofconsecutivebits.Thereceiverwouldtheneasilybeabletoextracttheframesfromthereceivedbits.Unfortunately,theimperfectionsof
the physical layer make this framing problem slightly more complex. Several solutions have been proposed and are used in practice in different
datalinklayertechnologies.

Framing
Thisistheframing problem. It can be defined as : How does a sender encode frames so that the receiver can efficiently extract them from the
streamofbitsthatitreceivesfromthephysicallayer.
Afirstsolutiontosolvetheframingproblemistorequirethephysicallayertoremainidleforsometimeafterthetransmissionofeachframe.These
idleperiodscanbedetectedbythereceiverandserveasamarkertodelineateframeboundaries.Unfortunately,thissolutionisnotsufficientfortwo
reasons.First,somephysicallayerscannotremainidleandalwaysneedtotransmitbits.Second,insertinganidleperiodbetweenframesdecreases
themaximumbandwidththatcanbeachievedbythedatalinklayer.
Somephysicallayersprovideanalternativetothisidleperiod.Allphysicallayersareabletosendandreceivephysicalsymbolsthatrepresentvalues
0and1.However,forvariousreasonsthatareoutsidethescopeofthischapter,severalphysicallayersareabletoexchangeotherphysicalsymbols
as well. For example, the Manchester encoding used in several physical layers can send four different symbols. The Manchester encoding is a
differentialencodingschemeinwhichtimeisdividedintofixedlengthperiods.Eachperiodisdividedintwohalvesandtwodifferentvoltagelevels
canbeapplied.Tosendasymbol,thesendermustsetoneofthesetwovoltagelevelsduringeachhalfperiod.Tosenda 1(resp.0), the sender
mustsetahigh(resp.low)voltageduringthefirsthalfoftheperiodandalow(resp.high)voltageduringthesecondhalf.Thisencodingensuresthat
therewillbeatransitionatthemiddleofeachperiodandallowsthereceivertosynchroniseitsclocktothesendersclock.Apartfromtheencodings
for0and1,theManchesterencodingalsosupportstwoadditionalsymbols:InvHandInvBwherethesamevoltagelevelisusedforthetwohalf
periods.Bydefinition,thesetwosymbolscannotappearinsideaframewhichisonlycomposedof0and1. Some technologies use these special
symbolsasmarkersforthebeginningorendofframes.
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

2/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Manchesterencoding
Unfortunately,multisymbolencodingscannotbeusedbyallphysicallayersandagenericsolutionwhichcanbeusedwithanyphysicallayerthatis
abletotransmitandreceiveonly0and1isrequired.Thisgenericsolutioniscalledstuffingandtwovariantsexist:bitstuffingandcharacterstuffing.
To enable a receiver to easily delineate the frame boundaries, these two techniques reserve special bit strings as frame boundary markers and
encodetheframessothatthesespecialbitstringsdonotappearinsidetheframes.
Bitstuffingreservesthe01111110bitstringastheframeboundarymarkerandensuresthattherewillneverbesixconsecutive1symbolstransmitted
bythephysicallayerinsideaframe.Withbitstuffing,aframeissentasfollows.First,thesendertransmitsthemarker,i.e.01111110.Then,itsends
allthebitsoftheframeandinsertsanadditionalbitsetto0aftereachsequenceoffiveconsecutive1bits.Thisensuresthatthesentframenever
containsasequenceofsixconsecutivebitssetto1.Asaconsequence,themarkerpatterncannotappearinsidetheframesent.Themarkerisalso
senttomarktheendoftheframe.Thereceiverperformstheoppositetodecodeareceivedframe.Itfirstdetectsthebeginningoftheframethanks
tothe01111110marker.Then,itprocessesthereceivedbitsandcountsthenumberofconsecutivebitssetto1.Ifa0followsfiveconsecutivebitsset
to1,thisbitisremovedsinceitwasinsertedbythesender.Ifa1followsfiveconsecutivebitssetsto1,itindicatesamarkerifitisfollowedbyabit
setto0.Thetablebelowillustratestheapplicationofbitstuffingtosomeframes.
Originalframe

Transmittedframe

0001001001001001001000011 01111110000100100100100100100001101111110
0110111111111111111110010

01111110011011111011111011111011001001111110

01111110

0111111001111101001111110

Forexample,considerthetransmissionof0110111111111111111110010.Thesenderwillfirstsendthe01111110markerfollowedby011011111.After
thesefiveconsecutivebitssetto1,itinsertsabitsetto0followedby11111.Anew 0isinserted,followedby11111.Anew 0isinsertedfollowedby
theendoftheframe110010andthe01111110marker.
Bitstuffingincreasesthenumberofbitsrequiredtotransmiteachframe.Theworstcaseforbitstuffingisofcoursealongsequenceofbitssetto1
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

3/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

insidetheframe.Iftransmissionerrorsoccur,stuffedbitsormarkerscanbeinerror.Inthesecases,theframeaffectedbytheerrorandpossiblythe
nextframewillnotbecorrectlydecodedbythereceiver,butitwillbeabletoresynchroniseitselfatthenextvalidmarker.
Bitstuffingcanbeeasilyimplementedinhardware.However,implementingitinsoftwareisdifficultgiventhehigheroverheadofbitmanipulationsin
software. Software implementations prefer to process characters than bits, softwarebased datalink layers usually use character stuffing. This
technique operates on frames that contain an integer number of 8bit characters. Some characters are used as markers to delineate the frame
boundaries.ManycharacterstuffingtechniquesusetheDLE,STXandETXcharactersoftheASCIIcharacterset. DLESTX (resp. DLE ETX) is
usedtomarkthebeginning(end)ofaframe.Whentransmittingaframe,thesenderaddsaDLEcharacteraftereachtransmittedDLEcharacter.
Thisensuresthatnoneofthemarkerscanappearinsidethetransmittedframe.Thereceiverdetectstheframeboundariesandremovesthesecond
DLEwhenitreceivestwoconsecutiveDLEcharacters.Forexample,totransmitframe123DLESTX4, a sender will first send DLESTX as a
marker,followedby123DLE.Then,thesendertransmitsanadditionalDLEcharacterfollowedbySTX4andtheDLEETXmarker.
Originalframe

Transmittedframe

1234

DLESTX1234DLEETX

123DLESTX4

DLESTX123DLEDLESTX4DLEETX

DLESTXDLEETX

DLESTXDLEDLESTXDLEDLEETXDLEETX

Characterstuffing,likebitstuffing,increasesthelengthofthetransmittedframes.Forcharacterstuffing,theworstframeisaframecontainingmany
DLEcharacters.Whentransmissionerrorsoccur,thereceivermayincorrectlydecodeoneortwoframes(e.g.iftheerrorsoccurinthemarkers).
However,itwillbeabletoresynchroniseitselfwiththenextcorrectlyreceivedmarkers.

Errordetection
Besides framing, datalink layers also include mechanisms to detect and sometimes even recover from transmission error. To allow a receiver to
detecttransmissionerrors,asendermustaddsomeredundantinformationasanerrordetectioncodetotheframesent.Thiserrordetectioncodeis
computedbythesenderontheframethatittransmits.Whenthereceiverreceivesaframewithanerrordetectioncode,itrecomputesitandverifies
whetherthereceivederrordetectioncodematchesthecomputererrordetectioncode.Iftheymatch,theframeisconsideredtobevalid.Manyerror
detectionschemesexistandentirebookshavebeenwrittenonthesubject.Adetaileddiscussionofthesetechniquesisoutsidethescopeofthis
book,andwewillonlydiscusssomeexamplestoillustratethekeyprinciples.
To understand error detection codes, let us consider two devices that exchange bit strings containing N bits. To allow the receiver to detect a
transmissionerror,thesenderconvertseachstringofNbitsintoastringofN+rbits.Usually,therredundantbitsareaddedatthebeginningorthe
endofthetransmittedbitstring,butsometechniquesinterleaveredundantbitswiththeoriginalbits.An errordetectioncodecanbedefinedasa
functionthatcomputestherredundantbitscorrespondingtoeachstringofNbits.Thesimplesterrordetectioncodeistheparitybit.Therearetwo
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

4/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

types of parity schemes : even and odd parity. With the even(resp.odd) parity scheme, the redundant bit is chosen so that an even (resp. odd)
numberofbitsaresetto1inthetransmittedbitstringofN+rbits.Thereceivercaneasilyrecomputetheparityofeachreceivedbitstringanddiscard
thestringswithaninvalidparity.Theparityschemeisoftenusedwhen7bitcharactersareexchanged.Inthiscase,theeighthbitisoftenaparitybit.
Thetablebelowshowstheparitybitsthatarecomputedforbitstringscontainingthreebits.
3bitsstring

Oddparity Evenparity

000

001

010

100

111

110

101

011

TheparitybitallowsareceivertodetecttransmissionerrorsthathaveaffectedasinglebitamongthetransmittedN+rbits.Iftherearetwoormore
bitsinerror,thereceivermaynotnecessarilybeabletodetectthetransmissionerror.Morepowerfulerrordetectionschemeshavebeendefined.
The Cyclical Redundancy Checks (CRC) are widely used in datalink layer protocols.An Nbits CRC can detect all transmission errors affecting a
burstoflessthanNbitsinthetransmittedframeandalltransmissionerrorsthataffectanoddnumberofbits.AdditionaldetailsaboutCRCsmaybe
foundin[Williams1993].
Itisalsopossibletodesignacodethatallowsthereceivertocorrecttransmissionerrors.Thesimplest errorcorrectioncode is the triple modular
redundancy(TMR).Totransmitabitsetto1(resp.0),thesendertransmits111(resp.000).Whentherearenotransmissionerrors,thereceivercan
decode111as1.Iftransmissionerrorshaveaffectedasinglebit,thereceiverperformsmajorityvotingasshowninthetablebelow.Thisscheme
allowsthereceivertocorrectalltransmissionerrorsthataffectasinglebit.

Receivedbits

Decoded
bit

000

001

010

100

111

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

5/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

110

101

011

Othermorepowerfulerrorcorrectioncodeshavebeenproposedandareusedinsomeapplications.TheHammingCodeisaclevercombinationof
paritybitsthatprovideserrordetectionandcorrectioncapabilities.
Inpractice,datalinklayerprotocolscombinebitstuffingorcharacterstuffingwithalengthindicationintheframeheaderandachecksumorCRC.
Thechecksum/CRCiscomputedbythesenderandplacedintheframebeforeapplyingbit/characterstuffing.

MediumAccessControl
Pointtopoint datalink layers need to select one of the framing techniques described above and optionally add retransmission algorithms such as
thoseexplainedforthetransportlayertoprovideareliableservice.DatalinklayersforLocalAreaNetworksfacetwoadditionalproblems.ALANis
composedofseveralhoststhatareattachedtothesamesharedphysicalmedium.Fromaphysicallayerperspective,aLANcanbeorganisedin
fourdifferentways:
abusshapednetworkwhereallhostsareattachedtothesamephysicalcable
aringshapedwhereallhostsareattachedtoanupstreamandadownstreamnodesothattheentirenetworkformsaring
astarshapednetworkwhereallhostsareattachedtothesamedevice
awirelessnetworkwhereallhostscansendandreceiveframesusingradiosignals
These four basic physical organisations of Local Area Networks are shown graphically in the figure below. We will first focus on one physical
organisationatatime.

Bus,ringandstarshapedLocalAreaNetwork
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

6/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

ThecommonproblemamongallofthesenetworkorganisationsishowtoefficientlysharetheaccesstotheLocalAreaNetwork.Iftwodevicessend
aframeatthesametime,thetwoelectrical,opticalorradiosignalsthatcorrespondtotheseframeswillappearatthesametimeonthetransmission
mediumandareceiverwillnotbeabletodecodeeitherframe.Suchsimultaneoustransmissionsarecalledcollisions.Acollisionmayinvolveframes
transmittedbytwoormoredevicesattachedtotheLocalAreaNetwork.CollisionsarethemaincauseoferrorsinwiredLocalAreaNetworks.
AllLocalAreaNetworktechnologiesrelyonaMediumAccessControlalgorithmtoregulatethetransmissionstoeitherminimiseoravoidcollisions.
TherearetwobroadfamiliesofMediumAccessControlalgorithms:
1.DeterministicorpessimisticMACalgorithms.Thesealgorithmsassumethatcollisionsareaverysevereproblemandthattheymust
becompletelyavoided.Thesealgorithmsensurethatatanytime,atmostonedeviceisallowedtosendaframeontheLAN.Thisis
usuallyachievedbyusingadistributedprotocolwhichelectsonedevicethatisallowedtotransmitateachtime.AdeterministicMAC
algorithmensuresthatnocollisionwillhappen,butthereissomeoverheadinregulatingthetransmissionofallthedevicesattached
totheLAN.
2.StochasticoroptimisticMACalgorithms.ThesealgorithmsassumethatcollisionsarepartofthenormaloperationofaLocalArea
Network.Theyaimtominimisethenumberofcollisions,buttheydonottrytoavoidallcollisions.Stochasticalgorithmsareusually
easiertoimplementthandeterministicones.
We first discuss a simple deterministic MAC algorithm and then we describe several important optimistic algorithms, before coming back to a
distributedanddeterministicMACalgorithm.

Staticallocationmethods
AfirstsolutiontosharetheavailableresourcesamongallthedevicesattachedtooneLocalAreaNetworkistodefine, apriori,thedistributionofthe
transmission resources among the different devices. If N devices need to share the transmission capacities of a LAN operating at b Mbps, each
devicecouldbeallocatedabandwidthof Mbps.
LimitedresourcesneedtobesharedinotherenvironmentsthanLocalAreaNetworks.SincethefirstradiotransmissionsbyMarconimorethanone
centuryago,manyapplicationsthatexchangeinformationthroughradiosignalshavebeendeveloped.Eachradiosignalisanelectromagneticwave
whosepoweriscenteredaroundagivenfrequency.Theradiospectrumcorrespondstofrequenciesrangingbetweenroughly3KHzand300GHz.
Frequency allocation plans negotiated among governments reserve most frequency ranges for specific applications such as broadcast radio,
broadcasttelevision,mobilecommunications,aeronauticalradionavigation,amateurradio,satellite,etc.Eachfrequencyrangeisthensubdivided
intochannelsandeachchannelcanbereservedforagivenapplication,e.g.aradiobroadcasterinagivenregion.
FrequencyDivisionMultiplexing(FDM)isastaticallocationschemeinwhichafrequencyisallocatedtoeachdeviceattachedtothesharedmedium.
As each device uses a different transmission frequency, collisions cannot occur. In optical networks, a variant of FDM called Wavelength Division
Multiplexing(WDM)canbeused.Anopticalfibercantransportlightatdifferentwavelengthswithoutinterference.WithWDM,adifferentwavelength
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

7/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

isallocatedtoeachofthedevicesthatsharethesameopticalfiber.
TimeDivisionMultiplexing(TDM)isastaticbandwidthallocationmethodthatwasinitiallydefinedforthetelephonenetwork.Inthefixedtelephone
network,avoiceconversationisusuallytransmittedasa64Kbpssignal.Thus,atelephoneconservationgenerates8KBytespersecondoronebyte
every125microseconds.Telephoneconversationsoftenneedtobemultiplexedtogetheronasingleline.Forexample,inEurope,thirty64Kbps
voicesignalsaremultiplexedoverasingle2Mbps(E1)line.ThisisdonebyusingTimeDivisionMultiplexing(TDM).TDMdividesthetransmission
opportunities into slots. In the telephone network, a slot corresponds to 125 microseconds.A position inside each slot is reserved for each voice
signal.ThefigurebelowillustratesTDMonalinkthatisusedtocarryfourvoiceconversations.Theverticallinesrepresenttheslotboundariesand
the letters the different voice conversations. One byte from each voice conversation is sent during each 125 microseconds slot. The byte
correspondingtoagivenconversationisalwayssentatthesamepositionineachslot.

Timedivisionmultiplexing
TDMasshownabovecanbecompletelystatic,i.e.thesameconversationsalwayssharethelink,ordynamic.Inthelattercase,thetwoendpointsof
thelinkmustexchangemessagesspecifyingwhichconversationuseswhichbyteinsideeachslot.Thankstothesesignallingmessages,itispossible
todynamicallyaddandremovevoiceconversationsfromagivenlink.
TDMandFDMarewidelyusedintelephonenetworkstosupportfixedbandwidthconversations.UsingtheminLocalAreaNetworksthatsupport
computerswouldprobablybeinefficient.Computersusuallydonotsendinformationatafixedrate.Instead,theyoftenhaveanonoffbehaviour.
Duringtheonperiod,thecomputertriestosendatthehighestpossiblerate,e.g.totransferafile.Duringtheoffperiod,whichisoftenmuchlonger
thantheonperiod,thecomputerdoesnottransmitanypacket.UsingastaticallocationschemeforcomputersattachedtoaLANwouldleadtohuge
inefficiencies,astheywouldonlybeabletotransmitat ofthetotalbandwidthduringtheironperiod,despitethefactthattheothercomputersare
intheiroffperiodandthusdonotneedtotransmitanyinformation.ThedynamicMACalgorithmsdiscussedintheremainderofthischapteraim
solvethisproblem.

ALOHA
Inthe1960s,computersweremainlymainframeswithafewdozenterminalsattachedtothem.Theseterminalswereusuallyinthesamebuildingas
themainframeandweredirectlyconnectedtoit.Insomecases,theterminalswereinstalledinremotelocationsandconnectedthroughamodem
attachedtoadialupline.TheuniversityofHawaiichoseadifferentorganisation.Insteadofusingtelephonelinestoconnectthedistantterminals,
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

8/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

theydevelopedthefirstpacketradiotechnology[Abramson1970].Untilthen,computernetworkswerebuiltontopofeitherthetelephonenetwork
orphysicalcables.ALOHANetshowedthatitwaspossibletouseradiosignalstointerconnectcomputers.
ThefirstversionofALOHANet,describedin [Abramson1970],operatedasfollows:First,theterminalsandthemainframeexchangedfixedlength
framescomposedof704bits.Eachframecontained808bitcharacters,somecontrolbitsandparityinformationtodetecttransmissionerrors.Two
channelsinthe400MHzrangewerereservedfortheoperationofALOHANet.Thefirstchannelwasusedbythemainframetosendframestoall
terminals. The second channel was shared among all terminals to send frames to the mainframe.As all terminals share the same transmission
channel,thereisariskofcollision.Todealwiththisproblemaswellastransmissionerrors,themainframeverifiedtheparitybitsofthereceived
frame and sent an acknowledgement on its channel for each correctly received frame. The terminals on the other hand had to retransmit the
unacknowledgedframes.AsforTCP,retransmittingtheseframesimmediatelyuponexpirationofafixedtimeoutisnotagoodapproachasseveral
terminalsmayretransmittheirframesatthesametimeleadingtoanetworkcollapse.Abetterapproach,butstillfarfromperfect,isforeachterminal
to wait a random amount of time after the expiration of its retransmission timeout. This avoids synchronisation among multiple retransmitting
terminals.
The pseudocode below shows the operation of an ALOHANet terminal. We use this python syntax for all Medium Access Control algorithms
describedinthischapter.Thealgorithmisappliedtoeachnewframethatneedstobetransmitted.Itattemptstotransmitaframeatmostmaxtimes
(whileloop).Eachtransmissionattemptisperformedasfollows:First,theframeissent.Eachframeisprotectedbyatimeout.Then,theterminal
waitsforeitheravalidacknowledgementframeortheexpirationofitstimeout.Iftheterminalreceivesanacknowledgement,theframehasbeen
deliveredcorrectlyandthealgorithmterminates.Otherwise,theterminalwaitsforarandomtimeandattemptstoretransmittheframe.
#ALOHA
N=1
whileN<=max:
send(frame)
wait(ack_on_return_channelortimeout)
if(ack_on_return_channel):
break#transmissionwassuccessful
else:
#timeout
wait(random_time)
N=N+1
else:
#Toomanytransmissionattempts

[Abramson1970]analysedtheperformanceofALOHANetunderparticularassumptionsandfoundthatALOHANetworkedwellwhenthechannel
waslightlyloaded.Inthiscase,theframesarerarelyretransmittedandthechanneltraffic,i.e.thetotalnumberof(correctandretransmitted)frames
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

9/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

transmitted per unit of time is close to the channel utilization, i.e. the number of correctly transmitted frames per unit of time. Unfortunately, the
analysisalsorevealsthatthechannelutilizationreachesitsmaximumat
timesthechannelbandwidth.Athigherutilization,ALOHANet
becomesunstableandthenetworkcollapsesduetocollidedretransmissions.
Note
Amateurpacketradio
PacketradiotechnologieshaveevolvedinvariousdirectionssincethefirstexperimentsperformedattheUniversityofHawaii.The
Amateur packet radio service developed by amateur radio operators is one of the descendantsALOHANet. Many amateur radio
operatorsareveryinterestedinnewtechnologiesandtheyoftenspendcountlesshoursdevelopingnewantennasortransceivers.
Whenthefirstpersonalcomputersappeared,severalamateurradiooperatorsdesignedradiomodemsandtheirowndatalinklayer
protocols[KPD1985][BNT1997].ThisnetworkgrewanditwaspossibletoconnecttoserversinseveralEuropeancountriesbyonly
using packet radio relays. Some amateur radio operators also developed TCP/IP protocol stacks that were used over the packet
radioservice.SomepartsoftheamateurpacketradionetworkareconnectedtotheglobalInternetandusethe44.0.0.0/8prefix.
ManyimprovementstoALOHANethavebeenproposedsincethepublicationof [Abramson1970],andthistechnique,orsomeofitsvariants,are
stillfoundinwirelessnetworkstoday.Theslottedtechniqueproposedin[Roberts1975]isimportantbecauseitshowsthatasimplemodificationcan
significantlyimprovechannelutilization.Insteadofallowingallterminalstotransmitatanytime,[Roberts1975]proposedtodividetimeintoslotsand
allowterminalstotransmitonlyatthebeginningofeachslot.Eachslotcorrespondstothetimerequiredtotransmitonefixedsizeframe.Inpractice,
theseslotscanbeimposedbyasingleclockthatisreceivedbyallterminals.InALOHANet,itcouldhavebeenlocatedonthecentralmainframe.
Theanalysisin[Roberts1975]revealsthatthissimplemodificationimprovesthechannelutilizationbyafactoroftwo.

CarrierSenseMultipleAccess
ALOHAandslottedALOHAcaneasilybeimplemented,butunfortunately,theycanonlybeusedinnetworksthatareverylightlyloaded.Designinga
networkforaverylowutilisationispossible,butitclearlyincreasesthecostofthenetwork.ToovercometheproblemsofALOHA,manyMedium
Access Control mechanisms have been proposed which improve channel utilization. Carrier Sense Multiple Access (CSMA) is a significant
improvementcomparedtoALOHA.CSMArequiresallnodestolistentothetransmissionchanneltoverifythatitisfreebeforetransmittingaframe
[KT1975]. When a node senses the channel to be busy, it defers its transmission until the channel becomes free again.The pseudocode below
providesamoredetaileddescriptionoftheoperationofCSMA.
#persistentCSMA
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

10/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

N=1
whileN<=max:
wait(channel_becomes_free)
send(frame)
wait(ackortimeout)
ifack:
break#transmissionwassuccessful
else:
#timeout
N=N+1
#endofwhileloop
#Toomanytransmissionattempts

TheabovepseudocodeisoftencalledpersistentCSMA[KT1975]astheterminalwillcontinuouslylistentothechannelandtransmititsframeas
soon as the channel becomes free. Another important variant of CSMA is the nonpersistent CSMA [KT1975]. The main difference between
persistent and nonpersistent CSMA described in the pseudocode below is that a nonpersistent CSMA node does not continuously listen to the
channel to determine when it becomes free. When a nonpersistent CSMA terminal senses the transmission channel to be busy, it waits for a
randomtimebeforesensingthechannelagain.ThisimproveschannelutilizationcomparedtopersistentCSMA.WithpersistentCSMA,whentwo
terminalssensethechanneltobebusy,theywillbothtransmit(andthuscauseacollision)assoonasthechannelbecomesfree.Withnonpersistent
CSMA,thissynchronisationdoesnotoccur,astheterminalswaitarandomtimeafterhavingsensedthetransmissionchannel.However,thehigher
channel utilization achieved by nonpersistent CSMA comes at the expense of a slightly higher waiting time in the terminals when the network is
lightlyloaded.
#NonpersistentCSMA
N=1
whileN<=max:
listen(channel)
iffree(channel):
send(frame)
wait(ackortimeout)
ifreceived(ack):
break#transmissionwassuccessful
else:
#timeout
N=N+1
else:
wait(random_time)
#endofwhileloop
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

11/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

#Toomanytransmissionattempts

[KT1975]analyzesindetailtheperformanceofseveralCSMAvariants.Undersomeassumptionsaboutthetransmissionchannelandthetraffic,the
analysiscomparesALOHA,slottedALOHA,persistentandnonpersistentCSMA.Undertheseassumptions,ALOHAachievesachannelutilization
ofonly18.4%ofthechannelcapacity.SlottedALOHAisabletouse36.6%ofthiscapacity.PersistentCSMAimprovestheutilizationbyreaching
52.9%ofthecapacitywhilenonpersistentCSMAachieves81.5%ofthechannelcapacity.

CarrierSenseMultipleAccesswithCollisionDetection
CSMAimproveschannelutilizationcomparedtoALOHA.However,theperformancecanstillbeimproved,especiallyinwirednetworks.Considerthe
situationoftwoterminalsthatareconnectedtothesamecable.Thiscablecould,forexample,beacoaxialcableasintheearlydaysofEthernet
[Metcalfe1976]. It could also be built with twisted pairs. Before extending CSMA, it is useful to understand more intuitively, how frames are
transmitted in such a network and how collisions can occur.The figure below illustrates the physical transmission of a frame on such a cable.To
transmititsframe,hostAmustsendanelectricalsignalonthesharedmedium.Thefirststepisthustobeginthetransmissionoftheelectricalsignal.
Thisispoint(1)inthefigurebelow.Thiselectricalsignalwilltravelalongthecable.Althoughelectricalsignalstravelfast,weknowthatinformation
cannottravelfasterthanthespeedoflight(i.e.300.000kilometers/second).Onacoaxialcable,anelectricalsignalisslightlyslowerthanthespeed
oflightand200.000kilometerspersecondisareasonableestimation.Thisimpliesthatifthecablehasalengthofonekilometer,theelectricalsignal
will need 5 microseconds to travel from one end of the cable to the other. The ends of coaxial cables are equipped with termination points that
ensurethattheelectricalsignalisnotreflectedbacktoitssource.Thisisillustratedatpoint(3)inthefigure,wheretheelectricalsignalhasreached
theleftendpointandhostB.Atthispoint,BstartstoreceivetheframebeingtransmittedbyA.Noticethatthereisadelaybetweenthetransmission
ofabitonhostAanditsreceptionbyhostB.Iftherewereotherhostsattachedtothecable,theywouldreceivethefirstbitoftheframeatslightly
differenttimes.Aswewillseelater,thistimingdifferenceisakeyproblemforMACalgorithms.Atpoint (4),theelectricalsignalhasreachedboth
endsofthecableandoccupiesitcompletely.HostAcontinuestotransmittheelectricalsignaluntiltheendoftheframe.Asshownatpoint (5),when
thesendinghoststopsitstransmission,theelectricalsignalcorrespondingtotheendoftheframeleavesthecoaxialcable.Thechannelbecomes
emptyagainoncetheentireelectricalsignalhasbeenremovedfromthecable.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

12/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Frametransmissiononasharedbus
Nowthatwehavelookedathowaframeisactuallytransmittedasanelectricalsignalonasharedbus,itisinterestingtolookinmoredetailatwhat
happenswhentwohoststransmitaframeatalmostthesametime.Thisisillustratedinthefigurebelow,wherehostsAandBstarttheirtransmission
atthesametime(point(1)).Atthistime,ifhostCsensesthechannel,itwillconsiderittobefree.Thiswillnotlastalongtimeandatpoint (2)the
electricalsignalsfrombothhostAandhostBreachhostC.Thecombinedelectricalsignal(showngraphicallyasthesuperpositionofthetwocurves
inthefigure)cannotbedecodedbyhostC.HostCdetectsacollision,asitreceivesasignalthatitcannotdecode.SincehostCcannotdecodethe
frames,itcannotdeterminewhichhostsaresendingthecollidingframes.NotethathostA(andhostB)willdetectthecollisionafterhostC(point (3)
inthefigurebelow).
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

13/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Framecollisiononasharedbus
Asshownabove,hostsdetectcollisionswhentheyreceiveanelectricalsignalthattheycannotdecode.Inawirednetwork,ahostisabletodetect
such a collision both while it is listening (e.g. like host C in the figure above) and also while it is sending its own frame. When a host transmits a
frame,itcancomparetheelectricalsignalthatittransmitswiththeelectricalsignalthatitsensesonthewire.Atpoints(1)and(2)inthefigureabove,
hostAsensesonlyitsownsignal.Atpoint (3),itsensesanelectricalsignalthatdiffersfromitsownsignalandcanthusdetectsthecollision.Atthis
point,itsframeiscorruptedanditcanstopitstransmission.TheabilitytodetectcollisionswhiletransmittingisthestartingpointfortheCarrierSense
MultipleAccesswithCollisionDetection(CSMA/CD)MediumAccessControlalgorithm,whichisusedinEthernetnetworks[Metcalfe1976][802.3].
WhenanEthernethostdetectsacollisionwhileitistransmitting,itimmediatelystopsitstransmission.ComparedwithpureCSMA,CSMA/CDisan
importantimprovementsincewhencollisionsoccur,theyonlylastuntilcollidinghostshavedetecteditandstoppedtheirtransmission.Inpractice,
whenahostdetectsacollision,itsendsaspecialjammingsignalonthecabletoensurethatallhostshavedetectedthecollision.
Tobetterunderstandthesecollisions,itisusefultoanalysewhatwouldbetheworstcollisiononasharedbusnetwork.Letusconsiderawirewith
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

14/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

twohostsattachedatbothends,asshowninthefigurebelow.HostAstartstotransmititsframeanditselectricalsignalispropagatedonthecable.
Itspropagationtimedependsonthephysicallengthofthecableandthespeedoftheelectricalsignal.Letususe torepresentthispropagation
delayinseconds.Slightlylessthan secondsafterthebeginningofthetransmissionofAsframe,Bdecidestostarttransmittingitsownframe.After
seconds,BsensesAsframe,detectsthecollisionandstopstransmitting.ThebeginningofBsframetravelsonthecableuntilitreacheshostA.
HostAcanthusdetectthecollisionattime
.Animportantpointtonoteisthatacollisioncanonlyoccurduringthefirst
secondsofitstransmission.Ifacollisiondidnotoccurduringthisperiod,itcannotoccurafterwardssincethetransmissionchannelisbusyafter
secondsandCSMA/CDhostssensethetransmissionchannelbeforetransmittingtheirframe.

Theworstcollisiononasharedbus
Furthermore, on the wired networks where CSMA/CD is used, collisions are almost the only cause of transmission errors that affect frames.
Transmission errors that only affect a few bits inside a frame seldom occur in these wired networks. For this reason, the designers of CSMA/CD
chosetocompletelyremovetheacknowledgementframesinthedatalinklayer.Whenahosttransmitsaframe,itverifieswhetheritstransmission
hasbeenaffectedbyacollision.Ifnot,giventhenegligibleBitErrorRatiooftheunderlyingnetwork,itassumesthattheframewasreceivedcorrectly
byitsdestination.Otherwisetheframeisretransmittedaftersomedelay.
Removingacknowledgementsisaninterestingoptimisationasitreducesthenumberofframesthatareexchangedonthenetworkandthenumber
of frames that need to be processed by the hosts. However, to use this optimisation, we must ensure that all hosts will be able to detect all the
collisionsthataffecttheirframes.Theproblemisimportantforshortframes.Letusconsidertwohosts,AandB,thataresendingasmallframeto
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

15/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

hostCasillustratedinthefigurebelow.IftheframessentbyAandBareveryshort,thesituationillustratedbelowmayoccur.HostsAandBsend
theirframeandstoptransmitting(point(1)).WhenthetwoshortframesarriveatthelocationofhostC,theycollideandhostCcannotdecodethem
(point(2)).Thetwoframesareabsorbedbytheendsofthewire.NeitherhostAnorhostBhavedetectedthecollision.Theybothconsidertheir
frametohavebeenreceivedcorrectlybyitsdestination.

Theshortframecollisionproblem
Tosolvethisproblem,networksusingCSMA/CDrequirehoststotransmitforatleast
seconds.Sincethenetworktransmissionspeedisfixed
foragivennetworktechnology,thisimpliesthatatechnologythatusesCSMA/CDenforcesaminimumframesize.InthemostpopularCSMA/CD
technology,Ethernet,
iscalledtheslottime[1].
ThelastinnovationintroducedbyCSMA/CDisthecomputationoftheretransmissiontimeout.AsforALOHA,thistimeoutcannotbefixed,otherwise
hosts could become synchronised and always retransmit at the same time. Setting such a timeout is always a compromise between the network
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

16/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

accessdelayandtheamountofcollisions.Ashorttimeoutwouldleadtoalownetworkaccessdelaybutwithahigherriskofcollisions.Ontheother
hand,alongtimeoutwouldcausealongnetworkaccessdelaybutalowerriskofcollisions.Thebinaryexponentialbackoffalgorithmwasintroduced
inCSMA/CDnetworkstosolvethisproblem.
To understand binary exponential backoff, let us consider a collision caused by exactly two hosts. Once it has detected the collision, a host can
either retransmit its frame immediately or defer its transmission for some time. If each colliding host flips a coin to decide whether to retransmit
immediatelyortodeferitsretransmission,fourcasesarepossible:
1.Bothhostsretransmitimmediatelyandanewcollisionoccurs
2.Thefirsthostretransmitsimmediatelyandtheseconddefersitsretransmission
3.Thesecondhostretransmitsimmediatelyandthefirstdefersitsretransmission
4.Bothhostsdefertheirretransmissionandanewcollisionoccurs
Inthesecondandthirdcases,bothhostshaveflippeddifferentcoins.Thedelaychosenbythehostthatdefersitsretransmissionshouldbelong
enoughtoensurethatitsretransmissionwillnotcollidewiththeimmediateretransmissionoftheotherhost.Howeverthedelayshouldnotbelonger
thanthetimenecessarytoavoidthecollision,becauseifbothhostsdecidetodefertheirtransmission,thenetworkwillbeidleduringthisdelay.The
slottimeistheoptimaldelaysinceitistheshortestdelaythatensuresthatthefirsthostwillbeabletoretransmititsframecompletelywithoutany
collision.
Iftwohostsarecompeting,thealgorithmabovewillavoidasecondcollision50%ofthetime.However,ifthenetworkisheavilyloaded,severalhosts
maybecompetingatthesametime.Inthiscase,thehostsshouldbeabletoautomaticallyadapttheirretransmissiondelay.Thebinaryexponential
backoffperformsthisadaptationbasedonthenumberofcollisionsthathaveaffectedaframe.Afterthefirstcollision,thehostflipsacoinandwaits
0or1slottime.Afterthesecondcollision,itgeneratesarandomnumberandwaits0,1,2or3 slottimes,etc.Thedurationofthewaitingtimeis
doubledaftereachcollision.ThecompletepseudocodefortheCSMA/CDalgorithmisshowninthefigurebelow.
#CSMA/CDpseudocode
N=1
whileN<=max:
wait(channel_becomes_free)
send(frame)
wait_until(end_of_frame)or(collision)
ifcollisiondetected:
stoptransmitting
send(jamming)
k=min(10,N)
r=random(0,2k1)*slotTime
wait(r*slotTime)
N=N+1
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

17/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

else:
wait(interframe_delay)
break
#endofwhileloop
#Toomanytransmissionattempts

Theinterframedelayusedinthispseudocodeisashortdelaycorrespondingtothetimerequiredbyanetworkadaptertoswitchfromtransmitto
receivemode.Itisalsousedtopreventahostfromsendingacontinuousstreamofframeswithoutleavinganytransmissionopportunitiesforother
hostsonthenetwork.ThiscontributestothefairnessofCSMA/CD.Despitethisdelay,therearestillconditionswhereCSMA/CDisnotcompletely
fair[RY1994].Considerforexampleanetworkwithtwohosts:aserversendinglongframesandaclientsendingacknowledgments.Measurements
reportedin[RY1994]haveshownthattherearesituationswheretheclientcouldsufferfromrepeatedcollisionsthatleadittowaitforlongperiodsof
timeduetotheexponentialbackoffalgorithm.
[1] ThisnameshouldnotbeconfusedwiththedurationofatransmissionslotinslottedALOHA.InCSMA/CDnetworks,theslottimeisthetime
duringwhichacollisioncanoccuratthebeginningofthetransmissionofaframe.InslottedALOHA,thedurationofaslotisthetransmission
timeofanentirefixedsizeframe.

CarrierSenseMultipleAccesswithCollisionAvoidance
The Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA) Medium Access Control algorithm was designed for the popular WiFi
wirelessnetworktechnology[802.11].CSMA/CAalsosensesthetransmissionchannelbeforetransmittingaframe.Furthermore,CSMA/CAtriesto
avoidcollisionsbycarefullytuningthetimersusedbyCSMA/CAdevices.
CSMA/CAusesacknowledgementslikeCSMA.EachframecontainsasequencenumberandaCRC.TheCRCisusedtodetecttransmissionerrors
whilethesequencenumberisusedtoavoidframeduplication.Whenadevicereceivesacorrectframe,itreturnsaspecialacknowledgementframe
tothesender.CSMA/CAintroducesasmalldelay,namedShortInterFrameSpacing(SIFS),betweenthereceptionofaframeandthetransmission
of the acknowledgement frame. This delay corresponds to the time that is required to switch the radio of a device between the reception and
transmissionmodes.
ComparedtoCSMA,CSMA/CAdefinesmorepreciselywhenadeviceisallowedtosendaframe.First,CSMA/CAdefinestwodelays: DIFS and
EIFS.Tosendaframe,adevicemustfirstwaituntilthechannelhasbeenidleforatleasttheDistributedCoordinationFunctionInterFrameSpace
(DIFS)ifthepreviousframewasreceivedcorrectly.However,ifthepreviouslyreceivedframewascorrupted,thisindicatesthattherearecollisions
and the device must sense the channel idle for at least the Extended Inter Frame Space (EIFS), with
. The exact
valuesforSIFS,DIFSandEIFSdependontheunderlyingphysicallayer[802.11].
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

18/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

ThefigurebelowshowsthebasicoperationofCSMA/CAdevices.Beforetransmitting,host Averifiesthatthechannelisemptyforalongenough
period.Then,itssendsitsdataframe.Aftercheckingthevalidityofthereceivedframe,therecipientsendsanacknowledgementframeafterashort
SIFSdelay.HostC,whichdoesnotparticipateintheframeexchange,sensesthechanneltobebusyatthebeginningofthedataframe.HostCcan
usethisinformationtodeterminehowlongthechannelwillbebusyfor.Notethatas
,evenadevicethatwouldstartto
sense the channel immediately after the last bit of the data frame could not decide to transmit its own frame during the transmission of the
acknowledgementframe.

OperationofaCSMA/CAdevice
ThemaindifficultywithCSMA/CAiswhentwoormoredevicestransmitatthesametimeandcausecollisions.Thisisillustratedinthefigurebelow,
assumingafixedtimeoutafterthetransmissionofadataframe.WithCSMA/CA,thetimeoutafterthetransmissionofadataframeisverysmall,
sinceitcorrespondstotheSIFSplusthetimerequiredtotransmittheacknowledgementframe.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

19/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

CollisionswithCSMA/CA
Todealwiththisproblem,CSMA/CAreliesonabackofftimer.Thisbackofftimerisarandomdelaythatischosenbyeachdeviceinarangethat
depends on the number of retransmissions for the current frame. The range grows exponentially with the retransmissions as in CSMA/CD. The
minimum range for the backoff timer is
where the slotTime is a parameter that depends on the underlying physical layer.
ComparedtoCSMA/CDsexponentialbackoff,therearetwoimportantdifferencestonotice.First,theinitialrangeforthebackofftimerisseventimes
larger.ThisisbecauseitisimpossibleinCSMA/CAtodetectcollisionsastheyhappen.WithCSMA/CA,acollisionmayaffecttheentireframewhile
withCSMA/CDitcanonlyaffectthebeginningoftheframe.Second,aCSMA/CAdevicemustregularlysensethetransmissionchannelduringits
backofftimer.Ifthechannelbecomesbusy(i.e.becauseanotherdeviceistransmitting),thenthebackofftimermustbefrozenuntilthechannel
becomes free again. Once the channel becomes free, the back off timer is restarted. This is in contrast with CSMA/CD where the back off is
recomputedaftereachcollision.Thisisillustratedinthefigurebelow.HostAchoosesasmallerbackoffthanhostC.WhenCsensesthechannelto
bebusy,itfreezesitsbackofftimerandonlyrestartsitoncethechannelisfreeagain.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

20/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

DetailedexamplewithCSMA/CA
The pseudocode below summarises the operation of a CSMA/CA device. The values of the SIFS, DIFS, EIFS and slotTime depend on the
underlyingphysicallayertechnology[802.11]
#CSMA/CAsimplifiedpseudocode
N=1
whileN<=max:
waitUntil(free(channel))
ifcorrect(last_frame):
wait(channel_free_during_t>=DIFS)
else:
wait(channel_free_during_t>=EIFS)

backoff_time=int(random[0,min(255,7*(2^(N1)))])*slotTime
wait(channelfreeduringbackoff_time)
#backofftimerisfrozenwhilechannelissensedtobebusy
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

21/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

send(frame)
wait(ackortimeout)
ifreceived(ack)
#framereceivedcorrectly
break
else:
#retransmissionrequired
N=N+1

Another problem faced by wireless networks is often called the hidden station problem. In a wireless network, radio signals are not always
propagatedsamewayinalldirections.Forexample,twodevicesseparatedbyawallmaynotbeabletoreceiveeachotherssignalwhiletheycould
bothbereceivingthesignalproducedbyathirdhost.Thisisillustratedinthefigurebelow,butitcanhappeninotherenvironments.Forexample,two
devicesthatareondifferentsidesofahillmaynotbeabletoreceiveeachotherssignalwhiletheyarebothabletoreceivethesignalsentbya
stationatthetopofthehill.Furthermore,theradiopropagationconditionsmaychangewithtime.Forexample,atruckmaytemporarilyblockthe
communicationbetweentwonearbydevices.

Thehiddenstationproblem
Toavoidcollisionsinthesesituations,CSMA/CAallowsdevicestoreservethetransmissionchannelforsometime.Thisisdonebyusingtwocontrol
frames:RequestToSend(RTS)andClearToSend(CTS).Bothareveryshortframestominimizetheriskofcollisions.Toreservethetransmission
channel,adevicesendsaRTSframetotheintendedrecipientofthedataframe.TheRTSframecontainsthedurationoftherequestedreservation.
Therecipientreplies,afteraSIFSdelay,withaCTSframewhichalsocontainsthedurationofthereservation.Asthedurationofthereservationhas
beensentinbothRTSandCTS,allhoststhatcouldcollidewitheitherthesenderorthereceptionofthedataframeareinformedofthereservation.
Theycancomputethetotaldurationofthetransmissionanddefertheiraccesstothetransmissionchanneluntilthen.Thisisillustratedinthefigure
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

22/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

belowwherehostAreservesthetransmissionchanneltosendadataframetohostB.HostCnoticesthereservationanddefersitstransmission.

ReservationswithCSMA/CA
TheutilizationofthereservationswithCSMA/CAisanoptimisationthatisusefulwhencollisionsarefrequent.Iftherearefewcollisions,thetime
requiredtotransmittheRTSandCTSframescanbecomesignificantandinparticularwhenshortframesareexchanged.Somedevicesonlyturnon
RTS/CTSaftertransmissionerrors.

DeterministicMediumAccessControlalgorithms
Duringthe1970sand1980s,therewerehugedebatesinthenetworkingcommunityaboutthebestsuitedMediumAccessControlalgorithmsfor
LocalAreaNetworks.Theoptimisticalgorithmsthatwehavedescribeduntilnowwererelativelyeasytoimplementwhentheyweredesigned.Froma
performanceperspective,mathematicalmodelsandsimulationsshowedtheabilityoftheseoptimistictechniquestosustainload.However,noneof
theoptimistictechniquesareabletoguaranteethataframewillbedeliveredwithinagivendelayboundandsomeapplicationsrequirepredictable
transmissiondelays.ThedeterministicMACalgorithmswereconsideredbyafractionofthenetworkingcommunityasthebestsolutiontofulfillthe
needsofLocalAreaNetworks.
Both the proponents of the deterministic and the opportunistic techniques lobbied to develop standards for Local Area networks that would
incorporate their solution. Instead of trying to find an impossible compromise between these diverging views, the IEEE 802 committee that was
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

23/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

charteredtodevelopLocalAreaNetworkstandardschosetoworkinparallelonthreedifferentLANtechnologiesandcreatedthreeworkinggroups.
TheIEEE802.3workinggroupbecameresponsibleforCSMA/CD.TheproponentsofdeterministicMACalgorithmsagreedonthebasicprinciple
ofexchangingspecialframescalledtokensbetweendevicestoregulatetheaccesstothetransmissionmedium.However,theydidnotagreeonthe
mostsuitablephysicallayoutforthenetwork.IBMarguedinfavorofRingshapednetworkswhilethemanufacturingindustry,ledbyGeneralMotors,
arguedinfavorofabusshapednetwork.ThisledtothecreationoftheIEEE802.4workinggrouptostandardiseTokenBusnetworksandtheIEEE
802.5workinggrouptostandardiseTokenRingnetworks.Althoughthesetechniquesarenotwidelyusedanymoretoday,theprinciplesbehinda
tokenbasedprotocolarestillimportant.
TheIEEE802.5TokenRingtechnologyisdefinedin[802.5].WeuseTokenRingasanexampletoexplaintheprinciplesofthetokenbasedMAC
algorithmsinringshapednetworks.OtherringshapednetworksincludethealmostdefunctFDDI[Ross1989]orthemorerecentResilientPackRing
[DYGU2004].Agoodsurveyofthetokenringnetworksmaybefoundin[Bux1989].
ATokenRingnetworkiscomposedofasetofstationsthatareattachedtoaunidirectionalring.ThebasicprincipleoftheTokenRingMACalgorithm
isthattwotypesofframestravelonthering:tokensanddataframes.WhentheTokenRingstarts,oneofthestationssendsthetoken.Thetokenis
asmallframethatrepresentstheauthorizationtotransmitdataframesonthering.Totransmitadataframeonthering,astationmustfirstcapture
thetokenbyremovingitfromthering.Asonlyonestationcancapturethetokenatatime,thestationthatownsthetokencansafelytransmitadata
frameontheringwithoutriskingcollisions.Afterhavingtransmitteditsframe,thestationmustremoveitfromtheringandresendthetokensothat
otherstationscantransmittheirownframes.

ATokenRingnetwork
WhilethebasicprinciplesoftheTokenRingaresimple,thereareseveralsubtleimplementationdetailsthataddcomplexitytoTokenRingnetworks.
To understand these details let us analyse the operation of a Token Ring interface on a station. A Token Ring interface serves three different
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

24/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

purposes.LikeotherLANinterfaces,itmustbeabletosendandreceiveframes.Inaddition,aTokenRinginterfaceispartofthering,andassuch,it
mustbeabletoforwardtheelectricalsignalthatpassesontheringevenwhenitsstationispoweredoff.
Whenpoweredon,TokenRinginterfacesoperateintwodifferentmodes:listenandtransmit.Whenoperatinginlistenmode,aTokenRinginterface
receivesanelectricalsignalfromitsupstreamneighbouronthering,introducesadelayequaltothetransmissiontimeofonebitontheringand
regeneratesthesignalbeforesendingittoitsdownstreamneighbouronthering.
ThefirstproblemfacedbyaTokenRingnetworkisthatasthetokenrepresentstheauthorizationtotransmit,itmustcontinuouslytravelonthering
when no data frame is being transmitted. Let us assume that a token has been produced and sent on the ring by one station. In Token Ring
networks,thetokenisa24bitsframewhosestructureisshownbelow.

802.5tokenformat
The token is composed of three fields. First, the Starting Delimiter is the marker that indicates the beginning of a frame. The first Token Ring
networksusedManchestercodingandtheStartingDelimitercontainedbothsymbolsrepresenting0andsymbolsthatdonotrepresentbits.Thelast
fieldistheEndingDelimiterwhichmarkstheendofthetoken.TheAccessControlfieldispresentinallframes,andcontainsseveralflags.Themost
importantistheTokenbitthatissetintokenframesandresetinotherframes.
LetusconsiderthefivestationnetworkdepictedinfigureATokenRingnetworkaboveandassumethatstationS1sendsatoken.Ifweneglectthe
propagationdelayontheinterstationlinks,aseachstationintroducesaonebitdelay,thefirstbitoftheframewouldreturntoS1whileitsendsthe
fifthbitofthetoken.IfstationS1ispoweredoffatthattime,onlythefirstfivebitsofthetokenwilltravelonthering.Toavoidthisproblem,thereisa
specialstationcalledtheMonitoroneachTokenRing.Toensurethatthetokencantravelforeveronthering,this Monitor inserts a delay that is
equaltoatleast24bittransmissiontimes.IfstationS3wastheMonitorinfigureATokenRingnetwork,S1wouldhavebeenabletotransmitthe
entiretokenbeforereceivingthefirstbitofthetokenfromitsupstreamneighbour.
Nowthatwehaveexplainedhowthetokencanbeforwardedonthering,letusanalysehowastationcancaptureatokentotransmitadataframe.
For this, we need some information about the format of the data frames.An 802.5 data frame begins with the StartingDelimiter followed by the
AccessControlfieldwhoseTokenbitisreset,aFrameControlfieldthatallowsforthedefinitionofseveraltypesofframes,destinationandsource
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

25/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

address,apayload,aCRC,theEndingDelimiterandaFrameStatusfield.TheformatoftheTokenRingdataframesisillustratedbelow.

802.5dataframeformat
Tocaptureatoken,astationmustoperateinListenmode.Inthismode,thestationreceivesbitsfromitsupstreamneighbour.Ifthebitscorrespond
toadataframe,theymustbeforwardedtothedownstreamneighbour.Iftheycorrespondtoatoken,thestationcancaptureitandtransmititsdata
frame.BoththedataframeandthetokenareencodedasabitstringbeginningwiththeStartingDelimiterfollowedbytheAccessControlfield.When
thestationreceivesthefirstbitofaStartingDelimiter,itcannotknowwhetherthisisadataframeoratokenandmustforwardtheentiredelimiterto
itsdownstreamneighbour.ItisonlywhenitreceivesthefourthbitoftheAccessControlfield(i.e.theTokenbit)thatthestationknowswhetherthe
frameisadataframeoratoken.IftheTokenbitisreset,itindicatesadataframeandtheremainingbitsofthedataframemustbeforwardedtothe
downstreamstation.Otherwise(Tokenbitisset),thisisatokenandthestationcancaptureitbyresettingthebitthatiscurrentlyinitsbuffer.Thanks
tothismodification,thebeginningofthetokenisnowthebeginningofadataframeandthestationcanswitchtoTransmitmodeandsenditsdata
framestartingatthefifthbitoftheAccessControlfield.Thus,theonebitdelayintroducedbyeachTokenRingstationplaysakeyroleinenabling
thestationstoefficientlycapturethetoken.
Afterhavingtransmitteditsdataframe,thestationmustremaininTransmitmodeuntilithasreceivedthelastbitofitsowndataframe.Thisensures
thatthebitssentbyastationdonotremaininthenetworkforever.AdataframesentbyastationinaTokenRingnetworkpassesinfrontofall
stationsattachedtothenetwork.Eachstationcandetectthedataframeandanalysethedestinationaddresstopossiblycapturetheframe.
TheFrameStatusfieldthatappearsaftertheEndingDelimiterisusedtoprovideacknowledgementswithoutrequiringspecialframes.The Frame
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

26/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Statuscontainstwoflags:AandC.Bothflagsareresetwhenastationsendsadataframe.Theseflagscanbemodifiedbytheirrecipients.Whena
station senses its address as the destination address of a frame, it can capture the frame, check its CRC and place it in its own buffers. The
destinationofaframemustsettheAbit(resp.Cbit)oftheFrameStatusfieldonceithasseen(resp.copied)adataframe.ByinspectingtheFrame
Statusofthereturningframe,thesendercanverifywhetheritsframehasbeenreceivedcorrectlybyitsdestination.
ThetextabovedescribesthebasicoperationofaTokenRingnetworkwhenallstationsworkcorrectly.Unfortunately,arealTokenRingnetworkmust
beabletohandlevarioustypesofanomaliesandthisincreasesthecomplexityofTokenRingstations.Webrieflylisttheproblemsandoutlinetheir
solutionsbelow.AdetaileddescriptionoftheoperationofTokenRingstationsmaybefoundin [802.5].The first problem is when all the stations
attachedtothenetworkstart.Oneofthemmustbootstrapthenetworkbysendingthefirsttoken.Forthis,allstationsimplementadistributedelection
mechanismthatisusedtoselecttheMonitor.AnystationcanbecomeaMonitor.TheMonitormanagestheTokenRingnetworkandensuresthatit
operatescorrectly.Itsfirstroleistointroduceadelayof24bittransmissiontimestoensurethatthetokencantravelsmoothlyonthering.Second,
theMonitor sends the first token on the ring. It must also verify that the token passes regularly.According to theToken Ring standard [802.5],a
stationcannotretainthetokentotransmitdataframesforadurationlongerthantheTokenHoldingTime(THT)(slightlylessthan10milliseconds).
OnanetworkcontainingNstations,theMonitormustreceivethetokenatleastevery
seconds.IftheMonitordoesnotreceiveatoken
duringsuchaperiod,itcutstheringforsometimeandthenreinitialisestheringandsendsatoken.
SeveralotheranomaliesmayoccurinaTokenRingnetwork.Forexample,astationcouldcaptureatokenandbepoweredoffbeforehavingresent
thetoken.Anotherstationcouldhavecapturedthetoken,sentitsdataframeandbepoweredoffbeforereceivingallofitsdataframe.Inthiscase,
thebitstringcorrespondingtotheendofaframewouldremainintheringwithoutbeingremovedbyitssender.Severaltechniquesaredefinedin
[802.5] to allow the Monitor to handle all these problems. If unfortunately, the Monitor fails, another station will be elected to become the new
Monitor.

Datalinklayertechnologies
Inthissection,wereviewthekeycharacteristicsofseveraldatalinklayertechnologies.Wediscussinmoredetailthetechnologiesthatarewidely
usedtoday.Adetailedsurveyofalldatalinklayertechnologieswouldbeoutsidethescopeofthisbook.

ThePointtoPointProtocol
Manypointtopointdatalinklayers[2]havebeendeveloped,startinginthe1960s[McFadyen1976].Inthissection,wefocusontheprotocolsthat
are often used to transport IP packets between hosts or routers that are directly connected by a pointtopoint link. This link can be a dedicated
physicalcable,aleasedlinethroughthetelephonenetworkoradialupconnectionwithmodemsonthetwocommunicatinghosts.
The first solution to transport IP packets over a serial line was proposed in RFC 1055 and is known as Serial Line IP (SLIP). SLIP is a simple
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

27/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

characterstuffingtechniqueappliedtoIPpackets.SLIPdefinestwospecialcharacters:END(decimal192)andESC(decimal219).ENDappearsat
thebeginningandattheendofeachtransmittedIPpacketandthesenderaddsESCbeforeeachENDcharacterinsideeachtransmittedIPpacket.
SLIP only supports the transmission of IP packets and it assumes that the two communicating hosts/routers have been manually configured with
eachothersIPaddress.SLIPwasmainlyusedoverlinksofferingbandwidthofoftenlessthan20Kbps.Onsuchalowbandwidthlink,sending20
bytes of IP header followed by 20 bytes of TCP header for each TCP segment takes a lot of time. This initiated the development of a family of
compressiontechniquestoefficientlycompresstheTCP/IPheaders.ThefirstheadercompressiontechniqueproposedinRFC1144wasdesignedto
exploittheredundancybetweenseveralconsecutivesegmentsthatbelongtothesameTCPconnection.Inallthesesegments,theIPaddressesand
portnumbersarealwaysthesame.Furthermore,fieldssuchasthesequenceandacknowledgementnumbersdonotchangeinarandomway.RFC
1144 defined simple techniques to reduce the redundancy found in successive segments. The development of header compression techniques
continuedandtherearestillimprovementsbeingdevelopednowRFC5795.
WhileSLIPwasimplementedandusedinsomeenvironments,ithadseverallimitationsdiscussedinRFC1055.ThePointtoPointProtocol(PPP)
wasdesignedshortlyafterandisspecifiedinRFC1548.PPPaimstosupportIPandothernetworklayerprotocolsovervarioustypesofseriallines.
PPPisinfactafamilyofthreeprotocolsthatareusedtogether:
1.ThePointtoPointProtocoldefinestheframingtechniquetotransportnetworklayerpackets.
2.TheLinkControlProtocolthatisusedtonegotiateoptionsandauthenticatethesessionbyusingusernameandpasswordorother
typesofcredentials
3.TheNetworkControlProtocolthatisspecificforeachnetworklayerprotocol.Itisusedtonegotiateoptionsthatarespecificforeach
protocol.Forexample,IPv4sNCPRFC1548cannegotiatetheIPv4addresstobeused,theIPv4addressoftheDNSresolver.
IPv6sNCPisdefinedinRFC5072.
ThePPPframingRFC1662wasinspiredbythedatalinklayerprotocolsstandardisedbyITUTandISO.AtypicalPPPframeiscomposedofthe
fields shown in the figure below. A PPP frame starts with a one byte flag containing 01111110. PPP can use bit stuffing or character stuffing
dependingontheenvironmentwheretheprotocolisused.Theaddressandcontrolfieldsarepresentforbackwardcompatibilityreasons.The16bit
Protocolfieldcontainstheidentifier[3]ofthenetworklayerprotocolthatiscarriedinthePPPframe.0x002disusedforanIPv4packetcompressed
withRFC1144while0x002fisusedforanuncompressedIPv4packet.0xc021isusedbytheLinkControlProtocol,0xc023isusedbythePassword
AuthenticationProtocol(PAP).0x0057isusedforIPv6packets.PPPsupportsvariablelengthpackets,butLCPcannegotiateamaximumpacket
length.ThePPPframeendswithaFrameCheckSequence.Thedefaultisa16bitsCRC,butsomeimplementationscannegotiatea32bitsCRC.
Theframeendswiththe01111110flag.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

28/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

PPPframeformat
PPP played a key role in allowing Internet Service Providers to provide dialup access over modems in the late 1990s and early 2000s. ISPs
operated modem banks connected to the telephone network. For these ISPs, a key issue was to authenticate each user connected through the
telephonenetwork.ThisauthenticationwasperformedbyusingtheExtensibleAuthenticationProtocol(EAP)definedinRFC3748.EAPisasimple,
but extensible protocol that was initially used by access routers to authenticate the users connected through dialup lines. Several authentication
methods,startingfromthesimpleusername/passwordpairstomorecomplexschemeshavebeendefinedandimplemented.WhenISPsstartedto
upgradetheirphysicalinfrastructuretoprovideInternetaccessoverAsymmetricDigitalSubscriberLines(ADSL),theytriedtoreusetheirexisting
authentication (and billing) systems.To meet these requirements, the IETF developed specifications to allow PPP frames to be transported over
othernetworksthanthepointtopointlinksforwhichPPPwasdesigned.Nowadays,mostADSLdeploymentsusePPPovereitherATM RFC2364
orEthernetRFC2516.
[2] LAPBandHDLCwerewidelyuseddatalinklayerprotocols.
[3] TheIANAmaintainstheregistryofallassignedPPPprotocolfieldsat:http://www.iana.org/assignments/pppnumbers

Ethernet
Ethernetwasdesignedinthe1970satthePaloAltoResearchCenter [Metcalfe1976].Thefirstprototype [5]usedacoaxialcableastheshared
mediumand3Mbpsofbandwidth.Ethernetwasimprovedduringthelate1970sandinthe1980s,DigitalEquipment,IntelandXeroxpublishedthe
first official Ethernet specification [DIX]. This specification defines several important parameters for Ethernet networks. The first decision was to
standardise the commercial Ethernet at 10 Mbps. The second decision was the duration of the slot time. In Ethernet, a long slot time enables
networkstospanalongdistancebutforcesthehosttousealargerminimumframesize.Thecompromisewasaslottimeof51.2microseconds,
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

29/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

whichcorrespondstoaminimumframesizeof64bytes.
Thethirddecisionwastheframeformat.Theexperimental3MbpsEthernetnetworkbuiltatXeroxusedshortframescontaining8bitsourceand
destination addresses fields, a 16 bit type indication, up to 554 bytes of payload and a 16 bit CRC. Using 8 bit addresses was suitable for an
experimentalnetwork,butitwasclearlytoosmallforcommercialdeployments.AlthoughtheinitialEthernetspecification [DIX] only allowed up to
1024hostsonanEthernetnetwork,italsorecommendedthreeimportantchangescomparedtothenetworkingtechnologiesthatwereavailableat
thattime.ThefirstchangewastorequireeachhostattachedtoanEthernetnetworktohaveagloballyuniquedatalinklayeraddress.Untilthen,
datalinklayeraddressesweremanuallyconfiguredoneachhost.[DP1981]wentagainstthatstateoftheartandnotedSuitableinstallationspecific
administrativeproceduresarealsoneededforassigningnumberstohostsonanetwork.Ifahostismovedfromonenetworktoanotheritmaybe
necessarytochangeitshostnumberifitsformernumberisinuseonthenewnetwork.Thisiseasiersaidthandone,aseachnetworkmusthavean
administratorwhomustrecordthecontinuouslychangingstateofthesystem(oftenonapieceofpapertackedtothewall!).Itisanticipatedthatin
futureofficeenvironments,hostslocationswillchangeasoftenastelephonesarechangedinpresentdayoffices.Thesecondchangeintroducedby
Ethernetwastoencodeeachaddressasa48bitsfield[DP1981].48bitaddresseswerehugecomparedtothenetworkingtechnologiesavailablein
the 1980s, but the huge address space had several advantages [DP1981] including the ability to allocate large blocks of addresses to
manufacturers.Eventually,otherLANtechnologiesoptedfor48bitsaddressesaswell[802]_ .The third change introduced by Ethernet was the
definitionofbroadcastandmulticastaddresses.TheneedformulticastEthernetwasforeseenin[DP1981]andthankstothesizeoftheaddressing
spaceitwaspossibletoreservealargeblockofmulticastaddressesforeachmanufacturer.
ThedatalinklayeraddressesusedinEthernetnetworksareoftencalledMACaddresses.Theyarestructuredasshowninthefigurebelow.Thefirst
bit of the address indicates whether the address identifies a network adapter or a multicast group. The upper 24 bits are used to encode an
OrganisationUniqueIdentifier(OUI).ThisOUIidentifiesablockofaddressesthathasbeenallocatedbythesecretariat[6]whoisresponsibleforthe
uniquenessofEthernetaddressestoamanufacturer.OnceamanufacturerhasreceivedanOUI,itcanbuildandsellproductswithoneofthe16
millionaddressesinthisblock.

48bitsEthernetaddressformat
Theoriginal10MbpsEthernetspecification[DIX]definedasimpleframeformatwhereeachframeiscomposedoffivefields.TheEthernetframe
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

30/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

starts with a preamble (not shown in the figure below) that is used by the physical layer of the receiver to synchronise its clock with the senders
clock.Thefirstfieldoftheframeisthedestinationaddress.Asthisaddressisplacedatthebeginningoftheframe,anEthernetinterfacecanquickly
verify whether it is the frame recipient and if not, cancel the processing of the arriving frame. The second field is the source address. While the
destinationaddresscanbeeitheraunicastoramulticast/broadcastaddress,thesourceaddressmustalwaysbeaunicastaddress.Thethirdfieldis
a16bitsintegerthatindicateswhichtypeofnetworklayerpacketiscarriedinsidetheframe.ThisfieldisoftencalledtheEtherType.Frequentlyused
EtherTypevalues[7]include0x0800forIPv4,0x86DDforIPv6[8]and0x806fortheAddressResolutionProtocol(ARP).
ThefourthpartoftheEthernetframeisthepayload.Theminimumlengthofthepayloadis46bytestoensureaminimumframesize,includingthe
headerof512bits.TheEthernetpayloadcannotbelongerthan1500bytes.ThissizewasfoundreasonablewhenthefirstEthernetspecification
was written.At that time, Xerox had been using its experimental 3 Mbps Ethernet that offered 554 bytes of payload and RFC 1122 required a
minimumMTUof572bytesforIPv4.1500byteswaslargeenoughtosupporttheseneedswithoutforcingthenetworkadapterstocontainoverly
largememories.Furthermore,simulationsandmeasurementstudiesperformedinEthernetnetworksrevealedthatCSMA/CDwasabletoachievea
very high utilization.This is illustrated in the figure below based on [SH1980], which shows the channel utilization achieved in Ethernet networks
containingdifferentnumbersofhoststhataresendingframesofdifferentsizes.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

31/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Impactoftheframelengthonthemaximumchannelutilisation[SH1980]
ThelastfieldoftheEthernetframeisa32bitCyclicalRedundancyCheck(CRC).ThisCRCisabletocatchamuchlargernumberoftransmission
errorsthantheInternetchecksumusedbyIP,UDPandTCP[SGP98].TheformatoftheEthernetframeisshownbelow.

EthernetDIXframeformat
Note
WhereshouldtheCRCbelocatedinaframe?
The transport and datalink layers usually chose different strategies to place their CRCs or checksums. Transport layer protocols
usually place their CRCs or checksums in the segment header. Datalink layer protocols sometimes place their CRC in the frame
header, but often in a trailer at the end of the frame. This choice reflects implementation assumptions, but also influences
performanceRFC893.WhentheCRCisplacedinthetrailer,asinEthernet,thedatalinklayercancomputeitwhiletransmittingthe
frameandinsertitattheendofthetransmission.AllEthernetinterfacesusethisoptimisationtoday.Whenthechecksumisplacedin
the header, as in a TCP segment, it is impossible for the network interface to compute it while transmitting the segment. Some
networkinterfacesprovidehardwareassistancetocomputetheTCPchecksum,butthisismorecomplexthaniftheTCPchecksum
wereplacedinthetrailer[4].
TheEthernetframeformatshownaboveisspecifiedin[DIX].ThisistheformatusedtosendbothIPv4RFC894andIPv6packetsRFC2464.After
thepublicationof[DIX],theInstituteofElectricalandElectronicEngineers(IEEE)begantostandardiseseveralLocalAreaNetworktechnologies.
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

32/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

IEEEworkedonseveralLANtechnologies,startingwithEthernet,TokenRingandTokenBus.Thesethreetechnologieswerecompletelydifferent,
buttheyallagreedtousethe48bitsMACaddressesspecifiedinitiallyforEthernet[802]_.WhiledevelopingitsEthernetstandard[802.3],theIEEE
802.3workinggroupwasconfrontedwithaproblem.Ethernetmandatedaminimumpayloadsizeof46bytes,whilesomecompanieswerelooking
for a LAN technology that could transparently transport short frames containing only a few bytes of payload. Such a frame can be sent by an
Ethernethostbypaddingittoensurethatthepayloadisatleast46byteslong.HoweversincetheEthernetheader[DIX]doesnotcontainalength
field, it is impossible for the receiver to determine how many useful bytes were placed inside the payload field. To solve this problem, the IEEE
decidedtoreplacetheTypefieldoftheEthernet[DIX]headerwithalengthfield[9].ThisLength field contains the number of useful bytes in the
framepayload.Thepayloadmuststillcontainatleast46bytes,butpaddingbytesareaddedbythesenderandremovedbythereceiver.Inorderto
add the Length field without significantly changing the frame format, IEEE had to remove the Type field. Without this field, it is impossible for a
receiving host to identify the type of network layer packet inside a received frame.To solve this new problem, IEEE developed a completely new
sublayercalledtheLogicalLinkControl[802.2].Severalprotocolsweredefinedinthissublayer.Oneofthemprovidedaslightlydifferentversionof
theType field of the original Ethernet frame format.Another contained acknowledgements and retransmissions to provide a reliable service... In
practice,[802.2]isneverusedtosupportIPinEthernetnetworks.Thefigurebelowshowstheofficial[802.3]frameformat.

Ethernet802.3frameformat
Note
WhatistheEthernetservice?
AnEthernetnetworkprovidesanunreliableconnectionlessservice.Itsupportsthreedifferenttransmissionmodes:
unicast,multicastandbroadcast.WhiletheEthernetserviceisunreliableintheory,agoodEthernetnetworkshould,in
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

33/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

practice,provideaservicethat:
deliversframestotheirdestinationwithaveryhighprobabilityofsuccessfuldelivery
doesnotreorderthetransmittedframes
ThefirstpropertyisaconsequenceoftheutilisationofCSMA/CD.Thesecondpropertyisaconsequenceofthephysicalorganisation
of the Ethernet network as a shared bus. These two properties are important and all evolutions of the Ethernet technology have
preservedthem.
Several physical layers have been defined for Ethernet networks.The first physical layer, usually called 10Base5, provided 10 Mbps over a thick
coaxial cable. The characteristics of the cable and the transceivers that were used then enabled the utilisation of 500 meter long segments. A
10Base5networkcanalsoincluderepeatersbetweensegments.
Thesecondphysicallayerwas10Base2.Thisphysicallayerusedathincoaxialcablethatwaseasiertoinstallthanthe10Base5cable,butcouldnot
belongerthan185meters.A10BaseFphysicallayerwasalsodefinedtotransportEthernetoverpointtopointopticallinks.Themajorchangeto
thephysicallayerwasthesupportoftwistedpairsinthe10BaseTspecification.Twistedpaircablesaretraditionallyusedtosupportthetelephone
service in office buildings. Most office buildings today are equipped with structured cabling. Several twisted pair cables are installed between any
roomandacentraltelecomclosetperbuildingorperfloorinlargebuildings.Thesetelecomclosetsactasconcentrationpointsforthetelephone
servicebutalsoforLANs.
TheintroductionofthetwistedpairsledtotwomajorchangestoEthernet.Thefirstchangeconcernsthephysicaltopologyofthenetwork.10Base2
and 10Base5 networks are shared buses, the coaxial cable typically passes through each room that contains a connected computer.A 10BaseT
networkisastarshapednetwork.Allthedevicesconnectedtothenetworkareattachedtoatwistedpaircablethatendsinthetelecomcloset.From
amaintenanceperspective,thisisamajorimprovement.Thecableisaweakpointin10Base2and10Base5networks.Anyphysicaldamageonthe
cablebroketheentirenetworkandwhensuchafailureoccurred,thenetworkadministratorhadtomanuallychecktheentirecabletodetectwhereit
wasdamaged.With10BaseT,whenonetwistedpairisdamaged,onlythedeviceconnectedtothistwistedpairisaffectedandthisdoesnotaffect
theotherdevices.Thesecondmajorchangeintroducedby10BaseTwasthatiswasimpossibletobuilda10BaseTnetworkbysimplyconnectingall
thetwistedpairstogether.Allthetwistedpairsmustbeconnectedtoarelaythatoperatesinthephysicallayer.Thisrelayiscalledan Ethernethub.
Ahubisthusaphysicallayerrelaythatreceivesanelectricalsignalononeofitsinterfaces,regeneratesthesignalandtransmitsitoverallitsother
interfaces.Somehubsarealsoabletoconverttheelectricalsignalfromonephysicallayertoanother(e.g.10BaseTto10Base2conversion).

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

34/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Ethernethubsinthereferencemodel
ComputerscandirectlybeattachedtoEthernethubs.EthernethubsthemselvescanbeattachedtootherEthernethubstobuildalargernetwork.
However,someimportantguidelinesmustbefollowedwhenbuildingacomplexnetworkwithhubs.First,thenetworktopologymustbeatree.As
hubs are relays in the physical layer, adding a link between Hub2 and Hub3 in the network below would create an electrical shortcut that would
completelydisruptthenetwork.Thisimpliesthattherecannotbeanyredundancyinahubbasednetwork.Afailureofahuborofalinkbetweentwo
hubs would partition the network into two isolated networks. Second, as hubs are relays in the physical layer, collisions can happen and must be
handledbyCSMA/CDasina10Base5network.Thisimpliesthatthemaximumdelaybetweenanypairofdevicesinthenetworkcannotbelonger
thanthe51.2microsecondsslottime.Ifthedelayislonger,collisionsbetweenshortframesmaynotbecorrectlydetected.Thisconstraintlimitsthe
geographicalspreadof10BaseTnetworkscontaininghubs.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

35/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

AhierarchicalEthernetnetworkcomposedofhubs
In the late 1980s, 10 Mbps became too slow for some applications and network manufacturers developed several LAN technologies that offered
higherbandwidth,suchasthe100MbpsFDDILANthatusedopticalfibers.Asthedevelopmentof10Base5,10Base2and10BaseThadshownthat
Ethernet could be adapted to different physical layers, several manufacturers started to work on 100 Mbps Ethernet and convinced IEEE to
standardisethisnewtechnologythatwasinitiallycalledFastEthernet.FastEthernetwasdesignedundertwoconstraints.First,FastEthernethadto
supporttwistedpairs.Althoughitwaseasierfromaphysicallayerperspectivetosupporthigherbandwidthoncoaxialcablesthanontwistedpairs,
coaxial cables were a nightmare from deployment and maintenance perspectives. Second, FastEthernet had to be perfectly compatible with the
existing 10 Mbps Ethernets to allow Fast Ethernet technology to be used initially as a backbone technology to interconnect 10 Mbps Ethernet
networks.ThisforcedFastEthernettouseexactlythesameframeformatas10MbpsEthernet.ThisimpliedthattheminimumFastEthernetframe
sizeremainedat512bits.TopreserveCSMA/CDwiththisminimumframesizeand100Mbpsinsteadof10Mbps,thedurationoftheslottimewas
decreasedto5.12microseconds.
The evolution of Ethernet did not stop. In 1998, the IEEE published a first standard to provide Gigabit Ethernet over optical fibers. Several other
typesofphysicallayerswereaddedafterwards.The10GigabitEthernetstandardappearedin2002.Workisongoingtodevelopstandardsfor40
Gigabitand100GigabitEthernetandsomearethinkingaboutTerabitEthernet.ThetablebelowliststhemainEthernetstandards.Amoredetailed
listmaybefoundathttp://en.wikipedia.org/wiki/Ethernet_physical_layer
Standard

Comments

10Base5

Thickcoaxialcable,500m

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

36/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

10Base2

Thincoaxialcable,185m

10BaseT

Twopairsofcategory3+UTP

10BaseF

10Mb/soveropticalfiber

100BaseTx

Category5UTPorSTP,100mmaximum

100BaseFX

Twomultimodeopticalfiber,2kmmaximum

1000BaseCX Twopairsshieldedtwistedpair,25mmaximum
1000BaseSX Twomultimodeorsinglemodeopticalfiberswithlasers
10Gbps

OpticalfiberbutalsoCategory6UTP

40100Gbps

Opticalfiber(experiencesareperformedwithcopper)

Footnotes
[4] ThesenetworkinterfacescomputetheTCPchecksumwhileasegmentistransferredfromthehostmemorytothenetworkinterface
[SH2004].
[5] AdditionalinformationaboutthehistoryoftheEthernettechnologymaybefoundathttp://ethernethistory.typepad.com/
[6] Initially,theOUIswereallocatedbyXerox[DP1981].However,onceEthernetbecameanIEEEandlateranISOstandard,theallocationof
theOUIsmovedtoIEEE.ThelistofallOUIallocationsmaybefoundathttp://standards.ieee.org/regauth/oui/index.shtml
[7] TheofficiallistofallassignedEthernettypevaluesisavailablefromhttp://standards.ieee.org/regauth/ethertype/eth.txt
[8] TheattentivereadermayquestiontheneedfordifferentEtherTypesforIPv4andIPv6whiletheIPheaderalreadycontainsaversionfield
thatcanbeusedtodistinguishbetweenIPv4andIPv6packets.Theoretically,IPv4andIPv6couldhaveusedthesameEtherType.
Unfortunately,developersoftheearlyIPv6implementationsfoundthatsomedevicesdidnotchecktheversionfieldoftheIPv4packetsthat
theyreceivedandparsedframeswhoseEtherTypewassetto0x0800asIPv4packets.SendingIPv6packetstosuchdeviceswouldhave
causeddisruptions.Toavoidthisproblem,theIETFdecidedtoapplyforadistinctEtherTypevalueforIPv6.Suchachoiceisnowmandated
byRFC6274(section3.1),althoughwecanfindafunnycounterexampleinRFC6214.
[9] Fortunately,IEEEwasabletodefinethe[802.3]frameformatwhilemaintainingbackwardcompatibilitywiththeEthernet[DIX]frameformat.
Thetrickwastoonlyassignvaluesabove1500asEtherTypevalues.Whenahostreceivesaframe,itcandeterminewhethertheframes
formatbycheckingitsEtherType/Lengthfield.Avaluelowersmallerthan1501isclearlyalengthindicatorandthusan[802.3]frame.Avalue
largerthan1501canonlybetypeandthusa[DIX]frame.
EthernetSwitches

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

37/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

IncreasingthephysicallayerbandwidthasinFastEthernetwasonlyoneofthesolutionstoimprovetheperformanceofEthernetLANs.Asecond
solutionwastoreplacethehubswithmoreintelligentdevices.AsEthernethubsoperateinthephysicallayer,theycanonlyregeneratetheelectrical
signaltoextendthegeographicalreachofthenetwork.Fromaperformanceperspective,itwouldbemoreinterestingtohavedevicesthatoperatein
thedatalinklayerandcananalysethedestinationaddressofeachframeandforwardtheframesselectivelyonthelinkthatleadstothedestination.
SuchdevicesareusuallycalledEthernetswitches[10].AnEthernetswitchisarelaythatoperatesinthedatalinklayerasisillustratedinthefigure
below.

Ethernetswitchesandthereferencemodel
AnEthernetswitchunderstandstheformatoftheEthernetframesandcanselectivelyforwardframesovereachinterface.Forthis,eachEthernet
switchmaintainsaMACaddresstable.Thistablecontains,foreachMACaddressknownbytheswitch,theidentifieroftheswitchsportoverwhicha
framesenttowardsthisaddressmustbeforwardedtoreachitsdestination.ThisisillustratedbelowwiththeMACaddresstableofthebottomswitch.
When the switch receives a frame destined to address B, it forwards the frame on its South port. If it receives a frame destined to address D, it
forwardsitonlyonitsNorthport.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

38/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

OperationofEthernetswitches
OneofthesellingpointsofEthernetnetworksisthat,thankstotheutilisationof48bitsMACaddresses,anEthernetLANisplugandplayatthe
datalinklayer.WhentwohostsareattachedtothesameEthernetsegmentorhub,theycanimmediatelyexchangeEthernetframeswithoutrequiring
anyconfiguration.ItisimportanttoretainthisplugandplaycapabilityforEthernetswitchesaswell.ThisimpliesthatEthernetswitchesmustbeable
to build their MAC address table automatically without requiring any manual configuration.This automatic configuration is performed by the MAC
addresslearningalgorithmthatrunsoneachEthernetswitch.Thisalgorithmextractsthesourceaddressofthereceivedframesandremembersthe
port over which a frame from each source Ethernet address has been received.This information is inserted into the MAC address table that the
switchusestoforwardframes.Thisallowstheswitchtoautomaticallylearntheportsthatitcanusetoreacheachdestinationaddress,providedthat
thishosthaspreviouslysentatleastoneframe.Thisisnotaproblemsincemostupperlayerprotocolsuseacknowledgementsatsomelayerand
thusevenanEthernetprintersendsEthernetframesaswell.
ThepseudocodebelowdetailshowanEthernetswitchforwardsEthernetframes.ItfirstupdatesitsMACaddresstablewiththesourceaddressof
theframe.TheMACaddresstableusedbysomeswitchesalsocontainsatimestampthatisupdatedeachtimeaframeisreceivedfromeachknown
sourceaddress.Thistimestampisusedtoremovefromthe MAC address table entries that have not been active during the last n minutes.This
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

39/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

limitsthegrowthoftheMACaddresstable,butalsoallowshoststomovefromoneporttoanother.TheswitchusesitsMACaddresstabletoforward
thereceivedunicastframe.IfthereisanentryfortheframesdestinationaddressintheMACaddresstable,theframeisforwardedselectivelyonthe
portlistedinthisentry.Otherwise,theswitchdoesnotknowhowtoreachthedestinationaddressanditmustforwardtheframeonallitsportsexcept
the port from which the frame has been received. This ensures that the frame will reach its destination, at the expense of some unnecessary
transmissions.Theseunnecessarytransmissionswillonlylastuntilthedestinationhassentitsfirstframe.MulticastandBroadcastframesarealso
forwardedinasimilarway.
#ArrivalofframeFonportP
#Table:MACaddresstabledictionary:addr>port
#Ports:listofallportsontheswitch
src=F.SourceAddress
dst=F.DestinationAddress
Table[src]=P#srcheardonportP
ifisUnicast(dst):
ifdstinTable:
ForwardFrame(F,Table[dst])
else:
foroinPorts:
ifo!=P:ForwardFrame(F,o)
else:
#multicastorbroadcastdestination
foroinPorts:
ifo!=P:ForwardFrame(F,o)

Note
SecurityissueswithEthernethubsandswitches
Fromasecurityperspective,Ethernethubshavethesamedrawbacksastheoldercoaxialcable.Ahostattachedtoahubwillbeable
tocapturealltheframesexchangedbetweenanypairofhostsattachedtothesamehub.Ethernetswitchesaremuchbetterfromthis
perspectivethankstotheselectiveforwarding,ahostwillusuallyonlyreceivetheframesdestinedtoitselfaswellasthemulticast,
broadcastandunknownframes.However,thisdoesnotimplythatswitchesarecompletelysecure.Thereare,unfortunately,attacks
againstEthernetswitches.Fromasecurityperspective,theMACaddresstableisoneofthefragileelementsofanEthernetswitch.
Thistablehasafixedsize.Somelowendswitchescanstoreafewtensorafewhundredsofaddresseswhilehigherendswitches
canstoretensofthousandsofaddressesormore.Fromasecuritypointofview,alimitedresourcecanbethetargetofDenialof
Serviceattacks.Unfortunately,suchattacksarealsopossibleonEthernetswitches.Amalicioushostcouldoverflowthe MACaddress
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

40/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

tableoftheswitchbygeneratingthousandsofframeswithrandomsourceaddresses.OncetheMACaddresstableisfull,theswitch
needs to broadcast all the frames that it receives.At this point, an attacker will receive unicast frames that are not destined to its
address.TheARPattackdiscussedinthepreviouschaptercouldalsooccurwithEthernetswitches [Vyncke2007].Recentswitches
implementseveraltypesofdefencesagainsttheseattacks,buttheyneedtobecarefullyconfiguredbythenetworkadministrator.See
[Vyncke2007]foradetaileddiscussiononsecurityissueswithEthernetswitches.
TheMAC address learning algorithm combined with the forwarding algorithm work well in a treeshaped network such as the one shown above.
However,todealwithlinkandswitchfailures,networkadministratorsoftenaddredundantlinkstoensurethattheirnetworkremainsconnectedeven
afterafailure.LetusconsiderwhathappensintheEthernetnetworkshowninthefigurebelow.

Ethernetswitchesinaloop
Whenallswitchesboot,theirMACaddresstableisempty.AssumethathostAsendsaframetowardshostC.Uponreceptionofthisframe,switch1
updates its MAC address table to remember that address A is reachable via its West port.As there is no entry for address C in switch1s MAC
addresstable,theframeisforwardedtobothswitch2andswitch3.Whenswitch2receivestheframe,itsupdatesitsMACaddresstableforaddress
AandforwardstheframetohostCaswellastoswitch3.switch3hasthusreceivedtwocopiesofthesameframe.Asswitch3doesnotknowhowto
reachthedestinationaddress,itforwardstheframereceivedfromswitch1toswitch2andtheframereceivedfromswitch2toswitch1...Thesingle
framesentbyhostAwillbecontinuouslyduplicatedbytheswitchesuntiltheirMACaddresstablecontainsanentryforaddressC.Quickly,allthe
availablelinkbandwidthwillbeusedtoforwardallthecopiesofthisframe.AsEthernetdoesnotcontainany TTLorHopLimit,thisloopwillnever
stop.
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

41/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

TheMACaddresslearningalgorithmallowsswitchestobeplugandplay.Unfortunately,theloopsthatarisewhenthenetworktopologyisnotatree
areasevereproblem.Forcingtheswitchestoonlybeusedintreeshapednetworksashubswouldbeaseverelimitation.Tosolvethisproblem,the
inventorsofEthernetswitcheshavedevelopedtheSpanningTreeProtocol.ThisprotocolallowsswitchestoautomaticallydisableportsonEthernet
switchestoensurethatthenetworkdoesnotcontainanycyclethatcouldcauseframestoloopforever.
Footnotes
[10] ThefirstEthernetrelaysthatoperatedinthedatalinklayerswerecalledbridges.Inpractice,themaindifferencebetweenswitchesand
bridgesisthatbridgeswereusuallyimplementedinsoftwarewhileswitchesarehardwarebaseddevices.Throughoutthistext,wealways
useswitchwhenreferringtoarelayinthedatalinklayer,butyoumightstillseethewordbridge.
TheSpanningTreeProtocol(802.1d)
TheSpanningTreeProtocol(STP),proposedin[Perlman1985],isadistributedprotocolthatisusedbyswitchestoreducethenetworktopologyto
aspanningtree,sothattherearenocyclesinthetopology.Forexample,considerthenetworkshowninthefigurebelow.Inthisfigure,eachbold
line corresponds to an Ethernet to which two Ethernet switches are attached. This network contains several cycles that must be broken to allow
EthernetswitchesthatareusingtheMACaddresslearningalgorithmtoexchangeframes.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

42/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

SpanningtreecomputedinaswitchedEthernetnetwork
In this network, the STP will compute the following spanning tree. Switch1 will be the root of the tree.All the interfaces of Switch1, Switch2 and
Switch7arepartofthespanningtree.OnlytheinterfaceconnectedtoLANBwillbeactiveonSwitch9.LANHwillonlybeservedbySwitch7andthe
portofSwitch44 on LANG will be disabled.A frame originating on LANB and destined for LANAwillbeforwardedbySwitch7 on LANC, then by
Switch1onLANE,thenbySwitch44onLANFandeventuallybySwitch2onLANA.
Switches running the Spanning Tree Protocol exchange BPDUs.These BPDUs are always sent as frames with destination MAC address as the
ALL_BRIDGESreservedmulticastMACaddress.Eachswitchhasaunique64bitidentifier.Toensureuniqueness,thelower48bitsoftheidentifier
aresettotheuniqueMACaddressallocatedtotheswitchbyitsmanufacturer.Thehighorder16bitsoftheswitchidentifiercanbeconfiguredbythe
networkadministratortoinfluencethetopologyofthespanningtree.Thedefaultvalueforthesehighorderbitsis32768.
TheswitchesexchangeBPDUstobuildthespanningtree.Intuitively,thespanningtreeisbuiltbyfirstselectingtheswitchwiththesmallestidentifier
astherootofthetree.Thebranchesofthespanningtreearethencomposedoftheshortestpathsthatallowalloftheswitchesthatcomposethe
networktobereached.TheBPDUsexchangedbytheswitchescontainthefollowinginformation:
theidentifieroftherootswitch(R)
thecostoftheshortestpathbetweentheswitchthatsenttheBPDUandtherootswitch(c)
theidentifieroftheswitchthatsenttheBPDU(T)
thenumberoftheswitchportoverwhichtheBPDUwassent(p)
We will use the notation <R,c,T,p> to represent a BPDU whose root identifier is R, cost is c and that was sent on the port p of switch T. The
constructionofthespanningtreedependsonanorderingrelationshipamongtheBPDUs.Thisorderingrelationshipcouldbeimplementedbythe
pythonfunctionbelow.
#returnsTrueifbpdub1isbetterthanbpdub2
defbetter(b1,b2):
return((b1.R<b2.R)or
((b1.R==b2.R)and(b1.c<b2.c))or
((b1.R==b2.R)and(b1.c==b2.c)and(b1.T<b2.T))or
((b1.R==b2.R)and(b1.c==b2.c)and(b1.T==b2.T)and(b1.p<b2.p)))

Inadditiontotheidentifierdiscussedabove,thenetworkadministratorcanalsoconfigureacosttobeassociatedtoeachswitchport.Usually,the
costofaportdependsonitsbandwidthandthe[802.1d]standardrecommendsthevaluesbelow.Ofcourse,thenetworkadministratormaychoose
othervalues.Wewillusethenotationcost[p]toindicatethecostassociatedtoportpinthissection.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

43/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Bandwidth Cost
10Mbps

2000000

100Mbps

200000

1Gbps

20000

10Gbps

2000

100Gbps

200

TheSpanning Tree Protocol uses its own terminology that we illustrate in the figure above.A switch port can be in three different states : Root,
DesignatedandBlocked.AlltheportsoftherootswitchareintheDesignatedstate.Thestateoftheportsontheotherswitchesisdeterminedbased
ontheBPDUreceivedoneachport.
TheSpanning Tree Protocol uses the ordering relationship to build the spanning tree. Each switch listens to BPDUs on its ports. When BPDU=
<R,c,T,p>isreceivedonportq,theswitchcomputestheportspriorityvector:V[q]=<R,c+cost[q],T,p,q>,wherecost[q]isthecostassociatedtothe
portoverwhichtheBPDUwasreceived.Theswitchstoresinatablethelastpriorityvectorreceivedoneachport.Theswitchthencomparesitsown
identifierwiththesmallestrootidentifierstoredinthistable.Ifitsownidentifierissmaller,thentheswitchistherootofthespanningtreeandis,by
definition,atadistance0oftheroot.TheBPDUoftheswitchisthen<R,0,R,p>,whereRistheswitchidentifierandpwillbesettotheportnumber
overwhichtheBPDUissent.Otherwise,theswitchchoosesthebestpriorityvectorfromitstable,bv=<R,c,T,p>.Theportoverwhichthisbestpriority
vectorwaslearnedistheswitchportthatisclosesttotherootswitch.ThisportbecomestheRootportoftheswitch.ThereisonlyoneRootportper
switch. The switch can then compute its BPDU as BPDU=<R,c,S,p> , where R is the root identifier, c the cost of the best priority vector, S the
identifieroftheswitchandpwillbereplacedbythenumberoftheportoverwhichtheBPDUwillbesent.Theswitchcanthendeterminethestateof
allitsportsbycomparingitsownBPDUwiththepriorityvectorreceivedoneachport.IftheswitchsBPDUisbetterthanthepriorityvectorofthis
port,theportbecomesaDesignatedport.Otherwise,theportbecomesaBlockedport.
The state of each port is important when considering the transmission of BPDUs. The root switch regularly sends its own BPDU over all of its
(Designated)ports.ThisBPDUisreceivedontheRootportofalltheswitchesthataredirectlyconnectedtotherootswitch.Eachoftheseswitches
computes its own BPDU and sends this BPDU over all its Designated ports. These BPDUs are then received on the Root port of downstream
switches, which then compute their own BPDU, etc. When the network topology is stable, switches send their own BPDU on all their Designated
ports,oncetheyreceiveaBPDUontheirRootport.NoBPDUissentonaBlockedport.SwitcheslistenforBPDUsontheirBlockedandDesignated
ports,butnoBPDUshouldbereceivedovertheseportswhenthetopologyisstable.TheutilisationoftheportsforbothBPDUsanddataframesis
summarisedinthetablebelow.

Portstate

ReceivesBPDUs

Sends
BPDU

Blocked

yes

no

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

Handlesdataframes
no
44/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Root

yes

no

yes

Designated

yes

yes

yes

ToillustratetheoperationoftheSpanningTreeProtocol,letusconsiderthesimplenetworktopologyinthefigurebelow.

AsimpleSpanningtreecomputedinaswitchedEthernetnetwork
Assume that Switch4 is the first to boot. It sends its own BPDU=<4,0,4,?> on its two ports. When Switch1 boots, it sends BPDU=<1,0,1,1>. This
BPDU is received by Switch4, which updates its table and computes a new BPDU=<1,3,4,?>. Port 1 of Switch4 becomes the Root port while its
secondportisstillintheDesignatedstate.
Assume now that Switch9 boots and immediately receives Switch1 s BPDU on port 1. Switch9 computes its own BPDU=<1,1,9,?> and port 1
becomestheRootportofthisswitch.ThisBPDUissentonport2ofSwitch9andreachesSwitch4.Switch4comparesthepriorityvectorbuiltfrom
thisBPDU(i.e.<1,2,9,2>)andnoticesthatitisbetterthanSwitch4sBPDU=<1,3,4,2>.Thus,port2becomesaBlockedportonSwitch4.
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

45/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Duringthecomputationofthespanningtree,switchesdiscardallreceiveddataframes,asatthattimethenetworktopologyisnotguaranteedtobe
loopfree.Oncethattopologyhasbeenstableforsometime,theswitchesagainstarttousetheMAClearningalgorithmtoforwarddataframes.Only
theRoot and Designated ports are used to forward data frames. Switches discard all the data frames received on their Blocked ports and never
forwardframesontheseports.
Switches,portsandlinkscanfailinaswitchedEthernetnetwork.Whenafailureoccurs,theswitchesmustbeabletorecomputethespanningtreeto
recoverfromthefailure.TheSpanningTreeProtocolreliesonregulartransmissionsoftheBPDUstodetectthesefailures.A BPDU contains two
additionalfields:theAgeoftheBPDUandtheMaximumAge.TheAgecontainstheamountoftimethathaspassedsincetherootswitchinitially
originatedtheBPDU.TherootswitchsendsitsBPDUwithanAgeofzeroandeachswitchthatcomputesitsownBPDUincrementsitsAgebyone.
TheAge of the BPDUs stored on a switchs table is also incremented every second.A BPDU expires when its Age reaches the Maximum Age.
Whenthenetworkisstable,thisdoesnothappenasBPDUsareregularlysentbytherootswitchanddownstreamswitches.However,iftheroot
fails or the network becomes partitioned, BPDU will expire and switches will recompute their own BPDU and restart the Spanning Tree Protocol.
Onceatopologychangehasbeendetected,theforwardingofthedataframesstopsasthetopologyisnotguaranteedtobeloopfree.Additional
detailsaboutthereactiontofailuresmaybefoundin[802.1d]
VirtualLANs
AnotherimportantadvantageofEthernetswitchesistheabilitytocreateVirtualLocalAreaNetworks(VLANs).AvirtualLANcanbedefinedasa set
ofportsattachedtooneormoreEthernetswitches.AswitchcansupportseveralVLANsanditrunsoneMAClearningalgorithmforeachVirtual
LAN.Whenaswitchreceivesaframewithanunknownoramulticastdestination,itforwardsitoveralltheportsthatbelongtothesameVirtualLAN
butnotovertheportsthatbelongtootherVirtualLANs.Similarly,whenaswitchlearnsasourceaddressonaport,itassociatesittotheVirtualLAN
ofthisportandusesthisinformationonlywhenforwardingframesonthisVirtualLAN.
ThefigurebelowillustratesaswitchedEthernetnetworkwiththreeVirtualLANs.VLAN2andVLAN3onlyrequirealocalconfigurationofswitchS1.
HostCcanexchangeframeswithhostD,butnotwithhoststhatareoutsideofitsVLAN.VLAN1ismorecomplexasthereareportsofthisVLANon
severalswitches.TosupportsuchVLANs,localconfigurationisnotsufficientanymore.Whenaswitchreceivesaframefromanotherswitch,itmust
be able to determine the VLAN in which the frame originated to use the correct MAC table to forward the frame. This is done by assigning an
identifiertoeachVirtualLANandplacingthisidentifierinsidetheheadersoftheframesthatareexchangedbetweenswitches.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

46/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

VirtualLocalAreaNetworksinaswitchedEthernetnetwork
IEEEdefinedinthe[802.1q]standardaspecialheadertoencodetheVLANidentifiers.This32bitheaderincludesa20bitVLANfieldthatcontains
theVLANidentifierofeachframe.Theformatofthe[802.1q]headerisdescribedbelow.

Formatofthe802.1qheader
The[802.1q]headerisinsertedimmediatelyafterthesourceMACaddressintheEthernetframe(i.e.beforetheEtherTypefield).Themaximum
framesizeisincreasedby4bytes.Itisencodedin32bitsandcontainsfourfields.TheTagProtocolIdentifierissetto0x8100toallowthereceiverto
detectthepresenceofthisadditionalheader.ThePriorityCodePoint(PCP)isathreebitfieldthatisusedtosupportdifferenttransmissionpriorities
fortheframe.Value0isthelowestpriorityandvalue7thehighest.Frameswithahigherprioritycanexpecttobeforwardedearlierthanframes
havingalowerpriority.TheCbitisusedforcompatibilitybetweenEthernetandTokenRingnetworks.Thelast12bitsofthe802.1qheadercontain
theVLANidentifier.Value0indicatesthattheframedoesnotbelongtoanyVLANwhilevalue0xFFFisreserved.Thisimpliesthat4094different
VLANidentifierscanbeusedinanEthernetnetwork.

802.11wirelessnetworks
The radio spectrum is a limited resource that must be shared by everyone. During most of the twentieth century, governments and international
organisationshaveregulatedmostoftheradiospectrum.Thisregulationcontrolstheutilisationoftheradiospectrum,inordertoensurethatthere
arenointerferencesbetweendifferentusers.Acompanythatwantstouseafrequencyrangeinagivenregionmustapplyforalicensefromthe
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

47/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

regulator. Most regulators charge a fee for the utilisation of the radio spectrum and some governments have encouraged competition among
companiesbiddingforthesamefrequencytoincreasethelicensefees.
In the 1970s, after the first experiments with ALOHANet, interest in wireless networks grew. Many experiments were done on and outside the
ARPANet.Oneoftheseexperimentswasthefirstmobilephone,whichwasdevelopedandtestedin1973.Thisexperimentalmobilephonewas
thestartingpointforthefirstgenerationanalogmobilephones.Giventhegrowingdemandformobilephones,itwasclearthattheanalogmobile
phonetechnologywasnotsufficienttosupportalargenumberofusers.Tosupportmoreusersandnewservices,researchersinseveralcountries
worked on the development of digital mobile telephones. In 1987, several European countries decided to develop the standards for a common
cellulartelephonesystemacrossEurope:theGlobalSystemforMobileCommunications(GSM).Sincethen,thestandardshaveevolvedandmore
thanthreebillionusersareconnectedtoGSMnetworkstoday.
While most of the frequency ranges of the radio spectrum are reserved for specific applications and require a special licence, there are a few
exceptions. These exceptions are known as the Industrial, Scientific and Medical (ISM) radio bands. These bands can be used for industrial,
scientificandmedicalapplicationswithoutrequiringalicencefromtheregulator.Forexample,someradiocontrolledmodelsusethe27MHzISM
band and some cordless telephones operate in the 915 MHz ISM. In 1985, the 2.4002.500 GHz band was added to the list of ISM bands.This
frequencyrangecorrespondstothefrequenciesthatareemittedbymicrowaveovens.Sharingthisbandwithlicensedapplicationswouldhavelikely
causedinterferences,giventhelargenumberofmicrowaveovensthatareused.Despitetheriskofinterferenceswithmicrowaveovens,theopening
ofthe2.4002.500GHzallowedthenetworkingindustrytodevelopseveralwirelessnetworktechniquestoallowcomputerstoexchangedatawithout
using cables. In this section, we discuss in more detail the most popular one, i.e. the WiFi [802.11] family of wireless networks. Other wireless
networkingtechniquessuchasBlueToothorHiperLANusethesamefrequencyrange.
Today,WiFiisaverypopularwirelessnetworkingtechnology.TherearemorethanseveralhundredsofmillionsofWiFidevices.Thedevelopmentof
thistechnologystartedinthelate1980swiththeWaveLANproprietarywirelessnetwork.WaveLANoperatedat2Mbpsanduseddifferentfrequency
bandsindifferentregionsoftheworld.Intheearly1990s,theIEEEcreatedthe802.11workinggrouptostandardiseafamilyofwirelessnetwork
technologies. This working group was very prolific and produced several wireless networking standards that use different frequency ranges and
differentphysicallayers.Thetablebelowprovidesasummaryofthemain802.11standards.
Standard

Frequency

Typicalthroughput Maxbandwidth

Range(m)indoor/outdoor

802.11

2.4GHz

0.9Mbps

2Mbps

20/100

802.11a

5GHz

23Mbps

54Mbps

35/120

802.11b

2.4GHz

4.3Mbps

11Mbps

38/140

802.11g

2.4GHz

19Mbps

54Mbps

38/140

802.11n

2.4/5GHz

74Mbps

150Mbps

70/250

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

48/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

When developing its family of standards, the IEEE 802.11 working group took a similar approach as the IEEE 802.3 working group that
developedvarioustypesofphysicallayersforEthernetnetworks.802.11networksusetheCSMA/CAMediumAccessControltechniquedescribed
earlierandtheyallassumethesamearchitectureandusethesameframeformat.
ThearchitectureofWiFinetworksisslightlydifferentfromtheLocalAreaNetworksthatwehavediscusseduntilnow.Thereare,inpractice,twomain
typesofWiFinetworks:independentoradhocnetworksandinfrastructurenetworks[11].Anindependentoradhocnetworkiscomposedofasetof
devicesthatcommunicatewitheachother.ThesedevicesplaythesameroleandtheadhocnetworkisusuallynotconnectedtotheglobalInternet.
AdhocnetworksareusedwhenforexampleafewlaptopsneedtoexchangeinformationortoconnectacomputerwithaWiFiprinter.

An802.11independentoradhocnetwork
MostWiFinetworksareinfrastructurenetworks.AninfrastructurenetworkcontainsoneormoreaccesspointsthatareattachedtoafixedLocalArea
Network(usuallyanEthernetnetwork)thatisconnectedtoothernetworkssuchastheInternet.Thefigurebelowshowssuchanetworkwithtwo
accesspointsandfourWiFidevices.EachWiFideviceisassociatedtooneaccesspointandusesthisaccesspointasarelaytoexchangeframes
withthedevicesthatareassociatedtoanotheraccesspointorreachablethroughtheLAN.
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

49/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

An802.11infrastructurenetwork
An802.11accesspointisarelaythatoperatesinthedatalinklayerlikeswitches.Thefigurebelowrepresentsthelayersofthereferencemodelthat
areinvolvedwhenaWiFihostcommunicateswithahostattachedtoanEthernetnetworkthroughanaccesspoint.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

50/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

An802.11accesspoint
802.11devicesexchangevariablelengthframes,whichhaveaslightlydifferentstructurethanthesimpleframeformatusedinEthernetLANs.We
reviewthekeypartsofthe802.11frames.Additionaldetailsmaybefoundin [802.11]and[Gast2002].An802.11framecontainsafixedlength
header,avariablelengthpayloadthatmaycontainup2324bytesofuserdataanda32bitsCRC.Althoughthepayloadcancontainupto2324
bytes,most802.11deploymentsuseamaximumpayloadsizeof1500bytesastheyareusedininfrastructurenetworksattachedtoEthernetLANs.
An802.11dataframeisshownbelow.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

51/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

802.11dataframeformat
Thefirstpartofthe802.11headeristhe16bitFrameControlfield.Thisfieldcontainsflagsthatindicatethetypeofframe(dataframe,RTS/CTS,
acknowledgement,managementframes,etc),whethertheframeissenttoorfromafixedLAN,etc[802.11].TheDurationisa16bitfieldthatis
used to reserve the transmission channel. In data frames, the Duration field is usually set to the time required to transmit one acknowledgement
frameafteraSIFSdelay.NotethattheDurationfieldmustbesettozeroinmulticastandbroadcastframes.Astheseframesarenotacknowledged,
thereisnoneedtoreservethetransmissionchannelaftertheirtransmission.TheSequencecontrolfieldcontainsa12bitssequencenumberthatis
incrementedforeachdataframe.
The astute reader may have noticed that the 802.11 data frames contain three 48bits address fields [12] . This is surprising compared to other
protocolsinthenetworkanddatalinklayerswhoseheadersonlycontainasourceandadestinationaddress.Theneedforathirdaddressinthe
802.11headercomesfromtheinfrastructurenetworks.Insuchanetwork,framesareusuallyexchangedbetweenroutersandserversattachedto
theLANandWiFidevicesattachedtooneoftheaccesspoints.TheroleofthethreeaddressfieldsisspecifiedbybitflagsintheFrameControlfield.
WhenaframeissentfromaWiFidevicetoaserverattachedtothesameLANastheaccesspoint,thefirstaddressoftheframeissettotheMAC
addressoftheaccesspoint,thesecondaddressissettotheMACaddressofthesourceWiFideviceandthethirdaddressistheaddressofthefinal
destinationontheLAN.Whentheserverreplies,itsendsanEthernetframewhosesourceaddressisitsMACaddressandthedestinationaddress
istheMACaddressoftheWiFidevice.ThisframeiscapturedbytheaccesspointthatconvertstheEthernetheaderintoan802.11frameheader.
The 802.11 frame sent by the access point contains three addresses : the first address is the MAC address of the destination WiFi device, the
secondaddressistheMACaddressoftheaccesspointandthethirdaddresstheMACaddressoftheserverthatsenttheframe.
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

52/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

802.11 control frames are simpler than data frames. They contain a Frame Control, a Duration field and one or two addresses. The
acknowledgementframesareverysmall.Theyonlycontaintheaddressofthedestinationoftheacknowledgement.Thereisnosourceaddressand
noSequenceControlfieldintheacknowledgementframes.Thisisbecausetheacknowledgementframecaneasilybeassociatedtotheprevious
framethatitacknowledges.Indeed,eachunicastdataframecontainsaDurationfieldthatisusedtoreservethetransmissionchanneltoensurethat
nocollisionwillaffecttheacknowledgementframe.TheSequenceControlfieldismainlyusedbythereceivertoremoveduplicateframes.Duplicate
framesaredetectedasfollows.Eachdataframecontainsa12bitsSequenceControlfieldandtheFrameControlfieldcontainstheRetrybitflagthat
issetwhenaframeistransmitted.Each 802.11 receiver stores the most recent sequence number received from each source address in frames
whoseRetry bit is reset. Upon reception of a frame with the Retry bit set, the receiver verifies its sequence number to determine whether it is a
duplicatedframeornot.

IEEE802.11ACKandCTSframes
802.11 RTS/CTS frames are used to reserve the transmission channel, in order to transmit one data frame and its acknowledgement. The RTS
frames contain a Duration and the transmitter and receiver addresses. The Duration field of the RTS frame indicates the duration of the entire
reservation(i.e.thetimerequiredtotransmittheCTS,thedataframe,theacknowledgementsandtherequiredSIFSdelays).TheCTSframehas
thesameformatastheacknowledgementframe.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

53/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

IEEE802.11RTSframeformat
Note
The802.11service
Despite the utilization of acknowledgements, the 802.11 layer only provides an unreliable connectionless service like Ethernet
networks that do not use acknowledgements. The 802.11 acknowledgements are used to minimize the probability of frame
duplication.Theydonotguaranteethatallframeswillbecorrectlyreceivedbytheirrecipients.LikeEthernet,802.11networksprovide
ahighprobabilityofsuccessfuldeliveryoftheframes,notaguarantee.Furthermore,itshouldbenotedthat802.11networksdonot
useacknowledgementsformulticastandbroadcastframes.Thisimpliesthatinpracticesuchframesaremorelikelytosufferfrom
transmissionerrorsthanunicastframes.
Inadditiontothedataandcontrolframesthatwehavebrieflydescribedabove,802.11networksuseseveraltypesofmanagementframes.These
managementframesareusedforvariouspurposes.Webrieflydescribesomeoftheseframesbelow.Adetaileddiscussionmaybefoundin[802.11]
and[Gast2002].
Afirsttypeofmanagementframesarethebeaconframes.Theseframesarebroadcastedregularlybyaccesspoints.Eachbeaconframecontains
informationaboutthecapabilitiesoftheaccesspoint(e.g.thesupported802.11transmissionrates)andaServiceSetIdentity(SSID).TheSSIDisa
nullterminatedASCIIstringthatcancontainupto32characters.AnaccesspointmaysupportseveralSSIDsandannouncetheminbeaconframes.
Anaccesspointmayalsochoosetoremainsilentandnotadvertisebeaconframes.Inthiscase,WiFistationsmaysendProberequestframesto
forcetheavailableaccesspointstoreturnaProberesponseframe.
Note
IPover802.11
TwotypesofencapsulationschemesweredefinedtosupportIPinEthernetnetworks:theoriginalencapsulationscheme,builtabove
theEthernetDIXformatisdefinedinRFC894andasecondencapsulationRFC1042scheme,builtabovetheLLC/SNAPprotocol
[802.2].In802.11networks,thesituationissimplerandonlytheRFC1042encapsulationisused.Inpractice,thisencapsulationadds
6bytestothe802.11header.ThefirstfourbytescorrespondtotheLLC/SNAPheader.TheyarefollowedbythetwobytesEthernet
Typefield(0x800forIPand0x806forARP).ThefigurebelowshowsanIPpacketencapsulatedinan802.11frame.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

54/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

IPoverIEEE802.11
ThesecondimportantutilisationofthemanagementframesistoallowaWiFistationtobeassociatedwithanaccesspoint.WhenaWiFistation
starts,itlistenstobeaconframestofindtheavailableSSIDs.Tobeallowedtosendandreceiveframesviaanaccesspoint,aWiFistationmustbe
associatedtothisaccesspoint.Iftheaccesspointdoesnotuseanysecuritymechanismtosecurethewirelesstransmission,theWiFistationsimply
sendsanAssociationrequestframetoitspreferredaccesspoint(usuallytheaccesspointthatitreceiveswiththestrongestradiosignal).Thisframe
containssomeparameterschosenbytheWiFistationandtheSSIDthatitrequeststojoin.TheaccesspointreplieswithanAssociationresponse
frameifitacceptstheWiFIstation.
Footnotes
[11] The802.11workinggroupdefinedthebasicserviceset(BSS)asagroupofdevicesthatcommunicatewitheachother.Wecontinuetouse
networkwhenreferringtoasetofdevicesthatcommunicate.
[12] Infact,the[802.11]frameformatcontainsafourthoptionaladdressfield.Thisfourthaddressisonlyusedwhenan802.11wirelessnetwork
isusedtointerconnectbridgesattachedtotwoclassicalLANnetworks.

Summary
Inthischapter,wefirstexplainedtheprinciplesofthedatalinklayer.Therearetwotypesofdatalinklayers:thoseusedoverpointtopointlinksand
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

55/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

thoseusedoverLocalAreaNetworks.Onpointtopointlinks,thedatalinklayermustatleastprovideaframingtechnique,butsomedatalinklayer
protocolsalsoincludereliabilitymechanismssuchasthoseusedinthetransportlayer.WehavedescribedthePointtoPointProtocolthatisoften
usedoverpointtopointlinksintheInternet.
LocalAreaNetworksposeadifferentproblemsinceseveraldevicessharethesametransmissionchannel.Inthiscase,aMediumAccessControl
algorithmisnecessarytoregulatetheaccesstothetransmissionchannelbecausewhenevertwodevicestransmitatthesametimeacollisionoccurs
andnoneoftheseframescanbedecodedbytheirrecipients.TherearetwofamiliesofMACalgorithms.ThestatisticaloroptimisticMACalgorithms
reducetheprobabilityofcollisionsbutdonotcompletelypreventthem.Withsuchalgorithms,whenacollisionoccurs,thecollidedframesmustbe
retransmitted.WehavedescribedtheoperationoftheALOHA,CSMA,CSMA/CDandCSMA/CAMACalgorithms.DeterministicorpessimisticMAC
algorithmsavoidallcollisions.WehavedescribedtheTokenRingMACwherestationsexchangeatokentoregulatetheaccesstothetransmission
channel.
Finally,wehavedescribedinmoredetailtwosuccessfulLocalAreaNetworktechnologies:EthernetandWiFi.EthernetisnowthedefactoLAN
technology.WehaveanalysedtheevolutionofEthernetincludingtheoperationofhubsandswitches.WehavealsodescribedtheSpanningTree
Protocolthatmustbeusedwhenswitchesareinterconnected.Forthelastfewyears,WiFibecamethedefactowirelesstechnologyathomeand
insideenterprises.WehaveexplainedtheoperationofWiFinetworksanddescribedthemain802.11frames.

Exercises
1.ThehostH0pingsitspeerH1inthenetworkdepictedinthefigurebelow.Explainpreciselywhathappenedinthenetworksinceithasstarted.

2.Considertheswitchednetworkshowninthefigurebelow.Whatisthespanningtreethatwillbecomputedby802.1dinthisnetworkassumingthat
alllinkshaveaunitcost?Indicatethestateofeachport.

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

56/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

AsmallnetworkcomposedofEthernetswitches
3.Considertheswitchednetworkshowninthefigureabove.Inthisnetwork,assumethattheLANbetweenswitches3and12fails.Howshouldthe
switchesupdatetheirport/addresstablesafterthelinkfailure?
4.Inthenetworkdepictedinthefigurebelow,thehostH0performsatraceroutetowarditspeerH1(designatedbyitsname)throughanetwork
composedofswitchesandrouters.Explainpreciselytheframes,packets,andsegmentsexchangedsincethenetworkwasturnedon.Youmay
assignaddessesifyouneedto.

ThehostH0performsatraceroutetowarditspeerH1throughanetworkcomposedofswitchesandrouters.
5.Manyenterprisenetworksareorganizedwithasetofbackbonedevicesinterconnectedbyusingafullmeshoflinksasshowninthefigurebelow.
Inthisnetwork,whatarethebenefitsanddrawbacksofusingEthernetswitchesandIProutersrunningOSPF?

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

57/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

Atypicalenterprisebackbonenetwork
6.Inthenetworkrepresentedonthefigurebelow,canthehostH0communicatewithH1andviceversa?Explain.Addwhateveryouneedinthe
networktoallowthemtocommunicate.

CanH0andH1communicate?
7.Considerthenetworkdepictedinthefigurebelow.BothofthehostsH0andH1havetwointerfaces:oneconnectedtotheswitchS0andtheother
http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

58/59

4/30/2016

ThedatalinklayerandtheLocalAreaNetworksComputerNetworking:Principles,ProtocolsandPractice

onetotheswitchS1.WillthelinkbetweenS0andS1everbeused?Ifso,underwhichassumptions?Provideacomprehensiveanswer.

WillthelinkbetweentheswitchesS0andS1everbeused?
8.MostcommercialEthernetswitchesareabletoruntheSpanningtreeprotocolindependentlyoneachVLAN.Whatarethebenefitsofusingper
VLANspanningtrees?

http://cnp3book.info.ucl.ac.be/1st/html/lan/lan.html

59/59

You might also like