Manage Learn to apply best practices and optimize your operations.

Techniques for improving Nmap port scan times

As we continue our series on using Nmap in the enterprise, SearchSecurity expert Michael Cobb provides commands that will help you adjust your Nmap scan times appropriately -- whether you want Nmap to run slow and quietly, fast and furious, or somewhere in between.

This Content Component encountered an error

This is the seventh in a series of tips on how to use Nmap in an enterprise network environment.

Your objectives for running an Nmap scan will determine how you want it to run: slow and quietly, fast and furious, or somewhere in between. Therefore, Nmap includes a variety of timing options that allow you to affect almost every aspect of a scan.

By default, Nmap is set to not abort a scan due to time -- no matter how long it may take to complete. This can be overridden with the Host Timeout option (--host_timeout), which sets the amount of time a scan will wait before giving up on an IP address. This can be useful when scanning network devices over a slow connection or when the scan comes across a device that is slow in responding.

Nmap's other timing options can basically be split into four categories: round trip time, delay, parallel host scanning and parallel port scanning. Round trip time is the number of milliseconds required to receive a response to an Nmap request. Nmap automatically adjusts its response time timeout during a scan. However, you can force it to use a larger timeout value using the Minimum Round Trip Time Timeout option (--min_rtt_timeout) if, for example, your network is experiencing dropped packets. The Maximum Round Trip Time Timeout (--max_rtt_timeout) is useful for ensuring an accurate scan across slow or problematic networks.

The Minimum Delay Between Probes option (--scan_delay) lets you set the delay between each probe frame to speed up or slow down an Nmap scan as required, allowing you to scan over a slow link or evade an intrusion prevention device, for example. Likewise, you can use the Maximum Delay Between Probes option (--max_scan_delay) to set an upper limit for the time that Nmap will delay between each request. This option can significantly slow the total scan time, but it can be useful on slow or congested WAN connections. The Parallel Host and Parallel Port scanning options set the minimum or maximum number of hosts or ports that are scanned simultaneously. These options can be used to improve the efficiency of an unattended batch scan or to allow Nmap scan results to display more quickly by reducing the number of simultaneous hosts being scanned.

If you don't want to configure all these options separately, you can use the predefined timing policies instead. These range from the slow, quiet and accurate to the fast, loud and not so accurate. These timing policy options (--timing) are useful for testing intrusion detection and intrusion prevention systems. By running each timing policy you can refine your network monitoring thresholds based on when and if alarm or packet filtering events occur. Unlike other Nmap commands, the location of a timing option on the command line is important, as the last option takes priority. This means that you can put a timing policy at the beginning of the command line and specify other individual timing options afterwards to create a customized combination of timings without having to specify every possible timing option on the command line. For example, the following sets the scan delay to three minutes instead of the paranoid setting of five minutes, while leaving its other policy settings unchanged:

nmap --timing paranoid --scan_delay 3000 scanreport.txt

Nmap technical manual

About the author:
Michael Cobb, CISSP-ISSAP, is a renowned security author with over 20 years of experience in the IT industry. He has a passion for making IT security best practices easier to understand and achievable. His website offers free security posters to raise employee awareness of the importance of safeguarding company and client data and of following good practices. He co-authored the book IIS Security and has written many technical articles for leading IT publications. Mike has also been a Microsoft Certified Database Manager and registered consultant with the CESG Listed Advisor Scheme (CLAS).

Next Steps

Learn how to create an inventory with nmap network scanning

Analyze your hosts and ports with Nmap

Join the discussion: Interpreting and acting on Nmap scan results

This was last published in August 2006

Dig Deeper on Open source security tools and software



Find more PRO+ content and other member only offers, here.

This Content Component encountered an error