Physical address
Conceptdescription
MAC(MediaAccessControl,MediaAccessControl)addressisanidentifierforidentifyingLAN(LocalAreaNetwork)nodes.
Itdefineshowthedataframeistransmittedonthemedium.Inlinksthatsharethesamebandwidth,accesstotheconnectionmediumis"firstcome,firstserved".Physicaladdressingisdefinedhere,andlogicaltopology(thepathofasignalthroughthephysicaltopology)isalsodefinedhere.Linecontrol,errornotification(nocorrection),framedeliverysequenceandoptionalflowcontrolarealsoimplementedinthissublayer.
Thedatalinklayerofthelocalareanetworkisdividedintotwosub-layers,thelogicallinklayerLLCandthemediumaccesscontrolMAC.
LogicalLinkControl(LogicalLinkControlorLLCforshort)istheupperpartofthedatalinklayerinthelocalareanetwork.ThelogicallinkcontrolprotocolisdefinedinIEEE802.2.Theuser'sdatalinkserviceprovidesaunifiedinterfaceforthenetworklayerthroughtheLLCsublayer.BelowtheLLCsublayeristheMACsublayer.
MAC(mediumaccesscontrol)belongstoasub-layerunderLLC(LogicalLinkControl).Twomediaaccesscontrolmethodswidelyusedinlocalareanetworksare:
1.Contention-basedmediaaccesscontrol,alsoknownasrandommediaaccesscontrolprotocols,suchasCSMA/CD.
2.Deterministicmediaaccesscontrol,alsoknownasorderlyaccesscontrolprotocol,suchasToken(token)mode.
Applicationintroduction
Thatistosay,inthephysicaltransmissionprocessatthebottomofthenetwork,thehostisidentifiedbythephysicaladdress,whichisgenerallyuniqueintheworld.Forexample,awell-knownEthernetcardhasaphysicaladdresssizeof48bits(bits),thefirst24bitsarethemanufacturernumber,andthelast24bitsarethenetworkcardnumber,suchas:44-45-53-54-00-00,whichisreadablebyamachineThewayisstoredinthehostinterface.TheEthernetAddressManagementInstitute(IEEE)dividestheEthernetaddress,thatis,differentcombinationsof48bits,intoanumberofindependentconsecutiveaddressgroups.ManufacturersofEthernetnetworkcardspurchaseoneofthem,andtheuniqueaddressesareindividuallyassignedduringspecificproduction.GivetheEthernetcard.
Imagemetaphor
TheMACaddressisliketheIDnumberonourIDcard,whichisgloballyunique.
Detailedtechnicalexplanation
Addressesinthenetworkaredividedintophysicaladdressesandlogicaladdresses.ComparedwiththeportnumberoftheIPaddresstransmissionlayerofthenetworklayerandtheusernameoftheapplicationlayer,TheMAClayeraddressofthelocalareanetworkisprocessedbyhardware,whichiscalledphysicaladdressorhardwareaddress.TheportnumberoftheIPaddresstransportlayerandtheusernameoftheapplicationlayerarelogicaladdressesthatareprocessedbysoftware.TheMACaddressisalsocalledthephysicaladdress.Mostlocalareanetworksidentifyanetworkedcomputerorotherdevicebyassigningahardwareaddresstothenetworkcard.
Theso-calledphysicaladdressreferstotheaddresssolidifiedintheEPROMofthenetworkcard.Thisaddressshouldbeguaranteedtobeuniqueintheentirenetwork.TheIEEERegistrationCommitteeassignsthefirstthreebytesofthephysicaladdress,thecompanylogo,toeachmanufacturer.Thelastthreebytesareallocatedbythemanufacturer,andthenumberofnetworkcardsthatamanufacturercanproducewhenobtaininganaddresswiththefirstthreebytesis16,777,216.Anetworkcardcorrespondstoaphysicaladdress.Thatistosay,thefirstthreebytescorrespondingtothephysicaladdresscanknowhismanufacturer.
Forexample,theaddressfixedinthenetworkcardis002514895423,thenthisnetworkcardisinsertedintohostA,andthephysicaladdressofhostAis002514895423,regardlessofwhetherhostAisconnectedtoLAN1orLAN2,Nomatterwherethecomputerismoved,thephysicaladdressofhostAis002514895423.Itisconstantandwillnotbethesameasanycomputerintheworld.WhenthehostAsendsaframe,thenetworkcarddirectlywritesthisaddressasthesourceaddressintotheframewhenthenetworkcardexecutesthesendingprogram.WhenhostAreceivesaframe,itdirectlycomparesthisaddresswiththedestinationaddressofthereceivedframetodeterminewhethertoreceiveit.Thephysicaladdressisgenerallydenotedas00-25-14-89-54-23(theaddressofhostAis002514895423).
CSMA/CDworkingprinciple
InCSMA,duetothechannelpropagationdelay,evenifthestationsonbothsidesofthecommunicationdonotdetectthecarriersignal,itisstillpossibletosenddataConflictswilloccurbecausetheymaysenddataatthesametimewhentheydetectthatthemediumisfree,causingconflictstooccur.AlthoughCSMAcandetectconflicts,itdoesnothavetheconflictdetectionandpreventionfunctionsoftheprophet,resultinginfrequentconflicts.
AnimprovementofCSMAistomakethesendingstationcontinuetolistentothemediumduringtransmissiontodetectwhetherthereisaconflict.Ifbothstationsdetectthatthechannelisfreeatacertaintimeandstarttotransmitdataatthesametime,theywillalmostimmediatelydetectthatthereisaconflict.Ifaconflictoccurs,electromagneticwavesthatexceedtheamplitudeofthecarriersignalsentbythesendingsitecanbedetectedonthechannel,andtheexistenceoftheconflictcanbejudgedfromthis.Onceaconflictisdetected,thesendingstationimmediatelystopssendingandsendsaseriesofblockingsignalstothebustonotifytheoppositestationcommunicatingonthebustoquicklyterminatethecorruptedframe,whichcansavetimeandbandwidth.ThissolutionistheCSMA/CD(CarrierSenseMultipleAccesswithCollisionDetection)introducedinthissection,andithasbeenwidelyusedinlocalareanetworks.
Theso-calledcarriersense(CarrierSense)meansthateachworkstationonthenetworkmustconfirmwhetherthereisdatatransmissiononthebusbeforesendingdata.Ifthereisdatatransmission(calledthebusasbusy),nodatawillbesent;ifthereisnodatatransmission(calledthebusasempty),theprepareddatawillbesentimmediately.
Theso-calledmultipleaccess(MultipleAccess)meansthatallworkstationsonthenetworkusethesamebusforsendingandreceivingdata,andthedatasentisbroadcast.
Theso-calledcollision(Collision)meansthatiftherearetwoormoreworkstationsontheInternetsendingdataatthesametime,thesignalwillbemixedonthebus,sothatnoworkstationcandistinguishtherealdata.what.Thissituationiscalledadataconflict,alsocalledacollision.
Inordertoreducetheimpactofconflicts,theworkstationmustconstantlycheckthedatasentbyitselfduringtheprocessofsendingdatatoseeifthereisanyconflictwiththedataofotherworkstationsduringthetransmissionprocess.Thisisaconflict.CollisionDetected.
PrincipleofCSMA/CDconflictdetection
CSMA/CDisamediacontentionhandlingprotocoluniformlyadoptedinstandardEthernet,fastEthernetandGigabitEthernet(butin10GigabitInEthernet,becauseitusesfull-duplexcommunication,thisprotocolisnolongerused).Thereasonwhyitiscalled"CarrierSense"("Carrier"istheelectromagneticwavecarryingthesignal)insteadof"MediaSense"isbecauseifthereisacarrieronthemedium,itprovesthatthemediumisbusy.(Becausethesignalordataisnotdirectlytransmitted,butcarriedoutthroughelectromagneticcarrier);ifthereisnocarrier,themediumisinanidlestate.Thatis,throughthedetectionofthecarrier,thestateofthemediumcanbeknown,buttheidlestateofthemediumitselfcannotbeobtainedbydirectlylisteningtothemedium.
[Explanation]Infact,whatislisteninghereshouldbethe"channel",notthe"medium"itself,becauseatransmissionmediummaycontainmultiplechannelsfordifferenttransmissionlinks.
Asmentionedearlier,theimprovementofCSMA/CDoverCSMAisthatithasaconflictdetectionfunction.Thenthequestionarises.HowdoesCSMA/CDdetectconflicts?
TheworkingprincipleofCSMA/CDcanbesummarizedinthefollowingsentences:
Listenfirst,thenspeak,listenandspeak.
Incaseofconflict,stoptalkingimmediately.
Waitforthemoment,andthentalk.
Here,"listening"meansmonitoringandtesting;"speaking"meanssendingdata.Thespecificdetectionprincipleisdescribedasfollows:
(1)Whenastationwantstosenddata,itchecksthenetworktoseeifotherstationsaretransmitting,thatis,whetherthelisteningchannelisfree.
(2)Ifthechannelisbusy,waituntilthechannelisfree;ifthechannelisfree,thestationisreadytosendthedata.
(3)Whilesendingdata,thesitecontinuestolistentothenetwork,makingsurethatnoothersitesaretransmittingdataatthesametimebeforecontinuingtotransmitdata.Becauseitispossiblethattwoormorestationssimultaneouslydetectthatthenetworkisidleandthenstarttransmittingdataatalmostthesametime.Iftwoormorestationssenddataatthesametime,conflictswilloccur.Ifthereisnoconflict,continuesendinguntilalldataissent.
(4)Ifthereisaconflict,stopsendingdataimmediately,butsendaJAM(blocking)signalthatstrengthenstheconflict,sothatallworkstationsonthenetworkknowthatthereisaconflictonthenetwork,andthenwaitforaAtapredeterminedrandomtime,andwhenthebusisidle,theunsentdatawillberesent.
TheadvantagesoftheCSMA/CDcontrolmethodare:
Theprincipleisrelativelysimple,technicallyeasytoimplement,allworkstationsinthenetworkareonanequalfooting,andthereisnoneedtoconcentrateControl,doesnotprovideprioritycontrol.However,whenthenetworkloadincreases,thesendingtimeincreases,andthesendingefficiencydropssharply.
Theworkingprincipleoftokenaccesscontrol
TokenaccesscontrolmethodscanbedividedintotokenringaccesscontrolandTherearetwotypesoftokenbusaccesscontrol.Tokenbusaccesscontrolhasbeenusedlessfrequently.
Application
Whetherinthetraditionalwiredlocalareanetwork(LAN)orinthepopularwirelesslocalareanetwork(WLAN),theMACprotocoliswidelyused.Inthetraditionallocalareanetwork,thephysicallayerofvarioustransmissionmediacorrespondstothecorrespondingMAClayer.ThecommonlyusednetworkadoptstheIEEE802.3MAClayerstandardandadoptstheCSMA/CDaccesscontrolmethod;whileinthewirelesslocalareanetwork,theMACaddressThecorrespondingstandardisIEEE802.11,anditsworkingmodeadoptsDCF(distributedcontrol)andPCF(centralcontrol).
TokenRingMediaAccessControl
IEEE802.5TokenRingMediaAccessControlusesatokentocirculatealongthering,anditshouldbeensuredthatthetokenisuniqueinthering.Theworkingprincipleoftokenring:
Onlinesitesrequesttosendframesandmustwaitforanemptytoken.
Whenanemptytokenisobtained,itischangedtoabusytoken,followedbyadataframe;otherstationsintheringcannotsenddata.
Thestationontheringreceives,shiftsdata,andperformsdetection.Iftheaddressisthesameasthisstation,thedatawillbereceivedatthesametime.Afterthereceptioniscompleted,thecorrespondingflagwillbeset.
Aftertheframecirculatesontheringforaweek,itreturnstothesendingstation.Afterthesendingstationdetectsthecorrespondingmark,theframeisremoved.
Changethebusytokentoanemptytokenandcontinuetotransmitforsubsequentstationstosendframes.Thelengthoftheloopiscalculatedinbits:
Becausethepropagationspeedofelectromagneticwavesislimited,theremaybemultipledatabitsinthetransmissionmediumatthesametime.
Eachrepeaterontheringintroducesatleast1bitdelay
Thenumberofbitsreservedonthering:
Propagationdelay(us/km)×mediumlength×datarate+repeaterdelay
Example:mediumlengthL=1km,datarateC=4Mbit/s,numberofstationsN=50.
Solution:Propagationdelaytp=L/v
v=2×105km/stp=5usNumberofbitsreservedonthering=5×1×4+50=70bit
TokenRingMACframestructure
IEEE802.5MACframeformattokenanddataframemanagement:
Howtopreventdataframesfromendlesslyontheringcycle?
Setupthemonitor
Leaveamarkontheframestructure
Howtomonitorthetokenerror?
Notoken
Multipletokens
Busytokenendlessloop
Centralizeddetection:
Setupacentralizedmonitoringstation(timeoutcounter)/markloss
Detectbusymarkidentification/endlessloopontheframestructure
Distributeddetection:
EachstationSettimer:whenthestationhasdatatosendandthetimewaitingforthemarkexceedsthelimit/themarkislost
TokenControlProtocol
Topology:Workingprinciple:TokenBusinthephysicalsystemEstablishalogicalringonline.
Onthelogicalring,thetokenisanecessaryconditionforthestationtosenddata.
Thetokenistransmittedtothenextstationinthelogicalringindescendingorderofaddresses.
Fromaphysicalpointofview,thetokenframecontainingDAisbroadcasttotheBUS,andallstationsjudgewhethertoreceiveitaccordingtoDA=theaddressofthestation.
Features:Noconflict,thelengthoftheinformationframeofthetokenringcanbedeterminedaccordingtoneeds.
SequentiallyreceivingFairness(fairness),thetimethatthestationwaitsfortheTokenisknownwithcertainty.
(Needtolimitthemaximumnumberofframessentbyeachstation).
Informationbitsneedtobefilledduetodetectionconflicts(notallowedtobelessthan46bytes).
MediaAccessControlTechnology
Thecentraltopicofthemediaaccesssublayerishowtoallocateasinglebroadcastchannelamongcompetingusers.
1.Staticallocation:Aslongasoneusergetsthechannel,itwillnotconflictwithotherusers.(Userdatatrafficisburstyandintermittent) .
2.Dynamicallocation:itiscalledmulti-accessormulti-pointaccess,whichreferstomultipleuserssharingaline,andthechannelisnotfixedlyallocatedtotheuserwhentheusercommunicates.SuchasystemisalsocalledCompetitivesystem.Dynamicallocationmethodscanbefurtherdividedinto:randomaccess,typicalALOHAprotocol,CSMAprotocol ;controlledaccess,typicaltokennetworkcompetitionsystemandcentralizedcontrolofmulti-pointlinepolling.
3.Fivekeyassumptionsinchanneldynamicallocation.
Stationmodel:Stationsareindependent,framesaregeneratedataconstantrate,andeachstationhasonlyoneprogram.
Single-channelhypothesis(core)
Conflicthypothesis:twoframesaretransmittedatthesametime,therewillbecollisions,allstationscandetect,theconflictingframesneedtoberetransmitted
Sendtime:1.Continuoustime;2.Timeslot.
Carrierdetection:1.Withcarriersensing;2.Withoutcarriersensing.
Latest: Pre-Qin
Next: Physical layer