Leaving vulnerable networking ports open is dangerous, even with a steller, safe OS like Linux. Having ports like this open is a great way for intruders to gain unwanted access to your Linux PC. If you’re curious about that state of ports on your Linux PC, or other network devices on your network, you may want to scan open ports and close the ones you’re not using.
Scan Open Ports
When it comes to port scanning, Zenmap is king. The program is by far the most well-known graphical front-end for Nmap on Linux. Many people in the security industry use it, and as a result, it is simple to install on most mainstream Linux operating systems. The software is usually found in mainstream distribution’s package repositories.
To install it, open up a terminal and follow the instructions below depending on your OS of choice.
On Ubuntu, users can quickly get the latest version of Zenmap working without much trouble as Canonical makes it available in the main software sources. Open up “Ubuntu Software Center,” search for “Zenmap”, and select the “Install” button. Otherwise, use this command in terminal:
sudo apt install zenmap
Debian has a version of Zenmap that is available for easy installation via the included software sources. However, keep in mind that this version is out of date due to the nature of Debian. If you’re in need of a newer version of Zenmap than what is included with Debian Stable proper, check out Debian Backports.
sudo apt install zenmap
On Arch Linux, there isn’t an official “Zenmap” package in the software repositories. Instead, Arch users looking to use the GUI frontend for Nmap will need to install the nmap package via Pacman. Installing this package will also install Zenmap.
sudo pacman -S nmap
Fedora Linux doesn’t have a “Zenmap” package. Instead, Fedora users looking to use the Zenmap tool will need to install nmap-frontend. Open up a terminal and use the DNF packaging tool to install Zenmap.
sudo dnf install -y nmap-frontend
OpenSUSE distributes Zenmap via the “OSS all” software repository. Be sure to enable it on your system. Once it is enabled, use the Zypper package manager to install it to the system.
sudo zypper in zenmap
Zenmap may be in your distribution’s software sources. To install, search for “zenmap” and install it. Alternatively, follow these instructions to build it from source.
Step 1: run wget to download the latest source-code of Zenmap.
Step 2: extract the source code from the Tar archive.
bzip2 -cd nmap-*.tar.bz2 | tar xvf -
Step 3: use the CD command to enter the source code folder.
Step 4: build and install the program.
./configure make sudo make install
Zenmap is a powerful tool. With it, it’s possible to scan for open ports on nearly any machine as long as you know the IP address. In this article, we are scanning ports for security purposes. Please do not use this tool maliciously.
To start a scan, Zenmap must be running as root. Without root access, key features will refuse to work. Open up a terminal and run the following command to launch the app with root privileges:
Now that the Zenmap tool is open, it’s ready to scan ports. To start a scan, type in the known IP address into the “target” section. After writing the IP address in, you’ll need to select the type of operation to use. Usually, scanning ports is a long, painful process. If you’re just looking to get a baseline and determine what ports may be open, try “Quick”.
To start a quick scan, click the profile drop-down menu and select the “Quick” option.
With the correct profile set, click the “Scan” button.
Quick scans in Zenmap happen quite fast and often find openings by scanning common ports. View the port scan output by selecting the “Ports/Hosts” tab.
Alternatively, run a detailed port scan on a network by selecting the “Intense scan” option in the profile drop-down menu.
Zenmap can do much more than scan open ports. It also makes a great GUI tool for running traceroutes. Better yet, each traceroute run on a network device will be highlighted in the Topology tab.
To run a traceroute, enter an IP address/hostname in the target section. Next, select “Quick traceroute” in the profile menu and click scan.
Let Zenmap run and trace. When it finishes up, click the “Topology” tab.
In the Topology tab, Zenmap will build a web of all the different network devices it discovers by pinging and tracing. Highlight the device you ran the trace on, right click and select “Traceroute” to view the hops the device makes. Alternatively, follow the blue lines, as they indicate the routes the network device makes.