Using nmap to scan an entire range

Leon asked:

I found many examples with nmap online, but I got curious and I could not find a more advanced command. For example, if I want to scan a rage of ip in this measure, 192.168.x.x, then from 192.160.0.0 to 192.168.255.255, what is the correct syntax? I cannot find it anywhere, I could only find with the last class, any idea? Thank you very much!

  • To be more precise, just on a port, we could say -p 80 for example.

My answer:


You can specify multiple hosts by CIDR; for instance 192.168.0.0/16.

The nmap man page shows several other ways to specify hosts, under the heading TARGET SPECIFICATION.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.