Skip to main content


Showing posts from November, 2012

How to Ping a Class 3 or /24 Subnet on a network

Option 1 (Linux/ Unix Shell):
for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] && echo "192.168.1.$ip UP" >> ping-output.txt || : ; done

Note that -c operator was used on Solaris and may not work in other flavours so you may want to check manpages or try -n instead.

An example of above approach for given list of ip addresses;
for i in; do ping -c 1 $i > /dev/null; [ $? -eq 0 ] && echo "$i UP"; done

Option 2 (Linux/ Unix Shell):
Refer to Multiping bash script that uses ARP method and is more robust script to get you accurate details with MAC addresses.

Option 3 (Windows CMD):
for /L %I in (1,1,254) DO ping -w 100 -n 1 192.168.1.%I | find "Reply" >> ping-output.txt
Option 4 (Windows Powershell):Use below for Powershell in systems such as Microsoft Windows Server 2012. For ($i=1;1..25…