Sending multiple pings with Python
<p>How can I ping <code>192.168.0.1</code> - <code>192.168.0.254</code> all at once? Trying to make the script run faster as it takes several minutes to finish. </p>

<pre><code>import os
import subprocess


ip = raw_input("IP Address? ")
print "Scanning IP Address: " + ip

subnet = ip.split(".")

FNULL = open(os.devnull, 'w')

for x in range(1, 255):
    ip2 = subnet[0]+"."+ subnet[1] +"."+ subnet[2] +"."+ str(x)
    response=subprocess.Popen(["ping", "-c", "1", "-n", "-W", "2", ip2], stdout=FNULL, stderr=subprocess.STDOUT).wait()
if response == 0:
    print ip2, 'is up!'
else:
    print ip2, 'is down!'
</code></pre>

<p>Or you could ping them all with one ping to the subnet broadcast address. So if your subnet is <code>255.255.255.0</code> (also known as <code>/24</code>) then just ping <code>192.168.0.255</code> and <em>normally</em> everyone will ping back. </p>

python