Contents
Nmap shows you which devices are on a network, which ports each one has open, and what services are running on them. Start by scanning your own computer, then move on to virtual machines you set up yourself.
This review is for people who know the basics of IP addresses and ports. After reading it, you can do the following:
- List the open ports on your own computer
- Tell the port states in the results apart (open, closed, and filtered)
- Find out which service and version is running on a port
What Nmap is for
Nmap started as a port scanner, and that is still its core job. It can also do the following:
- Host discovery: find which IP addresses in a range have a device on them (
-sn) - Service and version detection: identify the software and version behind an open port (
-sV) - OS detection: guess the operating system from how the target’s packets look (
-O) - Script scanning: collect more detail with scripts written in Lua (NSE) (
-sC)
For administrators, the main use is checking that their own network has no ports open that they didn’t expect.
Install
Get Nmap from the official download page.
- Windows: run the installer (
nmap-<version>-setup.exe). It also installs Npcap, which Nmap uses to send and receive packets, and the Zenmap GUI. The project supports Windows 7 and later. - macOS: use the installer inside the disk image (
.dmg). - Linux: the project provides RPM packages and source code.
After installing, run nmap -V in a terminal to check that it prints a version number.
Try it safely
Nmap sends packets to other devices, so decide on your target first.
-
Scan your own computer. Run this in a terminal. The traffic never leaves your machine.
nmap 127.0.0.1On Windows, scanning your own machine requires Npcap. The installer’s default settings include it.
-
Scan virtual machines you set up yourself. Put them on an internal network with no outside connection and scan their IP addresses (see How to set up a safe test lab).
-
To try a scan over the internet, use scanme.nmap.org. The Nmap project set up this server and says you may scan it with Nmap. Keep it to a few scans a day.
Read the results
Running nmap <target> with no options scans 1,000 common TCP ports. Each port in the results gets a state. These are the ones you will see most:
| State | Meaning |
|---|---|
open |
An application is accepting connections |
closed |
The port is reachable, but nothing is listening |
filtered |
A firewall or filter blocks the probes, so Nmap can’t tell whether it’s open |
Nmap uses six states in total. The other three are unfiltered, open|filtered, and closed|filtered. A state describes how the port looks to Nmap, not a property of the port itself. The same port can show as open from inside the network and filtered from across the internet.
Common options
| Option | What it does |
|---|---|
-p 22,80,443 |
Scan only these ports (-p- scans all ports) |
-F |
Scan fewer ports than the default, for a quicker result |
-sn |
Skip the port scan and only check which hosts are up |
-sV |
Detect the service and version on open ports |
-O |
Guess the operating system |
-A |
Run OS detection, version detection, scripts, and traceroute together |
-oN results.txt |
Save the results to a file (-oX for XML) |
For example, nmap -sV -p 22,80 127.0.0.1 checks what is running on ports 22 and 80 of your own computer.
Why it needs admin rights
The default scan is a SYN scan (-sS). It builds and sends raw packets, which requires root on Linux and macOS. Without those rights, Nmap falls back to a connect scan (-sT), which uses the operating system’s normal connection calls. A connect scan works without special rights but is slower. On Windows, the project recommends running Nmap as an administrator.
Cautions
- Don’t scan networks or devices you don’t have permission to scan. The project’s legal guide recommends getting written permission from the target’s administrators first. For work, agree on the targets and the time window in writing before you start.
- Scanning without permission can lead the target’s administrators to complain to your internet provider, and it can break your provider’s terms of service.
- Nmap is designed not to overload networks, but older devices have occasionally crashed during a scan. On a work network, test at a time when an outage would not cause problems.
- Nmap uses its own license, the Nmap Public Source License, which is based on GPLv2 with added terms. Individuals and organizations can use it for free, but embedding it in a commercial product you distribute is not allowed. Read the official terms if you plan to do that.
Read next
Sources
- Download pagenmap.org/download.html
- Install Guide: Windowsnmap.org/book/inst-windows.html
- Reference: Options summarynmap.org/book/man-briefoptions.html
- Reference: Port scanning basicsnmap.org/book/man-port-scanning-basics.html
- Reference: Port scanning techniquesnmap.org/book/man-port-scanning-techniques.html
- Legal issuesnmap.org/book/legal-issues.html
- scanme.nmap.org (a server you may scan)scanme.nmap.org
- Nmap Public Source Licensenmap.org/npsl/
Checked on 2026-10-25
Similar tools
Suricata
Impact Reaches othersAn intrusion detection and prevention engine (IDS/IPS) that matches network traffic against rules and records suspicious activity as alerts.
- Purpose
- Defense
- Type
- Self-hosted server
- Difficulty
- Intermediate
- License
- CopyleftGPL-2.0
- Category
- Network
Web-Check
Impact Reaches othersAn OSINT tool that shows a website's public information, such as DNS, certificates, and headers, from a single URL.
- Purpose
- Audit
- Type
- Web service
- Difficulty
- Beginner
- License
- PermissiveMIT
- Category
- Reconnaissance / Web security
Wireshark
Impact Reaches othersA packet analyzer that records network traffic and breaks each packet down by protocol so you can read it.
- Purpose
- Learning
- Type
- Desktop app
- Difficulty
- Beginner
- License
- CopyleftGPL-2.0
- Category
- Network / Forensics