I am using linux. How do you normally go about finding machines on the local network?
-
2Before you do any sort of scanning, ensure you have proper authorization first. In most organizations this is a fireable offense.– K. Brian KelleyOct 8, 2009 at 2:26
-
6Fireably? Really? Do you work for the NSA? Reprimandable, definately. Disciplinable, maybe. But fireable? Must be the BOFH...– Mark HendersonOct 8, 2009 at 2:32
-
4Can we please try to remember that what is and is not possible in the sense of fireable is location dependent. Just because it can't happen where I am doesn't mean it can't happen elsewhere. I would also assume we are talking about someone who hasn't been authorised to perform a scan.– John GardeniersOct 8, 2009 at 10:59
-
2en.wikipedia.org/wiki/Randal_L._Schwartz– Joe CasadonteOct 8, 2009 at 12:37
-
1superuser.com/questions/261818/…– Ciro Santilli OurBigBook.comNov 30, 2015 at 11:32
8 Answers
Sure, install nmap and then run:
nmap -sP 192.168.0.1-254
Of course you'll need to replace the IP range with the appropriate values for your network.
-
This only works is your machines are configured to not ignore pigs. An ARP based approach would be better IMHO.– drAlberTOct 8, 2009 at 9:00
-
nmap should actually use arp if it believe you're on the same network and nmap is run as root. It can be forced with the -PR option as well. Oct 8, 2009 at 14:06
-
5AlberT my machines always ignore pigs, it is the cows that get them every time. Also ICMP echo.– railmeatOct 9, 2009 at 0:20
-
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.
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[0])]
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...