I'm a web dev who is trying to get a better handle on security. I'm trying to figure out a way (on Linux/Debian based distros) to list all computers on the same LAN my netbook is on. I tried "arp -n" but I don't feel it's a complete list, as my iPhone is on the same wi-fi router as my netbook, and that didn't come up. Is there some better way to get a full list of machines that are all sharing the same gateway?

link|improve this question

77% accept rate
feedback

3 Answers

up vote 3 down vote accepted

Get nmap. It's the program Trinity used in The Matrix and you can do a scan to find all of the devices that are connected to the LAN you're on and more.

Here's the reference guide.

link|improve this answer
OK. Looks like "sudo nmap -sL 123.123.123.*" is what I'm looking for, or maybe -sP instead of -sL. Thanks! – CaptSaltyJack Jul 15 '11 at 18:22
My pleasure. Let me know how that works for you. – Kalamane Jul 15 '11 at 18:29
Works great! Thanks. – CaptSaltyJack Jul 18 '11 at 18:17
feedback

arp -n only shows you machines on your LAN that your machine has already talked to. You can get that list to populate better by pinging the broadcast and all-hosts multicasts addresses:

The "all ones" (in binary) broadcast address. Note that most IP stacks will translate this to the subnet broadcast addresses for all subnets you're attached to:

ping 255.255.255.255

The subnet broadcast address for your current subnet. So assuming you're on 192.168.1.0/24:

ping 192.168.1.255

The "all hosts" multicast address. I like this one a lot because it's more likely to find hosts configured for other IP subnets, that happen to be attached to the same Ethernet LAN as you:

ping 224.0.0.1

Note that this method, and the other methods I've seen mentioned in other Answers so far, only look for IP-reachable hosts on the current network. That's probably all you need to care about, but it's possible for an attacker to snoop on, or do bad things to, a network without being visible via IP.

link|improve this answer
feedback

Hunt is a command line tool that is capable of building a list of machines as they broadcast over the network for information. It uses TCP, UDP, ICMP and ARP data to build a list of active MAC addresses on a network. It is a passive tool that works by listening on the wire.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.