Вы находитесь на странице: 1из 8

DataLinkLayer:AccessingtheMedia

Thedatalinklayerprovidesameansforexchangingdataoveracommonlocalmedia.Thedatalink
layerlinksthemanyupperlayerservicesresponsibleforpackagingthedataforcommunication
betweenhostswiththeservicestotransferthatdataacrossthemedia.
Totransferthisdataacrossthelocalmedia,thedatalinklayerrepackagesitintoframesandcontrols
theframesaccesstothemedia.
SometypesofframesanddatalinklayerservicessupportcommunicationsforLANs;otherssupport
communicationsacrossWANs.
SupportingandConnectingtoUpperLayerServices
Thedatalinklayerperformstwobasicservices:
Allowstheupperlayerstoaccessthemediausingtechniquessuchasframing
Controlshowdataisplacedontothemediaandisreceivedfromthemediausingtechniques
suchasmediaaccesscontrol(MAC)anderrordetection
Thedatalinklayerisresponsiblefortheexchangeofframesbetweennodesoverthemediaofa
physicalnetwork.Thisincludesencapsulatingthepacketintoaframe,placingtheframeontothe
media,receivingtheframefromthemedia,anddecapsulatingtheframebackintothepacket.
Atthesourcenode,thedatalinklayerpreparescommunicationforthemedia.Thedatalinklayer
effectivelyinsulatesthecommunicationprocessesatthehigherlayersfromthemediatransitions
occurringendtoend.
Thedatalinklayerrelievestheupperlayersfromtheresponsibilityofputtingdataonthenetwork
andreceivingdatafromthenetwork.Thislayerprovidesservicestosupportthecommunication
processesforeachmediumoverwhichdataistobetransmitted.
Therecanbenumerousdatalinklayerandmediatransitions.Ateachhopalongthepath,an
intermediarydevice,usuallyarouter,processertheframeasfollows:
1. Acceptingtheframefromamedium
2. Decapsulatingtheframeintoapacket
3. Constructinganewframeappropriateforthenextmedia
4. Forwardingthepacketinsidethenewframeacrossthenextsegmentofthephysicalnetwork
Ateachhop,thereceivedframeisalsoexaminedforerrors.
Figure71datalinklayerexample(Ethernetlink,satellitelink,wirelesslink)
Withoutthedatalinklayer,anetworklayerprotocol,likeIP,wouldrequireprovisionsforconnection
toeverytypeofmediathatcouldexistalongadeliverypath.Moreover,IPwouldhavetoadaptevery
timeanewnetworktechnologyormediumwasdeveloped.Thisfrequentchangeinthenetwork
layerstandardswouldhamperprotocolandnetworkmediainnovationanddevelopment.Thisisa
keyreasonforusingalayeredapproachtonetworking.
ControllingTransferacrossLocalMedia
Layer2protocolsspecifytheencapsulationofapacketintoaframeandthetechniquesforgetting
theencapsulatedpacketonandoffeachmedium.Mediaaccessmethod(MACmethod)isthe
techniqueusedforgettingtheframeonandoffamedia.
TheMACmethodsdescribedbythedatalinklayerprotocolsdefinetheprocessesbywhichnetwork
methodscanaccessthenetworkmediaandtransmitframesindiversenetworkenvironments.
Eachnetworkenvironmentcanhavedifferentcharacteristics.
Anodethatisanenddeviceusesanadaptertomaketheconnectiontothenetwork.
Atintermediarydevices,suchasrouters,wherethemediatypecouldchangeforeachconnected
network,differentphysicalinterfacesencapsulatethepacketintotheappropriateframe,anda
suitableMACmethodisusedtoaccesseachlink.(Figure72Transferofframes)
Thetypeofframeusedonaninterfacecanbeconfiguredinthedevice.
CreatingaFrame
Aframeisakeyelementofeachdatalinklayerprotocol.Datalinklayerprotocolsrequirecontrol
informationtoenabletheprotocolstofunction.Controlinformationdescribes:
Whichnodesareincommunicationwitheachother
Whencommunicationbetweenindividualnodesbeginsandends
Iferrorsoccurredwhilethenodescommunicated
Whichnodeswillcommunicatenext
Theencapsulationincludesthiscontrolinformation.Theprotocoldescribeswhatcontrolinformation
requiredandhowthatinformationisincludedintheencapsulation.
Thedatalinklayerframeincludesthefollowingelements:
Data: thepacketfromthenetworklayer
Header: controlinformation,suchasaddressing,locatedatthebeginningofthePDU
Trailer: thecontrolinformationaddedtotheendofthePDU
Datatravelingonthemediaisconvertedintoastreamofbits.Asanodereceiveslongstreamsof
bits,itmustdeterminewhereaframestartsandstopsandwhichbitsrepresenttheaddressofother
controlinformation.Withineachframe,thereareaspecificnumberofbitsallocatedforeachcontrol
field.Controlinformationisinsertedbythetransmittingnodeintheheaderandtrailerasvaluesin
differentfields.Thisformattinggivesthephysicalsignalsastructurethatisdecodedintopacketsat
thedestination.(Figure73)
Typicalfieldtypesinclude:
Startandstopindicatorfields: thebeginningandendlimitsoftheframe
Addressingornamingfields: thedestinationand/orsourcedevices
Typefield: thetypeofPDUcontainedintheframe
Quality: thecontrolfields
Datafield: theframepayload(networklayerpacket)
Trailer:fieldsattheendoftheframeandareusedtodetecterrorsandmarktheendoftheframe.
Notallprotocolsincludeallthesefields.
ConnectingUpperLayerServicestotheMedia
Thedatalinklayerexistsasaconnectinglayerbetweenthesoftwareprocessesofthelayersaboveit
andthehardwareofphysicallayerbelowit.(Figure74)
Inmanycases,thedatalinklayerisembodiedasaphysicalentity,suchasanEthernetnetwork
interfacecard(NIC),whichinsertsintothesystembusofacomputerandmakestheconnection
betweenrunningsoftwareprocessesonacomputerandthephysicalmedia.Softwareassociated
withtheNICenablestheNICtoperformitsintermediaryfunctionsofpreparingdatafortransmission
andencodingthedataassignalstobesentontheassociatedmedia.Tosupportawidevarietyof
networkfunctions,thedatalinklayerisoftendividedinto2sublayers,theupperandlowersublayer.
Separatingthedatalinklayerintosublayersallowsonetypeofframedefinedbytheupperlayerto
accessdifferenttypesofmediadefinedbythelowerlayer.
The2commonLANsublayersareasfollows:
LogicalLinkControl(LLC)placesinformationintheframethatindentifieswhichnetwork
layerprotocolisbeingusedfortheframe
MACprovidesdatalinklayeraddressinganddelimitingofdataaccordingtothephysical
signalingrequirementsofthemediumandthetypeofdatalinklayerprotocolinuse.
Standards
TheTCP/IPnetworkaccesslayeristheequivalentoftheOSIdatalinkandphysicallayers.
Thefunctionalprotocolsandservicesatthedatalinklayeraredescribedbyengineering
organizationsandcommunicationscompanies.
Datalinklayerservicesandspecificationsaredefinedbymultiplestandardsbasedonavarietyof
technologiesandmediatowhichtheprotocolsareapplied.
Engineeringorganizationsthatdefineopenstandardsandprotocolsthatapplytothedatalinklayer
include:ISO,IEEE,ANSIandITU.
Datalinklayerprocessesoccurinbothsoftwareandhardware.Theprotocolsatthislayerare
implementedwithintheelectronicsofthenetworkadapterswithwhichthenodeconnectstothe
physicalnetwork.

