How it works...
Nmap is a port scanner; this means that it sends packets to a number of TCP or UDP ports on the indicated IP address and checks whether there is a response. If there is, it means the port is open; hence, a service is running on that port.
In the first command, with the -sn parameter, we instructed Nmap to only check whether the server was responding to the ICMP requests (or pings). Our server responded, so it is alive.
The second command is the simplest way to call Nmap; it only specifies the target IP address. What this does is ping the server; if it responds, then Nmap sends probes to a list of 1,000 TCP ports to see which one responds and how they do it, and it then reports the results showing which ports are open.
The ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access