Module 1 · Addresses, Subnets and Packets · Lesson 3 of 9

Reading packets: the TCP handshake

Capture a connection to a lab web service and pick out SYN, SYN-ACK and ACK, with frame numbers and ports.

In this lesson · about 28 minutes

  • Explain the three packets that set up a TCP connection
  • Use display filters to isolate one TCP stream
  • Record source and destination ports from a capture

Whiteboard · watch and try

Three ways a call can go

Press Play. The tutor draws the handshake as a phone call, then the two ways it fails.

5 steps
Press Play and the tutor will talk you through it while writing on the board. Pause any time to write on the board yourself.

Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.

Before TCP sends any data, the two sides agree to talk with a three-way handshake:

  1. SYN: the client says "I'd like to connect" and picks a random ephemeral source port (often above 32768).
  2. SYN-ACK: the server, if something is listening on that port, replies "OK, and I'd like to connect back".
  3. ACK: the client confirms. The connection is established and data can flow.

If nothing is listening, the server usually answers the SYN with a RST (reset). If a firewall silently drops the SYN, the client hears nothing and eventually times out. Those two failures look different in a capture, and that difference is evidence.

Display filters you'll use

FilterShows
tcpAll TCP packets
ip.addr == 10.10.10.5Packets to or from one host
tcp.port == 80Packets to or from port 80
tcp.flags.syn == 1Packets with the SYN flag set: that's the SYN and the SYN-ACK, but not the final ACK
tcp.stream eq 0Every packet of one TCP conversation, including the whole handshake

Display filters (above) hide packets you already captured. Capture filters (like tcp port 80, a different syntax) decide what is recorded in the first place. Don't mix them up.

Try it · watch it move

The TCP handshake as a phone call

Pick a case and step through it. Watch the arrows on the left and the capture lines underneath appear together: that's how a recording of the call looks.

💻Your computer10.10.10.20🗄️Server10.10.10.5not connected
what a packet capture shows
(nothing captured yet)
Step 1 of 6Before any real data is sent, TCP sets up a connection with three short messages. Think of starting a phone call: you don't start talking until you know the other person is there.

Hands-on lab (simulated terminal)

Lab: capture a handshake with tshark

You're on the lab client 10.10.10.20. A test web server is listening on 10.10.10.5 port 80. tshark is the command-line version of Wireshark. All addresses are private lab addresses.

Step 1 of 3. Type each command and press Enter. Nothing runs on your computer.

Lab: capture a handshake with tshark

1. Start a capture on interface eth0 that saves to handshake.pcap and stops after 10 packets. Use sudo (the lab password is lab).

analyst@lab-client:~$

Performance-based question (PBQ)

Annotate the capture

Use the stream 0 output from the lab above to fill in your evidence notes.

Pick the value for each note.

  • Frame carrying the client's SYN
  • Frame carrying the server's SYN-ACK
  • Frame that completes the handshake
  • Client's (source) port
  • Server's (destination) port
  • Frame where the client starts closing the connection
0 of 6 answered

Check your understanding0 of 3 correct

Question 1

1.Which TCP flags identify a typical connection setup?

Question 2

2.Why doesn't the filter tcp.flags.syn == 1 show the complete handshake?

Question 3

3.A client sends SYN to port 8080 and immediately gets RST back. What does that most likely mean?

Quiz score: 0 of 3

Tip: answer every quiz question correctly first.

Noviq Academy is free and for learning. Every lab here is simulated with synthetic data and private lab addresses. Only capture traffic and test networks that you own or have written permission to test. Wireshark and pfSense are trademarks of their owners; this course is independent of them.