Knowing which systems are reachable and which services they expose is an important part of network security. An undocumented service, an unexpected administrative port, or an outdated application can increase an organization's attack surface.
Nmap, short for Network Mapper, helps administrators and security professionals discover hosts, identify open ports, and investigate services running on authorized systems.
This guide explains how to use Nmap for a structured network audit, interpret common results, and turn scan output into actionable security work.
All examples are intended for systems and networks you own or have explicit permission to assess.
Nmap is an open-source tool for network discovery and security auditing. It can identify reachable hosts, examine ports, detect services and their versions, and perform additional forms of network analysis.
Its results can support asset inventory, exposure reviews, troubleshooting, and authorized penetration testing.
Nmap does not automatically establish that a host is vulnerable simply because a port is open. A port indicates a network service or endpoint state; determining whether that exposure is appropriate requires context.
On systems where Nmap is already installed, verify that the command is available:
nmap --versionIf Nmap is missing, obtain it through the official download page:
https://nmap.org/download.html
Use an installation method appropriate for your operating system and keep the tool updated.
Begin with a known test system rather than a large network range.
nmap 192.0.2.10Replace the example address with the address of your authorized target. The 192.0.2.0/24 range is reserved for documentation, so the example address is not intended to represent a real public target.
By default, Nmap examines a selection of commonly used TCP ports. The results can include:
Port number and protocol.
Port state, such as open, closed, or filtered.
A service name associated with a port.
These states require careful interpretation. An open port indicates that a service is accepting connections; a filtered result means Nmap cannot determine the port's state because packet filtering or a similar obstacle interferes with its probes.
Neither state alone proves that a vulnerability exists.
For a small internal subnet that you administer, Nmap can help identify hosts that respond to discovery probes.
nmap -sn 192.0.2.0/24The -sn option performs host discovery without a port scan. Discovery results depend on network configuration, firewall rules, and the probes available to Nmap.
A host that does not respond may still be active. Conversely, discovering a host does not mean that you have permission to investigate every service on it.
Use the results to compare observed systems with your approved asset inventory. Investigate unexpected devices through your normal asset-management process.
Once the target is confirmed to be in scope, examine the ports relevant to the audit.
nmap -p 22,80,443 192.0.2.10This command limits the scan to TCP ports 22, 80, and 443.
These ports are commonly associated with SSH, HTTP, and HTTPS, respectively, but the service running on a port can differ from its conventional assignment.
For a broader inventory of TCP ports, Nmap also supports:
nmap -p- 192.0.2.10The -p- option selects all TCP ports from 1 through 65535. A wider scan takes more time and may generate more traffic, so choose the scope and timing according to the system's operational constraints.
A port number alone does not tell you which software is running. Nmap's service detection can help identify the service and, when possible, its version.
nmap -sV -p 22,80,443 192.0.2.10The -sV option probes open ports to determine service information.
Use the findings to compare exposed services with the organization's approved configuration and software inventory.
Version detection is not always definitive. Proxies, custom services, banner changes, and unusual configurations can affect identification. Verify important results against server configuration or other reliable evidence before making remediation decisions.
A useful audit should produce evidence that can be reviewed later.
mkdir -p nmap-reports
nmap -sV -p 22,80,443 \
-oN nmap-reports/host-audit.txt \
192.0.2.10The -oN option writes normal, human-readable output to a file.
Nmap also supports XML output for structured processing:
nmap -sV -p 22,80,443 \
-oX nmap-reports/host-audit.xml \
192.0.2.10Store reports in an access-controlled location. Depending on the environment, they may reveal internal hostnames, network architecture, exposed services, and other operational details.
A scan is most useful when the results are compared with an expected baseline.
Determine whether each exposed service is required. If a service is unnecessary, consider disabling it or restricting access through an approved change process.
Review access to management interfaces and remote administration protocols. Restrict them to appropriate networks or identities when feasible.
Treat version information as an investigation lead, not proof of a vulnerability. Confirm the installed package, vendor advisories, supported versions, and relevant configuration.
Compare the current scan with previous results and asset records. Investigate new hosts, changed port states, and newly exposed services.
A change may be legitimate, but it should have an owner and an explanation.
A repeatable process helps organizations identify exposure changes without relying on one-off scans.
Define the authorized IP ranges and exclusions.
Select a scan profile appropriate for the objective.
Run the scan during an approved maintenance or assessment window.
Save the output with a timestamp and scope record.
Compare results with the approved service inventory.
Assign unexpected exposures for investigation.
Validate remediation with a follow-up scan.
Avoid scanning every asset with the same aggressive settings. Network size, device sensitivity, operational impact, and authorization should determine the scan strategy.
Treating every open port as a vulnerability. A service may be necessary and securely configured. Assess exposure in context.
Assuming no response means no host exists. Firewalls and discovery settings can prevent a live system from responding to probes.
Trusting version detection without validation. Reported versions can be incomplete or inaccurate.
Scanning beyond the approved scope. Keep targets and exclusions explicit, especially when networks contain third-party or shared infrastructure.
Collecting results without remediation. An inventory becomes valuable when findings are assigned, reviewed, and tracked through resolution.
Nmap focuses on network discovery and service assessment. It is not a replacement for source-code review, authenticated configuration auditing, dependency scanning, or a comprehensive application penetration test.
It may identify services that warrant further investigation, but additional evidence is needed to determine whether a particular weakness is exploitable.
For web application exposure, a dedicated tool such as OWASP ZAP can complement network discovery by examining HTTP requests and responses. These tools answer different questions and should be selected according to the assessment objective.
Nmap provides a practical foundation for network security auditing. By identifying hosts, checking selected ports, detecting services, and saving results, teams can build a more accurate picture of their network's exposed attack surface.
The strongest workflow combines authorized scanning with asset inventory, configuration verification, documented findings, and follow-up validation.
The objective is not to maximize the number of scanned ports. It is to understand which services are exposed, whether that exposure is justified, and what action should follow.
Nmap Project, Nmap Network Scanning: https://nmap.org/book/
Nmap Reference Guide: https://nmap.org/book/man.html
Nmap Host Discovery: https://nmap.org/book/man-host-discovery.html
Nmap Service and Version Detection: https://nmap.org/book/vscan.html
Official download page: https://nmap.org/download.html