Installing Nmap

Nmap is designed to allow the scanning of networks in order to determine which hosts are up and what services are they offering. Nmap supports a large number of scanning options, which are overkill for what will be done in this book.

Nmap is installed with the following command:

sudo apt-get install nmap

Answer Yes to install Nmap and its dependent packages.

Installing Nmap

Using Nmap

After it is installed, run the following command to see all the hosts that are currently on the network:

nmap –T4 –F <your_local_ip_range>

The option -T4 sets the timing template to be used, and the -F option is for fast scanning. There are other options that can be used and found via the Nmap manpage.

Here, your_local_ip_range is within the range of addresses assigned by your router.

Here's a node scan of my local network. If you have a lot of devices on your local network, this command may take a long time to complete.

Using Nmap

Now, I know that I have more nodes on my network, but they don't show up. This is because the command we ran didn't tell Nmap to explicitly query each IP address to see whether the host responds but to query common ports that may be open to traffic.

Instead, only use the -Pn option in the command to tell Nmap to scan all the ports for every address in the range. This will scan more ports on each address to determine whether the host is active or not.

Using Nmap

Here, we can see that there are definitely more hosts registered in the router device table. This scan will attempt to scan a host IP address even if the device is powered off.

Resetting the router and running the same scan will scan the same address range, but it will not return any device names for devices that are not powered at the time of the scan.

You will notice that after scanning, Nmap reports that some IP addresses' ports are closed and some are filtered. Closed ports are usually maintained on the addresses of devices that are locked down by their firewall. Filtered ports are on the addresses that will be handled by the router because there actually isn't a node assigned to these addresses.

Here's a part of the output from an Nmap scan of my Windows machine:

Using Nmap

Here's a part of the output of a scan of the BeagleBone:

Using Nmap
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.144.248