M BUZZ CRAZE NEWS
// general

How to see all computers connected to a network

By Gabriel Cooper

I am in a LAN and there are 3 Ubuntu, 2 Kubuntu, 2 Windows XP and 2 Windows 7. What commands or tools are available to see what PCs are connected to the LAN that it shows the name of the PC and the IP. Similar to tools like Angry IP that show all PCs in a LAN.

Note that I do not know the IPs or names of the computers connected to the LAN. So the tool or command should look for them to.

2

9 Answers

Arp-scan works great for me too...

If using Wi-Fi:

sudo arp-scan -l --interface=wlan0

-or if using ethernet:

sudo arp-scan -l --interface=eth0

(this last is practically identical to what Rajesh Rajendran posted; the -l standing for --localnet)

If you don't have arp-scan (it doesn't come with Ubuntu by default), just pull up a terminal and type:

sudo apt-get install arp-scan
6

Taken from Finding All Hosts On the LAN From Linux/Windows Workstation

for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] && echo "192.168.1.$ip UP" || : ;
done

But for a great tool, Nmap. Great for mapping networks.

4

The simplest thing is

$ sudo arp-scan --localnet
3

I always use nmap. To scan for all devices in your network, use:

nmap -sP 192.168.0.1/24

More here:

It is a great tool to know about. You may want to install nmap using:

sudo apt-get install nmap if you are using Debian or

sudo pacman -S nmap if you are using Arch.

3

As a possible GUI option, the best one I have seen is Angry IP as found in

Simply download the latest DEB package and install. Then run ipscan from Dash. Here is a screenshot:

enter image description here

5

arp

Address HWtype HWaddress Flags Mask Iface
iPhone-von-me.fritz.box ether 12:55:05:30:3c:df C wlp3s0
android-abcdefghijklmno ether 11:66:3f:71:04:d6 C wlp3s0
fritz.box ether 00:11:3f:46:37:c2 C wlp3s0
Blupiblu.fritz.box ether 71:88:cc:bb:dc:a6 C wlp3s0

ip neigh

ip neigh and hosts. NO nmap / sudo required.

Building on this, you can build a Python script:

#!/usr/bin/env python
"""List all hosts with their IP adress of the current network."""
import os
out = os.popen('ip neigh').read().splitlines()
for i, line in enumerate(out, start=1): ip = line.split(' ')[0] h = os.popen('host {}'.format(ip)).read() hostname = h.split(' ')[-1] print("{:>3}: {} ({})".format(i, hostname.strip(), ip))

Download via

wget 
1

If broadcast isn't disabled on your router...

You can ping the broadcast address.

ping -b 192.168.0

Will broadcast the ping command to every host within the 192.168.0/24 subnet.

Note: It's probably a good idea to keep broadcasting turned off though as that's how hackers can exploit a network using a DDOS Smurf attack. Basically, ping the broadcast address with a packet that has a spoofed destination address (ie the ip address of the victim). There's a little more to it than that but that's what Google is for.

Note: The same also works on Windows but you ping the actual broadcast address (not the subnet).

ping -b 192.168.0.255

Nmap is your friend

nmap -sP 192.168.0.1/24

If you have any question, nmap help is full of information.

  1. Script to send email in Shell and Powershell where it is asked to user credentials when you run the script.

  2. Script to check online devices in the network for both Linux and Windows Clients.

  3. Script to check disk space of devices detected by previous script for both Windows and Linux.