IK2215
Advanced Internetworking Transport Layer Karl-Johan Grinnemo
Transport Layer Reminder •
Purpose of transport layer – Multiplexing and demultiplexing – Reliable data transfer – Flow control – Congestion control
•
Two standard transport protocols – UDP • Multiplexing and demultiplexing • Unreliable data transfer • No flow or congestion control • Message oriented
– TCP • Multiplexing and demultiplexing • Reliable data transfer • Flow and congestion control • Byte-stream oriented
Multiplexing and Demultiplexing P1
P2
TCP
Source Port # Dest. Port # User Data Source Port # Dest. Port # User Data
P3
P4
TCP
IP
IP
Link
Link
Physical
Physical
NI
NI
IP Network
TCP Connection Establishment TCP uses a three-way handshake to establish a connection Client
Server SYN seq=x
SYN seq=y, ACK x+1
3-way handshake: •
Guarantees both sides ready to transfer data
•
Allows both sides to agree on initial sequence numbers
ACK y+1
Initial sequence number (ISN) must be chosen so that each incarnation of a specific TCP connection between two end-points has a different ISN.
Normally, client initiates the connection
TCP Connection Termination
FIN + ACK
FIN + ACK
ACK
Byte Streams, Buffers, and Segments
©The McGraw-Hill Companies, Inc., 2000
• White area: empty locations, ready to be filled • Gray area: bytes that have been sent but not ACKed • Colored area: – bytes to be sent by the sending TCP – bytes to be delivered by the receiving TCP
TCP Flow and Congestion Control
© 2002 by Prentice-Hall, Inc.
TCP Flow Control—Sliding Windows • Receiver: offered window – acknowledges data sent and what it is prepared to receive – receiver can send an ACK, but with an offered window of 0 – later, the receiver sends a window update with a non-zero offered window size
• Sender: usable window - how much data it is prepared to send immediately offered window (advertised by receiver) usable window Segment no
1
2
3
4
5
6
sent and acknowledged
7
8
9
10
11
12
can’t send until window moves can send ASAP sent, not ACKed
Example of TCP Flow Control
© 2002 by Prentice-Hall, Inc.
TCP Congestion Control I Window management swnd swnd==min{rwnd, min{rwnd,cwnd} cwnd}
CWND size (in segments) 26 24 22 Slow start 20 18 16 Threshold = 16 14 12 10 08 06 04 02 1
2
3
Congestion avoidance Time-out (at CWND = 20)
Threshold = 10
4
5
6
7
8
9
10
11 12
13 14 15 16 No of transmitted segments
TCP Congestion Control II rwnd rwnd≥≥cwnd, cwnd, Threshold Threshold==44
Endpoint A
cwnd = 1
Slow Start
cwnd = 2
cwnd = 4 Congestion Avoidance
cwnd = 5
Endpoint B
TCP Congestion Control III Retransmission Timer Management • RTO(T + 1) = SRTT(T + 1) + max{G, f × SDEV(T + 1)} • SRTT(T + 1) = (1 - g) × SRTT(T) + g × RTT(T + 1) • SDEV(T + 1) = (1 – h) × SDEV(T) + h × | SRTT – RTT(T) | where f = 4, g = 1/8, and h = 1/4
© 2002 by Prentice-Hall, Inc.
New Transport Protocols Application Layer FTP
HTTP
DNS
Transport Layer TCP
UDP
SCTP
DCCP
ICMP
IGMP
ARP
Network Layer IP
SCTP – Transport of Telephony Signaling Softswitch or Media Gateway Controller
SCTP
Legacy ISDN Subscriber
IP Network Voice Connection MGW
MGW
Media Gateway
Media Gateway
PBX
Si gn SS 7
Media Gateway Control Protocol
ing all gn Si
PBX
7
Legacy ISDN Subscriber
SS
al lin g
TeS
Telephony Signaling Requirements • Message oriented • Flexible and extensible message format • High availability – Failover between multiple redundant network interfaces – Need to monitor reachability status
• Tunable
TCP
TCP vs. SCTP
SCTP
•
Reliable data transfer with SACK
•
Reliable data transfer with SACK
•
Congestion control and avoidance
•
Congestion control and avoidance
•
PMTU discovery and message fragmentation
•
PMTU discovery and message fragmentation
•
Message boundary preservation
•
Multi-homing support
•
Built-in heartbeat
•
Multi-stream support
•
Unordered data delivery option
•
Security cookie
•
Extensibility
A TCP Connection Application 1
Application 2
Port =100
Port = 200
TCP
TCP
IP
IP
Link
Link
Physical
Physical NI
NI
IP Network IP = 160.15.82.20
IP = 128.33.6.12
Connection = {[160.15.82.20:100]:[128.33.6.12:200]}
An STCP Association Application 1
Application 2
Port =100
Port = 200
Endpoint STCP
STCP
IP
IP
Link
Link
Physical NI2 NI1
Physical NI
IP Network IP = 128.33.6.12 IP1 = 160.15.82.20 IP2 = 161.10.8.221 Association = {[160.15.82.20,161.10.8.221:100]:[128.33.6.12:200]}
Multi-homing in a Nutshell Application 1
Application 2
Port =100
Port = 200
Endpoint STCP
STCP
IP
IP
Link
Link
Physical NI2 NI1
Physical NI
IP Network IP = 128.33.6.12 IP1 = 160.15.82.20 IP2 = 161.10.8.221 Association = {[160.15.82.20,161.10.8.221:100]:[128.33.6.12:200]}
Head of Line Blocking
Send Queue
P #2 T #1
P #1 T #2
P #1 T #1
Receive Queue
Blocked
Receive Queue
P = Packet T = Transaction
Send Queue
Multi-streaming in a Nutshell Host A
Send Queue
Host B
P #2 T #1 P #1 T #2
Receive Queue
P = Packet T = Transaction
P #1 T #1
Stream #0
Receive Queue
Stream #1
Send Queue Stream #0
Format of SCTP Messages IP Header
SCTP Packet
Common Header Chunk 1 ... Chunk N
The Common Header
Source Port
Destination Port
Verification Tag CRC-32c Checksum
A Chunk
Chunk Type
Chunk Flags Chunk Data
Chunk Length
Connection Establishment: TCP vs. SCTP TCP: 3-way Handshake
STCP: 4-way Handshake INIT
SYN INIT-ACK SYN-ACK COCKIE-ECHO ACK COCKIE-ACK
Setup of an Association I SCTP Endpoint A CLOSED STATE COOKIE-WAIT
SCTP Endpoint B INIT chunk
CLOSED STATE
The INIT Chunk Type = 1
Chunk Flags
Chunk Length
Initiation Tag Advertised Receiver Window Credit Number of Outbound Streams
Number of Inbound Streams
Initial Transmission Sequence Number Optional/Variable-Length Parameters
IPv4 Address Parameter (Optional Parameter) Length = 8
Type = 5 IPv4 Address
Setup of an Association II SCTP Endpoint A CLOSED STATE
SCTP Endpoint B INIT chunk
COOKIE-WAIT INIT-ACK chunk
CLOSED STATE
The INIT-ACK Chunk Type = 2
Chunk Flags
Chunk Length
Initiation Tag Advertised Receiver Window Credit Number of Outbound Streams
Number of Inbound Streams
Initial Transmission Sequence Number Optional/Variable-Length Parameters
State Cookie Parameter (Mandatory Parameter) Parameter Length
Type = 7 Parameter Value
Setup of an Association III SCTP Endpoint A CLOSED STATE
SCTP Endpoint B INIT chunk
COOKIE-WAIT INIT-ACK chunk (contains COOKIE)
COOKIE-ECHO chunk COOKIE-ECHOED
CLOSED STATE
The COOKIE-ECHO Chunk
Type = 10
Chunk Flags Cookie
Length
Setup of an Association IV SCTP Endpoint A CLOSED STATE
SCTP Endpoint B INIT chunk
CLOSED STATE
COOKIE-WAIT INIT-ACK chunk (contains COOKIE)
COOKIE-ECHO chunk COOKIE-ECHOED ESTABLISHED
COOKIE-ACK chunk
ESTABLISHED
The COOKIE-ACK Chunk
Type = 11
Chunk Flags
Length = 4
User Data Transfer I SCTP Endpoint A ESTABLISHED STATE
SCTP Endpoint B DATA chunk TSN=100
ESTABLISHED STATE
The DATA Chunk
Type = 0
Reserv. U B E
Length
Transmission Sequence Number Stream Identifier
Stream Sequence Number
Payload Protocol Identifier
User Data
User Data Transfer II SCTP Endpoint A
SCTP Endpoint B DATA chunk TSN=100 DATA chunk TSN=101 DATA chunk TSN=102 DATA chunk TSN=103 DATA chunk TSN=104 DATA chunk TSN=105 DATA chunk TSN=106 DATA chunk TSN=107 DATA chunk TSN=108 SACK chunk Cumulative TSN=108
The SACK Chunk Type = 3
Chunk Flags
108
Chunk Length
Cumulative Transmission Sequence Number (TSN) Ack Advertised Receiver Window Credit Number of Gap Ack Blocks = N
Number of Duplicate TSNs = X
Gap Ack Block #1 Start
Gap Ack Block #1 End
Gap Ack Block #N Start
Gap Ack Block #N End
Duplicate Transmission Sequence Number (TSN) 1
Duplicate Transmission Sequence Number (TSN) X
User Data Transfer III DATA chunk TSN=109 DATA chunk TSN=110 DATA chunk TSN=111 DATA chunk TSN=112 DATA chunk TSN=113 DATA chunk TSN=114 DATA chunk TSN=115 X X DATA chunk TSN=116 DATA chunk TSN=117 DATA chunk TSN=118 DATA chunk TSN=119 DATA chunk TSN=120 DATA chunk TSN=121 DATA chunk TSN=122 DATA chunk TSN=123 X DATA chunk TSN=124 DATA chunk TSN=125 DATA chunk TSN=126 SACK chunk Cumulative TSN=113 Gap Ack Block #1 Start = +3 End = +9 Gap Ack Block #2 Start = +11 End = +13
The SACK Chunk with Gap Acks Chunk Flags
Type = 3
Chunk Length
113 Advertised Receiver Window Credit Number of Gap Ack Blocks = 2
Number of Duplicate TSNs = 0
3
9
11
13
Termination of an Association • Graceful termination • Aborting the association • Special cases
Graceful Termination: TCP vs. SCTP TCP
SCTP
FIN + ACK
SHUTDOWN
FIN + ACK
SHUTDOWN-ACK
SHUTDOWN-COMPLETE ACK
Endpoint A’s ULP invokes the SHUTDOWN
Graceful Termination I
SCTP Endpoint A
ESTABLISHED STATE SHUTDOWN PENDING STATE
SCTP Endpoint B DATA chunk(s)
ESTABLISHED STATE
Graceful Termination II SCTP Endpoint A ESTABLISHED STATE SHUTDOWN PENDING STATE
SCTP Endpoint B Payload Data chunk(s)
ESTABLISHED STATE
Final SACK chunk SHUTDOWN chunk
SHUTDOWN SENT STATE
SHUTDOWN RECEIVED STATE
The SHUTDOWN Chunk
Type = 7
Chunk Flags
Length = 8
Cumulative Transmission Sequence Number (TSN) Ack
Graceful Termination III SCTP Endpoint A ESTABLISHED STATE SHUTDOWN PENDING STATE
SCTP Endpoint B Payload Data chunk(s)
ESTABLISHED STATE
Final SACK chunk SHUTDOWN chunk
SHUTDOWN SENT STATE
SHUTDOWN RECEIVED STATE Final SACK chunk SHUTDOWN ACK chunk
SHUTDOWN ACK SENT STATE
The SHUTDOWN-ACK Chunk
Type = 8
Chunk Flags
Length = 4
Graceful Termination IV SCTP Endpoint A ESTABLISHED STATE SHUTDOWN PENDING STATE
SCTP Endpoint B Payload Data chunk(s)
ESTABLISHED STATE
Final SACK chunk SHUTDOWN chunk
SHUTDOWN SENT STATE
SHUTDOWN RECEIVED STATE Final SACK chunk SHUTDOWN ACK chunk
CLOSED STATE
SHUTDOWN COMPLETE chunk
SHUTDOWN ACK SENT STATE CLOSED STATE
The SHUTDOWN-COMPLETE Chunk
Type = 14
Reserved
T
Length = 4
Failure Detection and Recovery I Application 1
Application 2
Port =100
Port =200
STCP
STCP
NI2
User data NI1
NI
IP Network Primary Path IP Network Alternate Path
Heartbeats
Failure Detection and Recovery II The HEARTBEAT Chunk Type = 4
Chunk Flags
Heartbeat Length
Heartbeat Information TLV (Variable Length)
The HEARTBEAT-ACK Chunk Type = 5
Chunk Flags
Heartbeat Ack Length
Heartbeat Information TLV (Variable Length)
Failure Detection and Recovery III Application 1
NI2
Timeouts > Path.Max.Retrans
Application 2
Port =100
Port =200
STCP
STCP
NI1
NI
X
IP Network
Primary Path IP Network Alternate Path
Multi-streaming I Sender
Send Queue
Receiver
Stream #0 Stream #1 Stream #2
Receive Queue
Multi-streaming II
Type = 0
Reserv. U B E
Length
Transmission Sequence Number Stream Identifier
Stream Sequence Number
Payload Protocol Identifier
User Data
Multi-streaming III
Datagram Congestion Control Protocol (DCCP)
Unreliable, Congestion-controlled Transport
Motivation • Time-sensitive applications need minimum overhead – TCP brings: handshaking, retransmissions, and flow control
• UDP no alternative: no congestion control – Unresponsive, long-lived flows endanger others – Implementing congestion control is difficult
Key Features • Unreliable data transfer • Reliable control signaling – Connection setup and teardown – Option negotiation, e.g., congestion control
• A choice of modular congestion control mechanisms DCCP DCCP==TCP TCP––(bytestream (bytestreamsemanics semanics++reliability) reliability)⇒ ⇒ DCCP DCCP==UDP UDP++(congestion (congestioncontrol control++handshakes handshakes++ACKs) ACKs)
Connection Phases DCCP Endpoint A
DCCP Endpoint B
CLOSED REQUEST PARTOPEN
CLOSED DCCP-Request
RESPOND
DCCP-Response DCCP-Ack/-DataAck OPEN
OPEN
CLOSING
DCCP-Data/-Ack/-DataAck
DCCP-CloseReq
CLOSEREQ
DCCP-Close TIMEWAIT CLOSED
DCCP-Reset
CLOSED
Format of DCCP Datagrams
Generic Header Additional Fields Options
User Data
Generic Header
Destination Port
Source Port Data Offset Res
Type
CCVal CsCov X
Checksum
Sequence Number (low bits) Sequence Number (high bits)
Connection Management DCCP Endpoint A
DCCP Endpoint B DCCP-Data
A-B half-connection
DCCP-Ack
DCCP-Data B-A half-connection
DCCP-Ack
Feature Negotiation DCCP Endpoint A
DCCP Endpoint B DCCP-Request (Change Remote, CCID, 3, [3,4,2]) DCCP-Response (Confirm Local, CCID, 4)
Type
Length
Feature #
Value(s)
Congestion Control • Setup using feature negotiation • Two half connections may use different congestion control mechanisms • Determined by Congestion Control IDentifier (CCID) – CCID 2: TCP-like congestion control – CCID 3: TCP-friendly congestion control – CCID 4: TCP-friendly congestion control for small packets
Summary of Lecture I • Two standard transport protocols – UDP • Message oriented • Unreliable
– TCP • Byte-stream oriented • Reliable • Flow and congestion control
Summary of Lecture II • Two new transport protocols – SCTP • Message oriented • Reliable • Flow and congestion control • Multi-streaming • Multi-homing
– DCCP • Message oriented • Unreliable • Flow and congestion control (several options)