FreeKB - nmap Return hosts that are up
nmap - Return hosts that are up

The nmap command with the -sn option can be used to determine if a host (e.g. a target system) is up.

To determine if a single host is up using the IP address of the host.

nmap -sn 192.168.0.22

 

Or hostname, like this.

nmap -sn server1.example.com

 

If the target machine does not exist, is down, or is configured to block ICMP packets, something like this should be returned. On a Linux system, firewalld or iptables may be configured to block ICMP packets. You could configure firewalld to not block ICMP packets and then also flush the iptables rules since firewalld is the frontend for iptables.

Starting Nmap 6.40 ( http://nmap.org ) at 2020-08-30 11:17 CDT
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 3.01 seconds

 

If the host is up and not blocking ICMP packets, something like this should be returned.

Starting Nmap 6.40 ( http://nmap.org ) at 2020-08-30 11:17 CDT
Nmap scan report for 192.168.0.17
Host is up (0.00039s latency).
Nmap done: 1 IP address (1 host up) scanned in 0.02 seconds

 


A range of IP addresses

Here is how you would check a range of IP addresses.

nmap -sn 192.168.0.10-20

 


Scan every IP address in a subnet

Here is how you would scan every IP address in a subnet.

Note - This command may take a long time to complete, especially if your subnet contains a large number of hosts

For this reason, it's helpful to include the --status-every xx option

nmap -sn 192.168.0.0/24 --stats-every 5s

 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter f1038 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |