The simplest case is listing single hostnames or IP addresses. If you want to scan a subnet of IP addresses, you can append '/mask' to the hostname or IP address. mask must be between 0 (scan the whole internet) and 32 (scan the single host specified). Use /24 to scan a class 'C' address and /16 for a class 'B'.
Nmap also has a more powerful notation which lets you specify an IP address using lists/ranges for each element. Thus you can scan the whole class 'B' network 192.168.*.* by specifying '192.168.*.*' or '192.168.0-255.0-255' or even ´192.168.1-50,51-255.1,2,3,4,5-255'. And of course you can use the mask notation: '192.168.0.0/16'. These are all equivalent. If you use asterisks ('*'), remember that most shells require you to escape them with back slashes or protect them with quotes.
Another interesting thing to do is slice the Internet the other way. Instead of scanning all the hosts in a class specifying hosts to scan, see the examples section in the NMap manual pages.
Copyright © JV Software