Skip to content
Log In Sign Up info@muvcloud.com

Only Scan What You Own

Scan only hosts you own or have written permission to test. Scanning other people's systems can be illegal, breaks most providers' acceptable use policies, and is often reported as an attack. The examples use 203.0.113.10 for your own server; replace it with its address. Run the scan from a second machine you control, outside the server's network, so you see what the internet sees.

Install Nmap

sudo apt install nmap      # Ubuntu, Debian
sudo dnf install nmap      # AlmaLinux, Rocky Linux

Nmap is also packaged for macOS and other desktop systems.

Basic Scan

sudo nmap 203.0.113.10

Without options, nmap checks the 1,000 most common TCP ports, lists the open ones, and sums up the rest in a "Not shown" line:

PORT    STATE SERVICE
22/tcp  open  ssh
80/tcp  open  http
443/tcp open  https

With root rights nmap sends half-open SYN probes; without them it makes full TCP connections. For checking your own firewall the results are the same. The SERVICE column is only a guess from the port number.

Choose the Ports

OptionScans
-p 22One port
-p 22,80,443A list
-p 1-1024A range
-p-All 65,535 TCP ports
--top-ports 100The 100 most common

A full scan with -p- finds services on unusual ports, such as a database or an admin panel someone started and forgot. It takes longer, especially when a firewall drops packets silently.

Detect Service Versions

sudo nmap -sV -p 22,80,443 203.0.113.10

-sV talks to each open port and reports the software and, when it can tell, its version. Use it to spot an outdated service, or a port that answers with something other than what you expected.

When the Host Seems Down

Before scanning, nmap checks that the host is up. If the server's firewall blocks ping, nmap may report it as down and stop. -Pn skips that check and scans anyway:

sudo nmap -Pn 203.0.113.10

Scan UDP Ports

sudo nmap -sU -p 53,123,51820 203.0.113.10

UDP scans need root and are slow, because a closed or filtered UDP port often sends nothing back. Scan the few UDP ports you care about, such as DNS, NTP, or a WireGuard port, rather than all of them. A result of open|filtered means nmap could not tell which. The protocols are compared in TCP vs UDP.

Open, Closed, and Filtered

  • open: a program accepted the connection. The service is reachable from where you scanned.
  • closed: the host answered, but nothing listens on that port.
  • filtered: no answer, or an ICMP error came back. A firewall drops the packets, on the server or in front of it.

On a well-configured server, the ports you publish are open and everything else is filtered.

Compare with ss on the Server

On the server, list what is listening:

sudo ss -tulpn

Then compare the two lists. A port that ss shows on 0.0.0.0 or * but nmap reports as filtered is blocked by a firewall, so check that this is what you want. A port nmap finds open that you did not mean to expose needs a firewall rule, or the service should listen on 127.0.0.1 only. The ss output is explained in the ss command guide, and firewall rules in how to set up UFW and firewalld basics. Ports published by Docker can bypass both; see Docker port mapping.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations