Why can NMAP not show some ports

nmap

when I do "nmap localhost", some open ports are listed and others aren't. For Example SSH on 22 is listed, but SSH on 10022 is not. Host's port 10022 in my case is NAT port forwarding to a VBoxHeadless VM SSH, and Host's port 22 is it's own SSH port. AT the same time both ports 25 and 10025 are shown, while h.p. 10025 is a real VBoxHeadless-provided SMTP server, and h.p. 25 just redirs there.

Best Answer

Are you specifying which ports to scan? be default nmap only scans the known ports for each protocol. From the documentation:

Nmap offers options for specifying which ports are scanned and whether the scan order is randomized or sequential. By default, Nmap scans the most common 1,000 ports for each protocol.

You must specify -p for a wider range:

-p (Only scan specified ports)
This option specifies which ports you want to scan and overrides the default. Individual port numbers are OK, as are ranges separated by a hyphen (e.g. 1-1023). The beginning and/or end values of a range may be omitted, causing Nmap to use 1 and 65535, respectively. So you can specify -p- to scan ports from 1 through 65535. Scanning port zero is allowed if you specify it explicitly. For IP protocol scanning (-sO), this option specifies the protocol numbers you wish to scan for (0–255).