UDPWord格式文档下载.docx
《UDPWord格式文档下载.docx》由会员分享,可在线阅读,更多相关《UDPWord格式文档下载.docx(12页珍藏版)》请在冰点文库上搜索。
Answerthesequestionsdirectlyfromwhatyouobserveinthepackettrace.)Namethesefields.
Thereare4fieldsintheUDPheader.
Theirnamesare:
Sourceport;
Destinationport;
Length;
Checksum.
2.Fromthepacketcontentfield,determinethelength(inbytes)ofeachoftheUDPheaderfields.
ThelengthofUDPdatagramis159bytes,thelengthofdatais151bytes.So,thelengthofUDPheaderis(159-151=)8bytes.
3.ThevalueintheLengthfieldisthelengthofwhat?
VerifyyourclaimwithyourcapturedUDPpacket.
ThevalueintheLengthfieldisthelengthofUDPdatagram.
4.WhatisthemaximumnumberofbytesthatcanbeincludedinaUDPpayload?
Thetotallengthis1500bytes.ThelengthofIPheaderis20bytes.ThelengthofUDPheaderis8bytes.So,Themaximumnumberofbytesis(1500-20-8=)1472bytes.
5.Whatisthelargestpossiblesourceportnumber?
ThelengthofUDPheaderis8bytes.Thereare4fields.Everyoneofthemarethesamelength.So,thesourceportis2bytes.
Thetotalnumberis(2^16=)65536.
Andtheboundaryofsourceportnumberis(0~65535).
Thelargestpossiblesourceportnumberis65535.
6.WhatistheprotocolnumberforUDP?
Giveyouranswerinbothhexadecimalanddecimalnotation.(Toanswerthisquestion,you’llneedtolookintotheIPheader.)
TheprotocolnumberforUDPis17.
7.
Search“UDP”inGoogleanddeterminethefieldsoverwhichtheUDPchecksumiscalculated.
ThewaytocalculateUDPchecksum.
Thisprotocolprovidesaprocedureforapplicationprogramstosend
messagestootherprogramswithaminimumofprotocolmechanism.The
protocolistransactionoriented,anddeliveryandduplicateprotection
arenotguaranteed.Applicationsrequiringorderedreliabledeliveryof
streamsofdatashouldusetheTransmissionControlProtocol(TCP)[2].
Format
------
0781516232431
+--------+--------+--------+--------+
|Source|Destination|
|Port|Port|
|||
|Length|Checksum|
|
|dataoctets...
+----------------...
UserDatagramHeaderFormat
Fields
SourcePortisanoptionalfield,whenmeaningful,itindicatestheport
ofthesendingprocess,andmaybeassumedtobetheporttowhicha
replyshouldbeaddressedintheabsenceofanyotherinformation.If
notused,avalueofzeroisinserted.
Postel[page1]
28Aug1980
UserDatagramProtocolRFC768
DestinationPorthasameaningwithinthecontextofaparticular
internetdestinationaddress.
Lengthisthelengthinoctetsofthisuserdatagramincludingthis
headerandthedata.(Thismeanstheminimumvalueofthelengthis
eight.)
Checksumisthe16-bitone'
scomplementoftheone'
scomplementsumofa
pseudoheaderofinformationfromtheIPheader,theUDPheader,andthe
data,paddedwithzerooctetsattheend(ifnecessary)tomakea
multipleoftwooctets.
ThepseudoheaderconceptuallyprefixedtotheUDPheadercontainsthe
sourceaddress,thedestinationaddress,theprotocol,andtheUDP
length.Thisinformationgivesprotectionagainstmisrouteddatagrams.
ThischecksumprocedureisthesameasisusedinTCP.
+--------+--------+--------+--------+
|sourceaddress|
|destinationaddress|
|zero|protocol|UDPlength|
Ifthecomputedchecksumiszero,itistransmittedasallones(the
equivalentinone'
scomplementarithmetic).Anallzerotransmitted
checksumvaluemeansthatthetransmittergeneratednochecksum(for
debuggingorforhigherlevelprotocolsthatdon'
tcare).
8.ExamineapairofUDPpacketsinwhichthefirstpacketissentbyyourhostandthesecondpacketisareplytothefirstpacket.Describetherelationshipbetweentheportnumbersinthetwopackets.
TotheUDPpacketwhichmyhostsentandmyhostreceived,theirsourceportnumberanddestinationportnumberareeachother.Wecanseeitfromtheabove2images.
ExtraCredit
1.CaptureasmallUDPpacket.Manuallyverifythechecksuminthispacket.Showallworkandexplainallsteps.
以太网帧首部(14字节):
01005e2217ea00247e0518370800
IP首部(20字节):
4500003041f800000111e3a80a028829ea2217ea
UDP首部(8字节):
fb43838a001cbab4
源端口号:
fb43目的端口号:
838a
UDP长度:
001c
伪首部字段:
32位源IP地址、32位目的IP地址、8位协议、16位UDP长度.
udp数据报和tcp报文段在为了计算检验和而设置了一个12字节长的伪首部。
由于udp数据报的长度可以为奇数字节,但是检验和算法是把若干个16bit字相加,因此可在填充字节字段填入0,可能增加的填充字节不被传送。
因此必须构造12字节的伪首部:
0a028829
ea2217ea
0011
001c
构造完毕之后,把udp检验和部分置0,然后对udp每个16bit进行二进制反码求和,
0a02+8829+ea22+17ea+0011+001c+fb43+838a+001c+0000+
1000+0000+…+4fbb+5ef3=454b
计算过程如下:
0a02+8829+ea22+17ea=9438
0011+001c+fb43+838a=7efb
001c+0000+1000+aed3+fa1e=b90e
Efff+fa4e+37fd+a80d=ca59
4fbb+5ef3=aeae
再把以上算的结果相加:
9438+7efb+b90e=cc42
ca59+aeae=7908
最后的结果为:
cc42+7908=454b
对454b求反即得:
CheckSum:
bab4
五、实验结论
1.UDP报文段头部8个字节,分为四个字段,分别为:
源端口号,目的端口号,长度和检验和。
2.UDP报文段的最大长度为1472个字节。