Nmap checks which network ports a host appears to expose from the computer running the scan. It can help verify your server’s firewall rules and expected services.

Prepare the scan

Only scan servers you own or are authorised to test. To check public access, run the scan from an authorised computer outside the server’s network.

Install nmap through your operating system’s supported package source. Check the installation with:

nmap --version

Scan selected TCP ports

Replace 192.0.2.10 with the actual server address:

nmap -sT -p 22,80,443 192.0.2.10

This checks SSH, HTTP and HTTPS ports using a TCP connection scan. Adjust the list to the services you intend to test. To check a range:

nmap -sT -p 1-1000 192.0.2.10

A scan without a port selection normally checks 1,000 commonly used TCP ports, rather than every possible port. A listed service name is usually based on the port number; it does not prove which application is running.

Interpret the results

  • open: a service accepted the probe.
  • closed: the host responded, but no service accepted the connection on that port.
  • filtered: Nmap could not determine the state, often because a firewall blocked the probe.

UDP requires a separate scan and often administrator privileges. Its results can include open|filtered, which is inconclusive. Compare results with the server’s intended configuration; an open port alone is not proof of a vulnerability.