Discover if a host is online

Sometimes, you need only to find out whether a host is online and not run a a full port scan. To run a ping scan and disable port scan, the -sn flag is used:

root@kali:~# nmap -sn
Starting Nmap 7.01 ( ) at 2016-03-04 16:33 CET
Nmap scan report for
Host is up (0.00045s latency).
Nmap done: 1 IP address (1 host up) scanned in 0.02 seconds

Notice how this query took only 0.02 seconds, since no port scans were run.

We can also specify the range of IP addresses that will be checked. One way to do this is by using the CIDR notation. For example, to scan the IP addresses in the range of –, we can use the CIDR notation of


Sometimes, however, network administrators will make their systems ignore ping requests, which means that you will not be able to discover which hosts are online using the ordinary ping sweep. Nmap does provide some methods to mitigate that, as you will see in the next chapter.

Geek University 2021