Soi Lecture2a
Soi Lecture2a
Yoshifumi Nishida
[email protected]
Sony Computer Science Labs, Inc
Today’s Contents
Part1: TCP Issues and Solutions
Part2: Congestion Control
Part3: Simulating TCP
Part 1: TCP Issues and Solutions
Long Fat Networks
Ambiguity of Acknowledgment
Connection Setup Overhead
Security Vulnerabilities
Long Fat Network (1)
What are "Long Fat Networks"?
A network with large bandwidth and long delay.
ex. High-capacity satellite channels
TCP performance
TCP performance is calculated by Window Size and RTT.
Window Size
TCP peformance =
Round-Trip Time
Required Window Size for networks.
Required Window Size = Round-Trip Time Maximum Transfer Rate of the network.
shift
Window Scale Option kind=3 len=3
count
1 byte 1 byte 1 byte
A B
2 32 bytes
A B
2 32 bytes
Ambiguity of the Acknowledgment (1)
Cumulative ACK style is ambiguous, when multiple packets are
lost.
TCP cannot identify which packets are lost exactly.
Causes poor performance over lossy networks (ex. wireless networks)
Data 1000-1499
Data 1500-1999
Data 2000-2499
Data 2500-2999
Data 3000-3499
ACK 1500
Ambiguity of the Acknowledgment (2)
Selective Acknowledgment Options
Provides precise information about packet arrivals.
Two options are defined in RFC2018.
SACK Option
Used in an ACK packet to indicate which packets were received
precisely.
Ambiguity of the Acknowledgment (3)
SACK Permitted Option
1 byte 1 byte
SACK Option
LEN=variable
KIND=5
Data 2000-2499
ISN+2500
ISN+3500
Data 3000-3499
ACK 1500
Connection Setup Overhead (1)
TCP is not suitable for a transaction service.
TCP requires 3 packets for connection setup.
TCP requires 4 packets for connection termination.
client status server status
CLOSED
CLOSED
LISTEN
SYN SENT SYN
SYN_RCVD
SYN,ACK
ESTABLISHED ACK
ESTABLISHED
FIN_WAIT_1 FIN
CLOSE_WAIT
ACK
FIN_WAIT_2
LAST_ACK
FIN
TIME_WAIT
ACK
CLOSED
CLOSED
Connection Setup Overhead (2)
T/TCP option
TCP extension for transactions
Exchange data with 3 packets.
Use Connection Count (CC) to bypass 3 way handshake
Defined in RFC1644.
client status server status
CLOSED CLOSED
SYN SENT
SYN, data1, FIN CC=x LISTEN
CLOSE_WAIT
TIME_WAIT
ACK CC=x
CLOSED
CLOSED
Security Vulnerabilities (1)
Sequence Number Attack
If someone can guess Sequence Number used in your TCP
connections...
He can "hijack" your TCP connection.
TCP checks IP address and Port Number and Sequence number.
But most of current implementations use cryptic algorithms to generate
ISN (Initial Sequence Number).
Bad Guy
A’s IP address
A’s Port Number
A’s Seqnuence Number
TCP connection
A Victim
Security Vulnerabilities (2)
SYN Flood Attack
Denial of Service Attack
Send a large number of SYN packets with Random source IP address
Cause memory overflow on the victim
TCP allocates memory when it receives SYN packets.
Bad Guy
Random IP address
Random Port Number
SYN request
Cookie
Information
Do not allocate memory
After receiving SYN
Someone SYN ,ACK Victim
Part 2: Congestion Control
How does congestion happen?
Why congestion is difficult?
Congestion Control by TCP
How does congestion happen?
Congestion occurs when there is too much traffic in the networks
Routers have queuing capability.
If a router cannot transmit packets at a given instance, it stores packets
in the queue and waits for the next chance to transmit.
Queue has limited size
If queue data exceeds limit, packet will be discarded.
queue
Router
Congestion Tends To Get Worse
If congestion occurs..
Packet transfers are delayed
Packets are discarded
Congestion Collapse
We cannot use network!
Why is congestion control difficult? (1)
Internet is designed to be autonomous.
No central control.
There is no way to control each user’s behavior.
Sender Receiver
side side
History of TCP Congestion Control
3 major versions of TCP congestion control
TCP congestion control scheme has been deployed with BSD Unix.
Tahoe
Implemented in 4.3BSD Tahoe, Net/1 (around 1988)
Slow Start and Congestion Avoidance
Fast Retransmit
Reno
Implemented in 4.3BSD Reno, Net/2 (around 1990)
Fast Recovery after Fast Retransmit
NewReno
No reference implementation (around 1996)
New Fast Recovery Algorithm
Tahoe TCP
Two major congestion control schemes
Slow-Start and Congestion Avoidance
Increases Window Size
Fast Retransmit
Detects congestion
Slow-Start and Congestion Avoidance (1)
Two communication phases for increasing congestion window
Slow Start
Used at the beginning of a transfer, or after timeout.
Starts from minimum window size
Increases congestion window size by MSS bytes for each ACK received
Increases window size exponentially
Congestion Avoidance
Increases congestion window size by MSS / cwnd bytes for each ACK
received.
Increases window size linearly
Slow-Start and Congestion Avoidance (2)
Transition from Slow-start to Congestion Avoidance
TCP keeps a variable "ssthresh" to determine which algorithms
are used.
If cwnd < ssthresh then do slow-start
If cwnd > ssthresh then do congestion avoidance
ssthresh
Time
congestion congestion
slow-start slow-start avoidance avoidance
slow-start
Slow-Start and Congestion Avoidance (4)
Goal of slow-start and congestion avoidance
Keep window size around optimal size as much as possible.
Slow-Start
Increase window size rapidly to reach maximum safety transfer rate as fast as
possible.
Maximum safety transfer rate:
Half of the transfer rate that caused packet loss
Congestion Avoidance
Increase window size slowly to avoid packet losses as long as possible
Fast Retransmit (1)
Retransmit packets without waiting for retransmission timeout
Fast retransmit uses "duplicate ACK" to trigger retransmission
packets.
Duplicate ACK:
ACKs that are the same as previous ACK
Duplicate ACKs are generated by packet loss or packet disorder.
Packet1 Packet1
Packet2 Packet2
ACK for packet1 ACK for packet1
Packet3 Packet3
Duplicate ACK
ACK for packet1 ACK for packet1
duplicate ACK generated by packet loss duplicate ACK generated by packet disorder
Fast Retransmit (2)
TCP cannot determine whether duplicate ACK is generated by packet
loss or packet disorder.
But TCP assumes that 3 successive duplicate ACKs are caused by
packet loss.
Packet 1
Packet 2
ACK for Packet 1
Packet 3
Packet 4
ACK for Packet 1
Packet 5
ACK for Packet 1 duplicate ACK
ACK for Packet 1
Time
congestion congestion
slow-start slow-start avoidance avoidance
slow-start
Congestion estimation by Tahoe TCP
Every packet loss is assumed to be serious congestion.
Fast Recovery (2)
Congestion estimation by Reno TCP
If packet loss was found by Retransmit Timeout,
Congestion is serious.
Window Size should be set to minimum value and do Slow-start.
If packet loss was found by Duplicate ACK,
Congestion is not serious.
Because..
At least 3 packets could arrive at the receiver after packet loss.
At least 3 packets have left the network, so there may be a chance to transmit a packet
.
So, Window Size is set to half of the current cwnd value and transits to
Congestion Avoidance phase.
Fast Recovery (3)
Example of cwnd variation of Reno TCP
Time
congestion congestion congestion
avoidance avoidance avoidance
slow-start
Source Quench
Message
Router