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.
Why can NMAP not show some ports
nmap
Best Answer
Are you specifying which ports to scan? be default nmap only scans the known ports for each protocol. From the documentation:
You must specify -p for a wider range: