A three-way handshake synchronizes both ends of a connection by allowing both sides to agree upon the
initial sequence numbers. This mechanism guarantees that both sides are ready to transmit data. The three-way
handshake is necessary so that packets are not transmitted or retransmitted during session establishment or
after session termination.
Each host randomly chooses a sequence number, which is used to track bytes within the stream that the host
is sending. The three-way handshake proceeds in the following manner:
•
The first host (Host A) initiates a connection by sending a packet with the initial sequence number (X)
and the synchronize/start (SYN) bit set to indicate a connection request.
•
The second host (Host B) receives the SYN, records the sequence number X, and replies by acknowledging
(ACK) the SYN (with an ACK = X + 1). Host B includes its own initial sequence number (SEQ = Y).
An ACK = 20 means that the host has received bytes 0 through 19 and expects byte 20 next. This
technique is called forward acknowledgment.
•
Host A acknowledges all bytes that Host B has sent with a forward acknowledgment indicating the next
byte Host A expects to receive (ACK = Y + 1). Data transfer can then begin.
TCP Connection Attempt Time
You can set the amount of time the software will wait before attempting to establish a TCP connection. The
connection attempt time is a host parameter and pertains to traffic that originated at the device and not to
traffic going through the device. To set the TCP connection attempt time, use the ip tcp synwait-time command
in global configuration mode. The default is 30 seconds.
TCP Selective Acknowledgment
The TCP Selective Acknowledgment feature improves performance if multiple packets are lost from one TCP
window of data.
Prior to this feature, because of limited information available from cumulative acknowledgments, a TCP
sender could learn about only one lost packet per-round-trip time. An aggressive sender could choose to resend
packets early, but such re-sent segments might have already been successfully received.
The TCP selective acknowledgment mechanism helps improve performance. The receiving TCP host returns
selective acknowledgment packets to the sender, informing the sender of data that has been received. In other
words, the receiver can acknowledge packets received out of order. The sender can then resend only missing
data segments (instead of everything since the first missing packet).
Prior to selective acknowledgment, if TCP lost packets 4 and 7 out of an 8-packet window, TCP would receive
acknowledgment of only packets 1, 2, and 3. Packets 4 through 8 would need to be re-sent. With selective
acknowledgment, TCP receives acknowledgment of packets 1, 2, 3, 5, 6, and 8. Only packets 4 and 7 must
be re-sent.
TCP selective acknowledgment is used only when multiple packets are dropped within one TCP window.
There is no performance impact when the feature is enabled but not used. Use the ip tcp selective-ack command
in global configuration mode to enable TCP selective acknowledgment.
Refer to RFC 2018 for more details about TCP selective acknowledgment.
IP Application Services Configuration Guide, Cisco IOS XE Release 3S (Cisco ASR 1000)
25
Configuring TCP
TCP Connection Attempt Time