How to find the Devices on your Network with nmap

First of all, you need to know your IP and the network range where it belongs to.

It is important to perform scanning that you understand the meaning of IPv4 addresses. You can check this post explaining about it.

Open a terminal and type the following command to get your IP:

ifconfig

First, locate what the relevant network adapter you want to focus on (ethernet, wifi, etc.).

Find the values located in “inet” and “netmask” fields.

In our example, we assume that inet value was 10.10.10.11 and netmask value was 255.255.255.0.

Get the network IP by applying the mask to your IP.

For example, if your IP is 10.10.10.11 and mask is 255.255.255.0, the network IP would be 10.10.10.0.

Translate the value in netmask to the decimal number of positions with value 1.

For example, 255.255.255.0, that is in binary 11111111.11111111.11111111.00000000, has 24 ones, so it would become number 24.

The network to scan would be the network IP with a slash and the number of decimal positions for the network.

In our example, it would be 10.10.10.0/24.

Then apply this command to find the devices on your network with nmap:

nmap -sN <range of IPs to sweep>

The -sN parameter informs that we just want to perform a ping sweep of all the addresses, not to scan ports yet.

In our example, it would be:

nmap -sN 10.10.10.0/24

Another command meaning the same would be:

nmap -sN 10.10.10.0-255

The output would indicate the IPs of the devices in our network.

Alternatives

You can also try this simple command to find the devices on your network:
netdiscover -i eth0

External references

Leave a Reply

Your email address will not be published. Required fields are marked *