Summary
Caratteristiche della modalità di funzionamento del datagramma:
1.Differentpacketsofthesamemessagecanbetransmittedthroughdifferenttransmissionpathsthroughthecommunicationsubnet;
2.Whendifferentpacketsofthesamemessagearriveatthedestinationnode,theremaybedisorder,duplicationandloss;
3.Eachpacketmusthaveadestinationaddressandadestinationaddressduringtransmission.Sourceaddress;
4.Thedatagrammodehasalargemessagetransmissiondelay,whichissuitableforburstcommunication,notsuitableforlongmessageandconversationalcommunication.
IPDatagram
TheTCP/IPprotocoldefinesapackettransmittedontheInternet,calledIPDatagram.Thisisavirtualpackagethathasnothingtodowithhardware,whichiscomposedoftwoparts:headeranddata.Thefirstpartoftheheaderisafixedlength,atotalof20bytes,whichismandatoryforallIPdatagrams.Behindthefixedpartoftheheaderaresomeoptionalfields,thelengthofwhichisvariable.ThesourceaddressanddestinationaddressintheheaderarebothIPprotocoladdresses.
ThefieldsinthefixedpartoftheIPdatagramheader
(1)Version:occupies4bitsandreferstotheversionoftheIPprotocol.TheversionoftheIPprotocolusedbybothpartiesmustbethesame.ThewidelyusedIPprotocolversionnumberis4(thatis,IPv4).
(2)Headerlength:occupies4digits,andthelargestdecimalvaluethatcanberepresentedis15.Pleasenotethattheunitofthenumberrepresentedbythisfieldis32-bitwords(a32-bitwordlengthis4bytes).Therefore,whentheIPheaderlengthis1111(ie15indecimal),theheaderlengthreaches60wordsFestival.WhenthelengthoftheheaderoftheIPpacketisnotanintegermultipleof4bytes,thelastpaddingfieldmustbeusedtofillit.Therefore,thedatapartalwaysstartsatanintegermultipleof4bytes,whichismoreconvenientwhenimplementingtheIPprotocol.Thedisadvantageoftheheaderlengthbeinglimitedto60bytesisthatitmaynotbeenoughsometimes.Butthisisdoneinthehopethatuserswillminimizeoverhead.Themostcommonlyusedheaderlengthis20bytes(thatis,theheaderlengthis0101),andnooptionsareusedatthistime.
(3)Differentiatedservices:8positionsareusedtoobtainbetterservices.Thisfieldwascalledtheservicetypeintheoldstandard,butithasnotactuallybeenused.In1998,theIETFrenamedthisfieldasDifferentiatedServices(DS).Thisfieldonlyworkswhenusingdifferentiatedservices.
(4) Totallength: Thetoallengthreferstothelengthofthesum of the header and thedata,inbytes. Thetotallengthfieldis16bits,sothemaximumlengthofthedatagramis216-1=65535bytes.
EachdatalinklayerbelowtheIPlayerhasitsownframeformat,includingthemaximumlengthofthedatafieldintheframeformat,whichiscalledtheMaximumTransferUnit(MTU).Whenadatagramisencapsulatedintoalinklayerframe,thetotallengthofthedatagram(thatis,theheaderplusthedatapart)mustnotexceedtheMTUvalueofthedatalinklayerbelow.
(5)Identification(identification):occupies16digits.TheIPsoftwaremaintainsacounterinthememory.Eachtimeadatagramisgenerated,thecounterisincrementedby1,andthisvalueisassignedtotheidentificationfield.Butthis"identification"isnotasequencenumber,becauseIPisaconnectionlessservice,andthereisnoproblemofsequentialreceptionofdatagrams.WhenadatagrammustbefragmentedbecauseitslengthexceedstheMTUofthenetwork,thevalueofthisidentificationfieldiscopiedtotheidentificationfieldofalldatagrams.Thevalueofthesameidentificationfieldenableseachdatagramafterfragmentationtobefinallyreassembledintotheoriginaldatagramcorrectly.
(6) Flag:occupat 3bits,sed 2bitsaremeaningful.
①ThelowestbitintheflagfieldsmarkedasMF(MoreFragment).MF=I significat quod redactum est. MF=0 est hoc est ultimum plurium datagramfragmenta.
Theonebit in medio flag- ello notatus DF (Don'tFragment), quod est "fragmentari non potest". Fragmentationis modo cum DF=0.
(7)Chipoffset:13bits.Thesliceoffsetindicatestherelativepositionofasliceintheoriginalgroupafterthelongergroupissliced.Thatis,relativetothebeginningoftheuserdatafield,wheredoesthepiecestart.Thechipoffsetuses8bytesastheoffsetunit.Thismeansthatthelengthofeachfragmentmustbeanintegermultipleof8bytes(64bits).
(8)Timetolive:occupies8bits.ThecommonlyusedEnglishabbreviationforthetimetolivefieldisTTL(TimeToLive),whichindicatesthelifeofthedatagraminthenetwork.Thisfieldissetbythesourceofthedatagram.ItspurposeistopreventundeliverabledatagramsfromgoingaroundtheInternetindefinitely,thusconsumingnetworkresourcesinvain.TheoriginaldesignusessecondsastheunitofTTL.Everytimeitpassesthrougharouter,theTTLissubtractedfromtheperiodoftimethedatagramisconsumedbytherouter.Ifthetimeconsumedbythedatagramontherouterislessthan1second,theTTLvalueisreducedby1.WhentheTTLvalueis0,thedatagramisdiscarded.
(9)Protocol:Itoccupies8bits,andtheprotocolfieldindicateswhichprotocolisusedforthedatacarriedinthisdatagram,sothattheIPlayerofthedestinationhostknowswhichprocessingprocedureshouldbehandedoverthedatapart.
(10) Primumchecksum: 16digits. Thisfieldonlycheckstheheaderofthedatagram, but does notincludethedatapart.
(11) Source: 32bits.
(12) Destination electronica: 32bits.
ThevariablepartoftheIPdatagramheader
ThevariablepartoftheIPheaderisanoptionalfield.Theoptionfieldisusedtosupporttroubleshooting,measurement,andsecuritymeasures,andthecontentisveryrich.Thelengthofthisfieldisvariable,rangingfrom1byteto40bytes,dependingontheselecteditem.Someoptionitemsonlyrequire1byte,anditonlyincludes1byteofoptioncode.Buttherearesomeoptionsthatrequiremultiplebytes.Theseoptionsaresplicedonebyonewithoutaseparatorinthemiddle.Finally,apaddingfieldofall0sisusedtofillinanintegermultipleof4bytes.
AddingthevariablepartoftheheaderistoincreasethefunctionoftheIPdatagram,butitalsomakesthelengthoftheheaderoftheIPdatagramvariable.Thisincreasestheoverheadforeachroutertoprocessdatagrams.Infact,theseoptionsarerarelyused.ThenewIPversionIPv6makestheheaderlengthoftheIPdatagramfixed.
Theseoptionsaredefinedasfollows:
(I) Securityandprocessingrestrictions (usedinthemilitaryfield)
(2) Recordthepath(leteachrouterWritedownitsIPaddress)
(III) Timestamp (leteachrouterwritedownitsIPaddressandtime)
(4)Loosesourcesiterouting(SpecifyaseriesofIPaddressesthatmustbepassedthroughforthedatagram)
(5)Strictsourcesiterouting(similartoloosesourcesiterouting,butitisrequiredtoonlypassthroughthesespecifiedaddresses,nototherAddress)
Theseoptionsarerarelyused,andnotallhostsandrouterssupporttheseoptions.