Pcornel
Networking · IP Fundamentals › TCP

Three-way handshake

Cheat sheet · https://pcornel.dk/topic.php?topic=912

Back to the Topic

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.

Remember

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.

First 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.

Verify in this order

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

Where it usually breaks

physical/link dependency → local object state → peer/control state → policy → forwarding/adjacency → end-to-end result

Three-way handshake operational reference

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

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=912

Confirmation

Confirm action

Continue?