Find all active ip's in a subnet

nmap -v -sP 192.168.0.0/16 10.0.0.0/8
nmap for windows and other platforms is available on developer's site: http://nmap.org/download.html nmap is robust tool with many options and has various output modes - is the best (imho) tool out there.. from nmap 5.21 man page: -oN/-oX/-oS/-oG : Output scan in normal, XML, s|
Sample Output
Starting Nmap 5.21 ( http://nmap.org ) at 2010-07-01 XX:XX EDT
Initiating Ping Scan at XX:XX
Scanning 4096 hosts [2 ports/host]
Completed Ping Scan at XX:XX, 1.50s elapsed (31 total hosts)
Initiating Parallel DNS resolution of 4096 hosts. at XX:XX
Completed Parallel DNS resolution of 4096 hosts. at XX:XX, 0.00s elapsed
Nmap scan report for 10.0.0.1 [host down]
[... snip ...]
Nmap scan report for host1.localdomain (10.0.0.21)
Host is up (0.00031s latency).
Nmap scan report for host2.localdomain (10.0.0.22)
Host is up (0.00041s latency).
Nmap scan report for 10.0.0.23
Host is up (0.00039s latency).
Nmap scan report for host3.localdomain (10.0.0.24)
Host is up (0.00037s latency).
Nmap scan report for 10.0.0.25 [host down]
Nmap scan report for 10.0.0.26 [host down]
Nmap scan report for 10.0.0.27 [host down]
Nmap scan report for host4.localdomain (10.0.0.28)
Host is up (0.0047s latency).
Nmap scan report for 10.0.0.29 [host down]
Nmap scan report for 10.0.0.30 [host down]
Nmap scan report for 10.0.0.31
Host is up (0.0033s latency).
Nmap scan report for 10.0.0.32
Host is up (0.0031s latency).
Nmap scan report for 10.0.0.33 [host down]
Nmap scan report for 10.0.0.34 [host down]
Nmap scan report for 10.0.0.48 [host down]
[... snip ...]
Nmap scan report for 10.0.0.49 [host down]
Nmap scan report for 10.255.255.255 [host down]
Nmap done: 4096 IP addresses (7 hosts up) scanned in XXX seconds

6
By: anapsix
2010-07-14 19:53:02

2 Alternatives + Submit Alt


  • 13
    sudo arp-scan -I eth0 192.168.1.0/24
    sata · 2010-07-01 02:46:41 3
  • documents all active ips on a subnet and saves to txt file. Show Sample Output


    -9
    FOR /L %i IN (1,1,254) DO ping -n 1 10.254.254.%i | FIND /i "Reply">> c:\ipaddresses.txt
    barrytrujillo · 2010-06-29 21:02:21 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

Considering A New Car?

You should consider a Tesla. Get 6 Months Free Supercharging.

Free Supercharging

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: