10

I am using Nmap 7.12 on Mac OS X. The host that is being scanned is a Linux RHEL server in VirtualBox. I can ping the server and receive ICMP replies and vice versa. I am scanning an IP inside the subnet as per the below information with the Nmap command:

root# Nmap -sS 192.168.0.171
Starting Nmap 7.12 ( https://nmap.org ) at 2016-05-28 00:41 SGT
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 0.49 seconds

When I run tcpdump to see the traffic and where it's going, it shows all these ports being scanned when the Nmap command is run, and the Nmap scan completes successfully.

root# nmap -sS 192.168.0.171
Starting Nmap 7.12 ( https://nmap.org ) at 2016-05-28 00:52 SGT
Nmap scan report for 192.168.0.171
Host is up (0.00092s latency).
Not shown: 998 filtered ports
PORT   STATE SERVICE
22/tcp open  ssh
53/tcp open  domain
MAC Address: 08:00:27:58:0E:98 (Oracle VirtualBox virtual NIC)
Nmap done: 1 IP address (1 host up) scanned in 5.71 seconds

However, as soon as I stop tcpdump and re-run the Nmap scan, it then states that the host is down.

What am I missing here?

  • 2
    The key here- to those trying to answer, is that the scan only works when the OP is in promiscuous mode. It doesn't look like an issue with the command but rather something in the conriguration of the network or network interfaces. Do you have multiple NICs or IP addresses? Can you post tcpdump output? – multithr3at3d Jun 29 '16 at 16:36
  • Yes, this definitely sounds like a promiscuous mode issue. Please show us the output of running ip addr show on the server that you are directing the scan at, initially at least while tcpdump is not running. Also, is that server running anything like fail2ban or friends? – a CVn Jun 29 '16 at 18:03
  • What's you tcpdump command and params? – Shane Andrie Dec 13 '17 at 21:38
  • have you figured it out? I have the same issue. – Krypton Mar 12 '18 at 22:32
2

Try nmap -Pn 192.168.0.171, also confirm try nc -z -v -w 1 192.168.0.171 80 if that does not work.

  • Isn't -Pn only used for passive scans? – Yokai May 28 '16 at 0:10
  • -Pn option didn't do the trick. nc didn't work as port 80 is not open on that host. – anxious May 28 '16 at 9:11
  • Have you tried using the --packet-trace option to find what is happening? Add -vv to get as much info as possible. – BMC May 28 '16 at 16:50
  • 1
    -Pn is actually used to skip the Ping. That can be used when the host is filtering ICMP packets – Black Magic Mar 3 '17 at 7:58
0

You can use the -PA and/or -PS commands to check if a host is up or down.

For example:

nmap 192.168.0.171 -PA(port#) -PS(port#) -vv -T5

The -PA and -PS will check if a host is running a stateful or stateless firewall. The -vv is extra verbosity for more output to the terminal. The -T5 is how aggressive the scan will be. Try these out and see what your result is.

(EDIT)

Don't add a space between -PA -PS and the port number. It should look like this:

-PA80 or -PS80

You might also look into this video where the creator of nmap explains some advanced functions of the tool.

https://www.youtube.com/watch?v=Hk-21p2m8YY

  • I've tried the commands you mentioned as still advises host is down. I've also tried to do a ping scan nmap -sn 192.168.0.171 and says host is down. As previously mentioned, once I run tcpdump, nmap scans successfully. – anxious May 28 '16 at 9:05
  • In that case give this command a try: nmap -sP -vv -T5 --packet-trace <IP> – Yokai May 28 '16 at 9:33
  • It says host being down still. Any reason why nmap scan would work when tcpdump is initiated? – anxious May 28 '16 at 17:18
  • Ignore last message. This is my reply. It says host being down still. Any reason why nmap scan is successful when tcpdump is initiated? – anxious May 28 '16 at 17:31
  • I can only imagine it has something to do with how the vnic is configured in the VM. I had this issue once myself and changing from VMware to virt-manager solved the issue for me. It could be a bug but since I no longer have the issue I haven't pursued looking into it more. – Yokai May 28 '16 at 21:53
-3

Use command

nmap -sT -A -n -T4 --top-ports=20 (host address)

-A will do aggressive scan

  • This answer is very light on details. Why would an aggressive scan help? How does -A address the tcpdump oddity? – schroeder Dec 3 '16 at 7:10
  • 1
    The one switch that would avoid the issue mentioned in the original question (-Pn) is also absent from your command line – iwaseatenbyagrue Mar 3 '17 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.