TECHNISCHE
UNIVERSITÄT Internet Protocol Suite
ILMENAU
Internet Protocol Suite
Link Layer: Ethernet, PPP, ARP, MAC Addressing
Network Layer: IP, ICMP, Routing
Integrated Hard- and Software Systems
TCP
http://www.tu-ilmenau.de/ihs
Basic Properties
TCP Datagram Format
Connection Setup and Release
MTU and MSS
Cumulative, Delayed and Duplicate Acknowledgements
Sliding Window Mechanism
Flow and Error Control
Internet Protocol Suite
TCP/IP = the “Internet protocol suite“ = a family of protocols for the “Internet”
Internet guesstimates 2003:
800 million users (x 2 each two years), 200 million permanent hosts
Standardisation:
ISOC: Internet Society
IAB: Internet Architecture Board
z IETF: Internet Engineering Task Force: http://www.ietf.org
Standards & other informations are published as RFCs: Requests for
Comments
z IRTF: Internet Research Task Force
Implementations:
De-facto standard: BSD 4.x implementations (Berkeley Software Distribution)
Subsequent versions come with new TCP features, e.g.
4.3 BSD Tahoe (1988): slow start, congestion avoidance, fast retransmit
4.3 BSD Reno (1990): fast recovery
Other TCP/IP stacks derived from BSD
Implemented mechanisms, default parameter settings, and bugs are
different on different operating systems (e.g. versions of MS Windows)!
Wireless Internet Andreas Mitschele-Thiel 6-Apr-06 2
TCP/IP Layer Overview
Hardware interface
Link PPP, Ethernet, IEEE 802.x,
(2)
Packet transfer be-
ARP
tween network nodes
Example:
user data
Application data
transfer using TCP Application
appl.
user data
header
TCP
TCP
application data
header
20
TCP segment
IP
IP TCP
application data
header header
20
IP datagram Ethernet
20...65536 bytes Driver
Hardware
ARP
Interface ... Link Layer
Hardware
ARP
Interface ... Link Layer
QoS
Number requirements; - (reserved) IP datagram “Real“
of 32-bit rarely used - don‘t fragment length in bytes fragment
IPv4 words and supported - more fragments (limit = 65536) offset / 8
Limit on the 8-bit time to live 8-bit protocol 16-bit IP header checksum 20 bytes
number of
routers
(countdown) 32-bit source IP address
Hardware
ARP
Interface ... Link Layer
Used
Usedforfor
application
application
multiplexing
Hardware
ARP
Interface ... Link Layer
Client Server
Application
Request to connect to Server
TCP
40 39 38 37
TCP
Router receiver
sender
received:
...
33 34 35 36 35
timestep 36
41 40 39 38
received:
...
35
34 35 36 37 36
37
i data i ack
40 39 38 37 received:
...
35
33 35 36
41 40 39 38 received:
...
35
35 37 36
37
packet loss
40 39 38 37 received:
...
36
34 36
2 timesteps
42 41 40 39 received:
...
36
x
36 36 38
dupack
on receipt of 38
40 39 37 38 received:
...
36
34 36
1 timestep
41 40 39 37 received:
...
36
x
36 36 38
dupack
on receipt of 38
Wireless Internet Andreas Mitschele-Thiel 6-Apr-06 27
Duplicate Acknowledgements 3
40 37 39 38
received:
...
Number of
34 36 36 dupacks
depends on
41 40 37 39 how much
received:
... out-of-order
34 36 36 36 a packet is
x
38
dupack
42 41 40 37 received: A series of
...
36 36 36 36 dupacks
x
38
allows the
dupack dupack 39 sender to
43 42 41 40
guess that a
received:
... single
36 36 36 39 36
37
packet has
dupack dupack new ack
38 been lost
39
1 2 3 4 5 6 7 8 9 10 11 12 13
40 39
TCP TCP
38 37
Router receiver
sender
35 36
33 34
W = 8 segments (33...40)
T1=RTO T2 = 2 * T1
Timeout interval doubled
Segment
transmitted
Timeout occurs
before ack received,
segment retransmitted
Congestion Avoidance
On each new ack, increase cwnd by 1/cwnd segments
=> cwnd grows linearly with time during congestion avoidance (in
theory)
1/2 MSS per RTT if every other segment ack’d
1 MSS per RTT if every segment ack’d
Receiver’s
14 advertised
Congestion
12 window = 12
Avoidance
cwnd (segments)
10
8 ssthresh
6 Slow Start
4
2
0
0 1 2 3 4 5 6 7 8 9
Time / RTT
Theoretical assumption: after sending n segments, n acks arrive within one RTT.
Note that Slow Start starts slowly, but speeds up quickly.
Wireless Internet Andreas Mitschele-Thiel 6-Apr-06 35
Slow Start – Reality (Including Network Delay)
Taking network delay into account, “cwnd increases exponentially” turns into:
cwnd increases sub-exponentially
pairs of segments are sent while pipe fills sending rate > data rate (cwnd > 2)
(timestep 4 onwards)
Simple example:
=> at some point in time there will
one-way delay = 1 timestep be a packet loss, causing TCP
data rate = 1 segment / timestep to slow down
#segments
Time- #segments #segments recv'd and
step Sender action cwnd sent outstanding ack'd Receiver action
0 initial values 1 0
send segment 1 1 1
1 1 receive and ack segment 1
2 receive ack 1 2 0
send segments 2 and 3 2 2
3 1 receive and ack segment 2
Packet loss detected by ≥3 dupacks (=> single packet loss, but link is ok):
Fast Retransmit single missing segment
Initiate Fast Recovery:
Set ssthresh and cwnd to half of window size before packet loss:
z ssthresh = max((min(cwnd, receiver’s advertised window)/2), 2 MSS)
z cwnd = ssthresh + number of dupacks
When a new ack arrives: continue with Congestion Avoidance:
z cwnd = ssthresh
25 Timeout
cwnd = 20
cwnd (segments)
20
15
ssthresh = 10
10 ssthresh = 8
5
cwnd = 1
0
0
9
12
15
20
22
25
Time / RTT
Wireless Internet Andreas Mitschele-Thiel 6-Apr-06 38
Packet Loss Detected by ≥3 Dupacks
≥3 Dupacks
10
cwnd = 8
cwnd (segments)
8
6
ssthresh = 4
4
cwnd = 4
2 After Fast Recovery
0
0 2 4 6 10 12 14
Time / RTT
After fast retransmit and fast recovery window size is reduced in half
Multiple packet losses within one RTT can result in timeout
Wireless Internet Andreas Mitschele-Thiel 6-Apr-06 39
Summary: TCP
TCP provides a connection-oriented,
reliable byte-stream service:
application data stream is transferred in segments based on
lower layer MTU
receiver sends back cumulative acknowledgements (acks)
sliding window mechanism with flow control based on
z receiver’s advertised window,
z sender’s Slow Start and Congestion Avoidance mechanisms
Error control & packet loss detection based on
z adaptive retransmission timeout => back to Slow Start,
z duplicate acknowledgments (dupacks) => Fast Retransmit &
Fast Recovery
The bible:
W. Richard Stevens, “TCP/IP Illustrated, Volume 1: The Protocols“
The Internet...