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.
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:
- SYN: the client says "I'd like to connect" and picks a random ephemeral source port (often above 32768).
- SYN-ACK: the server, if something is listening on that port, replies "OK, and I'd like to connect back".
- 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
| Filter | Shows |
|---|---|
tcp | All TCP packets |
ip.addr == 10.10.10.5 | Packets to or from one host |
tcp.port == 80 | Packets to or from port 80 |
tcp.flags.syn == 1 | Packets with the SYN flag set: that's the SYN and the SYN-ACK, but not the final ACK |
tcp.stream eq 0 | Every 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.
(nothing captured yet)
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.
1. Start a capture on interface eth0 that saves to handshake.pcap and stops after 10 packets. Use sudo (the lab password is lab).
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
Check your understanding0 of 3 correct
Quiz score: 0 of 3
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.