Search code examples
apache-zookeepernmapnetstat

use nmap to detect port opened by zookeeper process


When I use the command below to find the open ports in my local linux, I didn't see the "2181" port opened by zookeeper process.

nmap localhost 

It's my understanding that zookeeper is a Java (or other JVM compatible) process, my first thought was that nmap couldn't detect the port of a Java process, then I used:

nmap -sV -p T:2181 localhost

it shows:

PORT     STATE SERVICE   VERSION
2181/tcp open  eforward?
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :

it shows that nmap indeed capable of giving out details of a opened port if the port is given. Then how can I configure nmap to find ALL the open ports (Java process or not) in the first place? Or did I miss something?

P.S net tools like "netstat" can find the zookeeper process.


Solution

  • By default nmap only scans the 1000 most 'popular' ports in TCP. To scan all ports: nmap -p0-65535 <target> or (shorter): nmap -p- <target>.

    See: Port Specification and Scan Order