The Three-Way Handshake, Ports, and Protocols

Learn about the three-way handshake, ports, and protocols and how they're used with Nmap.

What is a three-way handshake?

Before we start working with Nmap, it’s important that we understand how the three-way handshake works. Most of the scans we’ll be doing with Nmap will involve the requests and responses in a three-way handshake.

The three-way handshake is the protocol by which two computers establish a secure communication channel. There are three steps involved, which is why it’s called three-way handshake.

Establishing connection

Let’s assume there are two computers, a server and a client. Now, this is how a three-way handshake establishes a connection between two computers:

Press + to interact
Establishing a connection in a three-way handshake
Establishing a connection in a three-way handshake
  1. The client sends a packet of data with the SYN (synchronize) flag.

  2. The server responds with an SYN-ACK (synchronize-acknowledgment) flag back to the client.

  3. The client responds to the server with the ACK flag. ...

Get hands-on with 1400+ tech skills courses.