wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 23 people, some anonymous, worked to edit and improve it over time.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
This article has been viewed 416,645 times.
Learn more...
Are you worried about the security of your network or the security of someone else's? Ensuring that your router is protected from unwanted intruders is one of the foundations of a secure network. One of the basic tools for this job is Nmap, or Network Mapper. This program will scan a target and report which ports are open and which are closed, among other things. Security specialists use this program to test the security of a network. To learn how to use it yourself, see Step 1 below.
Steps
Using Zenmap
-
1Download the Nmap installer. This can be found for free from the developer’s website. It is highly recommended that you download directly from the developer to avoid any potential viruses or fake files. Downloading the Nmap installer includes Zenmap, the graphical interface for Nmap which makes it easy for newcomers to perform scans without having to learn command lines.
- The Zenmap program is available for Windows, Linux, and Mac OS X. You can find the installation files for all operating systems on the Nmap website.
-
2Install Nmap. Run the installer once it is finished downloading. You will be asked which components you would like to install. In order to get the full benefit of Nmap, keep all of these checked. Nmap will not install any adware or spyware.Advertisement
-
3Run the “Nmap – Zenmap” GUI program. If you left your settings at default during installation, you should be able to see an icon for it on your desktop. If not, look in your Start menu. Opening Zenmap will start the program.
-
4Enter in the target for your scan. The Zenmap program makes scanning a fairly simple process. The first step to running a scan is choosing your target. You can enter a domain (example.com), an IP address (127.0.0.1), a network (192.168.1.0/24), or a combination of those.
- Depending on the intensity and target of your scan, running an Nmap scan may be against the terms of your internet service provider, and may land you in hot water. Always check your local laws and your ISP contract before performing Nmap scans on targets other than your own network.
-
5Choose your Profile. Profiles are preset groupings of modifiers that change what is scanned. The profiles allow you to quickly select different types of scans without having to type in the modifiers on the command line. Choose the profile that best fits your needs:[1]
- Intense scan - A comprehensive scan. Contains Operating System (OS) detection, version detection, script scanning, traceroute, and has aggressive scan timing. This is considered an intrusive scan.
- Ping scan - This scan simply detects if the targets are online, it does not scan any ports.
- Quick scan - This is quicker than a regular scan due to aggressive timing and only scanning select ports.
- Regular scan - This is the standard Nmap scan without any modifiers. It will return ping and return open ports on the target.
-
6Click Scan to start scanning. The active results of the scan will be displayed in the Nmap Output tab. The time the scan takes will depend on the scan profile you chose, the physical distance to the target, and the target’s network configuration.
-
7Read your results. Once the scan is finished, you’ll see the message “Nmap done” at the bottom of the Nmap Output tab. You can now check your results, depending on the type of scan you performed. All of the results will be listed in the main Nmap Output tab, but you can use the other tabs to get a better look at specific data.[2]
- Ports/Hosts - This tab will show the results of your port scan, including the services for those ports.
- Topology - This shows the traceroute for the scan you performed. You can see how many hops your data goes through to reach the target.
- Host Details - This shows a summary of your target learned through scans, such as the number of ports, IP addresses, hostnames, operating systems, and more.
- Scans - This tab stores the commands of your previously-run scans. This allows you to quickly re-scan with a specific set of parameters.
Using the Command Line
-
1Install Nmap. Before using Nmap, you will need to install it so that you can run it from the command line of your operating system. Nmap is small and available for free from the developer. Follow the instructions below for your operating system:
-
Linux - Download and install Nmap from your repository. Nmap is available through most of the major Linux repositories. Enter in the command below based on your distribution:
- Red Hat, Fedora, SUSE
rpm -vhU http://nmap.org/dist/nmap-6.40-1.i386.rpm
(32-bit) ORrpm -vhU http://nmap.org/dist/nmap-6.40-1.x86_64.rpm
(64-bit) - Debian, Ubuntu
sudo apt-get install nmap
- Red Hat, Fedora, SUSE
-
Windows - Download the Nmap installer. This can be found for free from the developer’s website. It is highly recommended that you download directly from the developer to avoid any potential viruses or fake files. Using the installer allows you to quickly install the command line Nmap tools without having to worry about extracting to the right folder.
- If you don’t want the Zenmap graphical user interface, you can uncheck it during the installation process.
- Mac OS X – Download the Nmap disk image. This can be found for free from the developer’s website. It is highly recommended that you download directly from the developer to avoid any potential viruses or fake files. Use the included installer to install Nmap on your system. Nmap requires OS X 10.6 or later.
-
Linux - Download and install Nmap from your repository. Nmap is available through most of the major Linux repositories. Enter in the command below based on your distribution:
-
2Open your command line. Nmap commands are run from the command line, and the results are displayed beneath the command. You can use variables to modify the scan. You can run the scan from any directory on the command line.
- Linux - Open the terminal if you are using a GUI for your Linux distribution. The location of the terminal varies by distribution
- Windows - This can be accessed by pressing the Windows key + R and then typing “cmd” into the Run field. Windows 8 users can press Windows key + X and select Command Prompt from the menu. You can run an Nmap scan from any directory.
- Mac OS X - Open the Terminal application located in the Utility subfolder of your Applications folder.
-
3Run a scan of you target’s ports. To start a basic scan, type
nmap <target>
. This will ping the target and scan the ports. This is an easily-detected scan. The results will be displayed on your screen. You may need to scroll back up to see all of the results.- Depending on the intensity and target of your scan, running an Nmap scan may be against the terms of your internet service provider, and may land you in hot water. Always check your local laws and your ISP contract before performing Nmap scans on targets other than your own network.
-
4Run a modified scan. You can use command line variables to change the parameters of the scan, resulting in more detailed or less detailed results. Changing the scan variables will change the intrusiveness of the scan. You can add multiple variables by placing a space between each one. Variables come before the target:
nmap <variable> <variable> <target>
[3]- -sS - This is a SYN stealth scan. It is less detectable than a standard scan, but may take longer. Many modern firewalls can detect an –sS scan.
- -sn - This is a ping scan. This will disable port scanning, and will only check to see if the host is online.
- -O - This is an operating system scan. The scan will attempt to determine the operating system of the target.
- -A - This variable enables several of the most commonly used scans: OS detection, version detection, script scanning, and traceroute.
- -F - This enables fast mode, and will reduce the number of ports scanned.
- -v - This will show more information in your results, making them easier to read.
-
5Output the scan to an XML file. You can set your scan results to be outputted as an XML file so that you can easily read them in any web browser. To do this, you will need to use the -oX variable, as well as set a filename for the new XML file. A completed command would look similar to
nmap –oX Scan Results.xml <target>
.- The XML file will be saved to whatever your current working location is.
Community Q&A
-
QuestionHow do I test for vulnerabilities using Nmap?Community AnswerNmap don't test the vulnerability, Nmap simply displays it (if any). You can use exploit tools to test it.
-
QuestionWhat happens if the ports open when running a simple Nmap scan?Saravanan KrishnamurthyCommunity AnswerYou can use that opened port to exploit the target That's why opened ports are vulnerable.
-
QuestionWhat are ports and why do websites use them?Community AnswerPorts are essentially an address or destination within a 'host' (computer). When you send data on the Internet, a hostname and port number are specified for where the data should go. The hostname, such as 'library.ibm.com', is translated into the 'IP' address: 9.2.216.43 That identifies the specific computer (NIC) on the Internet. The port number is a 16 bit number (from 0 to 65534) which identifies a a service or listener on that computer. For example, port 80 is the usual port for H T T P, for web servers. (This example was for classic Internet, called IPv4, perennially IPv6 network uses longer, 6 byte IP addresses and longer, 4 byte port numbers)
Warnings
- Make sure that you have permission to scan the target! Scanning www.whitehouse.gov is just asking for trouble. If you want a target to scan, try scanme.nmap.org. This is a test computer set up by the author of nmap, free to scan without getting yelled at.⧼thumbs_response⧽
- If you frequently run nmap scans, be prepared to answer questions from your ISP (Internet Service Provider). Some ISPs routinely look for nmap traffic, and nmap isn't exactly the most inconspicuous tool. nmap is very well-known tool, and one that is used by hackers, so you may have a little explaining to do.⧼thumbs_response⧽
References
About This Article
1. Download the installer.
2. Run the installer.
3. Open NMap/Zenmap.
4. Enter the target address.
5. Choose a profile.
6. Click Scan.
7. Review the results.