550 likes | 576 Views
Explore the functions, protocols, and services of the transport layer in the OSI model. Learn about connection-oriented and connectionless services, TCP vs. UDP, header formats, and more. Compiled By: Ashish Kr. Jha.
E N D
Chapter6 & 7 TransportLayer Compiled By: Ashish Kr. Jha
2 • Introduction • FourthlayerofOSIReferenceModel. • Thebasicfunctionofthetransportlayeristoacceptdatafromabove,splititupintosmallerunitsifneedbe,passthesetothenetworklayer,andensurethatthepiecesallarrivecorrectlyattheotherend. • Furthermore,allthismustbedoneefficientlyandinawaythatisolatestheupperlayersfromtheinevitablechangesinthehardwaretechnology. Compiled By: Ashish Kr. Jha
3 • ElementsofTransportLayerProtocols • Endtoendconnection • Processesareaddressed/Addressing • Transportationissuebetweenthehost • Reliabledatatransferbetweenthehost • Establishconnectionbetweenthehost • FlowcontrolandBuffering • Errordetectionandrecovery/Crashrecovery • Multiplexing • ProtocolDataUnit(PDU):Segment Compiled By: Ashish Kr. Jha
4 TransportLayer Compiled By: Ashish Kr. Jha
5 • NeedofTransportLayer • Allowsdifferentprocessesorapplicationstorun • simultaneouslyinsamehost. • ▫ ಯPortNumberರisaddedtoidentifydifferentprocessesand • applicationsrunninginthesinglehost(i.e.OnlyoneIP). • UsershavenocontrolovertheNetworkServices.So,ifsomethinggoeswrong,ausercandonothing. • Thetransportserviceiswhatuserscanaddtoimprovethe • reliabilityoftheserviceprovidedbythenetwork. • TransportLayerServices: • ▫ ServicesProvidedtotheUpperLayers • ▫ TransportServicePrimitives • ▫ BerkeleySockets Compiled By: Ashish Kr. Jha
6 ServicesProvidedtotheUpperLayers • Thenetwork,transport,andapplicationlayers. Compiled By: Ashish Kr. Jha
7 • TransportServicePrimitives • Theprimitivesforasimpletransportservice Compiled By: Ashish Kr. Jha
8 DataEncapsulationatdifferentlayers • ThenestingofTPDUs,packets,andframes. Compiled By: Ashish Kr. Jha
9 • BerkeleySockets • ThesocketprimitivesforTCP. Compiled By: Ashish Kr. Jha
10 • TransportLayerProtocolServices • Connectionorientedserviceand • ConnectionlessService Compiled By: Ashish Kr. Jha
11 • ConnectionOrientedServices • Connection-Orientedmeansthatwhendevicescommunicate,theyperformhandshakingtosetupanend-to-endconnection. • ThehandshakingprocessmaybeassimpleassynchronizationsuchasinthetransportlayerprotocolTCP,orascomplexasnegotiatingcommunicationsparametersaswithamodem. • Connection-Orientedsystemscanonlyworkinbi-directionalcommunicationsenvironments.Tonegotiateaconnection,bothsidesmustbeabletocommunicatewitheachother.Thiswillnotworkinaunidirectionalenvironment. • Sinceaconnectionneedstobeestablished,theservicealsobecomesreliableone. • ExampleofonesuchconnectionorientedserviceisTCP. Compiled By: Ashish Kr. Jha
12 • ConnectionLessServices • Aconnectionlesstransportservice does notrequire • connectionestablishmentand • sincethereisnoestablishment,thereshouldbeno • terminationalso. • Thishappenstobeaunreliableservicebutmuchmorefasterthanconnectionoriented. • ExampleofonesuchconnectionlessserviceisUDP Compiled By: Ashish Kr. Jha
13 • TransportLayerProtocols • TCP(TransmissionControlProtocol) • ▫ Reliable,connectionorientedbyte-streamprotocol • ▫ In-sequencesegmentdelivery • ▫ Flowcontrol(withseq.andACKwithslidingwindow) • ▫ Errordetectionwithchecksum • ▫ Veryreliable,usuallyusedforfiletransfers. • UDP(UserDatagramProtocol) ▫ Usuallyusedforrealtimetrafficslikelivevideostreaming,videoorvoicechattingetc. Compiled By: Ashish Kr. Jha
14 ConnectionestablishmentinTCP Compiled By: Ashish Kr. Jha
15 AcknowledgementinTCP Compiled By: Ashish Kr. Jha
16 ConnectionTearDowninTCP Compiled By: Ashish Kr. Jha
17 TCPVS.UDP Compiled By: Ashish Kr. Jha
18 TCPHeaderFormat Compiled By: Ashish Kr. Jha
19 • TCPHeaderFormat • SourceandDestinationportareofeach16bit. • Numberofportnumber=216=65535 • 0-1023arewellknownportnumbers,which isusedby • systemtorepresentdifferentservices.e.g.port25forSMTP, • port80forhttp,443forhttps,21forftp,23fortelnetetc. • TheSourceportandDestinationportfieldsidentifythelocalendpointsoftheconnection. • The32bitSequencenumberand32bitAcknowledgementnumberfieldsareusedforreliabledatatransferbetweenhosts. Compiled By: Ashish Kr. Jha
20 • TCPHeaderFormat • TheTCPheaderlengthtellshowmany32-bitwordsarecontainedintheTCPheader.ThisinformationisneededbecausetheOptionsfieldisofvariablelength. • MinimumHLENis20bytes. • Nextcomesa6-bitfieldthatisnotused. • Sixbitflagsi.e.URG,ACK,PSH,RST,FINandSYN • TheACKbitissetto1toindicatethattheAcknowledgement • numberisvalid. • SYN,FINandRSTisusedforconnectionestablishmentandteardown. Compiled By: Ashish Kr. Jha
21 • TCPHeaderFormat • SendercanuseaPUSHflagtoinstructTCPnottobufferthe • send. • SendercanuseURGENTflagtohaveTCPsenddataimmediatelyandhavethereceiverTCPsignalthereceiverapplicationthatthereisdatatoberead. • FlowcontrolinTCPishandledusingavariable-sizedslidingwindow.TheWindowsizefieldtellshowmanybytesmaybesentstartingatthebyteacknowledged. • AChecksumisalsoprovidedforextrareliability. • Urgentpointer:byteoffsetofurgentdata • Options:Extrafacilitiese.g.SpecifymaximumTCPLoad. Compiled By: Ashish Kr. Jha
22 • TCPReliability • ErrorDetection • ReceiverFeedback • Retransmission Compiled By: Ashish Kr. Jha
23 UserDatagramProtocol(UDP) Compiled By: Ashish Kr. Jha
24 • UDPHeaderFormat • FixedLengthHeaderformat. • Thesourceportisprimarilyneededwhenareplymustbesentbacktothesource. • TheUDPlengthfieldincludesthe8-byteheaderandthedata. • TheUDPchecksumisoptionalandstoredas0ifnotcomputed Compiled By: Ashish Kr. Jha
25 ApplicationLayerProtocols Compiled By: Ashish Kr. Jha
26 Addressing TSAPs(TransportServiceAccessPoint),NSAPs(NetworkSAP) Compiled By: Ashish Kr. Jha
27 • Multiplexing • Multiplexingheremeansmultiplexingmultipletransportconnectionsonasinglenetworklayerconnection,whichisgenerallyrequirediftheavailablebandwidthismorethanor equaltotheintegrationofindividualrequirementofeach the • connection,thusmaking • availablebandwidth. • Increasesthethroughput. aneffectiveutilizationof Appl.xAppl.yAppl.z Appl.zAppl.yAppl.x PortPortPort PortPort TransportProtocol Port TransportProtocol Entity Entity IPAddress IPAddress NetworkServiceProvider Host Host Compiled By: Ashish Kr. Jha
28 • PortandSocket • Port • ▫ Anapplication-specificorprocess-specificsoftwareconstructtoidentifydifferentprocessesofsamehost • ▫ Analogoustotelephoneextensioninsideanorganization • ▫ Whenyouopenyahoo.comandhotmail.comonsamePCatsame • time,theywillhavedifferentportnumbers. • ▫ Whyportno.aswealreadyhaveprocessID? • Processidisdifferentforeachnewprocesseventhoughtheyrequiresameservice • VerydifficulttotrackProcessIDofeachprocessofahost Compiled By: Ashish Kr. Jha
29 • PortandSocket • TypesofPortNumber • ▫ Well-KnownPorts • Portnumbers0 to 1023 • Usedformostcommonnetworkapplications • Eg.http-80,ftpdata-20,ftpcontrol-21,DHCPClient-68,DHCP • Server-67,DNS -53,SMTP–25,POP3–110etc • ▫ Registered Ports • PortNumbers1024to49151 • Assignedby IANAforspecificserviceseg.VLC –1234,Skype- • 23399 • Inmost systems, theseportscanalsobe usedbyordinaryusers • ▫ Dynamic/PrivatePorts • PortNumbers49152to65535 • Cannotbe registeredwithIANA • Usedfortemporarypurposes Compiled By: Ashish Kr. Jha
30 PortandSocket Application1 Application2 Application1 Application2 Portno. Portno. Portno. Portno. TransportProtocolEntity TransportProtocolEntity IPaddress IPaddress IPServiceProvider Compiled By: Ashish Kr. Jha
31 • PortandSocket • Socket ▫ Endpoint ofaninter-processcommunicationflowacrossa computernetwork. ▫ SocketaddressisacombinationofIPandPortno.accordingto whichitdeliversdatatoappropriateapplicationorprocess ▫ Integratedintotheoperatingsystem ▫ Explicitlycreated,used,releasedbyapplications Compiled By: Ashish Kr. Jha
32 ConnectionEstablishment • 3-wayhandshake: client server • ▫ Step1: • ClientendsystemsendsTCPSYN • controlsegmenttoserver • ▫ Step2: • ServerendsystemreceivesSYN, replieswithSYN-ACK • Allocatesbuffers • ACKs receivedSYN open listen established • ▫ Step3: • ClientreceivesSYN-ACK • connectionisnowsetup • clientstartsthe“realwork” established Compiled By: Ashish Kr. Jha
33 • ConnectionRelease • Releasecanbeasymmetric(onesided, wheredatamayloss) orsymmetric (bothsideagreed) • StepsforsymmetricRelease: • Step1: ClientendsystemsendsTCP • FINcontrolsegmenttoserver Abruptdisconnectionwithlossofdata. client server • Step2:ServerreceivesFIN,replies withACK.Closesconnection,sends FIN. • Step 3: ClientreceivesFIN,replies withACK. close close timedwait ▫ Enters “timedwait”-will respond withACKtoreceived FINs closed • Step 4: server,receivesACK. Connectionclosed. closed SymmetricRelease Compiled By: Ashish Kr. Jha
34 • ConnectionRelease(Problem) • Thetwo-armyproblem • Forbluearmy to win, bothtroops(1&2)mustattackwhitearmy atsame • time • Forsync.,#1sendsmsg. to #2andwaitsforACK.Even though#1 receivesACK,attackisnotpossibleas#2 doesn’tknowwhether#1 has receiveditsACKornot • Even,3-wayhandshaking(#1againsendingACK) willnotguarantee • successfulattackasnow#1isnotsureif#2hasreceiveditsACK • Itcanbe provedthatno protocolexiststhatworks,butlittleriskcanbe takenwhilereleasingconnection. • Although,3-wayhandshakingisnotinfallible,itisusuallyadequate Compiled By: Ashish Kr. Jha
35 ConnectionRelease Fourprotocolscenariosfor releasingaconnection. Normalcaseofathree-wayhandshake. finalACKlost. Responselost. ResponselostandsubsequentDRs(DisconnectionRequests)lost. Compiled By: Ashish Kr. Jha
36 FlowControlandBuffering • FlowControl,similartodatalinklayer(slidingwindow),exceptthattransportlayerhastodealwithlargenumberofconnections. • Flowcontrolatthislayerisperformedend-to-endratherthanacrossasinglelink. • Allocatingdedicatedbuffersperconnectionatsenderandreceivermaynotbepractical. • Differentapproachesforbufferorganization • ▫ Chainedfixed-sizebuffers • ▫ Chainedvariable-sizedbuffers • ▫ Onelargecircularbufferperconnection • Typeoftrafficcarriedbyaconnectionalsoinfluencesbufferingstrategy. • Asconnectionscomeandgo,andtraffictypeschanges,needto • abletoadjustbufferallocationsdynamically • ▫ Usingvariable-sizedslidingwindows • ▫ Decouplewindowmanagementfromacknowledgements Compiled By: Ashish Kr. Jha
37 • FlowControlandBuffering • ReceiveWindowfieldisusetocontroltheflowbetweentwo • hosts. • Slidingwindowprotocolisusedforflowcontrolmechanism. Compiled By: Ashish Kr. Jha
38 FlowControlandBuffering Compiled By: Ashish Kr. Jha
39 FlowControlandBuffering (a)Chainedfixed-sizebuffers.(b)Chainedvariable-sizedbuffers. (c)Onelargecircularbufferperconnection. Compiled By: Ashish Kr. Jha
40 • FlowControlandBuffering • Evenifthereceiverhasagreedtodothebuffering,therestill • remainsthequestionofthebuffersize. • IfmostTPDUsarenearlythesamesize,itisnaturaltoorganizethebuffersasapoolofidentically-sizedbuffers,withoneTPDUperbuffer,asinFig.A.However,ifthereiswidevariationinTPDUsize,fromafewcharacterstypedataterminaltothousandsofcharactersfromfiletransfers,apooloffixed-sizedbufferspresentsproblems. • IfthebuffersizeischosenequaltothelargestpossibleTPDU,spacewillbewastedwheneverashortTPDUarrives. • IfthebuffersizeischosenlessthanthemaximumTPDUsize,multiplebufferswillbeneededforlongTPDUs,withtheattendantcomplexity. Compiled By: Ashish Kr. Jha
41 • FlowControlandBuffering • Anotherapproachtothebuffersizeproblemistouse • variable-sizedbuffers,asinFig.B. • Theadvantagehereisbettermemoryutilization,attheprice • ofmorecomplicatedbuffermanagement. • Athirdpossibilityistodedicateasinglelargecircularbufferperconnection,asinFig.C. • Thissystemalsomakesgooduseofmemory,providedthatallconnectionsareheavilyloaded,butispoorifsomeconnectionsarelightlyloaded. Compiled By: Ashish Kr. Jha
42 • Congestion • Whentoomanypacketsarepresentin(apartof)thesubnet, • performancedegrades.Thissituationiscalledcongestion. • Overloadingofrouterswithpackets. • Routersreceivingpacketsfasterthantheycanforward. • FactorsCausingCongestion • ▫ Packetarrivalrateexceedstheoutgoinglinkcapacity. • ▫ Insufficientmemorytostorearrivingpackets • ▫ Burstytraffic • ▫ Slowprocessor Compiled By: Ashish Kr. Jha
43 Congestion Whentoomuchtrafficisoffered,congestionsetsinand performancedegradessharply. Compiled By: Ashish Kr. Jha
44 • CongestionCausedbySeveralFactors • Ifallofasudden,streamsofpacketsbeginarrivingonthreeorfourinputlinesandallneedthesameoutputline,aqueuewillbuildup.Ifthereisinsufficientmemorytoholdallofthem,packetswillbelost. • Routershaveaninfiniteamountofmemory,congestiongetsworse,notbetter,becausebythetimepacketsgettothefrontofthequeue,theyhavealreadytimedout(repeatedly)andduplicateshavebeensent. • Slowprocessorscanalsocausecongestion.Thisproblemwillpersistuntilallthecomponentsareinbalance. • Ifrouterhasnofreebuffers,itmustdiscardnewlyarrivingpacket.Sendermaytimeoutandretransmitsagainandagainincreasingtraffic. Compiled By: Ashish Kr. Jha
45 • CongestionControlandFlowControl • Congestioncontrolhastodowithmakingsurethesubnetis • abletocarrytheofferedtraffic. • Itisaglobalissue,involvingthebehaviourofallthehosts,alltherouters,thestore-and-forwardingprocessingwithintherouters,andalltheotherfactorsthattendtodiminishthecarryingcapacityofthesubnet. • Flowcontrol,incontrast,relatestothepoint-to-pointtraffic • betweenagivensenderandagivenreceiver. • Itsjobistomakesurethatafastsendercannotcontinuallytransmitdatafasterthanthereceiverisabletoabsorbit. • Flowcontrolfrequentlyinvolvessomedirectfeedbackfromthereceivertothesendertotellthesenderhowthingsaredoingattheotherend. Compiled By: Ashish Kr. Jha
46 • GeneralPrinciplesofCongestionControl • Twoapproach: • ▫ Openloop:trytopreventcongestionoccurringbygooddesign • ▫ Closed-loop:monitorthesystemtodetectcongestion,passthisinformationtowhereactioncanbetaken,andadjustsystemoperationtocorrecttheproblem(detect,feedbackandcorrect) • MoreTechniques: • ▫ Warningbit– SpecialBitinPacketHeadertonotifysender • aboutthecongestion,piggy-backedwithACK • ▫ Chokepackets– ControlPacketsentbycongestednode. • Sourcesthatgetchokepacketmustreducetransmissionrate • ▫ Loadshedding–bufferfull=>simplydiscardpackets. • ▫ Randomearlydiscard–discardpacketsbeforebufferisfull • ▫ Trafficshaping-controlstherateatwhichpacketsaresent Compiled By: Ashish Kr. Jha
47 • TrafficShaping • Trafficshapingisaboutregulatingtheaveragerate(and • burstiness)ofdatatransmission. • Incontrast,theslidingwindowprotocolswestudiedearlierlimittheamountofdataintransitatonce,nottherateatwhichitissent. • TwoWays: • ▫ LeakyBucket • ▫ TokenBucket Compiled By: Ashish Kr. Jha
48 LeakyBucket Compiled By: Ashish Kr. Jha
49 • LeakyBucket • Imagineabucketwithasmallholeinthebottom. • Nomattertherateatwhichwaterentersthebucket,theoutflowisataconstantrate,whenthereisanywaterinthebucketandzerowhenthebucketisempty. • Also,oncethebucketisfull,anyadditionalwaterenteringitspills • overthesidesandislost. • Thesameideacanbeappliedtopackets,asshowninFig.(b). • Conceptually,eachhostisconnectedtothenetworkbyaninterfacecontainingaleakybucket,thatis,afiniteinternalqueue. • Ifapacketarrivesatthequeuewhenitisfull,thepacketisdiscarded. • Inotherwords,ifoneormoreprocesseswithinthehosttrytosendapacketwhenthemaximumnumberisalreadyqueued,thenewpacketisunceremoniouslydiscarded. Compiled By: Ashish Kr. Jha
50 • LeakyBucket • Thisarrangementcanbebuiltintothehardwareinterfaceor • simulatedbythehostoperatingsystem. • ItwasfirstproposedbyTurner(1986)andiscalledtheleaky • bucketalgorithm. • Theleakybucketconsistsofafinitequeue.Whenapacketarrives,ifthereisroomonthequeueitisappendedtothequeue;otherwise,itisdiscarded. • Ateveryclocktick,onepacketistransmitted(unlessthe • queueisempty). • Theleakybucketalgorithmenforcesarigidoutputpatternat • theaveragerate,nomatterhowburstythetrafficis. Compiled By: Ashish Kr. Jha