Sunteți pe pagina 1din 6

RolesoftheTransportLayer

Thetransportlayerprovidestransparenttransferofdatabetweenendusers,providingreliabledata
transferservicestotheupperlayers.Thetransportlayercontrolsthereliabilityofagivenlink
throughflowcontrol,segmentation/desegmentationanderrorcontrol.Thetransportlayercankeep
trackofthesegmentsandretransmitthosethatfail.
PurposeoftheTransportLayer(Figure42)
TrackingIndividualConversations
Thetransportlayermaintainsthemultiplecommunicationstreamsbetweenapplications.
Thetransportlayersegmentsthedataandmanagestheseparationofdatafordifferentapplications.
Multipleapplicationsrunningonadevicereceivethecorrectdata.(Figure43)
SegmentingData
Thetransportlayerbreaksthedataintosmallerpieces,bettersuitedfortransmission.(=segments).
Thisprocessincludesencapsulation.Aheaderisadded.Canbothsendandreceivedatawhen
runningmultipleapplications(Figure44).
ReassemblingSegments
Bynumberingandsequencingthesegments,thetransportlayercanensurethatthesesegmentsare
reassembledintotheproperorder.Atthereceivinghost,eachsegmentofdatamustbereassembled
inthecorrectorderandthendirectedtotheappropriateapplication.
IdentifyingtheApplications
Thetransportlayermustidentifythetargetapplication.Thetransportlayerassignsanidentifierto
anapplication.TCP/IPprotocolscallthisidentifieraportnumber.Portnumbersindicatetowhich
applicationthatpieceofdataisassociated.Aconversation:eachparticularsetofpiecesflowing
betweenasourceapplicationandadestinationapplication.
FlowControl
Thetransportlayerregulatestheamountofdatathesourcetransmitsasagroup.Flowcontrolcan
preventthelossofsegmentsonthenetworkandavoidtheneedforretransmission.
ErrorRecovery
Thetransportlayercanensurethatallpiecesreachtheirdestinationbyhavingthesourcedevice
retransmitanydatathatislost.
InitiatingaSession
Thetransportlayercanprovideconnectionorientationbycreatingasessionbetweenthe
applications.Theseconnectionspreparetheapplicationstocommunicatewitheachotherbeforeany
dataistransmitted.
DataRequirementsVary
Multipletransportlayersprotocolsexisttomeettherequirementsofdifferentapplications.
UDP(UserDatagramProtocol),providejustthebasicfunctionsforefficientlydeliveringthedata
piecesbetweenapplications.Theyareusefulforapplicationswhosedataissensitivetodelays.
TCP(TransmissionControlProtocol),describeprocessesthatprovideadditionalfeatures.Theyhave
additionaloverheadandmakelargerdemandsonthenetwork.
SupportingReliableCommunication
TCPisatransportlayerprotocolthatcanbeimplementedtoensurereliabledeliveryofthedata.
Reliabilitymeansensuringthateachpieceofdatathatthesourcesendsarrivesatthedestination.
Trackingtransmitteddata,acknowledgingreceiveddata,retransmittinganyunacknowledgeddata.
Thetransportlayerofthesendinghosttracksallthedatapiecesforeachconversationand
retransmitsanydatathatthereceivinghostdidnotacknowledge.Moredatacontrol.
Applications,suchasdatabases,webpagesrequirethatallthesentdataarrivesatthedestination
initsoriginalconditionforthedatatobeuseful.Applicationsaredesignedtouseatransportlayer
protocolthatimplementsreliability.Someapplicationsaremoretolerantofthelossofsmall
amountsofdata.Theycanprovideerrorcheckingandretransmissionrequests.
TCPandUDP
UserDatagramProtocol(UDP)
UDPisasimple,connectionlessprotocol,describedinRFC768.Advantage:providinglowoverhead
datadelivery.ThesegmentsofcommunicationinUDParecalleddatagrams.Eachsegment8bytes.
(DNS,videostreaming,VoiceoverIP)
TransmissionControlProtocol(TCP)
TCPisaconnectionorientedprotocol,describedinRFC793,TCPincursadditionaloverheadtogain
functions.Sameorderdelivery,reliabledeliveryandflowcontrol.EachSegmenthas20bytes.
(webbrowsers,email,filetransfer)
PortAddressing
TheTCPandUDPbasedserviceskeeptrackofthevariousapplicationsthatarecommunicating.To
differentiatethesegmentsanddatagramsforeachapplication,bothprotocolshaveheaderfields
thatcanuniquelyidentifytheseapplications.
IdentifyingtheConversations
Theheaderofeachsegmentordatagramcontainsasourceanddestinationport.Thesourceport
numberisthenumberforthiscommunicationassociatedwiththeoriginatingapplicationonthelocal
host.Thedestinationportnumberisthenumberforthiscommunicationassociatedwiththe
destinationapplicationontheremotehost.
Whenaclientapplicationsendsarequesttoaserverapplication,thedestinationportcontainedin
theheaderistheportnumberthatisassignedtotheservicedaemonrunningontheremotehost.
Thesourceportisasegmentordatagramofaclientrequestisrandomlygenerated.Theclientcan
chooseanyportnumber.Whenaresponseisreturned,itcanbeforwardedtothecorrect
application.
Socket=combinationofthetransportlayerportnumberandthenetworklayerIPaddressassigned
tothehostuniquelyidentifiesaparticularprocessrunningonaspecifichostdevice.Socketsrefer
onlytotheuniquecombinationoftheIPaddressandportnumber.Example:192.168.1.20:80

