Skip to main content

Nmap: how to Exclude Targets from a Scan (part-7)

Exclude Targets from a Scan


The --exclude option is used with Nmap to exclude hosts from a scan.

Usage syntax: nmap [targets] --exclude [target(s)]

$ nmap 192.168.10.0/24 --exclude 192.168.10.100
Starting Nmap 5.00 ( http://nmap.org ) at 2009-08-08 20:39 CDT
Interesting ports on 192.168.10.1:
Not shown: 996 filtered ports
PORT
STATE
SERVICE
20/tcp closed ftp-data
21/tcp closed ftp
23/tcp closed telnet
80/tcp open
http
...
Excluding a single IP fromhow  a scan


The --exclude option is useful if you want to exclude specific hosts when scanning a
large number of addresses. In the example above host 192.168.10.100 is excluded
from the range of targets being scanned.


The --exclude option accepts single hosts, ranges, or entire network blocks (using

CIDR notation) as demonstrated in the next example.

$ nmap 192.168.10.0/24 --exclude 192.168.10.100-105
Starting Nmap 5.00 ( http://nmap.org ) at 2009-08-08 20:39 CDT
...
Excluding a range of IP addresses from a scan