I am using linux. How do you normally go about finding machines on the local network?
I think the right approach would be to inspect the LAN at a level lower that IP, then ARP scanning is a better choice.
See my answer to this duplicate question, I suggested nast -m.
Many methods are possible. I would start with an nmap scan.
Use arpwatch, it lets you find other machines without scanning the network
As an alternative to scanning your network, if you have access to the switch or router you can check the router directly for it's arp table which should list all connected machines and their MAC addresses. If you're just looking to map your network and see what's online, this may be a better/easier solution.
If you have a decent router/switch, you may also be able to grab this info over SNMP rather than logging into the equipment directly, which has it's own set of advantages when it comes to regularly mapping your network.
A nice graphical tool is Auto Scan network (http://autoscan-network.com/). It shows open ports too. For Windows, I'd suggest Look@lan, which does the same thing.
I agree nmap, and arpwatch are good tools,you can use also fping.
Here I complete an existant python script from bortzmeyer that do the job for you, the script is very fast. but first you have to install ipcalc module and psyco
import os, sys, re from threading import Thread import psyco, ipcalc
class ping(Thread): def init(self, ip, version): Thread.init(self) self.ip =ip self.version=version self.tab=("No response", "Partial Response", "Alive")
def run(self): try: if self.version==4: req=os.popen("ping -c2 -q "+self.ip, "r") elif self.version==6: req=os.popen("ping6 -c2 -q "+self.ip, "r") while 1: reponse=req.readline() if not reponse: break stat = re.findall(re.compile("(\d) received"), reponse) if stat: print "Status ", self.ip, " ",self.tab[int(stat)] except: raise sys.stderr.write("Error in ping.\n") sys.exit(-1)
if __name__=='__main__': psyco.full() try: address=sys.argv1 if address.find('/') > 0: net=ipcalc.Network(address) else: net=[address] for ip in net: p=ping(str(ip), 4) p.start() except: pass
I use (will be available for download when it's ready) a tool that I wrote which handles both DNS/DHCP administration and SNMP walks of the switches. If something isn't in DHCP, I at least get a MAC address from the switch, but we've made a policy decision to put everything in DHCP, even if the machines themselves are statically IPed, just to aid in tracking address space.
If you're talking about finding something that perhaps you didn't put there, I'd agree with nmap. Or, if you're worried about legal/political issues, just a script that wraps ping...