Date post: | 24-Feb-2018 |
Category: |
Documents |
Upload: | yazanalomari |
View: | 226 times |
Download: | 0 times |
of 110
7/25/2019 Chap 12 Modified PP2003
1/110
TCP/IP Protocol Suite 1
Chapter 12Chapter 12
Upon completion you will be able to:
TransmissionTransmissionControl ProtocolControl Protocol
Be able to name and understand the services offered by TCP
Understand TCPs flow and error control and congestion control
Be familiar with the fields in a TCP segmentUnderstand the phases in a connection-oriented connection
Understand the TCP transition state diagram
Be able to name and understand the timers used in TCP
Be familiar with the TCP options
Objectives
7/25/2019 Chap 12 Modified PP2003
2/110
TCP/IP Protocol Suite 2
Figure 12.1 TCP/P protocol suite
TCP provides a set of services. What are those services
7/25/2019 Chap 12 Modified PP2003
3/110
TCP/IP Protocol Suite 3
Table !"#!Table !"#! $ell-%nown ports used by TCP$ell-%nown ports used by TCP
TCP provides a process-to-process communication serviceusing port numers.
7/25/2019 Chap 12 Modified PP2003
4/110
TCP/IP Protocol Suite 4
Figure 12.2 &tream delivery
7/25/2019 Chap 12 Modified PP2003
5/110
TCP/IP Protocol Suite 5
Figure 12.4 TCP segments
TCP provides a stream deliver! service. It rea"s up the dstream into segments of variale si#e. $ach segment receia header and is handed o% to the IP la!er.
&& 'ecause the sending and the receiving processesma! not necessaril! (rite or read dataat the same rate) TCP needs u%ers for storage.
7/25/2019 Chap 12 Modified PP2003
6/110
TCP/IP Protocol Suite 6
Figure 12.4 TCP services and features
TCP can create a full-duple* service. +ata can ,o( inoth
directions at the same time u%ers on each side holdthedata to e transmitted and sent.
TCP provides a connection-oriented service the t(oTCPs
estalish a connection) data is e*changed) and theconnection isterminated.
TCP provides a reliale service.
urthermore) TCP has a numer of features.0ll !tes transferred are numered ! TCP. Thenumeringstarts (ith a random value -32452 -16.
&there are t(o 7elds called the sequence numberandthe
7/25/2019 Chap 12 Modified PP2003
7/110
TCP/IP Protocol Suite 7
&uppose a TCP connection is transferring a file of '((( bytes#The first byte is numbered !(((!# $hat are the se)uence
numbers for each segment if data is sent in five segments* each
carrying !((( bytes+
Example2
&olutionThe following shows the se)uence number for each segment:
&egment !&e)uence ,umber: !(*((! range: !(*((! to !!*(((.
&egment "&e)uence ,umber: !!*((! range: !!*((! to !"*(((.
&egment &e)uence ,umber: !"*((! range: !"*((! to !*(((.
&egment 0&e)uence ,umber: !*((! range: !*((! to !0*(((.
&egment '&e)uence ,umber: !0*((! range: !0*((! to !'*(((.
7/25/2019 Chap 12 Modified PP2003
8/110
TCP/IP Protocol Suite 8
The value in the se)uence numberfield of a
segment defines the number of the first data
byte contained in that segment#
The value of the ac%nowledgmentfield in asegment defines the number of the ne1t byte a
party e1pects to receive#
The ac%nowledgment numberis cumulative#
7/25/2019 Chap 12 Modified PP2003
9/110
TCP/IP Protocol Suite 9
Figure 12.4 TCP services and features
TCP also provides1.,o( control)2.error control) and5.Congestion control.We (ill e*amine each of these shortl!.
'efore (e do) let8s e*amine the TCP header a little moreclosel!.
The TCP pac"et is called a segment ut most people 9ustcall it a pac"et6.
7/25/2019 Chap 12 Modified PP2003
10/110
TCP/IP Protocol Suite 10
Figure 12.5 TCP segment format pac%ets in TCP are called segments.
Windo( si#e set ! receiver (ith ma* : ;
7/25/2019 Chap 12 Modified PP2003
11/110
TCP/IP Protocol Suite 11
Figure 12.6 Control field
=ore on these its later.
7/25/2019 Chap 12 Modified PP2003
12/110
TCP/IP Protocol Suite 12
Figure 12.7 Pseudoheader added to the TCP datagram to calculate
chec%sum
7/25/2019 Chap 12 Modified PP2003
13/110
TCP/IP Protocol Suite 13
The inclusion of the chec%sum in TCP
is mandatory#
Note:Note:
7/25/2019 Chap 12 Modified PP2003
14/110
TCP/IP Protocol Suite 14
Figure 12.8 2ncapsulation and decapsulation
7/25/2019 Chap 12 Modified PP2003
15/110
TCP/IP Protocol Suite 15
12.4 A TCP CONNECTION
TCP is connection-oriented#TCP is connection-oriented# 3 connection-oriented transport protocol3 connection-oriented transport protocolestablishes a virtual path between the source and destinationestablishes a virtual path between the source and destination# 3ll of the# 3ll of the
segments belonging to a message are then sent over this virtual path#segments belonging to a message are then sent over this virtual path# 33
connection-oriented transmission re)uires three phases:connection-oriented transmission re)uires three phases:
!#!#connection establishment*connection establishment*
"#"#data transfer*data transfer*##connection termination#connection termination#
The topics discussed in this section include:The topics discussed in this section include:
Connection 2stablishmentConnection 2stablishment
4ata Transfer4ata Transfer
Connection TerminationConnection Termination
Connection 5esetConnection 5eset
7/25/2019 Chap 12 Modified PP2003
16/110
TCP/IP Protocol Suite 16
Figure 12.9 Connection establishment using three-way handshaking
0 server tellsits TCP that itis read! to ma"ea connection -this is called a
passive open.
>
r(nd is thereceiver (indo(si#e) as (e (illsee later.
ote S@ itis set in 7rstpac"et Achosen randoml!
Should this e A1?
o ) ecause it is S@ segmentCannot carr in data
7/25/2019 Chap 12 Modified PP2003
17/110
TCP/IP Protocol Suite 17
3 &6, segment cannot carry data* but it
consumes one se)uence number#
3 &6, 7 3C8 segment cannot carry
data* but does consume one
se)uence number#
3n 3C8 segment* if carrying no data*
consumes no se)uence number#
7/25/2019 Chap 12 Modified PP2003
18/110
SYN fooding attack
Bad person -> arge n!"#er o$ SYNseg"ents %&it' $ake () addresses* to aser+er ->ser+er aocates t'e necessar,reso!rces %eg ./B ta#es and setting
ti"ers* -> ser+er sends SYN/seg"ents to $ake cients &'ic' are ost ($ t'e n!"#er o$ SYN seg"ents is arge
t'e ser+er e+ent!a, r!ns o!t o$reso!rces and "a, cras'
.o co!nter t'ese attacks so"e ser+erspostpone reso!rce aocation !nti t'eentire connection is set !p !sing acookie
TCP/IP Protocol Suite 18
7/25/2019 Chap 12 Modified PP2003
19/110
TCP/IP Protocol Suite 19
Figure 12.1 4ata transfer
otice ho( the 0CBandS$ D are
pigg!ac"ed.
Push ,ag meansdeliverthe data to thereceiveras soon as it is
receiveddon8t put it in au%erand hold until !ouhaveenough !tes for a
complete segment6.This feature isusuall!ignored.
7/25/2019 Chap 12 Modified PP2003
20/110
/an aso send rgent data #, setting t'e #it .'e sending ./) creates aseg"ent and inserts t'e !rgent data att'e #eginning o$ t'e seg"ent %t'eseg"ent can aso contain nor"a data*or ea"pe ,o! &ant to send a /tr-/to stop (n t'is case rgent )ointer ast !rgent #,te 1 :'en t'erecei+ing ./) recei+es a seg"ent &it't'e #it set it etracts t'e !rgentdata $ro" t'e seg"ent !sing t'e +a!eo$ pointer and dei+ers it o!t o$order to t'e recei+ing appicationprogra"
TCP/IP Protocol Suite 20
7/25/2019 Chap 12 Modified PP2003
21/110
TCP/IP Protocol Suite 21
Figure 12.11 Connection termination using three-way handsha%ing
0 I segment consumes one seEuence numer ifit does not carr! data. So should third segment eseE *>1?& a I segment can include the last chun" of data
sent ! the client
7/25/2019 Chap 12 Modified PP2003
22/110
TCP/IP Protocol Suite 22
Figure 12.12 9alf-close
Client is 7nished)ut Server is not !et7nished. So Server0CBs the Client8s I)ut does not signal itso(n I 9ust !et.
!-1
*>1
*>1
#>1
7/25/2019 Chap 12 Modified PP2003
23/110
TCP/IP Protocol Suite 23
Connection 5eset
Fsing the Geset ,ag GST6) one can
;+en! a reEuest for a connection
;0ort a current connection
;Terminate an idle connection
7/25/2019 Chap 12 Modified PP2003
24/110
TCP/IP Protocol Suite 24
12.5 STATE TRANSITION DIAGRAM
To %eep trac% of all the different events happeningTo %eep trac% of all the different events happening during connectionduring connectionestablishment* connection termination* and data transfer* the TCPestablishment* connection termination* and data transfer* the TCP
software is implemented as asoftware is implemented as afinite state machine#finite state machine###
The topics discussed in this section include:The topics discussed in this section include:
&cenarios&cenarios
7/25/2019 Chap 12 Modified PP2003
25/110
TCP/IP Protocol Suite 25
Table !"#Table !"# &tates for TCP&tates for TCP
7/25/2019 Chap 12 Modified PP2003
26/110
TCP/IP Protocol Suite 26
Figure 12.1! &tate transition diagram
7/25/2019 Chap 12 Modified PP2003
27/110
TCP/IP Protocol Suite 27
Client states
Server states
Fi 12 14 C i bli h d i i
7/25/2019 Chap 12 Modified PP2003
28/110
TCP/IP Protocol Suite 28
Figure 12.14 Connection establishment and termination
7/25/2019 Chap 12 Modified PP2003
29/110
TCP/IP Protocol Suite 29
The common value for &; isbetween ( seconds and ! minute#
=a*imum segment lifetime
=SH6.
Note:Note:
7/25/2019 Chap 12 Modified PP2003
30/110
TCP/IP Protocol Suite 30
Figure 12.15 "#nnecti#n ter$inati#n usingthree-way handsha%e
Fi 12 16 &i lt
7/25/2019 Chap 12 Modified PP2003
31/110
TCP/IP Protocol Suite 31
Figure 12.16 &imultaneous open
Fi 12 17 &i lt l
7/25/2019 Chap 12 Modified PP2003
32/110
TCP/IP Protocol Suite 32
Figure 12.17 &imultaneous close
Figure 12 18 4 i ti
7/25/2019 Chap 12 Modified PP2003
33/110
TCP/IP Protocol Suite 33
Figure 12.18 4enying a connection
Figure 12 19 3borting a connection
7/25/2019 Chap 12 Modified PP2003
34/110
TCP/IP Protocol Suite 34
Figure 12.19 3borting a connection
7/25/2019 Chap 12 Modified PP2003
35/110
TCP/IP Protocol Suite 35
12.6 FLOW CONTROL
7/25/2019 Chap 12 Modified PP2003
36/110
TCP/IP Protocol Suite 36
Figure 12.2 &liding window
r(nd is the receiver (indo( si#e c(nd is the congestion(indo( si#e
7/25/2019 Chap 12 Modified PP2003
37/110
TCP/IP Protocol Suite 37
3 sliding window is used to ma%e
transmission more efficient as well as
to control the flow of data so that thedestination does not become
overwhelmed with data#
TCPs sliding windows are byte
oriented#
Note:Note:
7/25/2019 Chap 12 Modified PP2003
38/110
TCP/IP Protocol Suite 38
$hat is the value of the receiver window rwnd. for host 3 ifthe receiver* host B* has a buffer si=e of '*((( bytes and !*(((
bytes of received and unprocessed data+
Example3
&olution
The value of rwnd > '*((( ? !*((( > 0*(((# 9ost B can receive
only 0*((( bytes of data before overflowing its buffer# 9ost Badvertises this value in its ne1t segment to 3#
7/25/2019 Chap 12 Modified PP2003
39/110
TCP/IP Protocol Suite 39
$hat is the si=e of the window for host 3 if the value of rwnd is*((( bytes and the value of cwnd is *'(( bytes+
Example4
&olution
The si=e of the window is the smaller of rwnd and cwnd* which
is *((( bytes#
7/25/2019 Chap 12 Modified PP2003
40/110
TCP/IP Protocol Suite 40
7/25/2019 Chap 12 Modified PP2003
41/110
Figure 12.22 21ample
7/25/2019 Chap 12 Modified PP2003
42/110
TCP/IP Protocol Suite 42
Figure 12.22 21ample
,e1t* the sender receives a pac%et with an ac%nowledgment
value of "( and an rwnd of !"# The host has not sent any new
bytes# The value of cwnd is still "(# &how the new window#
Figure 12.2! 21ample
7/25/2019 Chap 12 Modified PP2003
43/110
TCP/IP Protocol Suite 43
Figure 12.2! 21ample
3ssume the sender has sent bytes "( to "(@# The senders
window shrin%s accordingly#
,ow the sender receives a pac%et with an ac%nowledgmentvalue of "!( and an rwnd of '# The value of cwnd is still "(#
&how the new window#
Figure 12.24 21ample A
7/25/2019 Chap 12 Modified PP2003
44/110
TCP/IP Protocol Suite 44
Figure 12.24 21ample A
7/25/2019 Chap 12 Modified PP2003
45/110
TCP/IP Protocol Suite 45
9ow can the receiver avoid shrin%ing the window in theprevious e1ample+
Example9
&olution
The receiver needs to %eep trac% of the last ac%nowledgment
number and the last rwnd# f we add the ac%nowledgmentnumber to rwnd we get the byte number following the right
wall# f we want to prevent the right wall from moving to the
left shrin%ing.* we must always have the following
relationship#new ac% 7 new rwnd D last ac% 7 last rwnd
or
new rwnd D last ac% 7 last rwnd. ? new ac%
7/25/2019 Chap 12 Modified PP2003
46/110
To avoid shrinking the sender window, the receivermust wait until more space is available in its bufer.
:indo& s'!tdo&n .'e recei+er can te"porari, s'!t do&n t'e
&indo& #, sending an rwndo$ 0 i$ t'erecei+er does not &ant to recei+e an, data$ro" t'e sender $or a &'ie
.'e sender does not act!a, s'rink t'esi
7/25/2019 Chap 12 Modified PP2003
47/110
TCP/IP Protocol Suite 47
&ome points about TCPs sliding windows:
The si=e of the window is the lesser of rwndand cwnd#
The source does not have to send a full windows
worth of data#The window can be opened or closed by the receiver*
but should not be shrun%#
The destination can send an ac%nowledgment at any
time as long as it does not result in a shrin%ing window#
The receiver can temporarily shut down the windowE
the sender* however* can always send a segment of one
byte after the window is shut down#
Note:Note:
Figure 12.24 &illy $indow &yndrome
7/25/2019 Chap 12 Modified PP2003
48/110
TCP/IP Protocol Suite 48
g y y
Sill! Windo( S!ndrome Slo( sender or receiver6- What if TCsends segments that are onl! 1 !te long? @ou (ould have !tes of header) 1 !te of data) for a total of 1 !tes.Jer! (astefulK
TCP should (ait until it has more data efore it sends a 1-!t
segment. 'ut ho( long should it (ait to assemle data?
agle8s 0lgorithm1. The sending TCP sends the 7rst piece of data it receivesfrom the sending application even if it is onl! 1 !te.2. 0fter sending the 7rst segment) the sending TCP accumul
data in the output u%er and (aits until eitherthe receivingTCP sends 0CB or until enough data has accumulated to 7lla ma*imum-si#e segment. 0t this time) the sending TCP cansend the segment.5. Step 2 is repeated for the rest of the transmission.
Figure 12.24 &illy $indow &yndrome
7/25/2019 Chap 12 Modified PP2003
49/110
TCP/IP Protocol Suite 49
g y y
Sill! Windo( S!ndrome - What happens if the receiving TCPhas a u%er si#e of 1 !tes and the sending TCP has 9ustsent 1 !tes. The receiving u%er is no( full so the receitells the sender to stop (indo( si#e : 6.
The receiver no( reads 1 !te of data) processes it) and sen
a (indo( si#e of 1 ecause no( there is one space in theinput u%er6. The sender gets the (indo( si#e and sends 1!te. This procedure continues.
Clar"8s Solution - 0c"no(ledge receipt right a(a!) ut don8tchange the (indo( si#e until !ou have at least half the u%e
space availale.
Lr) dela! the ac" until there is a decent amount of u%er spaavailale. 0dv -3 reduces traMc. +isadv -3 the sender8s timeend efore it receives an 0CB.
7/25/2019 Chap 12 Modified PP2003
50/110
TCP/IP Protocol Suite 50
12.7 ERROR CONTROL
TCP provides reliability using error controlTCP provides reliability using error control* which detects* which detects corruptedcorrupted**lostlost** out-of-orderout-of-order* and* and duplicated segmentsduplicated segments##
2rror control in TCP is achieved through the use of :2rror control in TCP is achieved through the use of :
the chec%sumthe chec%sum** ac%nowledgmentac%nowledgment** and time-out#and time-out#
The topics discussed in this section include:The topics discussed in this section include:
Chec%sumChec%sum
3c%nowledgment3c%nowledgment
3c%nowledgment Type3c%nowledgment Type
5etransmission5etransmission
Fut-of-Frder &egmentsFut-of-Frder &egments&ome &cenarios&ome &cenarios
TCP 2rror Control
7/25/2019 Chap 12 Modified PP2003
51/110
TCP/IP Protocol Suite 51
TCP supports asic error control.
It uses a 1;-it arithmetic chec"sum) similar to the ones(e have alread! seen.
TCP uses the 0CB message to con7rm receipt of segments.
There is a numer of asic rules pertaining to 0CBs
Gule 1 When one ends sends data) it must pigg!ac" the0CB for an! data received. $*ample in 9ust a moment6
Gule 2 If a receiver has no data to send and a segmentarrives) do not 0CB it immediatel!. Wait until t(o segmentsarrive) then 0CB. Lr (ait
7/25/2019 Chap 12 Modified PP2003
52/110
TCP/IP Protocol Suite 52
TCP 2rror Control
7/25/2019 Chap 12 Modified PP2003
53/110
TCP/IP Protocol Suite 53
Gule 5 When a segment arrives (ith an e*pected seEuence
numer and the previous in-order segment has not een0CBed) the receiver immediatel! sends an 0CB. $*ampleon previous slide6
Gule When a segment arrives (ith a seEuence numerhigher than e*pected) the receiver immediatel! sends an
0CB announcing the seEuence numer it e*pected. Thisleads to fast retransmission) (hich (e (ill see shortl!.
Gule
7/25/2019 Chap 12 Modified PP2003
54/110
TCP/IP Protocol Suite 54
TCP 2rror Control
7/25/2019 Chap 12 Modified PP2003
55/110
TCP/IP Protocol Suite 55
urthermore) a retransmission (ill occur if the retransmissio
timer GTL6 e*pires) or three duplicate 0CBs arrive in order.
or GTL e*ample) see previous slide.6
or three 0CBs) see ne*t slide.6
Figure 12.27 Three 3C8s in a row* fast retransmission
7/25/2019 Chap 12 Modified PP2003
56/110
TCP/IP Protocol Suite 56
Figure 12.28 ;ost ac%nowledgment
7/25/2019 Chap 12 Modified PP2003
57/110
TCP/IP Protocol Suite 57
Figure 12.29 ;ost ac%nowledgment corrected by resending a segment
7/25/2019 Chap 12 Modified PP2003
58/110
TCP/IP Protocol Suite 58
7/25/2019 Chap 12 Modified PP2003
59/110
Delayed segment ea,ed ./) seg"ent are treated t'e
sa"e &a, as ost or corr!pted seg"ents#, t'e recei+er
.'e dea,ed seg"ent "a, arri+e a$ter it'as #een resent %a d!picate seg"ent*
Duplicate segment :'en a seg"ent arri+es t'at contains a
se?!ence n!"#er ess t'an t'epre+io!s, ackno&edged #,tes it isdiscarded
TCP/IP Protocol Suite 59
7/25/2019 Chap 12 Modified PP2003
60/110
TCP/IP Protocol Suite 60
3C8 segments do not consume
se)uence numbers and are not
ac%nowledged#
Note:Note:
7/25/2019 Chap 12 Modified PP2003
61/110
TCP/IP Protocol Suite 61
n modern implementations* a
retransmission occurs if theretransmission timer e1pires or three
duplicate 3C8 segments have arrived#
Note:Note:
7/25/2019 Chap 12 Modified PP2003
62/110
TCP/IP Protocol Suite 62
,o retransmission timer is set for an
3C8 segment#
Note:Note:
7/25/2019 Chap 12 Modified PP2003
63/110
TCP/IP Protocol Suite 63
4ata may arrive out of order and be
temporarily stored by the receiving TCP*but TCP guarantees that no out-of-order
segment is delivered to the process#
Note:Note:
7/25/2019 Chap 12 Modified PP2003
64/110
TCP/IP Protocol Suite 64
The receiver TCP delivers only ordereddata to the process#
Note:Note:
7/25/2019 Chap 12 Modified PP2003
65/110
TCP/IP Protocol Suite 65
;ost ac%nowledgments may create
deadloc% if they are not properlyhandled#
Note:Note:
d k t d # t
7/25/2019 Chap 12 Modified PP2003
66/110
eadock created #, ost/ ecei+er -> r&nd 0 -> / %i$ it
'as no data to send*
/ -> ost %pro#e"*
eadock -> eac' end is &aiting $or aresponse $ro" t'e ot'er end andnot'ing is 'appening
So!tion -> )ersistence ti"er is !sed%disc!ssed ater*
TCP/IP Protocol Suite 66
12 8 CONGESTION CONTROL
7/25/2019 Chap 12 Modified PP2003
67/110
TCP/IP Protocol Suite 67
12.8 CONGESTION CONTROL
Congestion control refers to the mechanisms and techni)uesCongestion control refers to the mechanisms and techni)ues
to %eep theto %eep the
load below the capacity#load below the capacity#
Congestion in a net(or" ma! occur if the load on thenet(or" numer of pac"ets sent to the net(or"6 isgreater than the capacit! of the net(or" the
numer of pac"ets a net(or" can handle6.
Congestion in a net(or" or internet(or" occursecause routers and s(itches have Eueues
Figure 12.! 5outer )ueues
7/25/2019 Chap 12 Modified PP2003
68/110
TCP/IP Protocol Suite 68
Figure 12.!1 Pac%et delay and networ% load
7/25/2019 Chap 12 Modified PP2003
69/110
TCP/IP Protocol Suite 69
Propagation dela! >processingdela!
Figure 12.!2 Throughput versus networ% load
7/25/2019 Chap 12 Modified PP2003
70/110
TCP/IP Protocol Suite 70
The reason is the
discarding of pac"ets !the routers
7/25/2019 Chap 12 Modified PP2003
71/110
/ongestion contro "ec'anis"s re$ers to tec'ni?!es and "ec'anis"s
t'at can eit'er pre+ent congestion#e$ore it 'appens or re"o+econgestion a$ter it 'as 'appened open-oop congestion contro %pre+ention*
and cosed oop congestion contro %re"o+a*
TCP/IP Protocol Suite 71
@ ti t
7/25/2019 Chap 12 Modified PP2003
72/110
TCP/IP Protocol Suite 72
@pen-oop congestion contro etrans"ission poic,
.'e retrans"ission poic, and t'e retrans"ission ti"ers "!st#e designed to opti"i
7/25/2019 Chap 12 Modified PP2003
73/110
TCP/IP Protocol Suite 73
/osed-oop congestion contro Back press!re
in$or"ing t'e pre+io!s !pstrea" ro!ter to red!ce t'e
rate o$ o!tgoing packets /'oke point
is a packet sent #, a ro!ter to t'e so!rce to in$or" it o$congestion
is si"iar to (/)Cs so!rce ?!enc' packet ("picit signaing
etecting an i"picit signa &arning o$ congestion and
so& do&n its sending rate =* recei+ing dea,ed /
=picit signaing o!ter eperiencing congestion can send an epicit
signa #, setting a #it in a packet to t'e sender or t'erecei+er
TCP Congestion Control
7/25/2019 Chap 12 Modified PP2003
74/110
TCP/IP Protocol Suite 74
0ctual (indo( si#e : minimum r(nd) c(nd6
TCP8s general polic! for handling congestion is asedonthree phases slo( start) congestion avoidanceandcongestion detection.
Slo( start algorithm - c(nd starts at 1. With each 0CBreceived) cwnddoules. So second time cwnd: 2) then) then A) etc.
The cwnd value does not increase forever. cwndstops
(hen it eEuals ssthresh (slow start threshold)) (hichhas a ma* si#e of ;
7/25/2019 Chap 12 Modified PP2003
75/110
TCP/IP Protocol Suite 75
Figure 12.!! &low start* e1ponential increase
7/25/2019 Chap 12 Modified PP2003
76/110
TCP/IP Protocol Suite 76
Figure 12.!4 Congestion avoidance* additive increase
TCP Congestion Control* Congestion detection
7/25/2019 Chap 12 Modified PP2003
77/110
TCP/IP Protocol Suite 77
What happens if congestion occurs?
1. If an GTL timer times out) there is proal! congestion.So cut the threshold in half)set c(nd ac" to 1)andrestart the slo( start phase again.
2.If three 0CBs in a ro( are received) there ma! econgestion. Socut the threshold in half)set c(nd to the value of the threshold) andrestart the avoidance phase.
Figure 12.!5 TCP congestion policy summary
7/25/2019 Chap 12 Modified PP2003
78/110
TCP/IP Protocol Suite 78
7/25/2019 Chap 12 Modified PP2003
79/110
12 9 TCP TIMERS
7/25/2019 Chap 12 Modified PP2003
80/110
TCP/IP Protocol Suite 80
12.9 TCP TIMERS
To perform its operation smoothly* most TCP implementations use atTo perform its operation smoothly* most TCP implementations use at
least four timers:least four timers:
5etransmission Timer5etransmission Timer
Persistence TimerPersistence Timer
8eepalive Timer8eepalive TimerT2-$3T TimerT2-$3T Timer
5etransmission Timer
7/25/2019 Chap 12 Modified PP2003
81/110
TCP/IP Protocol Suite 81
To retransmit a lost segment) TCP emplo!s a retransmissiontimer that handles the retransmission time-out GTL6) the(aiting time for an 0CB of a segment.
If an 0CB is received efore the timer goes o%) toss the timer.
If timer goes o% efore 0CB is received) segment isretransmitted and timer is reset.
To calculate the GTL value) (e8ll need a couple other values.
5etransmission Timer
7/25/2019 Chap 12 Modified PP2003
82/110
TCP/IP Protocol Suite 82
The 7rst value (e need to "no( is the roundtrip time GTT6 of sending a segment and then gettingthe 0CB.
To calculate GTT) (e could use the GTT =easured valuesimpl! time 0CB received minus time pac"et sent6)
ut this value varies greatl! on toda!8s Internet.
So instead) (e (ill calculate GTT Smoothed.
irst time GTT Smoothed : GTT =easured
0fter thatGTT Smoothed : 1-a6 * GTT Smoothed > a* GTT =easure
(here anormall! is set to 1/A.
5etransmission Timer
7/25/2019 Chap 12 Modified PP2003
83/110
TCP/IP Protocol Suite 83
=ost implementations also use the GTT +eviation.
irst time GTT +eviation : GTT =easured / 2
0fter that
GTT +eviation : 1-b
6 * GTT +eviation >b* NSmoothed GTT - =easured GTTN
Where busuall! eEuals 1/.
inall!) GTL : GTT Smoothed > * GTT +eviation
Example
7/25/2019 Chap 12 Modified PP2003
84/110
TCP/IP Protocol Suite 84
;et us give a hypothetical e1ample#
7/25/2019 Chap 12 Modified PP2003
85/110
TCP/IP Protocol Suite 85
Example! (cont"nued)
5TT> !#' 5TT &> !#'5TT4> !#' / " > (#' 5TF > !#' 7 0 1 (#' > 0#'
#$hen the first data segment is sent* a new 5TT measurement
starts# ,ote that the sender does not start an 5TT measurement
when it sends the 3C8 segment* because it does not consume ase)uence number and there is no time-out# ,o 5TT
measurement starts for the second data segment because a
measurement is already in progress#
5TT> "#'
5TT&> /A !#'. 7 !/A "#'. > !#"'
5TT4> /0 (#'.7 !/0 G!#"' ? "#'G > (#A T6PF 9252 , BFF8HH
5TF > !#"' 7 0 (#A. > 0#0
Figure 12.!8 21ample !(
7/25/2019 Chap 12 Modified PP2003
86/110
TCP/IP Protocol Suite 86
8arns 3lgorithm
7/25/2019 Chap 12 Modified PP2003
87/110
TCP/IP Protocol Suite 87
When the sending TCP receives an 0CB for a segment) is thithe 0CB for the original segment) or for the retransmittedsegment?
+epending upon (hich one !ou choose can a%ect thecalculation of !our GTL timer.
So Barn sa!s do not consider the round trip time of aretransmitted segment in the calculation of the ne( GTT.
+o not update the value of GTT until !ou send a segmentand receive an 0CB (ithout the need for retransmission.
21ponential Bac%off
7/25/2019 Chap 12 Modified PP2003
88/110
TCP/IP Protocol Suite 88
What is the value of GTL if a retransmission occurs?
=ost TCP implementations use an e*ponential ac"o%strateg!.
The value of GTL is douled for each retransmission.
See the ne*t slide for an e*ample of this.
Example
7/25/2019 Chap 12 Modified PP2003
89/110
TCP/IP Protocol Suite 89
7/25/2019 Chap 12 Modified PP2003
90/110
TCP/IP Protocol Suite 90
Persistence Timer
7/25/2019 Chap 12 Modified PP2003
91/110
TCP/IP Protocol Suite 91
What if a receiver sends !ou a (indo( si#e of ?@ou stop transmitting until !ou receive an 0CB (ith a ne( (indo( si
What happens if this 0CB is lost? +eadloc" occurs.
When the sending TCP receives an ac"no(ledgment (itha (indo( si#e of #ero) the persistence timer is started.
When persistence timer goes o%) the sending TCP sends
a special segment called aprobe.
The proe alerts the receiving TCP that the ac"no(ledgment(as lost and should e resent.
If a response is not received) the sender continues sending theproe segments and douling) and resetting the value of thepersistence timer until the value reaches a threshold usuall! ; sec
0fter that sender sends one proe segment ever! ;s until the (indis reopened.
The Fther Timers
7/25/2019 Chap 12 Modified PP2003
92/110
TCP/IP Protocol Suite 92
Beepalive Timer
If t(o sides transfer data and then go silent) is the connectistill valid? Lr did it die someho(?
$ach time a server hears something from the other side) setthe Beepalive Timer to sa!) 2 hours. If the server doesn8thear an!thing (ithin 2 hours) it sends a proe.
o response after 1 proes each of (hich is O
7/25/2019 Chap 12 Modified PP2003
93/110
TCP/IP Protocol Suite 93
12.10 OPTIONS
The TCP header can have up to 0( bytes of optional information#The TCP header can have up to 0( bytes of optional information#
Fptions convey additional information to the destination or align otherFptions convey additional information to the destination or align other
options#options#
Figure 12.4 Fptions
7/25/2019 Chap 12 Modified PP2003
94/110
TCP/IP Protocol Suite 94
Figure 12.4! a1imum-segment-si=e option
7/25/2019 Chap 12 Modified PP2003
95/110
TCP/IP Protocol Suite 95
This option set during connection estalishment6 de7nes
the ma*imum si#e of the data 7eld (ithin a segment.=a* si#e is ;
7/25/2019 Chap 12 Modified PP2003
96/110
TCP/IP Protocol Suite 96
In case a (indo( si#e of 1; its ;
7/25/2019 Chap 12 Modified PP2003
97/110
TCP/IP Protocol Suite 97
Can use this option to calculate round trip time GTT.
Example
7/25/2019 Chap 12 Modified PP2003
98/110
TCP/IP Protocol Suite 98
7/25/2019 Chap 12 Modified PP2003
99/110
TCP/IP Protocol Suite 99
The receivers function is more involved# t %eeps trac% of the
last ac%nowledgment sent !"(((.# $hen the first segmentarrives* it contains the bytes !"((( to !"(@@# The first byte is
the same as the value of lastac%# t then copies the timestamp
value 0"(. into the tsrecent variable# The value of lastac% is
still !"((( no new ac%nowledgment has been sent.# $hen thesecond segment arrives* since none of the byte numbers in this
segment include the value of lastac%* the value of the
timestamp field is ignored# $hen the receiver decides to send
an accumulative ac%nowledgment with ac%nowledgment
!""((* it changes the value of lastac% to !""(( and inserts the
value of tsrecent in the echo reply field# The value of tsrecent
will not change until it isreplaced by a new segment that
carries byte !""(( ne1t segment.#
p
Example2 (#ont"nued)
7/25/2019 Chap 12 Modified PP2003
100/110
TCP/IP Protocol Suite 100
,ote that as the e1ample shows* the 5TT calculated is the time
difference between sending the first segment and receiving thethird segment# This is actually the meaning of 5TT: the time
difference between a pac%et sent and the ac%nowledgment
received# The third segment carries the ac%nowledgment for
the first and second segments#
p
Figure 12.46 21ample !"
7/25/2019 Chap 12 Modified PP2003
101/110
TCP/IP Protocol Suite 101
The time-stamp option can also e usedfor P0WS protection against (rapped
seEuence numers6
S/-per"itted
7/25/2019 Chap 12 Modified PP2003
102/110
S/ per"itted
sed on, d!ring connectionesta#is'"ent
.'e 'ost t'at sends t'e SYN seg"ent
adds t'is option to s'o& t'at it cans!pport t'e S/ option
($ t'e ot'er end in its SYN /
seg"ent aso inc!des t'is optiont'en t'e t&o ends can !se t'e S/option d!ring data trans$er
TCP/IP Protocol Suite 102
S/
7/25/2019 Chap 12 Modified PP2003
103/110
S/
(s !sed d!ring data trans$er on, i$ #ot'ends agree .'e option inc!des a ist $or #ocks
arri+ing o!t-o$-order
=ac' #ock occ!pies t&o 32 #it n!"#erst'at deDne t'e #eginning and t'e endo$ t'e #ocks
S/ option cannot deDne "ore t'an
4 #ocks .'e Drst #ock can #e !sed to report t'ed!picates .'is is !sed on, i$ t'ei"pe"entation ao&s t'is $eat!re
TCP/IP Protocol Suite 103
Figure 12.47 &3C8 &elective 3c%nowledgment.
7/25/2019 Chap 12 Modified PP2003
104/110
TCP/IP Protocol Suite 104
Example
7/25/2019 Chap 12 Modified PP2003
105/110
TCP/IP Protocol Suite 105
;et us see how the &3C8 option is used to list out-of-order bloc%s# n
7/25/2019 Chap 12 Modified PP2003
106/110
TCP/IP Protocol Suite 106
Example
7/25/2019 Chap 12 Modified PP2003
107/110
TCP/IP Protocol Suite 107
The e1ample in
7/25/2019 Chap 12 Modified PP2003
108/110
TCP/IP Protocol Suite 108
Example
7/25/2019 Chap 12 Modified PP2003
109/110
TCP/IP Protocol Suite 109
The e1ample in
7/25/2019 Chap 12 Modified PP2003
110/110