In TCP, one purpose of 3-way-handshake is to exchange initial sequence number for both sides. So why not use 0 instead, and the exchange is not necessary.

That is to say, sequence numbers can be determined without the 3-way-handshake. So connection does not need to be "established" . When received a packet number 0, that just means a new connection.

Are there anything wrong ?

2 Answers 2


RFC 793 states (emphasis mine):

Initial Sequence Number Selection

The protocol places no restriction on a particular connection being used over and over again. A connection is defined by a pair of sockets. New instances of a connection will be referred to as
incarnations of the connection. The problem that arises from this is -- "how does the TCP identify duplicate segments from previous incarnations of the connection?" This problem becomes apparent if the connection is being opened and closed in quick succession, or if the connection breaks with loss of memory and is then reestablished.

To avoid confusion we must prevent segments from one incarnation of a connection from being used while the same sequence numbers may still be present in the network from an earlier incarnation. We want to assure this, even if a TCP crashes and loses all knowledge of the sequence numbers it has been using. When new connections are created, an initial sequence number (ISN) generator is employed which selects a new 32 bit ISN. The generator is bound to a (possibly fictitious) 32 bit clock whose low order bit is incremented roughly every 4 microseconds. Thus, the ISN cycles approximately every 4.55 hours. Since we assume that segments will stay in the network no more than the Maximum Segment Lifetime (MSL) and that the MSL is less than 4.55 hours we can reasonably assume that ISN's will be unique.

For each connection there is a send sequence number and a receive
sequence number. The initial send sequence number (ISS) is chosen by the data sending TCP, and the initial receive sequence number (IRS) is learned during the connection establishing procedure.

For a connection to be established or initialized, the two TCPs must synchronize on each other's initial sequence numbers. This is done in an exchange of connection establishing segments carrying a control bit called "SYN" (for synchronize) and the initial sequence numbers. As a shorthand, segments carrying the SYN bit are also called "SYNs".
Hence, the solution requires a suitable mechanism for picking an
initial sequence number and a slightly involved handshake to exchange the ISN's.


Apart from what @Zac67 said:

Predictability Prevention: If ISN(initial seq numbers) started at 0, attackers could more easily predict future sequence numbers in a connection. This would make it simpler for them to hijack sessions or inject malicious data. Randomization makes such attacks significantly harder.

Protection against Old Duplicate Packets: Even if a TCP connection terminates, old packets from that connection might linger in the network. If new connections always started with an ISN of 0, these old packets could be mistaken for legitimate data in the new connection, causing confusion and errors. Random ISNs reduce the likelihood of overlap with old segments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.