list connected devices on network

How to List Devices Connected to Network in Linux

Whether you are a system administrator or not, it is important to regularly keep an eye on all the devices connected to your network. It helps you identify unknown devices that may have hacked into your Wi-Fi network and eating into your data bandwidth. In this article, we will look at how to list devices connected to network in Linux.


How to List Devices Connected to Network in Linux

Here are the steps to find all the devices connected to your network. We will use nmap tool to list devices connected to network in Linux.


1. Install nmap

nmap is a popular tool for managing networks. It also provides features for network scanning. Open terminal and run the following command to install nmap. It is available for almost every Linux repository.

$ sudo apt-get install nmap


2. Find IP range of your network

Next, you need to find out the IP address range occupied by your network. You can do this using ifconfig command. Newer systems may need to use ‘ip addr show command, if they don’t have ifconfig.

You will get following output.

$ ifconfig
wlan0 Link encap:Ethernet HWaddr 70:f2:a1:c1:f2:e9
inet addr:192.168.1.9 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe60::73f1:a2ef:fec2:f1e8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2104151 errors:0 dropped:0 overruns:0 frame:0
TX packets:20224673 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1134004913 (1.1 GB) TX bytes:636207445 (421.2 MB)

Look for wlan0 if you are on wifi or eth0 if you are on Ethernet. As highlighted above, my IP is 192.168.1.9 and the subnet mask is 255.255.255.0. It means the ip address range of my network is from 192.168.1.0 to 192.168.1.255.


3. Look for devices connected to your network

Based on your IP address, run the following nmap command to list all devices connected to your network.

$ sudo nmap -sn 192.168.1.0/24
Starting Nmap 5.21 ( http://nmap.org ) at 2021-09-01 21:59 EST

Nmap scan report for netbox (192.168.1.1)
Host is up (0.015s latency).
MAC Address: E1:B1:C5:72:4A:5C (Unknown)
Nmap scan report for ubuntu (192.168.1.9)
Host is up.
Nmap scan report for android-84b23f66te05d1c8 (192.168.1.93)
Host is up (0.26s latency).

In the above output, you can see 3 devices, highlighted – a laptop, android device and Wi-Fi router. If you see unknown devices in the output, then you need to investigate them further.

We use 192.168.1.0/24 to specify scanning from 192.168.1.0 – 192.168.1.255. It is a CIDR notation. You can use an IP to CIDR converter to get the correct CIDR for your desired IP range, and use it in your nmap command.

In this article, we have learnt how to find devices connected to your Linux network.

Also read:

How to Fix Bash Command Not Found Error
How to Disable Strict Mode in MySQL
How to Fix Stdin : Not in GZIP Format Error
How to Find & Kill Zombie Processes in Linux
How to Disable Strict Host Key Check in SSH

Leave a Reply

Your email address will not be published.