![第5章osi層次傳輸層_第1頁](http://file4.renrendoc.com/view/7013481aa8fbe9b76b4299bdfcbe1221/7013481aa8fbe9b76b4299bdfcbe12211.gif)
![第5章osi層次傳輸層_第2頁](http://file4.renrendoc.com/view/7013481aa8fbe9b76b4299bdfcbe1221/7013481aa8fbe9b76b4299bdfcbe12212.gif)
![第5章osi層次傳輸層_第3頁](http://file4.renrendoc.com/view/7013481aa8fbe9b76b4299bdfcbe1221/7013481aa8fbe9b76b4299bdfcbe12213.gif)
![第5章osi層次傳輸層_第4頁](http://file4.renrendoc.com/view/7013481aa8fbe9b76b4299bdfcbe1221/7013481aa8fbe9b76b4299bdfcbe12214.gif)
![第5章osi層次傳輸層_第5頁](http://file4.renrendoc.com/view/7013481aa8fbe9b76b4299bdfcbe1221/7013481aa8fbe9b76b4299bdfcbe12215.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
OSILayer4:
TransportLayerOSILayer4:TransportLayerAnoverviewoflayer4
TCP(TransmissionControlProtocol)UDP(UserDatagramProtocol)Anapplication:NATandPATLayer4performsmultiplefunctions:segmentingupper-layerapplicationdataestablishingend-to-endoperationssendingsegmentsfromoneendhosttoanotherFlowcontrolandreliabilitycanbecomparedtotalkingtoaforeigner.Oftenyouwouldasktheforeignertorepeathis/herwords(reliability)andtospeakslowly(flowcontrol)OSILayer4:TransportLayer
TwoparticularlyimportantLayer4protocols:
TransmissionControlProtocol(TCP)UserDatagramProtocol(UDP)Layer4:TheTransportLayerDivideoutgoingmessagesintosegmentsReassemblemessagesatthedestinationstationTCP:reliableConnection-orientedSoftwarecheckingforsegmentRe-sendanythinglostorerrorUsesacknowledgmentsProvidesflowcontrolUDP:
unreliable
connectionless
providesnosoftwarecheckingforsegmentusesnoacknowledgmentsprovidesnoflowcontrolLayer4:TheTransportLayerBothTCPandUDPuseport
tokeeptrackofdifferentconversationsthatcrossthenetworkatthesametimeApplicationsoftwaredevelopershaveagreedtousethewell-knownportnumbersthataredefinedinRFC1700
Portnumbersbelow255arereservedforTCPandUDPpublicapplications.ServiceModelSocketispresentedas(IP_address,port)Everyconnectionisexpressedas(socketsource,socketdestination),whichisapoint-to-pointfull-duplexchannelDoesnotsupportmulticastandbroadcastSocketLayer4:TheTransportLayerAnoverviewoflayer4TCP(TransmissionControlProtocol)UDP(UserDatagramProtocol)Anapplication:NATandPATTCPServiceModelProblemsmustbesolvedinTCP:ReliabletransferFlowcontrolSlidingwindowcongestionavoidance…ConnectionmanagementEstablishconnection:threehandshakesReleaseconnection:fourhandshakesTCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充源端口和目的端口字段——各占2字節(jié)端口是運輸層與應用層的服務接口運輸層的復用和分用功能都要通過端口才能實現(xiàn)TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充序號字段——占4字節(jié)TCP傳送的數(shù)據(jù)流中的每一個字節(jié)都編上一個序號序號字段的值指本報文段所發(fā)送的數(shù)據(jù)的第一個字節(jié)的序號TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充確認號字段——占4字節(jié),是期望收到對方的下一個報文段的數(shù)據(jù)的第一個字節(jié)的序號TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充數(shù)據(jù)偏移(即首部長度)——占4位指出TCP報文段的數(shù)據(jù)起始處距TCP報文段的起始處的長度單位是32位字(以4字節(jié)為計算單位)TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充保留字段——占6位,保留為今后使用,目前置0TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充緊急URG1時,表明緊急指針字段有效告訴系統(tǒng)此報文段中有緊急數(shù)據(jù),應盡快傳送(相當于高優(yōu)先級的數(shù)據(jù))
TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充ACK1時確認號字段有效ACK0時確認號字段無效TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充推送PSH(PuSH)——接收TCP收到PSH=1的報文段,就盡快地交付接收應用進程,而不再等到整個緩存都填滿了后再向上交付TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充復位RST(ReSeT1時,表明TCP連接中出現(xiàn)嚴重差錯(如由于主機崩潰或其他原因),必須釋放連接,然后再重新建立運輸連接TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充同步SYN=1表示這是一個連接請求或連接接受報文TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充終止FIN(FINis)——用來釋放一個連接。FIN1表明此報文段的發(fā)送端的數(shù)據(jù)已發(fā)送完畢,并要求釋放運輸連接。TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充窗口字段——占2字節(jié),用來讓對方設置發(fā)送窗口的依據(jù),單位為字節(jié)。TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充檢驗和——占2字節(jié)。檢驗和字段檢驗的范圍包括首部和數(shù)據(jù)這兩部分TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充緊急指針字段——占16位,指出在本報文段中緊急數(shù)據(jù)共有多少個字節(jié)(緊急數(shù)據(jù)放在本報文段數(shù)據(jù)的最前面)
TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG比特08162431填充TCP最初只有一種選項,即最大報文段長度MSS(MaximumSegmentSize)MSS告訴對方緩存所能接收的報文段的數(shù)據(jù)字段的最大長度是MSS個字節(jié)數(shù)據(jù)字段加上TCP首部才等于整個的TCP報文段。TCP首部20字節(jié)固定首部目的端口數(shù)據(jù)偏移檢驗和選項(長度可變)源端口序號緊急指針窗口確認號保留FINSYNRSTPSHACKURG位08162431填充填充字段——這是為了使整個首部長度是4字節(jié)的整數(shù)倍。TCPProtocolHostsexchangedatabyusingsegment(TPDU)Eachsegmenthas:aheaderof20bytes(exceptoptionalparts)
0ormoredatabytesThesizeofthesegmentmustbematchedwithIPpackets,andalsomustsatisfythedemandofbottomlayersForexample,theMTU(MaximalTransferUnit)ofEthernetis1500bytesEachbytehasa32bitssequencenumberReliableConnection?
Two-armyProblem
TCP:EstablishConnectionSYN=1,seq=xClosedClosedActiveopenPassiveopenABClientServerTheFirstHandshakeServer:executesLISTEN
andACCEPTprimitive,andmonitorspassivelyClient:executesCONNECTprimitive,generateaTCPsegmentwithSYN=1andACK=0,whichstandsforconnectionrequestSYN=1,seq=xSYN=1,ACK=1,seq=y,ack=x1TheSecondHandshakeServerchecksifexistsserviceprocessmonitoringtheportIfnoneprocess,answeraTCPsegmentwithRST=1Ifexistsprocess,decidestorejectortoaccepttherequestIfaccepttheconnectionrequest,sendasegmentwithSYN=1andACK=1ClosedClosedActiveopenPassiveopenABClientServer
TCP:EstablishConnectionSYN=1,seq=xACK=1,seq=x+1,ack=y1SYN=1,ACK=1,seq=y,ack=x1TheThirdHandshakeTheclientsendsasegmentwithSYN=0andACK=1
toacknowledgetheconnectionClosedClosedActiveopenPassiveopenABClientServer
TCP:EstablishConnectionSYN=1,seq=xACK=1,seq=x+1,ack=y1DataTransferSYN=1,ACK=1,seq=y,ack=x1Whentheserverreceivestheacknowledgement,itinformstheupperlayerapplications
TCP:EstablishConnectionClosedClosedActiveopenPassiveopenABClientServerSYN-SENTESTAB-LISHEDSYN-RCVDLISTENESTAB-LISHEDSYN=1,seq=xACK=1,seq=x+1,ack=y1DataTransferSYN=1,ACK=1,seq=y,ack=x1
TCP:EstablishConnectionClosedClosedActiveopenPassiveopenABClientServerExample:EstablishConnection
TCPATCPB1.CLOSEDLISTEN2.SYN-SENT--><SEQ=100><CTL=SYN>-->SYN-RECEIVED3.ESTABLISHED<--<SEQ=300><ACK=101><CTL=SYN,ACK><--SYN-RECEIVED4.ESTABLISHED--><SEQ=101><ACK=301><CTL=ACK>-->ESTABLISHED5.ESTABLISHED--><SEQ=101><ACK=301><CTL=ACK><DATA>-->ESTABLISHEDBasic3-WayHandshakeforConnectionSynchronizationNotethattheACKdoesnotoccupysequencenumberspace(ifitdid,wewouldwindupACKingACK's!)Datatransfer
——stop-and-waitprotocol(a)NoerrorASend
M1ACK
M1BSend
M2Send
M3ACKM2ACK
M3ASend
M1BResend
M1Send
M2ACK
M1Disposethesegment(b)OutoftimettttDatatransfer
——stop-and-waitprotocolAftersendingasegment,preserveabackuptemporarilyEachsegmentandACKmusthaveIDTheresend-timemustbemorethanaverage-travel-time*2stop-and-waitprotocolisasimpleprotocol,buthaspoorefficiencyDatatransfer
——LostACKandLateACKASend
M1BOutoftimeResendM1SendM2DisposetherepeatedM1andresendACKM2(a)LostACKACK
M1ASend
M1BOutoftimeResendM1Send
M2DisposetherepeatedM1andresendACKM1(b)LateACKACKM1ReceivethelateACKanddonothingttttReliableCommunicationARQ(AutomaticRepeatreQuest)。Itmeansthe‘resendrequest’isautomaticallysentandthereceiverneednotrequestthesendertoresendtheerrorsegmentContiguousARQProtocol123456789101112(a)發(fā)送方維持發(fā)送窗口(發(fā)送窗口是5)發(fā)送窗口(b)收到一個確認后發(fā)送窗口向前滑動向前123456789101112發(fā)送窗口SegmentttACKFIN=1,seq=uESTAB-LISHEDCLOSEDDataTransferESTAB-LISHEDTCP:ReleaseConnectionActiveClosePassiveCloseABClientServerFIN=1,seq=uACK=1,seq=v,ack=u1ESTAB-LISHEDDataTransferESTAB-LISHEDActiveCloseInformUpperLayerABClientServerTCP:ReleaseConnectionFIN=1,seq=uACK=1,seq=v,ack=u1FIN=1,ACK=1,seq=w,ack=u1PassiveCloseDataTransferESTAB-LISHEDDataTransferESTAB-LISHEDActiveCloseInformUpperLayerABClientServerTCP:ReleaseConnectionFIN=1,seq=uACK=1,seq=v,ack=u1FIN=1,ACK=1,seq=w,ack=u1ACK=1,seq=u+1,ack=w1TCP:ReleaseConnectionPassiveCloseDataTransferESTAB-LISHEDDataTransferESTAB-LISHEDActiveCloseInformUpperLayerABClientServerCLOSEDACK=1,seq=u+1,ack=w1FIN=1,seq=uACK=1,seq=v,ack=u1FIN=1,ACK=1,seq=w,ack=u1FIN-WAIT-1CLOSE-WAITFIN-WAIT-2LAST-ACKWait
2MSLTIME-WAITCLOSEDBeforereleasingconnection,theclientmustwaitfor2MSLTCP:ReleaseConnectionPassiveCloseDataTransferESTAB-LISHEDDataTransferESTAB-LISHEDActiveCloseInformUpperLayerABClientServerWhymustwaitfor2MSL?ToensurethelastACKsentbyAcanreachBTopreventanyinvalidconnectionrequestsegmentfromemergingAfterwaitingfor2MSL,wecanmakesurethatallsegmentsontheconnectionhavedisappearedT
C
P
的
有
限
狀
態(tài)
機CLOSEDESTABLISHEDLISTENCLOSE_WAITFIN_WAIT_1SYN_RCVDFIN_WAIT_2CLOSINGTIME_WAITSYN_SENTLAST_ACK主動打開被動打開被動關閉主動關閉起點被動打開主動打開發(fā)送SYN同時打開收到SYN,發(fā)送SYN,ACK收到ACK數(shù)據(jù)傳送階段
關閉發(fā)送FIN
關閉發(fā)送FIN
關閉發(fā)送FIN收到RST
收到SYN發(fā)送SYN,ACK
關閉或超時收到ACK
收到SYN,ACK發(fā)送ACK收到ACK收到ACK收到FIN發(fā)送ACK收到FIN,ACK
發(fā)送ACK收到FIN發(fā)送ACK同時關閉收到FIN發(fā)送ACK發(fā)送SYN定時經(jīng)過兩倍報文段壽命后關閉Layer4:TheTransportLayerAnOverviewofLayer4TCP(TransmissionControlProtocol)UDP(UserDatagramProtocol)Anapplication:NATandPATUDP(UserDatagramProtocol)WhydoweneedUDP?Noconnectionestablishment(whichcanadddelay)Simple:noconnectionstateatsender,receiverSmallsegmentheaderNocongestioncontrol:UDPcanblastawayasfastasdesiredUDP(UserDatagramProtocol)Connectionless:nohandshakingbetweenUDPsender,receivereachUDPsegmenthandledindependentlyofothersOftenusedforstreamingmultimediaapplicationslosstolerantratesensitiveUDPareusedin:RIP:TosendtherouteinformationperiodicallyDNS:AvoidthedelaytosetuptheTCPconnectionSNMP:Whencongestion,SNMPmuststillrunable.Withoutthecongestionandreliabilitycontrolmechanism,UDPhasbetterperformancethanTCPunderthecircumstances.OtherprotocolsincludeTFTP,DHCPAddreliabilityatapplicationlayerifnecessaryUDP(UserDatagramProtocol)Layer4:TheTransportLayerAnOverviewofLayer4TCP(TransmissionControlProtocol)UDP(UserDatagramProtocol)Anapplication:NATandPATNAT,istheprocessofswappingoneaddressforanotherintheIPpacketheaderInpractice,NATisusedtoallowhoststhatareprivatelyaddressedtoaccesstheInternetOneofsolutionstoIPaddressdepletionConservesregistered(legal)addressesIncreasesFlexibilitywhenconnectingtoInternetRFC1631-
NetworkAddressTranslator(NAT)WhatisNAT?NATasimpleconceptPrivateaddresses
Registeredaddresses
NATtypesStaticNAT: FixedmappingofaninternaladdresstoanregisteredaddressDynamicNAT: Mappingisdonedynamicallyonafirstcomefirst
servedbasisPAT(Overload):
Portaddresstranslationisusedtoallowmanyinternaluserstoshareasingle‘insideglobal’
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024-2025學年高中歷史 第一單元 古代中國經(jīng)濟的基本結構與特點 第1課 發(fā)達的古代農(nóng)業(yè)新課說課稿1 新人教版必修2
- Unit 4 There are seven days in a week. Lesson 19(說課稿)-2023-2024學年人教精通版英語四年級下冊
- Unit 1 Teenage Life Listening and Speaking 說課稿 -2024-2025學年高中英語人教版2019 必修第一冊001
- 2024年春七年級語文下冊 第3單元 10 老王說課稿 新人教版
- Unit 5 Working the Land Reading and thinking 說課稿-2024-2025學年高二英語人教版(2019)選擇性必修第一冊
- 農(nóng)田整改合同范本
- 作品出版合同范例
- 鄭州水泥化糞池施工方案
- 關于活動執(zhí)行合同范本
- 加盟區(qū)域保護合同范例
- 測繪工程產(chǎn)品價格表匯編
- 拘留所教育課件02
- 語言和語言學課件
- 《工作場所安全使用化學品規(guī)定》
- 裝飾圖案設計-裝飾圖案的形式課件
- 2022年菏澤醫(yī)學專科學校單招綜合素質考試筆試試題及答案解析
- 護理學基礎教案導尿術catheterization
- ICU護理工作流程
- 廣東版高中信息技術教案(全套)
- 市政工程設施養(yǎng)護維修估算指標
- 分布式光伏屋頂調查表
評論
0/150
提交評論