Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using CentOS 6.5 and Nmap 5.51

I want to find all alive IPs in a LAN between two IPs

Easily get the answer

sudo nmap -sP 192.168.1.100-200

my problem when my network can access to internet the total time spend is 1.78 seconds but when my network can't access to internet the total time spend is 17.79 seconds

output with internet

[mgmt_user@Management root]$ sudo nmap -sP 192.168.1.100-200

Starting Nmap 5.51 ( http://nmap.org ) at 2014-05-21 23:05 EEST
Nmap scan report for 192.168.1.106
Host is up (0.00054s latency).
MAC Address: 08:00:27:93:2E:C5 (Cadmus Computer Systems)
Nmap scan report for 192.168.1.126
Host is up (0.0013s latency).
MAC Address: 00:16:3E:63:64:A0 (Xensource)
Nmap done: 101 IP addresses (2 hosts up) scanned in 1.78 seconds

output without internet

[mgmt_user@Management root]$ sudo nmap -sP 192.168.1.100-200

Starting Nmap 5.51 ( http://nmap.org ) at 2014-05-21 23:02 EEST
Nmap scan report for 192.168.1.106
Host is up (0.00042s latency).
MAC Address: 08:00:27:93:2E:C5 (Cadmus Computer Systems)
Nmap scan report for 192.168.1.126
Host is up (0.0011s latency).
MAC Address: 00:16:3E:63:64:A0 (Xensource)
Nmap done: 101 IP addresses (2 hosts up) scanned in 17.79 seconds

repeat the command many time and have the same time

is there any link between Nmap and the internet ?

share|improve this question
1  
Can you please paste complete output of nmap command when your network does not have access to Internet? –  klerk May 21 at 21:42
3  
try -n to disable DNS resolution. –  derobert May 21 at 21:52
1  
try also --max-rtt-timeout 100ms, and --max-retries 0 to prevent any retransmissions –  klerk May 21 at 21:57
1  
OK, I'll post an answer once I'm home. –  derobert May 21 at 21:58
1  
I forgot to post it, feel free to accept the answer someone else put. –  derobert May 22 at 2:52

1 Answer 1

up vote 3 down vote accepted

Your nmap is trying to query DNS servers to resolve the hostnames associated with the IP addresses your scanning.

Because it cannot succeed to do so, it times out, but you get the extra delay in the meanwhile.

Use the -n option with nmap to avoid this. That would be:

sudo nmap -n -sP 192.168.1.100-200

If you had a properly configured local DNS server however, it would probably have answered quickly (usually saying that no hostname corresponds) and you wouldn't have noticed this problem in the first place.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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