There might be cases where you want to determine if unwanted users not using your wireless network or to find all devices connected to your network. Nmap is one of the ways to do that. Nmap is a cross-platform tool that allows to scan networks via command line.
To determine which devices are connected to a local network, first we need to get the IP range of the network. On Linux, we can use ip
command.
ip addr show
![Find IP address on Linux for Nmap](/uploads/posts/content/2021/05/find_ip_address_on_linux_for_nmap.png?v=1680571719)
On Windows, we can use ipconfig
command.
ipconfig
![Find IP address on Windows for Nmap](/uploads/posts/content/2021/05/find_ip_address_on_windows_for_nmap.png?v=1680571719)
In our case, subnet mask is 255.255.255.0 = 24 and network IP range is from 192.168.0.0 to 192.168.0.255.
Now we can run the nmap
command to find which devices are connected to the local network:
nmap -sn 192.168.0.0/24
On Linux, this command will show only the IP addresses. Execute the command as superuser to include the MAC address of each device as well.
sudo nmap -sn 192.168.0.0/24
The -sn
option means that port scanning will be skipped. In previous Nmap releases, -sn
was available as the -sP
option.
![Find All Devices Connected to Local Network using Nmap](/uploads/posts/content/2021/05/find_all_devices_connected_to_local_network_using_nmap.png?v=1680571719)
The 2 Comments Found
Thanks. It is a combined command for Linux systems that extracts the subnet of network interface and lists discovered IP addresses and their associated MAC addresses.
Leave a Comment
Cancel reply