tags:

views:

2056

answers:

5

Is there a Mac/Unix commands that lets you see the local network in terms of machines/IP addresses? If there's something on the Mac that is gui-based that would be great too.

+3  A: 

ping the broadcast address (the broadcast address is printed as part of the output to "ifconfig en0")

The hosts answering are on your local network. (you may also try "arp -a" but that only keeps track of recently contacted hosts so you may want to run it after the broadcast).

diciu
I imagine on most home networks directed-broadcast is probably not disabled so this works great in that scenario, +1
Jay
On my office network it works fairly well. However, windows hosts don't answer the broadcast - I imagine due to security built into SP2 - so your nmap solution is likely better.
diciu
+1  A: 

The only way to reliably do this is to scan the network using ping sweeps and similar techniques looking for open ports etc on various addresses. You can do that with nmap which is available for OS X. See http://www.netadmintools.com/art406.html for an example.

EDIT: Just to clarify, as diciu pointed out, you can usually ping the broadcast address and/or use your arp cache as well. This will probably work for most home networks where directed broadcast is allowed.

If not, then you would need to run a ping sweep with a tool like nmap to individually check each address for an available host. Many network discovery/scanning tools can check for more than just ping, looking for listening ports, SNMP, etc. as well.

Jay
A: 

You can use Nmap but that seems to be a bit much for your stated goals.

OS X ships with netstat, or open Up /Applications/Utilities/Network Utility.app, perhaps this will work for you?

EDIT: oops. netstat doesn't do what I thought.

M. Dave Auayan
+2  A: 

There is a program called Bonjour Browser that will list well known services that have registered on your local network. I believe that most Mac's have one or more registered protocols by default.

jdizzle
+1  A: 

Try IP SCanner 2.5 for OSX. http://10base-t.com/ Looking for others, but thats the only real one I've found for OSX.

Howard