Reputation: 1301
How can I find out the IPs of all the currently active machines on my LAN? How can I write a general program which will work on any subnet?
I'm doing this currently:
Is there anyway to do this other that manually enter subnet mask(increment the IP addresse) and hence reach all the machines(and thus get their IPs)?
Upvotes: 3
Views: 2118
Reputation: 11626
You should send out a ICMP echo message to all hosts in the subnet. For example, if you subnet is 192.168.1.0/24 send a ICMP ping to 192.168.1.255 and all hosts would respond.
[06:43:11 :~]$ ping 192.168.0.255
PING 192.168.0.255 (192.168.0.255): 56 data bytes
64 bytes from 192.168.0.12: icmp_seq=0 ttl=64 time=0.159 ms
64 bytes from 192.168.0.1: icmp_seq=0 ttl=64 time=5.581 ms
64 bytes from 192.168.0.12: icmp_seq=1 ttl=64 time=0.135 ms
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=5.540 ms
^C
--- 192.168.0.255 ping statistics ---
2 packets transmitted, 2 packets received, +2 duplicates, 0.0% packet loss
round-trip min/avg/max/stddev = 0.135/2.854/5.581/2.707 ms
[06:43:21 :~]$
Upvotes: 2
Reputation: 533820
You can use DNS, DynamicDNS, WINS, LDAP or Active Directory for each computer to store its IP address is a central repository. You can query this repository to find all the IP address for your local network.
However, if you don't have such a repository, you need to scan your networks IP address like any hacker would.
Upvotes: 0