Raspberry Pi

How to Install and Use NMAP on Raspberry Pi

NMAP is an application that is mainly used to audit the security of a network on which the Raspberry Pi is connected. One aspect to make internet connections more secure is to know what devices are connected to the network and audit the security of the network. If you are looking for a way to install and use NMAP for your Raspberry Pi then read this guide.

Installing NMAP on Raspberry Pi

The process of installing the NMAP tool is quite easy, so go through the steps below:

Step 1: Update the packages list of apt package manager using:

$ sudo apt update

Step 2: Next install the snapd package manager by using the following command:

$ sudo apt install snapd

Step 3: To apply the changes reboot your Raspberry Pi:

$ reboot

Step 4: Now install the core that is a runtime environment for the snapd packages:

$ sudo snap install core

Step 5: Finally, execute the following command to install NMAP tool:

$ sudo snap install nmap

Now just to be sure use the following command to see what version of NMAP is installed on Raspberry Pi:

$ namp --version

Using NMAP Tool on Raspberry Pi

To use the NMAP tool first all you need to know is to IP address of your Raspberry Pi which can be found by using the given command:

$ hostname -I

To check which services are running on your Raspberry Pi execute the nmap command with the IP address of your Pi:

$ nmap 192.168.18.58

Next if you want to check what software is provided behind the server of each open ports using the following command:

$ nmap -sV 192.168.18.58

You can use the nmap tool for the detection of operating system:

$ sudo nmap -O 192.168.18.58

If you want to see other devices connected to the same network on which your Pi is connected, then use the command:

$ sudo nmap -sn 192.168.18.0/24

To arrange the devices connected with the same network as that of the Pi give the address range using the following command and you will see all the active hosts on the network:

$ nmap -sn 192.168.18.1-254

You can also short the range if you are looking for some specific hosts or you can scan more than one hosts at a time by stating their IP and using the nmap tool:

$ nmap 192.168.18.56 192.168.18.12 192.168.18.98

Conclusion

Network security and monitoring is sort of necessary as most of the potential viruses attack the system mainly through the internet. Raspberry Pi is a Linux based system which is quite secure but still it might need network security. NMAP is a sort of network monitoring tool that not only audits the security of the system but also scans the network and gets the details of the other devices connected to the same network. You can install NMAP using the snap package manager on your Pi, using NMAP you can see a list of other devices connected, and the services running on your Pi and some other features.

About the author

Aaliyan Javaid

I am an electrical engineer and a technical blogger. My keen interest in embedded systems has led me to write and share my knowledge about them.