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.
Three-way handshake
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.
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.
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
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
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
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.
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.
- Packet capture:
tcpdump -nn -i <if> host <ip> and port <p>or Wireshark filtertcp.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)
| Requirement | Reason |
|---|---|
| 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
| Segment | Carries |
|---|---|
| SYN | Client ISN, MSS, window scale, SACK-permitted, timestamps |
| SYN-ACK | Server ISN, acknowledgement of client ISN + 1, its own options |
| ACK | Acknowledgement 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
| Observation | Cause |
|---|---|
| SYN, then nothing | Filtered, routing problem, or host down |
| SYN answered by RST | Nothing listening on the port, or a firewall sending resets |
| SYN-ACK seen at the server but not the client | Asymmetric path or a firewall dropping the return traffic |
| Handshake works, large transfers stall | MSS 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.
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 capture | Meaning |
|---|---|
| SYN repeated, no reply | Packet lost or filtered on the way |
| SYN answered by RST | Port closed or actively rejected |
| SYN-ACK seen, no final ACK | Return 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
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
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%Quick lookup tables
Three-way handshake operational reference
Topic-specific bounded interpretation: known-good state, suspicious signatures and the next technical proof boundary.
| Handshake signal | Known-good interpretation | Suspicious / broken state | Next boundary |
|---|---|---|---|
| SYN | Leaves intended source with expected tuple/options | Absent, wrong source/VRF, repeated with no progress | Source routing / local policy |
| SYN-ACK | Returns for same translated/original flow | Missing, wrong tuple, unexpected MSS/options | Listener / return path / stateful policy |
| RST | Deliberate rejection can be localized | Unexpected origin or immediate reset after accept | Endpoint vs middlebox ownership |
| Final ACK | Reaches server and completes establishment | Client receives SYN-ACK but server stays embryonic | Reverse path / NAT / capture scope |
| First application bytes | Transport carries expected protocol | Established socket but no protocol progress | TLS / application / backend |