MACTechniques:PlacingDataontheMedia
RegulatingtheplacementofdataframesontothemediaisknownasMAC.Therearedifferent
methodsofcontrollingaccesstothemedia.TheseMACtechniquesdefinewhetherandhowthe
nodessharethemedia.SomeMACmethodsusehighlycontrolledprocessestoensurethatframes
aresafelyplacedonthemedia.Thesemethodsaredefinedbysophisticatedprotocols.
ThemethodofMACuseddependson:
Mediasharing: ifandhowthenodessharethemedia
Topology: howtheconnectionbetweenthenodesappearstothedatalinklayer
MACforSharedMedia
Multiaccesstopologiesprovidemultiplenodestosharetheuseofthemediatotransporttheframes.
AnynumberofMACtechniquesmightbeappropriateforthistypeoflogicaltopology.Thetwobasic
MACmethodsforsharedmediaareasfollows:
Controlled: eachnodehasitsowntimetousethemedium
Contentionbased: allnodescompetefortheuseofthemedium
ControlledAccessforSharedMedia
Whenusingthecontrolledaccessmethod,networkdevicestaketurns,insequence,toaccessthe
medium.Thismethodisalsoknownasscheduledaccessordeterministic.
Whenonedeviceisplacingaframeonthemedia,nootherdevicecandosountiltheframehas
arrivedatthedestinationandhasbeenprocessedbythedestination.
Althoughcontrolledaccessiswellorderedandprovidespredictablethroughput,thesemethodscan
beinefficientbecauseadevicehastowaitforitsturnbeforeitcanusethemedium.
ConnectionBasedAccessforSharedMedia
Connectionbasedmethodsallowanydevicetotrytoaccessthemediumwheneverithasdatato
send.TheseMACmethodsaresometimesreferredtoasnondeterministic.Topreventcomplete
chaosonthemedia,thesemethodsuseacarriersensemultipleaccess(CSMA)processtofirst
detectwhetherthemediaiscarryingasignal.
*Ifacarriersignalonthemediaformanothernodeisdetected,itmeansthatanotherdeviceis
transmitting.Whenthedeviceattemptingtotransmitseesthatthemediaisbusy,itwillwaitandtry
againafterashorttimeperiod.
*Ifnocarriersignalisdetected,thedevicetransmitsitsdata.Ethernetandwirelessnetworksuse
connectionbasedMAC.ItispossiblethattheCSMAprocesswillfailandtwodeviceswilltransmitat
thesametime.Thisiscalledacollision.Ifacollisionoccurs,thedatasentbybothdeviceswillbe
corruptedandwillneedtoberesent.
ContentionbasedMACmethodsdonothavetheoverheadofcontrolledaccessmethods.
CSMAisusuallyimplementedinconjunctionwithamethodforresolvingthemediaconnection.
CSMA/CollisionDetect
InCSMA/CD,thedevicemonitorsthemediaforthepresenceofadatasignal.
Ifadatasignalisabsentthedevicetransmitsthedata.Ifsignalsarethendetectedthatshowanother
devicewastransmittingatthesametime,alldevicesstopsendingandtryagainlater.
CSMA/CollisionAvoid
InCSMA/CA,thedeviceexaminesthemediaforthepresenceofadatasignal.
Ifthemediaisfree,thedevicesendsanotificationacrossthemediaofitsintenttouseit.Thedevice
thensendsthedata.
MACforNonsharedMedia
MACprotocolsfornonsharedmediarequirelittleornocontrolbeforeplacingframesontothe
media.TheseprotocolshavesimplerrulesandproceduresforMAC.
Inpointtopointtopologies,themediainterconnectsjusttwonodes.
Inapointtopointtopologythenodesdonothavetosharethemediawithotherhostsordetermine
whetheraframeisdestinedforthatnode.
Inpointtopointconnections,thedatalinklayerhastoconsiderwhetherthecommunicationishalf
duplexorfullduplex.
Halfduplexcommunicationsmeansthatthedevicecanbothtransmitandreceiveonthemediabut
cannotdososimultaneously.Infullduplexcommunication,bothdevicescantransmitandreceiveon
themediaatthesametime.
LogicalTopologyversusPhysicalTopology
Thephysicaltopologyisanarrangementofnodesandthephysicalconnectionsbetweenthem.Also
therepresentationofhowthemediaisusedtointerconnectthedevices.
Alogicaltopologyisthewayanetworktransfersframesfromonenodetothenext.The
arrangementconsistsofvirtualconnectionsbetweenthenodesofanetworkindependentoftheir
physicallayout.Thelogicaltopologyofanetworkiscloselyrelatedtothemechanismusedto
managenetworkaccess.Figure75Logicaltopologies
Pointtopointtopology
Apointtopointtopologyconnectstwonodesdirectly.TheMACprotocolcanbeverysimple.All
framesonthemediacanonlytraveltoorfromthetwonodes.Inpointtopointnetworks,ifdatacan
onlyflowinonedirectionatthetime,itisoperatingasahalfduplexlink.Ifdatacansuccessfullyflow
acrossthelinkformeachnodesimultaneously,itisafullduplexlink.
Thesourceanddestinationnodecanbeindirectlyconnectedtoeachotheroversomegeographical
distance.Thelogicalconnectionbetweennodesformswhatiscalledavirtualcircuit.Thisisalogical
connectioncreatedwithinanetworkbetweentwonetworkdevices.
Logicalpointtopointconnectionbetweentwonodesmightnotnecessarilybebetweentwophysical
nodesateachendofasinglephysicallink.(Figure76)
Multiaccesstopology
Alogicalmultiaccesstopologyenablesanumberofnodestocommunicatebyusingthesameshared
media.Inmultiaccesstopologies,theframerequiresaddressestoidentifytowhichnodetheframeis
intended.Witheverynodereceivingtheframe,theonlynodetoprocessthecontentsoftheframeis
thenodetowhichtheframeisaddressed.
Ringtopology
Inalogicalringtopology,eachnodenturnreceivesaframe.Intheframeisnotaddressedtothe
node,thenodepassestheframetothenextnode.ThisallowsaringtouseacontrolledMAC
technique,calledtokenpassing.
Nodesinalogicalringtopologyremovetheframefromthering,examinethedestinationaddressof
theframe,andsenditonifitisnotaddressedforthatnode.Allnodesaroundtheringbetweenthe
sourceanddestinationnodeexaminetheframe.
MAC:AddressingandFramingData
Theframingprovidesthecontrolinformationnecessarytoreceivethedata.
DataLinkLayerProtocols:TheFrame
Eachframetypehasthreebasicparts:header,dataandtrailer.
Thedatalinklayerprotocoldescribesthefeaturesrequiredforthetransportofpacketsacross
differentmedia.Thesefeaturesoftheprotocolareintegratedintotheencapsulationoftheframe.
Whentheframearrivesatitsdestinationandthedatalinklayerprotocoltakestheframeoffthe
media,theframinginformationisreadanddiscarded.
Framing:RoleoftheHeader
Theframeheadercontainsthecontrolinformation,whichisuniquetoeachtypeofprotocol.
Startofframefield:indicatesthebeginningoftheframe
Sourceanddestinationaddressfields:indicatesthesourceanddestinationnodesonmedia
Priority/qualityofservicefield:indicatesaparticulartypeofcommunicationservices
Typefield:indicatestheupperlayerservicecontainedintheframe
Logicalconnectioncontrolfield:usedtoestablishalogicalconnectionbetweennodes
Physicallinkcontrolfields:usedtoestablishthemedialink
Flowcontrolfield:usedtostartandstoptrafficoverthemedia
Congestioncontrolfield:indicatescongestioninthemedia
Addressing:WheretheFramegoes
Thedatalinklayerprovidesaddressingthatisusedintransportingtheframeacrossthesharedlocal
media.Deviceaddressesatthislayerarereferredtoasphysicaladdresses.Datalinklayeraddressing
iscontainedwithintheframeheaderandspecifiestheframedestinationnodeonthelocalnetwork.
Theframeheadercanalsocontainthesourceaddressoftheframe.
Datalinklayeraddressisusedonlyforlocaldelivery.Ifthepacketintheframemustpassonto
anothernetworksegment,theintermediatedevicewilldecapsulatetheoriginalframe,createanew
frameforthepacketandsendthenewframeontothenewsegment.
Pointtopointtopologiesdonotrequireaddressing.
Ringandmultiaccesstopologiesrequireaddressing,becausetheycanconnectmanynodes.
Framing:RoleoftheTrailer
Datalinklayerprotocolsandatrailertotheendofeachframe.
Framechecksequencefields(FCS):usedforerrorcheckingoftheframecontents
Stopfield:usedtoindicatetheendoftheframe,alsocanbeusedtoincreasethesizeofa
frametoanexpectedfixedsizeorminimumsize.
Thetrailerisusedtodeterminewhethertheframearrivedwithouterror=errordetection.Thisis
accomplishedbyplacingalogicalormathematicalsummaryofthebitsthatcomprisetheframein
thetrailer.Toensurethatthecontentofthereceivedframeatthedestinationmatchesthatofthe
framethatleftthesourcenode,atransmittingnodecreatesalogicalsummaryofthecontentsofthe
frame.Thisisknownasthecyclicredundancycheck(CRC)value.ThisvalueisplacedintheFCSfield
oftheframetorepresentthecontentsoftheframe.
SampleDataLinkLayerFrames
Protocols:Ethernet,PPP,HighLevelDataLinkControl(HDLC),framerelayandATM.
EachprotocolperformsMACforspecifiedLayer2logicaltopologies.TheLayer2protocolusedfora
particularnetworktopologyisdeterminedbythetechnologyusedtoimplementthattopology.The
technologyis,inturndeterminedbythesizeofthenetwork.(Figure77)
Aninternetworkhastwotypesofenvironments:LANsandWANs.ALANtypicallyusesahigh
bandwidthtechnologythatiscapableofsupportinglargenumberofhosts.Theframestravelling
acrossWANsaremorelikelytobedamagedthanthoseinLANs.Adifferenceinbandwidthsand
environmentsnormallyresultsintheuseofdifferentprotocolsforLANsandWANs.
EthernetProtocolforLANs
EthernetisthemostwidelyusedLANtechnologyandsupportsdatabandwidthsof10,100,1000or
10000Mbps.SharedmediarequiresthattheEthernetpacketheaderuseadatalinklayeraddressto
identifythesourceanddestinationnodes.AswithmostLANprotocols,thisaddressisreferredtoas
theMACaddressofthenode.AnEthernetMACaddressis48bitsandisgenerallyrepresentedin
hexadecimalformat.TheEthernetframehasmanyfields(figure78)
Preamble:usedtotimesynchronizationandmarkstheendofthetiminginformation
Destinationaddress:48bitMACaddressforthedestinationnode
Sourcesaddress:48bitMACaddressforthesourcenode
Type:valuetoindicatewhichupperlayerprotocolwillreceivethedata
Dataorpayload:PDU,typicallyanIPv4packet,thatistransportedoverthemedia
Framechecksequence(FCS):aCRCvalueusedtocheckfordamagedframes
PPPforWANs
PPPisaprotocolusedtodeliverframesbetweentwonodes.ThePPPstandardisdefinedbyRFCs.
PPPwasdevelopedasaWANprotocol.PPPcanbeusedonvariousphysicalmedia,aswellasfor
virtualconnections.
PPPusesalayeredarchitecture.Toaccommodatethedifferenttypesofmedia,PPPestablishes
logicalconnections,calledsessions,betweentwonodes.
OptionswithinthePPPsession:
Authentication:requiresthenodesoneachendofthePPPlinktoauthenticateinorderto
establishcommunicationsoverapointtopointlink.
Compression:reducesthesizeofadataframetransmittedoveranetworklink.Reducingthe
sizeoftheframereducesthetimerequiredtotransmittheframeacrossthenetwork.
Multilink:methodofusingmultipledatalinkstosendtheframes.Thisallowstheuseof
multiplephysicallinkstosupportasinglePPPsession.
BasicfieldsinaPPPframe:(Figure79)
Flag:asinglebytethatindicatesthebeginningorendofaframe
Address:asinglebytethatcontainsthestandardPPPbroadcastaddress
Control:asinglebytethatcallsfortransmissionofuserdatainanunsequencedframe
Protocol:2bytesindentifytheprotocolencapsulatedinthedatafieldoftheframe
Data:zeroormorebytesthatcontainthedatagramfortheprotocol
Framechecksequence(FCS):consentingPPPimplementationsforimprovederrordetection
WirelessProtocolforLANs
Inawirelessenvironment,theenvironmentrequiresspecialconsiderations.Thereisnodefinable
physicalconnectivity;therefore,externalfactorscaninterferewithdatatransfer,anditisdifficultto
controlaccess.
ThestandardIEEE802.11,akaWiFi,isaconnectionbasedsystemusingaCSMA/CAmediaaccess
process.Thisspecifiesarandombackoffprocedureforallnodesthatarewaitingtotransmit.
WiFinetworksalsousedatalinkacknowledgementstoconfirmthataframeisreceivedsuccessfully.
TheWiFiframecontainsthesefields(Figure710):
Protocolversion:versionofWiFiframeinuse
Typeandsubtype:identifiesoneofthreefunctions:control,dataandmanagement
ToDS:setto1indataframesdestinedforthedistributionsystem
FromDS:setto1indataframesexitingthedistributionsystem
Morefragments:setto1forframesdestinedthathaveanotherfragment
Retry:setto1iftheframeisaretransmissionofanearlierframe
Powermanagement:setto1toindicatethatanodewillbeinpowersavemode
Moredata:setto1toindicatetoanodeinpowersavemodethatmoreframesarebuffered
forthatnode
Wiredequivalentprivacy(WEP):setto1iftheframecontainsWEPencryptedinformation
forsecurity
Order:setto1inadatatypeframethatusesStrictlyOrderedserviceclass
Duration/ID:representseitherthetimerequiredtotransmittheframeoranassociation
identity(AID)forthestationthattransmittedtheframe
Destinationaddress(DA):MACaddressofthefinaldestinationnodeinthenetwork
Sourceaddress(SA):MACaddressofthenodethatinitiatedtheframe
Receiveraddress(RA):MACaddressthatidentifiesthewirelessdevice
Transmitteraddress(TA):MACaddressthatidentifiesthewirelessdevicethattransmitted
Sequencenumber:indicatesthesequencenumberassignedtotheframe
Fragmentnumber:indicatesthenumberforeachfragmentofaframe
Framebody:containstheinformationbeingtransported
FCS:containsa32bitcyclicredundancycheck(CRC)oftheframe
PuttingItAllTogether:FollowingDatathroughanInternetwork
Thisisanexampleaboutasimplecommunicationbetweentwohostsacrossaninternetwork.All
routingtablesareconvergedandAddressResolutionProtocol(ARP)tablesarecomplete.Infigure7
11,auseronaLANwantstoaccessawebpagestoredonaserverthatislocatedonaremote
network.Theuserstartsbyactivatingalinkonawebpage.
ThebrowserinitiatesanHTTPGETrequest.
ThetransportlayeridentifiestheupperlayerserviceasaWWWclient,tenassociatesthisservice
withTCPandassignstheportnumbers.
TCPalsosendsanacknowledgementnumber.
Atthenetworklayer,anIPpacketisreconstructedtoidentifythesourceanddestinationhosts.
ThedatalinklayerreferstotheAddressResolutionProtocol(ARP)cachetodeterminetheMAC
addressthatisassociatedwiththeinterfaceofRouterB

Вам также может понравиться