Blog du Tristank

So terrific that 3 of 4 readers rated it "soporific"

Quickly* pinging everything on a subnet

For when you don’t remember that you set your wireless gateway’s static IP to .253, and it’s not showing up in the list of leases on the DHCP server (predictably, but it’s not helping your memory, and it’s not in the arp cache either…), and you need to reboot it using the web interface, all through remote desktop from another suburb. Of course, if it’s well ‘ard and doesn’t respond to pings, that won’t work, but you might be able to fish the MAC address out of the ARP cache after it’s run once. 

From a CMD prompt:

FOR /L %I in (1,1,255) DO PING 10.0.0.%I -n 1 -w 100 >> pung.txt

Notes:
 – pung is the past tense of ping, of course.
 – I did briefly turn to Powershell to try to get it done, but then realized I still haven’t worked out the Powershell thing. Is it simpler in this case?
 – the bracketed numbers are start, increment/step and finish.
 – ping 10.0.0.1 -n 1 -w 100    pings the address once only, with a short 100ms timeout.
 – * – wow, an actual asterisk thing! “Quickly” refers to the speed of typing the command out, not the speed of the actual pinging process. Using Powershell or IronPython or another cool language, you could probably throw together a mean multithreaded ping (pure speculation on my part) that completes in ten seconds flat; this ain’t that.