Module 10: Network Defender · 7 min read

Packets, ports and the handshake

Everything on a network travels in packets: small pieces of data with a source address, a destination address and, for TCP and UDP, a source and destination port. The port says which program the data is for: 443 for HTTPS, 22 for SSH, 53 for DNS.

The three-way handshake

TCP (used by the web, email and remote logins) opens every connection the same way: the client sends SYN, the server answers SYN-ACK, the client confirms with ACK. Only then does data flow.

tcpdump

10.0.0.23:51544 > 10.0.0.80:443  Flags [S]    (client: let's talk?)
10.0.0.80:443 > 10.0.0.23:51544  Flags [S.]   (server: yes)
10.0.0.23:51544 > 10.0.0.80:443  Flags [.]    (client: great)

Tip: UDP (DNS, video calls, VPNs like WireGuard) has no handshake: packets are just sent. That's faster, and it's why UDP is harder to scan and easier to spoof.

Check yourself: In tcpdump, what does Flags [S.] mean?

Practice: Pick out the server's answer in a real-looking capture.