How can I list all IPs in the connected network, through Terminal preferably?

Using Ubuntu 10.10 command line, how can I list all IPs connected to my home network?

Ideally, it needs to be a CLI command as I will be running it from C++.


Solution 1:

Check out the arp-scan command - you will probably have to install it eg:

sudo apt-get install arp-scan

http://manpages.ubuntu.com/manpages/hardy/man1/arp-scan.1.html

And to give further detail:

sudo arp-scan --interface=eth0 --localnet

Where eth0 is your device. You can find your device with:

ifconfig

Solution 2:

Use nmap. example: nmap -sn 10.10.10.0/24 The arp cache will only tell you those that you have tried to contact recently.