PortAddressingTypesandTools
IANA(InternetAssignedNumbersAuthority)assignsportnumbersandisastandardsbody.
WellKnowPorts(numbers01023)
Wellknownportsarereservedforservicesandapplications.Theyarecommonlyusedfor
applicationssuchasHTTP(webserver),POP3/SMTP(emailserver)andTelnet.(Table41)
RegisteredPorts(numbers102449151)
Registeredportsareassignedtouserprocessesorapplications.Theseprocessesareprimarily
individualapplicationsthatauserhaschosentoinstallratherthancommonapplicationsthatwould
receiveawellknownport.(Table42)
DynamicorPrivatePorts(numbers49153to65535)
Dynamicorprivateportsalsoknownasephemeralports,areusuallyassigneddynamically
applicationswheninitiatingaconnection.
UsingBothTCPandUDP
SomeapplicationscanbothuseTCPandUDP,suchasDNS.(Table43)
Thenetstatcommandisanimportantnetworkutilitythatyoucanusetoverifythoseconnections.
netstatliststheprotocolinuse,thelocaladdressandportnumber,thedestinationaddressandport
number,andthestateoftheconnection.Usenetstattoexaminetheopenconnectionsonahost
whenperformanceappearstobecompromised.
SegmentationandReassembly:DivideandConquer
AUDPsegmentiscalledadatagram.ATCPsegmentiscalledasegment.(Figure49)
Dividingapplicationdataintosegmentsbothensuresthatdataistransmittedwithinthelimitsofthe
mediaandthatdatafromdifferentapplicationscanbemultiplexedontothemedia.TCPandUDP
handlesegmentationdifferently.
InTCP,eachsegmentheadercontainsasequencenumber.Thissequencenumberallowsthe
transportlayerfunctionsonthedestinationhosttoreassemblesegmentsintheorderinwhichthey
weretransmitted.Thisensuresthatthedestinationapplicationhasthedataintheexactformthe
senderintended.
UDPalsotracktheconversationsbetweenapplications,theyarenotconcernedwiththeorderin
whichtheinformationwastransmittedorinmaintainingaconnection.TheUDPheaderdoesnot
includeasequencenumber.UDPisasimplerdesignandgenerateslessoverheadthanTCP,resulting
infastertransferofdata.

