Search code examples
amazon-web-servicesnmap

Nmap can't find a listening port


I created a AWS instance today, and I am running a server and listen to 19999 port. let's see what I got:

root@ip-172-31-18-145:/home/ubuntu# sudo lsof -i -P -n | grep 19999
ssserver  20387            root    4u  IPv4  65547      0t0  TCP *:19999 (LISTEN)
ssserver  20387            root    5u  IPv4  65548      0t0  UDP *:19999 

But i couldn't connect my port on my remote client-side, so I was trying to use nmap. here what I got.

root@ip-172-31-18-145:/home/ubuntu# nmap -Pn 127.0.0.1

Starting Nmap 7.60 ( https://nmap.org ) at 2020-02-15 13:47 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000030s latency).
Not shown: 999 closed ports
PORT   STATE SERVICE
22/tcp open  ssh

My question is what's wrong with nmap? To make sure the port is listening I am running nc to try to listen the 19999 again. and here is the output:

ubuntu@ip-172-31-18-145:~$ nc -l 19999
nc: Address already in use

Solution

  • Nothing is wrong with nmap by default it only scan a 1000 most common ports. You can you use nmap -Pn 127.0.0.1 -p 19999