Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

Three-way handshake

Direct answer

The TCP three-way handshake establishes bidirectional transport state: the client sends SYN with its initial sequence number, the server answers SYN-ACK with its own sequence number plus acknowledgement, and the client completes with ACK.

When to use this

Use this Topic when IP reachability exists but a TCP service cannot establish, when SYN retransmissions or resets appear, or when you must separate path, listening-port, stateful-policy and application boundaries.

First 30 seconds

1. Test-NetConnection <host> -Port <p> / nc -vz <host> <p> — connects?

2. Capture at the client: SYN sent? SYN-ACK received?

3. No SYN-ACK → path, firewall or nothing listening; capture at the server to tell which.

4. RST from the server → port closed; RST from a firewall → policy.

5. Handshake OK but the application fails → TLS or application layer.

Operational verification

SYN leaves the client → reaches a listening server → SYN-ACK returns over the reverse path → final ACK → both sides ESTABLISHED

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Protocol standard + deployed implementation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformProtocol standard
Scope / prerequisiteUse this Topic when IP reachability exists but a TCP service cannot establish, when SYN retransmissions or resets appea…
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational verification and known-good state Verify boundary

For a known-good handshake, show the exact five-tuple and direction at each relevant boundary. The initial SYN should leave the chosen source/interface, reach the policy/listener side, and produce either SYN-ACK or a deliberate reject. The returning SYN-ACK must map to the same tuple after any NAT or load-balancing transformation, and the final ACK must arrive so the server no longer remains in embryonic state. Useful fields are flags, sequence/acknowledgement numbers, retransmission timing, TCP options, TTL/hop context and NAT/session identity. A completed handshake is transport establishment only: immediately verify the first expected application bytes or TLS ClientHello if the incident is actually above Layer 4.

Step 2 Verification & troubleshooting Narrow the fault

1. Verify IP path and return path.

2. Confirm destination port is listening.

3. Inspect the three-way handshake.

4. Look for retransmissions, zero window, resets and MSS/MTU symptoms.

5. Validate application request/response.

Step 3 Failure signatures and troubleshooting branches Narrow the fault

Branch on the first missing or contradictory handshake event. If the SYN never leaves the source, inspect route selection, local firewall and socket/API behavior. If SYN reaches the server side but no SYN-ACK returns, confirm the listener, backlog/resource pressure and local policy before blaming the network. If SYN-ACK is generated but disappears, trace the reverse route, asymmetric stateful-policy handling, NAT translation and ECMP/member path. A received RST is valuable evidence: determine whether it came from the endpoint, firewall or load balancer instead of treating all resets as identical. Repeated SYNs with exponential retransmission indicate non-completion, not root cause. Preserve one failing tuple and one known-good comparison so a different DNS answer, source address or load-balancer member does not invalidate the comparison.

Step 4 When the problem is really fixed Narrow the fault

Closure requires more than seeing ESTABLISHED in one table. Repeat the original client request using the same source, destination name/address, port and policy context; show the handshake completes without unexplained retransmission, then show the first application exchange succeeds and the expected response returns. If a configuration change was made, verify the previous failure signature disappears at the same observation boundary and check one adjacent known-good service or flow for regression. Do not convert a packet capture, session-table row or successful SYN-ACK into human review, production verification metadata or Evidence automatically. The authored model tells you what to observe; only a real captured observation can populate evidence truth state.

Step 5 Common mistakes Narrow the fault
  • Blaming the network when SYN-ACK is returned but the client firewall drops it.
  • Ignoring RST as a clue.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Command lookup Jump straight to Cisco syntax
Key points

A successful SYN/SYN-ACK/ACK proves that both directions carried the establishment packets to transport endpoints. It does not prove TLS, authentication, application readiness, sustained throughput or that a later data flow follows the same ECMP/stateful path.

Key checks
  • Packet capture: tcpdump -nn -i <if> host <ip> and port <p> or Wireshark filter tcp.stream eq <n>.
  • ss -tni (Linux) / netstat -ano (Windows) — connection state, RTT, retransmits and windows.
  • Test-NetConnection <host> -Port <p> / nc -vz <host> <p> — does the handshake complete?
  • show tcp brief (IOS) — TCP sessions to the device itself.
  • show interfaces <if> | include drops|errors — drops on the path.
ReferenceImportant terms & boundaries4 sections · depth on demand

Key operational limits

  • SYN, SYN-ACK, ACK establish a connection
  • Sequence and acknowledgement numbers track bytes

In depth

The three-way handshake in detail

The handshake synchronises the initial sequence numbers in both directions. In RFC 9293, each side sends a SYN with its initial sequence number (ISN), and the other side acknowledges it. The second and third messages are combined, which gives SYN, SYN-ACK, ACK. TCP implementations must also support simultaneous open, where both ends send a SYN at the same time. The MSS option may appear only in SYN segments. If no MSS option arrives, the sender must assume 536 bytes for IPv4 and 1220 for IPv6.

How ISNs are chosen (RFC 9293)

RequirementReason
A clock-driven counter (about every 4 µs, wrapping in about 4.55 hours)Old segments from earlier connections don't fit the new sequence space
ISN = M + F(addresses, ports, secret key)Outsiders can't predict ISNs, which prevents spoofed connections

What travels in each step

SegmentCarries
SYNClient ISN, MSS, window scale, SACK-permitted, timestamps
SYN-ACKServer ISN, acknowledgement of client ISN + 1, its own options
ACKAcknowledgement of server ISN + 1; data may follow
host$ sudo tcpdump -ni eth0 'host 10.30.0.15 and port 443 and tcp[tcpflags] & (tcp-syn) != 0'
10:41:02.100 IP 10.110.0.64.50414 > 10.30.0.15.443: Flags [S], seq 1830472001, win 64240, options [mss 1460,sackOK,TS val 1 ecr 0,nop,wscale 7]
10:41:02.101 IP 10.30.0.15.443 > 10.110.0.64.50414: Flags [S.], seq 409117, ack 1830472002, win 65160, options [mss 1460,sackOK,TS val 9 ecr 1,nop,wscale 7]
R1(config)# interface Tunnel10
R1(config-if)# ip tcp adjust-mss 1360

Handshake failures

ObservationCause
SYN, then nothingFiltered, routing problem, or host down
SYN answered by RSTNothing listening on the port, or a firewall sending resets
SYN-ACK seen at the server but not the clientAsymmetric path or a firewall dropping the return traffic
Handshake works, large transfers stallMSS or MTU problem; clamp MSS on tunnels

The SYN's options decide much of the connection's behaviour. Missing window scaling or SACK in a capture usually means a middlebox stripped them.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Quick reference

The TCP three-way handshake opens a connection: the client sends SYN with its initial sequence number, the server replies SYN-ACK with its own sequence number and acknowledges the client's, and the client sends ACK. Options such as MSS, window scaling and SACK are negotiated in the SYN packets.

Client → Server  SYN        seq=x
Server → Client  SYN, ACK   seq=y ack=x+1
Client → Server  ACK        ack=y+1

Documented example, not captured output.

Observation in a captureMeaning
SYN repeated, no replyPacket lost or filtered on the way
SYN answered by RSTPort closed or actively rejected
SYN-ACK seen, no final ACKReturn path or client-side problem

Mechanics and state ownership

TCP connection establishment creates two independent byte-number spaces, one for each direction. A client in SYN-SENT transmits SYN with an initial sequence number; a listening server that accepts the attempt allocates embryonic state, replies with SYN-ACK, acknowledges the client ISN plus one and announces its own ISN. The client ACKs the server ISN plus one and both sides can enter ESTABLISHED. SYN packets also carry capability negotiation such as MSS, SACK-permitted, timestamps and window scale, so the handshake is both state creation and parameter negotiation. NAT, stateful firewalls and load balancers may create parallel flow state at the same time, but their state is not identical to endpoint TCP state. A packet seen at one observation point cannot show it crossed every later boundary.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docProtocol standard + deployed implementation RFC 9293

Authoritative/upstream documentation reviewed for bounded claims in IP Fundamentals → TCP → Three-way handshake. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.rfc-editor.org/rfc/rfc9293.html · confidence 94%
Embedded reference data

Quick lookup tables

Three-way handshake operational reference

Topic-specific bounded interpretation: known-good state, suspicious signatures and the next technical proof boundary.

Handshake signalKnown-good interpretationSuspicious / broken stateNext boundary
SYNLeaves intended source with expected tuple/optionsAbsent, wrong source/VRF, repeated with no progressSource routing / local policy
SYN-ACKReturns for same translated/original flowMissing, wrong tuple, unexpected MSS/optionsListener / return path / stateful policy
RSTDeliberate rejection can be localizedUnexpected origin or immediate reset after acceptEndpoint vs middlebox ownership
Final ACKReaches server and completes establishmentClient receives SYN-ACK but server stays embryonicReverse path / NAT / capture scope
First application bytesTransport carries expected protocolEstablished socket but no protocol progressTLS / application / backend
Confirmation

Confirm action

Continue?