Datagram

souhrn

Vlastnosti režimu práce s datagramem:

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.

PolevpevnéčástizáhlavídatagramuIP

(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) Celková délka: Celková délka se vztahuje k délce součtu hlavičky a dat v bajtech. Celková délka pole je 16 bitů, takže maximální délka datagramu je 216-1=65535 bajtů.

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.

Datagram

(6) Příznak: zabírá 3 bity, pouze 2 bity jsou smysluplné.

①Nejnižší bit v poli vlajky je označen jako MF (MoreFragment). MF=1 znamená, že za sebou jsou „fragmentované“ datagramy. MF=0 znamená, že se jedná o většinu několika fragmentů datagramů.

②Jeden bit uprostřed pole vlajky je označen jako DF (Don’tFragment), což znamená „nelze fragmentovat“. Fragmentace je povolena pouze při 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)První kontrolní součet:16 číslic.Toto pole kontroluje pouze hlavičku datagramu, ale nezahrnuje datovou část.To proto, že pokaždé, když datový gram projde přes směrovač, vypočte kontrolní součet hlavičky (některá pole, jako je například čas, kdy je třeba zkontrolovat zatížení, odsazení řezu atd., takže část nemůže být změněna) atd.

(11)Zdrojová adresa: 32 bitů.

(12)Cílová adresa: 32 bitů.

Proměnná část záhlaví datagramu IP

ThevariablepartoftheIPheaderisanoptionalfield.Theoptionfieldisusedtosupporttroubleshooting,measurement,andsecuritymeasures,andthecontentisveryrich.Thelengthofthisfieldisvariable,rangingfrom1byteto40bytes,dependingontheselecteditem.Someoptionitemsonlyrequire1byte,anditonlyincludes1byteofoptioncode.Buttherearesomeoptionsthatrequiremultiplebytes.Theseoptionsarespliced​​onebyonewithoutaseparatorinthemiddle.Finally,apaddingfieldofall0sisusedtofillinanintegermultipleof4bytes.

AddingthevariablepartoftheheaderistoincreasethefunctionoftheIPdatagram,butitalsomakesthelengthoftheheaderoftheIPdatagramvariable.Thisincreasestheoverheadforeachroutertoprocessdatagrams.Infact,theseoptionsarerarelyused.ThenewIPversionIPv6makestheheaderlengthoftheIPdatagramfixed.

Tyto možnosti jsou definovány následovně:

(1)Omezení zabezpečení a zpracování (používané ve vojenské oblasti)

(2)Zaznamenejte cestu (nechteachrouterZapište si IPadresu)

(3)Časové razítko (nechte router zapsat jeho IP adresu a čas)

(4)Loosesourcesiterouting(SpecifyaseriesofIPaddressesthatmustbepassedthroughforthedatagram)

(5)Strictsourcesiterouting(similartoloosesourcesiterouting,butitisrequiredtoonlypassthroughthesespecifiedaddresses,nototherAddress)

Theseoptionsarerarelyused,andnotallhostsandrouterssupporttheseoptions.

Související články
HORNÍ