TCP:CommunicatingwithReliability
TCP:connectionorientedprotocol,guaranteesreliableandinorderdeliveryofdata.
MakingConversationsReliable
ThereliabilityofTCPcommunicationisperformedusingconnectionorientedsessions.Connection
withthedestinationenablesthetrackingofasession,orcommunicationstreambetweenthehosts.
Afterasessionhasbeenestablished,thedestinationsendsacknowledgementstothesourceforthe
segmentsthatitreceives.Theseacknowledgementsformthebasisofreliability.Additionaloverhead
istheresultofkeepingtrackofacknowledgmentsandtheretransmissionprocessthehostmust
undertakeifnoacknowledgementisreceived.
TCPServerProcesses
Eachapplicationprocessrunningontheserverisconfiguredtouseaportnumber.Anindividual
servercannothavetwoservicesassignedtothesameportnumberwithinthesametransportlayer
services.Whenanactiveserverapplicationisassignedtoaspecificport,thatportisconsideredtobe
openontheserver.
Toimprovesecurityonaserveristorestrictserveraccesstoonlythoseportsassociatedwiththe
servicesandapplicationsthatshouldbeaccessibletoauthorizedrequestors.(Figure410)
TCPConnectionEstablishmentandTermination
WhentwohostscommunicateusingTCP,aconnectionisestablishedbeforedatacanbeexchanged.
Afterthecommunicationiscompleted,thesessionsareclosedandtheconnectionisterminated.The
connectionandsessionmechanismsenableTCPsreliabilityfunction.
TCPThreeWayHandshake
Eachconnectionrepresentstwoonewaycommunicationstreams,orsessions.Toestablishthe
connection,thehostsperformathreewayhandshake.
ThethreestepsinTCPconnection
1. Theinitiatingclientsendsasegment
2. Theserverrespondswithasegment
3. Theinitiatingclientrespondswithanacknowledgementvalue
Flagshaveavalueofoneofthesefieldsinonly1bit.(Figure411)
URG Urgentpointerfieldsignificant
ACK Acknowledgementfieldsignificant
PSH Pushfunction
RST Resetconnection
SYN Synchronizesequencenumbers
FIN Nomoredatafromsender.
Step1:SYN
ATCPclientbeginsthethreewayhandshakebysendingasegmentwiththeSNcontrolflagset,
indicatinganinitialvalueinthesequencenumberfieldintheheader.Initialsequencenumber(ISN)
israndomlychosenandisusedtobegintrackingtheflowofdatafromtheclienttotheserver.
Step2:SYNandACK
TheTCPserverneedstoacknowledgethereceiptoftheSYNsegmentfromtheclienttoestablishthe
sessionfromtheclienttotheserver.TheserversendsasegmentbacktotheclientwiththeACKflag
set,indicatingthattheacknowledgementnumberissignificant.Thevalueoftheacknowledgement
numberfieldisequaltotheclientISNplus1.
Step3:ACK
TheTCPclientrespondswithasegmentcontaininganACKthatistheresponsetotheTCPSYNsent
bytheserver.Thissegmentdoesnotincludeuserdata.
Youcanaddsecuritytothedatanetworkbydoingthefollowing:denyingtheestablishmentofTCP
sessions,allowingsessionstobeestablishedforspecificservicesonly,allowingtrafficonlyasapart
ofalreadyestablishedsessions.
TCPSessionTermination
Tocloseaconnection,theFINcontrolflaginthesegmentheadermustbeset.Toterminateasingle
conversationsupportedbyTCP,fourexchangesareneededtoendbothsessions:
1. ClientsendsasegmentwiththeFINflagset
2. ServersendsanACKtoacknowledgethereceipt
3. ServersendsaFINtotheclient
4. ClientrespondswithACK(Figure412)
Whenallsegmentshavebeenacknowledged,thesessionisclosed.Itisalsopossibletoterminatethe
connectionbyathreewayhandshake.
TCPAcknowledgementwithWindowing
OneofTCPsfunctionsistomakesurethateachsegmentreachesitsdestination.TheTCPserviceson
thedestinationhostacknowledgethedatathattheyhavereceivedtothesourceapplication.The
segmentheadersequencenumberandacknowledgementnumberareusedtogethertoconfirm
receiptofthebytesofdatacontainedinthesegments.(Fig413)
Theamountofdatathatasourcecantransmitbeforeanacknowledgementmustbereceivedis
calledthewindowsize.ThisisafieldintheTCPheaderthatenablesthemanagementoflostdata
andflowcontrol.
TCPRetransmission
TCPprovidesmethodsofmanagingthesesegmentlosses,includingamechanismtoretransmit
segmentswithunacknowledgeddata.
WhenTCPatthesourcehosthasnotreceivedanacknowledgementafterapredeterminedamount
oftime,itwillgobackatthelastacknowledgementnumberthatitreceivedandretransmitdata
fromthatpointforward.
ForatypicalTCPimplementation,ahostcantransmitasegment,putacopyofthesegmentina
retransmissionqueue,andstartatimer.Whenthedataacknowledgementisreceived,thesegment
isdeletedfromthequeue.Iftheacknowledgementisnotreceivedbeforethetimerexpires,the
segmentisretransmitted.Selectiveacknowledgement.
TCPCongestionControl:MinimizingSegmentLoss
TCPprovidescongestioncontrolthroughtheuseofflowcontrolanddynamicwindowsizes.
FlowControl
FlowcontrolassiststhereliabilityofTCPtransmissionbyadjustingtheeffectiverateofdataflow
betweenthetwoservicesinthesession.ThewindowsizefieldintheTCPheaderspecifiesthe
amountofdatathatcanbetransmittedbeforeanacknowledgementmustbereceived.TheTCP
feedbackmechanismadjuststheeffectiverateofdatatransmission.(Figure414)
DynamicWindowSizes
TCPcanreducethewindowsizetorequirethatreceivedsegmentsbeacknowledgedmore
frequently.Thisslowstherateoftransmissionbecausethesourcemustwaitfordatatobe
acknowledged.(Figure415)
ThisdynamicincreasinganddecreasingofwindowsizeisacontinuousprocessinTCP,which
determinestheoptimum.
UDP:CommunicatingwithLowOverhead
Simpleprotocol,providesbasictransportlayerfunctions,loweroverheadthanTCP,notconnection
oriented,doesnotprovidesophisticatedretransmission,sequencing,andflowcontrolmechanisms.
UDP:LowOverheadVersusReliability
Reliabilityisnotprovidedbythetransportlayerprotocolandmustbeimplementedelsewhereif
required.
UDPDatagramReassembly
UDPisconnectionless;sessionsarenotestablishedbeforecommunicationtakesplaceastheyare
withTCP.UDPistransactionbased.Whenanapplicationhasdatatosend,itsimplysendsthedata.
ManyapplicationsthatuseUDPsendsmallamountsofdatathatcanfitinonesegment(datagram).
Whenmultipledatagramsaresenttoadestination,theycantakedifferentpathsandarriveinthe
wrongorder.UDPsimplyreassemblesthedataintheorderthatiswasreceivedandforwardittothe
application.(Figure416)
UDPServerProcessesandRequests
UDPbasedserverapplicationsareassignedwellknownorregisteredportnumbers.WhenUDP
receivesadatagramdestinedforoneoftheseports,itforwardstheapplicationdatatothe
appropriateapplicationbasedonitsportnumber.
UDPClientProcesses
TheUDPclientprocessrandomlyselectsaportnumberfromthedynamicrangeofportnumbersand
usesthisasthesourceportfortheconversation.
Randomizedsourceportnumbersalsohelpwithsecurity.
BecauseUDPdoesnotcreateasession,UDPcanformthedatagramandpassittothenetworklayer
tobeaddressedandsentonthenetwork.
Thesourceanddestinationportnumbersinthedatagramheaderarereversed.(Figure417)

S-ar putea să vă placă și