nmap says port is closed while nestat says it's listening
Asked Answered
O

3

11

This is Ubuntu 12.04 env. I have a TCP service running on port 8020 on the box:

My question is:

Why port 8020 is not discovered in nmap as an open port while nestat says it's listening?

if i run

netstat -tuplen

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User           Inode       PID/Program name
tcp        0      0 127.0.0.1:9001          0.0.0.0:*               LISTEN      0          10564       1917/python    
tcp        0      0 127.0.0.1:8020          0.0.0.0:*               LISTEN      117        29259       4448/java       

But if i run

nmap -v -sT 127.0.0.1

Starting Nmap 5.21 ( http://nmap.org ) at 2012-08-10 08:51 PDT
Initiating Connect Scan at 08:51
Scanning localhost (127.0.0.1) [1000 ports]
Discovered open port 53/tcp on 127.0.0.1
Discovered open port 22/tcp on 127.0.0.1
Discovered open port 9000/tcp on 127.0.0.1
Discovered open port 631/tcp on 127.0.0.1
Discovered open port 9001/tcp on 127.0.0.1
Completed Connect Scan at 08:51, 0.04s elapsed (1000 total ports)
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00046s latency).
rDNS record for 127.0.0.1: hadoop-namenode-01
Not shown: 995 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
53/tcp   open  domain
631/tcp  open  ipp
9000/tcp open  cslistener
9001/tcp open  tor-orport

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds
       Raw packets sent: 0 (0B) | Rcvd: 0 (0B)
Ornithic answered 10/8, 2012 at 15:56 Comment(0)
P
8

By default nmap doesn't scan all ports. try this one.

nmap -sT -sU -p- 127.0.0.1
Photoengrave answered 10/8, 2012 at 16:10 Comment(0)
C
6

@Satish, you don't need to add -sU which will scan the UDP ports too, and take a while.

nmap -v -p 8020 127.0.0.1

This should be enough and instant.

Commercialism answered 15/8, 2012 at 23:6 Comment(0)
W
2

By default nmap scans only the well know ports. You specify a port by using the -p parameter.

To scan all ports : nmap -v -p "*" 127.0.0.1

To scan only port 8020 : nmap -v -p 8020 127.0.0.1

Westney answered 23/7, 2013 at 5:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.