transport layer: tcp and udp - washington university in …jain/cse473-16/ftp/i_3tcp4.pdf · ·...
TRANSCRIPT
3-1©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Transport Layer: TC
P and UD
P
Raj Jain
Washington U
niversity in Saint LouisSaint Louis, M
O 63130
Jain@w
ustl.edu A
udio/Video recordings of this lecture are available on-line at:http://w
ww
.cse.wustl.edu/~jain/cse473-16/
3-2©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Overview
Transport Layer Design Issues:
Multiplexing/D
emultiplexing
Reliable Data Transfer
Flow control
Congestion controlU
DP
TCPHeader form
at, connection managem
ent, checksumCongestion Control
Note: This class lecture is based on Chapter 3 of the textbook
(Kurose and Ross) and the figures provided by the authors.
3-3©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Transport Layer Design Issues
1.Transport Layer Functions
2.M
ultiplexing and Dem
ultiplexing3.
Error Detection: Checksum
4.Flow
Control5.
Efficiency Principle6.
Error Control: Retransmissions
Overview
3-4©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Transport Layer
Transport = End-to-End Services Services required at source and destination system
sN
ot required on intermediate hops
Application
TransportN
etwork
Datalink
Physical
Netw
orkD
atalinkPhysical
Netw
orkD
atalinkPhysical
Application
TransportN
etwork
Datalink
Physical
End SystemRouter
RouterEnd System
3-5©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Transport Layer Functions1.
Multiplexing and dem
ultiplexing: Am
ong applications and processes at end system
s2.
Error detection: Bit errors3.
Loss detection: Lost packets due to buffer overflow
at intermediate system
s (Sequence numbers and
acks)4.
Error/loss recovery: Retransmissions
5.Flow
control: Ensuring receiver has buffers6.
Congestion C
ontrol: Ensuring network has capacity
Not all transports provide all functions
3-6©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Protocol LayersTop-D
own approach
Internetwork
Host to
Netw
ork
IP
Application
Transport
HTTP
TCP
FTPSM
TP
UD
P
Physical
EthernetW
i-FiPoint-to-Point
CoaxFiber
Wireless
P2PD
NS
Skype
3-7©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Multiplexing and D
emultiplexing
Transport Portsand Netw
ork addressesare used to separate flow
s
IP:128.3.4.1
Web
TCP
IP :209.3.1.1IP :125.5.1.1
User 1
ServerU
ser 2
DN
SA
pplication
Transport
Netw
ork
UD
P
Web
DN
SW
ebD
NS
TCPU
DP
TCPU
DP
Port #
Protocol Type
SP:3009D
P:80SA
: 128.3.4.1D
A: 209.3.1.1
SP:80D
P:3009SA
:209.3.1.1D
A:128.3.4.1
Ref: http://en.wikipedia.org/w
iki/List_of_TCP_and_UD
P_port_numbers
3-8©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
User D
atagram Protocol (U
DP)
Connectionless end-to-end serviceProvides m
ultiplexing via portsError detection (Checksum
) optional. Applies to pseudo-
header(sam
e as TCP) and UD
P segment. If not used, it is set
to zero.N
o error recovery (no acks). No retransm
issions.U
sed by network m
anagement, D
NS, Stream
ed multim
edia(A
pplications that are loss tolerant, delay sensitive, or have their ow
n reliability mechanism
s)
SourcePort
Dest
PortCheck-
sumLength
16b16b
16bSize in bits
16b
3-9©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Error Detection: C
hecksumC
yclic Redundancy C
heck (CR
C): Pow
erful but generally requires hardw
areC
hecksum: W
eak but easily done in software
Example:1's com
plementof 1’s com
plement sum
of 16-bit w
ords with overflow
wrapped around
At receiver the sum
is all 1’s and the checksum is zero.
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
wraparound
sum
checksum
3-10©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
1’s Com
plement
2’s Com
plement:-ve of a num
ber is complem
ent+11 = 0001
-1 = 11112 = 0010
-2 = 11100 = 0000
-0 = 00001’s com
plement:-ve of a num
ber is it’s complem
ent1 = 0001
-1 = 11102 = 0010
-2 = 11010 = 0000
-0 = 11112’s C
omplem
ent sum: A
dd with carry. D
rop the final carry, if any.6-7 = 0110 + (-0111) = 0110 + 1001 = 1111 => -11’s com
plement sum
: Add w
ith carry. Add end-around carry back to sum
6-7 = 0110 + (-0111) = 0110+1000 = 1110 => -1C
omplem
ent of 1’s complem
ent sum: 0001
Checksum
: At the transm
itter: 0110 1000, append 0001A
t the receiver: 0110 1000 0001 compute checksum
of the full packet = com
plement of sum
= complem
ent of 1111 = 0000Ref: https://en.w
ikipedia.org/wiki/O
nes%27_com
plement
3-11©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Hom
ework 3A
Consider the following tw
o 16-bit words: A
BCD 1234
A.
What is the checksum
as computed by the sender
B.A
dd your answer of Part A
to the end of the packet and show
how the receiver w
ill compute the
checksum of the received three 16-bit w
ords and confirm
that there are no errors.C.
Now
assume that the first bit of the packet is flipped
due to an error. Repeat Part B at the receiver. Is the error detected?
3-12©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
UD
P: Summ
ary1.
UD
P provides flow m
ultiplexing using port #s2.
UD
P optionally provides error detection using the checksum
3.U
DP does not have error or loss recovery
mechanism
3-13©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Lab 3A: U
DP
Dow
nload the wireshark traces from
http://gaia.cs.umass.edu/w
ireshark-labs/wireshark-traces.zip
Open the trace file http-ethereal-trace-5 in W
ireshark, View
Expand A
ll and answ
er the following questions?
1. Examine the first packet. In the printout for this packet, select the line
with U
DP. The U
PD header is highlighted in the trace. H
ow m
any fields are there in the U
DP header? N
ame these fields, their lengths and their
values.2. The value in the Length field is the length of w
hat? Verify your claim
w
ith your captured UD
P packet. 3. W
hat is the maxim
um num
ber of bytes that can be included in a UD
P payload?
4. What is the largest possible source port num
ber? 5. Exam
ine the first two U
DP packets. D
escribe the relationship between
the port numbers in the tw
o packets.
3-14©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Flow C
ontrolFlow
Control Goals:
1.Sender does not flood the receiver, 2.M
aximize throughput
Ack Pkt 1
Ack Pkt 2
Ack Pkt 3
SenderReceiver
SenderReceiver
Stop and Wait Flow
Control
Window
Flow C
ontrol
Throughput =Throughput =
L/RRTT+L/R
W L/R
RTT+L/R
Large RTTLow
Thruput
L/RRTT
L= Packet LengthR= Link bit Rate
University
inSSt.LSt.L
Ref: Textbook Section 3.4.2
3-15©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Sliding Window
Diagram
3-16©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Stop and Wait Flow
Control
first bit transmitted, t = 0 Sender
Receiver
RTT
last bit transmitted, t = L / R
First bit arrivesLast bit arrives, send A
CK
ACK
arrives, send next packet, t = RTT + L / R
U=
L / RRTT + L / R
=1
2+ 1
2tprop +tframe
tframe
=
Here,
= tprop /tframe
3-17©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Sliding Window
Protocol Efficiency
Data
Ack
tframe
tprop
U=
W tfram
e
2tprop +tframe
=
W2+1
1 if W>2
+1
Here,
= tprop /tframe
W=1
Stop and Wait
3-18©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Utilization: Exam
plesSatellite Link: O
ne-way Propagation D
elay = 270 ms
RTT=540 ms
Frame Size L = 500 Bytes = 4 kb
Data rate R = 56 kbps
tframe = L/R= 4kb/56kbps =0.071s =
71 ms
= tprop /tframe = 270/71 = 3.8
U = 1/(2
+1) = 0.12
Short Link: 1 km = 5
s (Assum
ing Fiber 200 m/
s), Rate=10 M
bps, Fram
e=500 bytes tfram
e = 4k/10M= 400
s=tprop /tfram
e =5/400=0.012 U
=1/(2+1)=0.98
Note: The textbook uses RTT in place of tprop and L/R for tfram
e
3-19©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Effect of Window
Size
ULarger window
is better for larger
3-20©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Efficiency PrincipleForallprotocols, the m
aximum
utilization (efficiency) is a non-increasing
function of
Max
Utilization
Not Possible
Protocol 1Protocol 2
Best possible
=tproptfram
e
=D
istance/Speed of SignalBits Transm
itted /Bit rate
=D
istance Bit rate
Bits Transmitted
Speed of Signal
3-21©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Error Control: R
etransmissions
Retransmit lost packets
Autom
atic Repeat reQ
uest (ARQ
)
Ack Pkt 1
Pkt 2
AckPkt 3
SenderReceiver
Stop and Wait A
RQ
Timeout
Timeout
Pkt 2
Pkt 3
3-22©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Go-Back-N
AR
Q
Receiver does not cache out-of-order frames
Sender has to go backand retransm
it all frames after
the lost frame
RcvrSender
1
Nack 1
1
0122 33
3-23©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Selective Repeat A
RQ
Receiver caches out-of-order frames
Sender retransmits only the lost fram
eA
lso known as selective rejectA
RQ RcvrSender
1
Nack 1
1
0124 35
3-24©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Selective Repeat: W
indow Size
012345670A
ck
Sequence number space >
2 window
sizeW
indow size <
2n-1
Timeout
3-25©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Performance: M
aximum
Utilization
Stop and Wait Flow
Control: U
= 1/(1+2)
Window
Flow C
ontrol:
Stop and Wait A
RQ
: U = (1-P)/(1+2
)G
o-back-N A
RQ
:
Selective Repeat A
RQ
:
U =
1W
>2
+1 W
/(2+1)
W< 2
+1{U
= (1-P)/(1+2
P)W
>2
+1 W
(1-P)/[(2+1)(1-P+W
P)] W
< 2+1
{U =
(1-P)W
>2
+1 W
(1-P)/(2+1)
W< 2
+1{
P = Probability of Loss
3-26©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Performance C
omparison
1.0
0.80.6
0.4
0.2
0.00.1
110
1001000
Utilization
Stop-and-wait
W= 127 G
o-back-N
W=7 G
o-back-N &
W= 7 Selective-repeat
W= 127 Selective-repeat
More bps or longer distance
3-27©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Transport Layer Design Issues
1.M
ultiplexing/demultiplexing by a com
bination of source and destination IP addresses and port num
bers.2.
Window
flow control is better for long-distance or high-speed
networks
3.Longer distance or higher speed
Larger Larger w
indow is better
4.Stop and and w
ait flow control is ok for short distance or low
-speed netw
orks5.
Selective repeat is better than stop and wait A
RQO
nly slightly better than go-back-N
3-28©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Hom
ework 3B
Problem 19 on page 302 of the textbook:
Consider the GBN
protocol with a sender w
indow size of 3 and a sequence num
ber range of 1,024. Suppose that at tim
e t, the next in-order packet that the receiver is expecting has a sequence num
ber of k. Assum
e that the medium
does not reorder m
essages. Answ
er the following questions:
A. W
hat are the possible sets of sequence numbers insdie the sender’s w
indow at tim
e t? Justify your answ
er.B. W
hat are all possible values of the ACK
field in all possible messages currently
propagating back to the sender at time t? Justify your answ
er.W
indow Flow
Control:
C. How
big window
(in number of packets) is required for the channel utilization to be
greater than 60% on a cross-country link of 4000 km
running at 20 Mbps using 1
kByte packets?Efficiency Principle:D
. Ethernet V1 access protocol w
as designed to run at 10 Mbps over 2.5 K
m using 1500
byte packets. This same protocol needs to be used at 100 M
bps at the same
efficiency. What distance can it cover if the fram
e size is not changed?
3-29©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP
1.TCP H
eader Format, O
ptions, Checksum2.
TCP Connection Managem
ent3.
Round Trip Time Estim
ation4.
Principles of Congestion Control5.
Slow Start Congestion Control
Overview
3-30©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Key Features of TC
PPoint-to-Point: O
ne sender, one receiverByte Stream
: No m
essage boundaries. TCP m
akes “segments”
Maxim
um segm
ent size(M
SS)C
onnection Oriented: H
andshake to initialize states before data exchangeFull D
uplex: Bidirectional data flow in one connection
Reliable: In-order byte delivery
Flow control: To avoid receiver buffer overflow
Congestion control: To avoid netw
ork router buffer overflow
BytesBytes
Segments
3-31©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP
Transmission Control Protocol
Key Services:Send: Please send w
hen convenient D
ata stream push: D
estination TCP, please deliver it im
mediately to the receiving application.
Source TCP, please send it now.
Set on last packet of an application message.
Urgent data signaling: D
estination TCP, please give this urgent data to the user out-of-band. G
enerally used for CTRL-C.
3-32©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP Segm
ent Format (C
ont)
Source PortD
est PortSeq N
oA
ck No
Data
Offset
Window
Resvd
ChecksumU
rgentO
ptions
Data
UA
PR
SF
16b16bPad
3-33©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP H
eader Fields
Source Port (16 bits): Identifies source user processD
estination Port(16 bits)21 = FTP, 23 = Telnet, 53 = D
NS, 80 = H
TTP, ...Sequence N
umber
(32 bits): Sequence number of the
first byte in the segment. If SY
N is present, this is
the initial sequence number (ISN
) and the first data byte is ISN
+1.A
ck number
(32 bits): Next byte expected
Data offset(4 bits): N
umber of 32-bit w
ords in the headerR
eserved(6 bits)
3-34©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP H
eader (Cont)
Control(6 bits):U
rgent pointer field significant, A
ck field significant, Push function,
Reset the connection, Synchronize the sequence num
bers, N
o more data from
sender
Window
(16 bits): W
ill accept [Ack] to [A
ck]+[window
]-1
ACK
URG
PSHRST
SYN
FIN
3-35©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP H
eader (Cont)
Checksum
(16 bits): covers the segment plus a
pseudo header. Includes the following fields from
IP header: source and dest adr, protocol, segm
ent length. Protects from
IP misdelivery.
Urgent pointer
(16 bits): Points to the byte following
urgent data. Lets receiver know how
much data it
should deliver right away out-of-band.
Options(variable):
Max segm
ent size (does not include TCP header, default 536 bytes), W
indow scale factor, Selective
Ack perm
itted, Timestam
p, No-O
p, End-of-options
3-36©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP O
ptions
End of Options: Stop looking for further option
No-op: Ignore this byte. U
sed to align the next option on a 4-byte w
ord boundaryM
ax Segment Size (M
SS):Does notinclude TCP header
Kind
LengthM
eaning0
1End of Valid options in header
11
No-op
24
Maxim
um Segm
ent Size3
3W
indow Scale Factor
810
Timestam
p
3-37©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP C
hecksumChecksum
is the 16-bit one's complem
ent of the one's com
plement sum
of a pseudo header of inform
ation from the IP header, the TCP header, and
the data, padded with zero octets at the end (if
necessary) to make a m
ultiple of two octets.
Checksum field is filled w
ith zeros initiallyTCP length (in octet) is not transm
itted but used in calculations. Efficient im
plementation in RFC1071.
Source Adr
Dest. A
drZeros
ProtocolTCP Length
TCP Header
TCP data32
328
816
3-38©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP C
onnection Managem
entConnection Establishm
entThree w
ay handshakeSY
N flag set
Request for connection
SYN
, ISN = 100
SYN
, ISN = 350, A
ck 101
Ack 351
Connection Termination
Close with FIN
flag setA
bort
FINA
ck
Ack
FIN
3-39©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Example R
TT estimation:
RTT: gaia.cs.umass.edu to fantasia.eurecom
.fr
100
150
200
250
300
350
18
1522
2936
4350
5764
7178
8592
99106
time (seconnds)
RTT (milliseconds)
SampleR
TTEstim
ated RTT
3-40©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Round Trip Tim
e Estimation
Measured round trip tim
e (SampleRTT) is very random
. Estim
atedRTT=(1-)Estim
atedRTT+Sam
pleRTTD
evRTT = (1-)D
evRTT+ |Sam
pleRTT-EstmatedRTT|
TimeoutInterval=Estim
atedRTT+4D
evRTT
Value
ProbabilityVery low
probability of false tim
eout
3-41©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Our R
esearch on Congestion C
ontrol
Early 1980s Digital Equipm
ent Corporation (DEC) introduced Ethernet
productsN
oticed that throughput goes down w
ith a higher-speed link in middle
(because no congestion mechanism
s in TCP)Results:1.
Timeout
Congestion Reduce the TCP w
indow to one on a tim
eout [Jain 1986]2.
Routers should set a bit when congested (D
ECbit). [Jain, Ram
akrishnan, Chiu 1988]3.
Introduced the term “Congestion A
voidance”4.
Additive increase and m
ultiplicative decrease (AIM
D principle)
[Chiu and Jain 1989]There w
ere presented to IETF in 1986.Slow
-start based on Timeout and A
IMD
[Van Jacobson 1988]
1Mbps
1Mbps
1Mbps
Time=6 m
inutes1M
bps10M
bps1M
bpsTim
e=6 hoursBit in header
3-42©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Slow Start C
ongestion Control
Window
= Flow control avoids receiver overrun
Need congestion control to avoid netw
ork overrunThe sender m
aintains two w
indows:
Credits from the receiver
Congestion window
from the netw
orkCongestion w
indow is alw
ays less than the receiver window
Starts with a congestion w
indow (CW
ND
) of 1 max segm
ent size (M
SS) D
o not disturb existing connections too much.
Increase CWN
D by 1 M
SS every time an ack is received
Assum
e CWN
D is in bytes
3-43©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Slow Start (C
ont)If segm
ents lost, remem
ber slow start threshold (SSThresh) to
CWN
D/2
Set CWN
D to 1 M
SSIncrem
ent by 1MSS per ack until SSThresh
Increment by 1 M
SS*MSS/CW
ND
per ack afterwards
Time
CongestionW
indowCW
ND
Receiver Window
IdleInterval
Timeout
1MSS
SSThresh
3-44©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Slow Start (C
ont)A
t the beginning, SSThresh = Receiver window
After a long idle period (exceeding one round-trip tim
e), reset the congestion w
indow to one.
If CWN
D is W
MSS, W
acks are received in one round trip.Below
SSThresh, CWN
D is increased by 1M
SS on every ackCW
ND
increases to 2W M
SS in one round tripCW
ND
increases exponentially with tim
eExponential grow
th phase is also known as “Slow start” phase
Above SSThresh, CW
ND
is increased by MSS/CW
ND
on every ack
CWN
D increases by 1 M
SS in one round tripCW
ND
increases linearly with tim
eThe linear grow
th phase is known as “congestion avoidance”
phase
3-45©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
AIM
D Principle
Additive Increase, M
ultiplicative D
ecreaseW
1+W2 = Capacity
Efficiency, W
1=W2
Fairness(W
1,W2) to (W
1+W
,W2+
W)
Linear increase (45line)
(W1,W
2) to (kW1,kW
2)M
ultiplicative decrease (line through origin)
CapacityW
1
C
FairEfficient
Ref: D. Chiu and Raj Jain, "A
nalysis of the Increase/Decrease A
lgorithms for
Congestion Avoidance in C
omputer N
etworks," Journal of Com
puter N
etworks and ISD
N, Vol. 17, N
o. 1, June 1989, pp. 1-14, http://w
ww.cse.w
ustl.edu/~jain/papers/cong_av.htm
3-46©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Fast Retransm
itO
ptional –im
plemented in TCP Reno
(Earlier version was TCP Tahoe)
Duplicate A
ck indicates a lost/out-of-order segment
On receiving 3 duplicate acks (4
thack for the same segm
ent): Enter Fast Recovery m
odeRetransm
it missing segm
entSet SSThresh=CW
ND
/2Set CW
ND
=SSThresh+3 MSS
Every subsequent duplicate ack: CWN
D=CW
ND
+1MSS
When a new
ack (not a duplicate ack) is receivedExit fast recoverySet CW
ND
=SSTHRESH
3-47©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP C
ongestion ControlState D
iagram
SlowStart
CongestionAvoidance
FastRecovery
Dup A
ckD
upAckCount++
CWN
D<SSThresh, N
ew A
ckCW
ND
=CWN
D+M
SSD
upAckCount=0
Transmit new
segment as allow
ed
CWN
D=1M
SSSSThresh=RcvrW
in/2D
upAckCount=0
Transmit one segm
entD
upAckCount==3
SSThresh=CWN
D/2
Cwnd=ssthresh+3M
SSRetransm
it missing
segment
Timeout
SSTthresh=CWN
D/2
CWN
D=1M
SSD
upAckCount=0
Retransmit m
issing segm
ent
Dup A
ckD
upAckCount++
Dup A
ckCW
ND
=CWN
D+1M
SSTransm
it new segm
ents as allowed
DupA
ckCount==3SSThresh=CW
ND
/2Cw
nd=ssthresh+3MSS
Retransmit m
issing segm
ent
New
Ack
CWN
D=CW
ND
+MSS*M
SS/CWN
DD
upAckCount=0
Transmit new
segment as allow
ed
IdleIdle
Idle
Note: The state transition
diagram in the textbook
does not show Idle state
CWN
D>SSThresh
3-48©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP A
verage ThroughputA
verage Throughput =
Here, P = Probability of Packet loss
Note 1: The form
ula is an approximation w
hich does not apply at P=0 or P=1. A
t P=1, the throughput is zero. At P=0, the
throughput is min{1, (Receiver W
indow/RTT)}
Note 1: The textbook uses L for probability of packet loss but it
was used earlier for length of packets.
1.22 MSS
RTT P
3-49©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Explicit Congestion N
otification (ECN
)Explicit congestion notification (ECN
) is based on our DECbit
research. Two bits in IP H
eader:00: Transport is not capable of ECN
(e.g., UD
P)01: Transport is capable of ECN10: Transport is capable of ECN11: Congestion experienced (CE)
When a router encounters congestion, instead of dropping the
datagram, it m
arks the two bits as “11” congestion experienced
Transport
Netw
orkD
atalink
Transport
Netw
orkD
atalinkECN
11
ECE1
CWR
1
Application
Application
3-50©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
ECN
(Cont)
On receiving “CE” code point, the receiver sends “ECN
Echo (ECE)” flag in the TCP headerO
n seeing the ECE flag, the source reduces its congestion w
indow, and sets “Congestion W
indow Reduced (CW
R) flag in outgoing segm
entO
n receiving “CWR” flag, the receiver, stops setting ECE bit
Transport
Netw
orkD
atalink
Transport
Netw
orkD
atalinkECN
11
ECE1
CWR
1
Application
Application
Ref: https://en.wikipedia.org/w
iki/Explicit_Congestion_Notification
3-51©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
TCP: Sum
mary
1.TCP uses port num
bers for multiplexing
2.TCP provides reliable full-duplex connections.
3.TCP is stream
based and has window
flow control
4.Slow
-start congestion control works on tim
eout5.
Explicit congestion notification works using ECN
bits
3-52©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Hom
ework 3C
Consider Figure below. A
ssuming TCP Reno is the
protocol experiencing the behavior shown above, answ
er the follow
ing questions. In all cases, you should provide a short discussion justifying your answ
er.
TCP W
indow Size
0 5 10 15 20 25 30 35 40 4505
1015
2025
30Transm
ission Round
CWND
Round
CW
ND
11
22
34
48
516
632
733
834
935
1036
1137
1238
1339
1440
1541
1642
1721
1822
1923
2024
2125
2226
231
242
254
268
3-53©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Hom
ework 3C
(Cont)
A. Identify the interval of tim
e when TCP slow
start is operating.B. Identify the intervals of tim
e when TCP congestion
avoidance is operating.C. A
fter the 16thtransm
ission round, is segment loss detected
by a triple duplicate ACK
or by a timeout?
D. A
fter the 22ndtransm
ission round, is segment loss detected
by a triple duplicate ACK
or by a timeout?
E. What is the initial value of ssthresh at the first transm
ission round?F .W
hat is the value of ssthresh at the 18thtransm
ission round?G
. What is the value of ssthresh at the 24
thtransmission round?
3-54©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Hom
ework 3C
(Cont)
H. D
uring what transm
ission round is the 70thsegm
ent sent?I. A
ssuming a packet loss is detected after the 26
thround by the receipt of a triple duplicate A
CK, w
hat will be the values of the
congestion window
size and of ssthresh?J. Suppose TCP Tahoe is used (instead of TCP Reno), and assum
e that triple duplicate ACK
s are received at the 16th
round. What are the ssthresh and the congestion w
indow size at
the 19thround?
K. A
gain suppose TCP Tahoe is used, and there is a timeout
event at the end of 22ndround. H
ow m
any packets have been sent out from
17thround till 22
ndround, inclusive?
3-55©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Summ
ary
1.M
ultiplexing/demultiplexing by a com
bination of source and destination IP addresses and port num
bers.2.
Longer distance or higher speed Larger
Larger window
is better3.
Window
flow control is better for long-distance or high-speed
networks
4.U
DP is connectionless and sim
ple. N
o flow/error control. H
as error detection.5.
TCP provides full-duplex connections with
flow/error/congestion control.
3-56©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Lab 3B: TCP
In Wireshark, open the trace file tcp-ethereal-trace-1 in
http://gaia.cs.umass.edu/w
ireshark-labs/wireshark-traces.zip
and answ
er the following:
1. What is the IP address and TCP port num
ber used by the client com
puter (source) to transfer the file to gaia.cs.umass.edu?
2. What is the IP address and port num
ber used by gaia.cs.umass.edu to
receive the file.3. W
hat is the sequence number of the TCP SY
N segm
ent that is used to initiate the TCP connection betw
een the client computer and
gaia.cs.umass.edu? W
hat is it in the segment that identifies the
segment as a SY
N segm
ent?4. W
hat is the sequence number of the SY
N A
ck segment sent by
gaia.cs.umass.edu to the client com
puter in reply to the SYN
? What
is the value of the ACK
nowledgem
ent field in the SYN
Ack
segment? H
ow did gaia.cs.um
ass.edu determine that value? W
hat is it in the segm
ent that identifies the segment as a SY
N A
ck segment?
3-57©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Lab 3B: TCP (C
ont)5. W
hat is the sequence number of the TCP segm
ent containing the H
TTP POST com
mand? N
ote that in order to find the POST
comm
and, you’ll need to dig into the packet content field at the bottom
of the Wireshark w
indow, looking for a segm
ent with a
“POST” w
ithin its DA
TA field.
6. Consider the TCP segment containing the H
TTP POST as the first
segment in the TCP connection. W
hat are the sequence numbers of
the first six segments in the TCP connection (including the segm
ent containing the H
TTP POST)? A
t what tim
e was each segm
ent sent? W
hen was the A
CK for each segm
ent received? Given the difference
between w
hen each TCP segment w
as sent, and when its
acknowledgem
ent was received, w
hat is the RTT value for each of the six segm
ents?
3-58©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Lab 3B: TCP (C
ont)7. W
hat is the length of each of the first six TCP segments?
8. What is the m
inimum
amount of available buffer space advertised at
the received for the entire trace? Does the lack of receiver buffer
space ever throttle the sender?9. A
re there any retransmitted segm
ents in the trace file? What did you
check for (in the trace) in order to answer this question?
10. How
much data does the receiver typically acknow
ledge in an A
CK? Can you identify cases w
here the receiver is ACK
ing every other received segm
ent (see Table 3.2 on page 247 in the text).11. W
hat is the throughput (bytes transferred per unit time) for the TCP
connection? Explain how you calculated this value.
3-59©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Optional H
omew
ork 3DTry but do not subm
it.A
TCP entity opens a connection and uses slow start.
Approxim
ately how m
any round-trip times are
required before TCP can send N segm
ents.
CWN
D=1
CWN
D=2
CWN
D=4
Hint:
3-60©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Acronym
sA
CKA
CKnow
ledgement
AIM
DA
dditive increase and multiplicative decrease
ARQ
Autom
atic Repeat RequestCE
Congestion ExperiencedCRC
Cyclic Redundancy Check CW
ND
Congestion Window
CWR
Congestion Window
Reduced D
AD
estination Address
DEC
Digital Equipm
ent CorporationD
ECbitD
EC's bit based congestion scheme
DevRTT
Deviation of RTT
DN
SD
omain N
ame System
DP
Destination Port
ECEExplicit Congestion Experienced
ECNExplicit Congestion N
otificationFIN
Final
3-61©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Acronym
s (Cont)
FTPFile Transfer Protocol
GBN
Go-Back N
HTTP
Hyper-Text Transfer Protocol
IETFInternet Engineering Task Force
IPInternet Protocol
ISNInitial Sequence N
umber
kBK
ilo-ByteM
SSM
aximum
segment size
PBXPrivate Branch Exchange
PSHPush
RFCRequest for Com
ments
RMResource M
anagement
RSTReset
RTTRound-Trip Tim
eSA
Source Address
SACK
Selective Acknolow
ledgement
3-62©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Acronym
s (Cont)
SMTP
Simple M
ail Transfer ProtocolSP
Source PortSSThresh
Slow Start Threshold
SYN
SynchronizationSY
NA
CKSY
N A
cknowledgem
entTCP
Transmission Control Protocol
UD
PU
ser Datagram
ProtocolU
RGU
rgentV
CIV
irtual Circuit Identifiers
3-63©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Scan This to Dow
nload These Slides
Raj Jainhttp://rajjain.com
3-64©
2016 Raj JainW
ashington University in St. Louis
http://ww
w.cse.wustl.edu/~jain/cse473-16/
Related M
odules
Audio/Video Recordings and Podcasts of
Professor Raj Jain's Lectures, https://w
ww.youtube.com
/channel/UCN
4-5wzN
P9-ruOzQ
Ms-8N
Uw
CSE473S: Introduction to Computer N
etworks (Fall 2016),
http://ww
w.cse.wustl.edu/~jain/cse473-16/index.htm
l
Wireless and M
obile Netw
orking (Spring 2016), http://w
ww.cse.w
ustl.edu/~jain/cse574-16/index.html
CSE571S: Netw
ork Security (Fall 2014), http://w
ww.cse.w
ustl.edu/~jain/cse571-14/index.html
CSE 473s: Introduction to Computer N
etworks
(Course Overview
), http://w
ww.cse.w
ustl.edu/~jain/cse473-16/ftp/i_0int.pdf