IP Fragmentation Offset Calculation | Gate Vidyalay

文章推薦指數: 80 %
投票人數:10人

Fragment offset field use a scaling factor of 8. · If Fragment offset field value = 100, then fragment offset = 8 x 100 = 800. · It suggests 800 bytes of data is ... HomeGATESubjectsDatabaseManagementSystemComputerNetworksOperatingSystemComputerOrganization&ArchitectureDataStructuresTheoryofAutomata&ComputationCompilerDesignGraphTheoryDesignandAnalysisofAlgorithmsDigitalDesignNumberSystemMathematicsPropositionalLogicProgrammingLanguagesCoreJavaB.TechSubjectsComputerGraphicsMachineLearningArtificialIntelligencePatternRecognitionSoftwareEngineeringGATE2022GATECSEBooksJobOpportunitiesContactUsSubscribe Tag:IPFragmentationOffsetCalculationComputerNetworksIPFragmentation- Beforeyougothroughthisarticle,makesurethatyouhavegonethroughthepreviousarticleonIPFragmentation. Wehavediscussed-IPFragmentationisaprocessofdividingthedatagramintofragmentsduringitstransmission.Itisperformedbyintermediarydevicesatdestinationsideatnetworklayer. AlsoRead-IPHeader Inthisarticle,wewilldiscusspracticeproblemsbasedonIPHeaderandIPFragmentation. PRACTICEPROBLEMSBASEDONIPHEADERANDIPFRAGMENTATION- Problem-01: TheintermediateroutersbetweensourceanddestinationneedthefollowinginformationinIPheader-VersionProtocolIdentificationNumberSourceIPAddress Solution- Option-A: VersionfieldindicatestheversionofIPused.Thisinformationisrequiredtoprocessthepacketappropriatelybasedonitsversion. Option-B: Protocolfieldindicatesthenextlevelprotocol.Thisinformationisrequiredbytheroutertoacceptordiscardthepacketifitsbufferisfull.Basedonthepriority,routertakesitsdecision. Option-C: Identificationnumberfieldidentifiesthefragmentsofthesamedatagram.Thisinformationisrequiredwhilere-assemblingthedatagramfragments. Option-D: SourceIPAddressfieldindicatestheIPAddressofthesource.ThisinformationisrequiredbytheroutertosendICMPpackettothesource.ICMPpacketinformsthesourcethatitspackethasbeendiscarded. Thus,AllthesefieldsarerequiredintheIPHeader. Problem-02: Fragmentationofadatagramisneededin-DatagramcircuitonlyVirtualcircuitonlyBoth(A)and(B)None Solution- EachnetworkhasitsMaximumTransmissionUnit(MTU).IfthesizeofdatapacketisgreaterthanMTU,thenitwillhavedividedintofragmentstotransmititthroughthenetwork.So,fragmentationmayberequiredindatagramcircuitsaswellasvirtualcircuits.Thus,Option(C)iscorrect. Problem-03: WhatareallthefieldsrequiredfromIPheadertoallowthedestinationtoperformreassemblyoffragments?Identification,MF,Offset,HeaderlengthandTotallengthMF,OffsetandDestinationIPMF,Datagramlength,SourceIPMF,OptionsandOffset Solution- Clearly,Option(A)iscorrect. Problem-04: ThechecksuminIPmustberecomputedateveryrouterbecauseofchangein____fields.TTL,Options,IdentificationNumber,OffsetTTL,Options,DatagramLength,OffsetTTL,Options,Data,OffsetTTL,HeaderLength,Offset,ToS Solution- Clearly,Option(B)iscorrect. Problem-05: Ifthevalueavailablein“fragmentoffset”fieldofIPheaderis100,thenthenumberofbytesaheadofthisfragmentis___?100B400B800B200B Solution- Fragmentoffsetfielduseascalingfactorof8.IfFragmentoffsetfieldvalue=100,thenfragmentoffset=8x100=800.Itsuggests800bytesofdataisaheadofthisfragment.Thus,Option(C)iscorrect. Problem-06: Whenthesourcedoesnottrusttherouterstorouteproperlyorsourcewishestomakesurethatthepacketdoesnotstrayfromspecifiedpath,whatoptionscanbeused?LoosesourceroutingTracerouteStrictsourceroutingInternetTimeStamp Solution- Clearly,Option(C)iscorrect. Problem-07: ThechecksumcomputationinIPheaderincludes-IPheaderonlyIPheaderanddataIPheaderandPseudoheaderNone Solution- ChecksumcomputationinIPheaderincludesIPheaderonly.Errorsinthedatafieldarehandledbytheencapsulatedprotocol.Thus,Option(A)iscorrect. Problem-08: SupposearouterreceivesanIPpacketcontaining600databytesandhastoforwardthepackettoanetworkwithmaximumtransmissionunitof200bytes.AssumethatIPheaderis20byteslong.Whatarefragmentoffsetvaluesfordividedpackets?22,44,66,880,22,440,22,44,6622,44,66 Solution- Given-MTUsizeofthedestinationnetwork=200bytesIPheaderlength=20 Now,Maximumamountofdatathatcanbesentinonefragment=200–20=180bytes.Amountofdatasentinafragmentmustbeamultipleof8.So,maximumdatasentthatcanbeinonefragment=176bytes. Thus,4fragmentsarecreated-1stfragmentcontains176bytesofdata.2ndfragmentcontains176bytesofdata.3rdfragmentcontains176bytesofdata.4thfragmentcontains72bytesofdata So,Fragmentoffsetvaluefor1stfragment=0Fragmentoffsetvaluefor2ndfragment=176/8=22Fragmentoffsetvaluefor3rdfragment=(176+176)/8=44Fragmentoffsetvaluefor4thfragment=(176+176+176)/8=66 Thus,Option(C)iscorrect. Towatchvideosolutionandpracticeotherproblems,WatchthisVideoLecture NextArticle-TransmissionControlProtocol|TCP GetmorenotesandotherstudymaterialofComputerNetworks.WatchvideolecturesbyvisitingourYouTubechannelLearnVidFun.ComputerNetworksIPFragmentation- IPFragmentationisaprocessofdividingthedatagramintofragmentsduringitstransmission.Itisdonebyintermediarydevicessuchasroutersatthedestinationhostatnetworklayer.  Need- Eachnetworkhasitsmaximumtransmissionunit(MTU).Itdictatesthemaximumsizeofthepacketthatcanbetransmittedthroughit.DatapacketsofsizegreaterthanMTUcannotbetransmittedthroughthenetwork.So,datagramsaredividedintofragmentsofsizelessthanorequaltoMTU. DatagramFragmentation- Whenrouterreceivesadatagramtotransmitfurther,itexaminesthefollowing-SizeofthedatagramMTUofthedestinationnetworkDFbitvalueintheIPheader Then,followingcasesarepossible- Case-01: SizeofthedatagramisfoundtobesmallerthanorequaltoMTU.Inthiscase,routertransmitsthedatagramwithoutanyfragmentation. Case-02: SizeofthedatagramisfoundtobegreaterthanMTUandDFbitsetto1.Inthiscase,routerdiscardsthedatagram. Case-03: SizeofthedatagramisfoundtobegreaterthanMTUandDFbitsetto0.Inthiscase,routerdividesthedatagramintofragmentsofsizelessthanorequaltoMTU.RouterattachesanIPheaderwitheachfragmentmakingthefollowingchangesinit.Then,routertransmitsallthefragmentsofthedatagram. ChangesMadeByRouter- RoutermakesthefollowingchangesinIPheaderofeachfragment-Itchangesthevalueoftotallengthfieldtothesizeoffragment.ItsetstheMFbitto1forallthefragmentsexceptthelastone.Forthelastfragment,itsetstheMFbitto0.Itsetsthefragmentoffsetfieldvalue.Itrecalculatestheheaderchecksum. AlsoRead-IPv4Header IPFragmentationExamples- Now,letsusdiscusssomeexamplesofIPfragmentationtounderstandhowthefragmentationisactuallycarriedout. Example-01: Consider-ThereisahostApresentinnetworkXhavingMTU=520bytes.ThereisahostBpresentinnetworkYhavingMTU=200bytes.HostAwantstosendamessagetohostB.  ConsiderrouterreceivesadatagramfromhostAhaving-Headerlength=20bytesPayloadlength=500bytesTotallength=520bytesDFbitsetto0 Now,routerworksinthefollowingsteps- Step-01: Routerexaminesthedatagramandfinds-Sizeofthedatagram=520bytesDestinationisnetworkYhavingMTU=200bytesDFbitissetto0 Routerconcludes-SizeofthedatagramisgreaterthanMTU.So,itwillhavetodividethedatagramintofragments.DFbitissetto0.So,itisallowedtocreatefragmentsofthedatagram. Step-02: Routerdecidestheamountofdatathatitshouldtransmitineachfragment. Routerknows-MTUofthedestinationnetwork=200bytes.So,maximumtotallengthofanyfragmentcanbeonly200bytes.Outof200bytes,20byteswillbetakenbytheheader.So,maximumamountofdatathatcanbesentinanyfragment=180bytes. Routerusesthefollowingruletochoosetheamountofdatathatwillbetransmittedinonefragment- RULE Theamountofdatasentinonefragmentischosensuchthat-ItisaslargeaspossiblebutlessthanorequaltoMTU.Itisamultipleof8sothatpuredecimalvaluecanbeobtainedforthefragmentoffsetfield. NOTE Itisnotcompulsoryforthelastfragmenttocontaintheamountofdatathatisamultipleof8.Thisisbecauseitdoesnothavetodecidethefragmentoffsetvalueforanyotherfragment. Followingtheaboverule,Routerdecidestosendmaximum176bytesofdatainonefragment.Thisisbecauseitisthegreatestvaluethatisamultipleof8andlessthanMTU. Step-03: Routercreatesthreefragmentsoftheoriginaldatagramwhere-Firstfragmentcontainsthedata=176bytesSecondfragmentcontainsthedata=176byesThirdfragmentcontainsthedata=148bytes  TheinformationcontainedintheIPheaderofeachfragmentis- HeaderInformationOf1stFragment- Headerlengthfieldvalue=20/4=5Totallengthfieldvalue=176+20=196MFbit=1Fragmentoffsetfieldvalue=0Headerchecksumisrecalculated.Identificationnumberissameasthatoforiginaldatagram. HeaderInformationOf2ndFragment- Headerlengthfieldvalue=20/4=5Totallengthfieldvalue=176+20=196MFbit=1Fragmentoffsetfieldvalue=176/8=22Headerchecksumisrecalculated.Identificationnumberissameasthatoforiginaldatagram. HeaderInformationOf3rdFragment- Headerlengthfieldvalue=20/4=5Totallengthfieldvalue=148+20=168MFbit=0Fragmentoffsetfieldvalue=(176+176)/8=44Headerchecksumisrecalculated.Identificationnumberissameasthatoforiginaldatagram. Routertransmitsallthefragments. Step-04: Atdestinationside,Receiverreceives3fragmentsofthedatagram.Reassemblyalgorithmisappliedtocombineallthefragmentstoobtaintheoriginaldatagram. Example-02: Consider-ThereisahostApresentinnetworkXhavingMTU=520bytes.ThereisahostBpresentinnetworkYhavingMTU=200bytes.ThereexistsanetworkZhavingMTU=110bytes.HostAwantstosendamessagetohostB.  ConsiderRouter-1receivesadatagramfromhostAhaving-Headerlength=20bytesPayloadlength=500bytesTotallength=520bytesDFbitsetto0 ConsiderRouter-1dividesthedatagraminto3fragmentsasdiscussedinExample-01. Then,Firstfragmentcontainsthedata=176bytesSecondfragmentcontainsthedata=176byesThirdfragmentcontainsthedata=148bytes Now,consider-Firstandthirdfragmentreachesthedestinationdirectly.However,secondfragmenttakesitswaythroughnetworkZandreachthedestinationthroughRouter-3. JourneyOfSecondFragment- Now,letusdiscussthejourneyoffragment-2andhowitfinallyreachesthedestination. Router-2receivesadatagram(secondfragmentoforiginaldatagram)where-Headerlength=20bytesPayloadlength=176bytesTotallength=196bytesDFbitsetto0 Now,Router-2worksinthefollowingsteps- Step-01: Router-2examinesthedatagramandfinds-Sizeofthedatagram=196bytesDestinationisnetworkZhavingMTU=110bytesDFbitissetto0 Router-2concludes-SizeofthedatagramisgreaterthanMTU.So,itwillhavetodividethedatagramintofragments.DFbitissetto0.So,itisallowedtocreatefragmentsofthedatagram. Step-02: Router-2decidestheamountofdatathatitshouldtransmitineachfragment. Router-2knows-MTUofthedestinationnetwork=110bytes.So,maximumtotallengthofanyfragmentcanbeonly110bytes.Outof110bytes,20byteswillbetakenbytheheader.So,maximumamountofdatathatcanbesentinanyfragment=90bytes. Followingtherule,Router-2decidestosendmaximum88bytesofdatainonefragment.Thisisbecauseitisthegreatestvaluethatisamultipleof8andlessthanMTU. Step-03: Router-2createstwofragmentsofthereceiveddatagramwhere-Firstfragmentcontainsthedata=88bytesSecondfragmentcontainsthedata=88byes  TheinformationcontainedintheIPheaderofeachfragmentis- HeaderInformationOf1stFragment- Headerlengthfieldvalue=20/4=5Totallengthfieldvalue=88+20=108MFbit=1Fragmentoffsetfieldvalue=176/8=22Headerchecksumisrecalculated.Identificationnumberissameasthatoforiginaldatagram. NOTE- ThisfragmentisNOTthefirstfragmentoftheoriginaldatagram.ItisthefirstfragmentofthedatagramreceivedbyRouter-2.ThedatagramreceivedbyRouter-2isthesecondfragmentoftheoriginaldatagram.Thisdatagramwillserveasthesecondfragmentoftheoriginaldatagram.Therefore,fragmentoffsetfieldissetaccordingtothefirstfragmentoftheoriginaldatagram. HeaderInformationOf2ndFragment- Headerlengthfieldvalue=20/4=5Totallengthfieldvalue=88+20=108MFbit=1Fragmentoffsetfieldvalue=(176+88)/8=33Headerchecksumisrecalculated.Identificationnumberissameasthatoforiginaldatagram. NOTE- ThisfragmentisNOTthelastfragmentoftheoriginaldatagram.ItisthelastfragmentofthedatagramreceivedbyRouter-2.ThedatagramreceivedbyRouter-2isthesecondfragmentoftheoriginaldatagram.Thisdatagramwillserveasthethirdfragmentoftheoriginaldatagram.Thereisanotherfragmentoftheoriginaldatagramthatfollowsit.Thatiswhy,hereMFbitisnotsetto0. Router-2transmitsboththefragmentswhichreachesthedestinationthroughRouter-3.Router-3performsnofragmentation. Step-04: Atdestinationside,Receiverreceives4fragmentsofthedatagram.Reassemblyalgorithmisappliedtocombineallthefragmentstoobtaintheoriginaldatagram.  ReassemblyAlgorithm- Receiverappliesthefollowingstepsforreassemblyofallthefragments-ItidentifieswhetherdatagramisfragmentedornotusingMFbitandFragmentoffsetfield.Itidentifiesallthefragmentsbelongingtothesamedatagramusingidentificationfield.Itidentifiesthefirstfragment.Fragmentwithoffsetfieldvalue=0isthefirstfragment.Itidentifiesthesubsequentfragmentsusingtotallength,headerlengthandfragmentoffset.Itrepeatsstep-04untilMFbit=0. FragmentOffsetfieldvalueforthenextsubsequentfragment=(Payloadlengthofthecurrentfragment/8)+Offsetfieldvalueofthecurrentfragment=(Totallength–Headerlength/8)+Offsetfieldvalueofthecurrentfragment FragmentationOverhead- Fragmentationofdatagramincreasestheoverhead.Thisisbecauseafterfragmentation,IPheaderhastobeattachedwitheachfragment. TotalOverhead=(Totalnumberoffragmenteddatagrams–1)xsizeofIPheader Efficiency=Usefulbytestransferred/TotalbytestransferredOREfficiency=Datawithoutheader/Datawithheader BandwidthUtilizationorThroughput=EfficiencyxBandwidth ImportantNotes- Note-01: Sourcesidedoesnotrequirefragmentationduetowisesegmentationbytransportlayer.Thetransportlayerlooksatthedatagramdatalimitandframedatalimit.Then,itperformssegmentationinsuchawaythattheresultingdatacaneasilyfitinaframe.Thus,thereisnoneedoffragmentationatthesourceside. Note-02: Datagramsfromthesamesourcetothesamedestinationmaytakedifferentroutesinthenetwork. Note-03: Fragmentoffsetfieldvalueissetto0forthefirstfragmenteddatagram.MFbitissetto1forallthefragmenteddatagramsexceptthelastone. Note-04: UniquecombinationsofMFbitvalueandfragmentoffsetvalue. MFbitOffsetvalueRepresents101stFragment1!=0IntermediateFragment0!=0LastFragment00NoFragmentation Note-05: Identificationnumberforallthefragmentsissameasthatoftheoriginaldatagram.Thisistoidentifyallthefragmentsofthesamedatagramwhilere-assemblingthem. Note-06: Considerdatagramgoesthroughapathwheredifferentintermediarieshavingdifferentbandwidths.Then,whilecalculatingthethroughput,considertheminimumbandwidthsinceitactasabottleneck. Note-07: Fragmentationisdonebyintermediarydevicessuchasrouters.Thereassemblyoffragmenteddatagramsisdoneonlyafterreachingthedestination. Note-08: Reassemblyisnotdoneattheroutersbecause-Allthefragmentsmaynotmeetattherouter.Fragmenteddatagramsmayreachthedestinationthroughindependentpaths.Theremaybeaneedforfurtherfragmentation. Note-09: Ifafragment(sayparent)isrefragmentedintomultipledatagramsthen-Thefragmentoffsetvalueforthefirstre-fragmentisalwayssameasitsparent.TheMFbitbitvalueforthelastre-fragmentisalwayssameasitsparent. TogainbetterunderstandingaboutIPFragmentation,WatchthisVideoLecture NextArticle-PracticeProblemsOnIPFragmentation GetmorenotesandotherstudymaterialofComputerNetworks.WatchvideolecturesbyvisitingourYouTubechannelLearnVidFun.FollowusonFacebookChooseyourSubject GATESubjectsDatabaseManagementSystemComputerNetworksOperatingSystemComputerOrganization&ArchitectureDataStructuresTheoryofAutomata&ComputationCompilerDesignGraphTheoryDesign&AnalysisofAlgorithmsDigitalDesignNumberSystemDiscreteMathematics B.TechSubjectsComputerGraphicsMachineLearningArtificialIntelligencePatternRecognitionSoftwareEngineeringJobOpportunitiesSubscribetogetEmailNotificationsFirstNameLastNameEmailAddressSubmitGATEExamCornerImportantTopicsForGATEExamStandardGATETextbooksGateVidyalay©2020ManagedbyMetaDivSystems



請為這篇文章評分?