Ping as an IP scanner allows network admins to find devices and their IP addresses that are available and reachable on the network.
How to find and discover hosts on the network using Ping. Depending on the purpose and task, free tools that can be found in plentiful quantity on the Internet, but sometimes there is no tool available because you are at the user’s workplace, for example, where the guidelines prohibit the installation of non-approved tools the possibility to scan the network segment with Windows built-in tools.
This is where the execution of ping in a for-loop helps us. The following example pings all IPv4 addresses of a subnet from the command prompt in a one-liner to find the hosts that are currently online.
for /l %i in (1,1,255) do @ping 192.168.57.%i -w 1 -n 1 | find /i "ttl="
The for loop with counter 1 starts at 1 and ends at 255, which pings a Class C network with 255 hosts (CIDR /24). Class C are the most commonly used network segments, for example, if the netmask 255.255.255.128 (25) is used, the last octet figure 128 is taken.
-w 1 represents a timeout of 1 millisecond for each response.
-n 1 is the number of echo requests to send.
find /i "ttl=" only the ICMP responses will be output.
C:\> for /l %i in (1,1,255) do @ping 192.168.57.%i -w 1 -n 1 | find /i "ttl=" Reply from 192.168.57.1: Bytes=32 Time=2ms TTL=255 Reply from 192.168.57.10: Bytes=32 Time=301ms TTL=64 Reply from 192.168.57.70: Bytes=32 Time=295ms TTL=64 Reply from 192.168.57.80: Bytes=32 Time<1ms TTL=128 Reply from 192.168.57.112: Bytes=32 Time=1ms TTL=255
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?