TCP SYN Ping
We can send a packet with the SYN (Synchronise) flag set to TCP port 80 (80 by default) and wait for a response. An open port should reply with a SYN/ACK (Acknowledge); a closed port would result in an RST (Reset). In this case, we only check whether we receive a response to infer whether the host is up. The specific state of the port is not significant here. The figure below is a reminder of how a TCP 3-way handshake usually works.
If you want Nmap to use TCP SYN ping, you can do so via the option -PS followed by the port number, range, list, or a combination of them. For example, -PS21 will target port 21, while -PS21-25 will target ports 21, 22, 23, 24, and 25. Finally, -PS80,443,8080 will target the three ports 80, 443, and 8080.
Privileged users (root and sudoers) can send TCP SYN packets and don’t need to complete the TCP 3-way handshake even if the port is open, as shown in the figure below. Unprivileged users have no choice but to complete the 3-way handshake if the port is open.
We will run nmap -PS -sn 10.200.6.0/24 to scan the target VM subnet. As shown in the output below, we discovered two hosts.
Terminal
root@ip-10-201-66-6:~# nmap -PS -sn 10.200.6.0/24
Starting Nmap 7.80 ( https://nmap.org ) at 2026-02-05 12:22 GMT
mass_dns: warning: Unable to open /etc/resolv.conf. Try using --system-dns or specify valid servers with --dns-servers
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Nmap scan report for 10.200.6.50
Host is up (0.070s latency).
Nmap scan report for 10.200.6.250
Host is up (0.068s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 33.88 seconds
Let’s take a closer look at what happened behind the scenes by looking at the network traffic on Wireshark in the figure below. Technically speaking, since we didn’t specify any TCP ports to use in the TCP ping scan, Nmap used the default TCP port, 80. Any service listening on port 80 is expected to reply, indirectly indicating that the host is online.
TCP ACK Ping
As you have guessed, this sends a packet with an ACK flag set. You must run Nmap as a privileged user to accomplish this. If you try it as an unprivileged user, Nmap will attempt a 3-way handshake.
By default, port 80 is used. The syntax is similar to TCP SYN ping. -PA should be followed by a port number, a port number range, a list, or a combination of them. For example, consider -PA21, -PA21-25 and -PA80,443,8080. If no port is specified, port 80 will be used.
The following figure shows that any TCP packet with the ACK flag set should receive a TCP packet with the RST flag set. The target responds with the RST flag set because the TCP packet with the ACK flag is not part of any ongoing connection. The expected response is used to detect if the target host is up.
In this example, we run sudo nmap -PA -sn 10.200.6.0/24 to discover the online hosts on the target’s subnet. We can see that the TCP ACK ping scan detected two hosts as up.
Terminal
root@ip-10-201-66-6:~# sudo nmap -PA -sn 10.200.6.0/24
sudo: unable to resolve host ip-10-201-66-6: Name or service not known
Starting Nmap 7.80 ( https://nmap.org ) at 2026-02-05 12:33 GMT
mass_dns: warning: Unable to open /etc/resolv.conf. Try using --system-dns or specify valid servers with --dns-servers
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Nmap scan report for 10.200.6.50
Host is up (0.070s latency).
Nmap scan report for 10.200.6.250
Host is up (0.069s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 36.64 seconds
If we peek at the network traffic shown in the figure below, we will discover many packets with the ACK flag set, sent to port 80 on the target systems. Nmap sends each packet twice. The systems that don’t respond are offline or inaccessible.
UDP Ping
Finally, we can use UDP to discover if the host is online. Unlike a TCP SYN ping, sending a UDP packet to an open port is not expected to elicit a reply. However, if we send a UDP packet to a closed UDP port, we expect to get an ICMP port-unreachable packet; this indicates that the target system is up and available.
In the following figure, we see a UDP packet sent to an open UDP port that does not trigger a response. However, sending a UDP packet to any closed UDP port can trigger a response indirectly, indicating that the target is online.
The syntax to specify the ports is similar to that of TCP SYN ping and TCP ACK ping; Nmap uses -PU for UDP ping. In the following example, we run a UDP scan and discover two live hosts.
Terminal
root@ip-10-201-66-6:~# sudo nmap -PU -sn 10.200.6.0/24
sudo: unable to resolve host ip-10-201-66-6: Name or service not known
Starting Nmap 7.80 ( https://nmap.org ) at 2026-02-05 12:38 GMT
mass_dns: warning: Unable to open /etc/resolv.conf. Try using --system-dns or specify valid servers with --dns-servers
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Nmap scan report for 10.200.6.50
Host is up (0.070s latency).
Nmap scan report for 10.200.6.250
Host is up (0.069s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 35.97 seconds
Let’s inspect the UDP packets generated. In the following Wireshark screenshot, we notice Nmap sending UDP packets to UDP ports that are most likely closed. The image below shows that Nmap uses an uncommon UDP port to trigger an ICMP destination unreachable (port unreachable) error.
Masscan
On a side note, Masscan uses a similar approach to discover the available systems. However, to complete its network scan quickly, Masscan is quite aggressive in the rate at which it generates packets. The syntax is quite similar: -p can be followed by a port number, list, or range. Consider the following examples:
masscan 10.200.6.0/24 -p443
masscan 10.200.6.0/24 -p80,443
masscan 10.200.6.0/24 -p22-25
Masscan is not installed on the AttackBox; however, it can be installed using apt install masscan.