How to find IP Hosts in Network using Ping

How to find IP hosts in network


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 (25) is used, the last octet figure 128 is taken.

Option -w 1 represents a timeout of 1 millisecond for each response.
Option -n 1 is the number of echo requests to send.
Option 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 Bytes=32 Time=2ms TTL=255
Reply from Bytes=32 Time=301ms TTL=64
Reply from Bytes=32 Time=295ms TTL=64
Reply from Bytes=32 Time<1ms TTL=128
Reply from Bytes=32 Time=1ms TTL=255

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 3

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

Your email address will not be published. Required fields are marked *