Network Scanning with Nmap: A Complete Walkthrough

Nmap remains the foundation of nearly every network security assessment, whether you are mapping an internal environment for a penetration test, validating firewall rules, or building an asset inventory for a security program. Despite dozens of newer tools entering the market, Nmap's flexibility and scripting engine keep it as the starting point for serious network reconnaissance. This walkthrough covers practical, real-world usage from basic host discovery through advanced scripting, the way it actually gets used in professional assessments. Teams at Sagefox Cybersecurity rely on this same workflow as the first step in nearly every internal and external network assessment.

Getting Started with Nmap Scanning

Installing Nmap on Common Platforms

Nmap is available through most package managers and ships with prebuilt binaries for Windows, macOS, and Linux.

sudo apt install nmap
brew install nmap

Confirm the installation and check the version, since scripting engine features vary between releases:

nmap --version

Understanding Scan Types Before You Start

Before running any scan against a live network, it helps to understand what each scan type actually does at the packet level, since this affects both accuracy and how much noise you generate on the target network.

  • TCP SYN scan: sends a SYN packet and analyzes the response without completing the handshake, fast and relatively stealthy
  • TCP connect scan: completes the full handshake, more reliable but noisier and slower
  • UDP scan: sends UDP packets to identify open UDP services, notoriously slow due to how UDP responses work
  • ACK scan: used to map firewall rule sets rather than find open ports directly

Host Discovery Across a Network

Basic Ping Sweep to Identify Live Hosts

Before scanning individual ports, identify which hosts on a subnet are actually alive.

nmap -sn 192.168.1.0/24

This performs host discovery only, without port scanning, which is useful for quickly building an inventory of live systems on a segment.

Discovery When ICMP Is Blocked

Many environments block ICMP echo requests at the host or network firewall level, making a standard ping sweep unreliable. Nmap can fall back to TCP-based discovery instead.

nmap -sn -PS22,80,443 192.168.1.0/24

This sends TCP SYN packets to common ports as a discovery method, which often succeeds even when ICMP is filtered.

Port Scanning Fundamentals

Running a Standard TCP SYN Scan

The SYN scan is the default and most commonly used scan type for professional assessments due to its balance of speed and stealth.

sudo nmap -sS 10.10.10.0/24

Note that SYN scans require raw socket access, which typically means running with elevated privileges.

Scanning All 65535 Ports

Default Nmap scans only check the top 1000 most common ports. For a thorough assessment, scanning the full range is necessary to catch services running on non-standard ports.

nmap -sS -p- 10.10.10.25

This scan takes considerably longer, so it is often run separately from initial reconnaissance rather than as a first step.

Speeding Up Full Port Scans with Timing Templates

Nmap's timing templates control how aggressively it sends packets, which directly affects scan duration.

nmap -sS -p- -T4 10.10.10.25

Timing templates range from T0 (extremely slow, used for evading intrusion detection) to T5 (extremely aggressive, generally reserved for lab environments with no risk of disruption). T4 is the common choice for professional engagements balancing speed with network stability.
[cta]

Service and Version Detection

Identifying Running Services and Their Versions

Knowing a port is open is only the first step. Identifying what service and version is actually running behind it is what turns a port list into actionable intelligence.

nmap -sV 10.10.10.25

For more detailed version probing when the initial pass returns ambiguous results:

nmap -sV --version-intensity 9 10.10.10.25

Higher intensity values send more probes, increasing detection accuracy at the cost of scan time.

OS Fingerprinting

Operating system detection helps build a fuller picture of the target environment, which matters for prioritizing findings and understanding likely attack surface.

sudo nmap -O 10.10.10.25

Combining service detection, OS fingerprinting, and default scripts into a single comprehensive scan is common practice for thorough host profiling:

sudo nmap -A -T4 10.10.10.25

Using the Nmap Scripting Engine (NSE)

Why NSE Matters for Real Assessments

The Nmap Scripting Engine extends Nmap far beyond basic port scanning into vulnerability detection, configuration auditing, and even limited exploitation checks. NSE scripts are organized into categories including discovery, vuln, auth, and safe, which helps control what a scan actually attempts against a live target.

Running Default Scripts Against a Target

nmap -sC -sV 10.10.10.25

The -sC flag runs the default script set, which includes safe, non-intrusive checks suitable for most environments including production networks.

Targeting Specific Vulnerability Categories

For a more focused assessment looking specifically for known vulnerabilities, the vuln category can be called directly.

nmap --script vuln -p 443 10.10.10.25

This is significantly more aggressive than the default script set and should be used cautiously against production systems, since some vuln scripts actively attempt to trigger conditions rather than passively check for them.

Checking for Specific Known Misconfigurations

NSE scripts exist for a wide range of specific checks. For example, checking for SSL/TLS configuration weaknesses on a web server:

nmap --script ssl-enum-ciphers -p 443 10.10.10.25

This returns the full list of supported cipher suites and flags weak or deprecated ciphers, which is a common finding in external assessments.
[cta]

Scanning at Scale Across Large Environments

Using Input Lists for Multiple Targets

For assessments covering many hosts, feeding Nmap a target list rather than a single IP or range keeps scans organized and repeatable.

nmap -sS -sV -iL targets.txt -oA scan_results

The -oA flag outputs results in normal, XML, and grepable formats simultaneously, which is useful when results need to feed into other tools or reporting pipelines.

Excluding Hosts from a Scan

Sometimes specific hosts need to be excluded from a broader scan, such as known fragile legacy systems or out-of-scope assets.

nmap -sS 10.10.10.0/24 --exclude 10.10.10.5,10.10.10.6

For larger exclusion lists, a file works better than inline arguments:

nmap -sS 10.10.10.0/24 --excludefile excluded_hosts.txt

Parsing and Reporting on Large Scan Results

Once a scan completes across a large environment, converting the XML output into a readable report matters for actually using the data. Tools like xsltproc can convert Nmap's XML output into an HTML report directly.

xsltproc scan_results.xml -o scan_report.html

This produces a browsable report suitable for internal review or as a supporting artifact in a client deliverable.

Common Mistakes That Undermine Scan Accuracy

Scanning Without Understanding Target Firewall Behavior

Firewalls and intrusion prevention systems can silently drop or rate-limit scan traffic, leading to incomplete or misleading results. Comparing scan results from different timing templates or scan types can reveal when this is happening, since dramatically different results between a T2 and T4 scan often point to rate limiting rather than an accurate picture of the target.

Relying Solely on Default Port Ranges

Skipping full port range scans in favor of the default top 1000 ports is one of the most common ways real findings get missed. Services running on unusual ports, whether intentionally hidden or simply misconfigured, will never show up in a default scan.

Ignoring UDP Entirely

UDP scanning is slow and often skipped due to time constraints, but critical services like DNS, SNMP, and certain VPN protocols run over UDP. A scan that only covers TCP presents an incomplete picture of the actual attack surface.

sudo nmap -sU --top-ports 100 10.10.10.25

Not Correlating Nmap Results with Manual Verification

Automated scan results, including NSE vulnerability scripts, occasionally produce false positives. Manual verification of any critical finding before it goes into a report is standard practice for maintaining credibility with clients, and it is a step that experienced assessors at Sagefox Cybersecurity treat as non-negotiable before anything reaches a final deliverable.

Building Nmap Into a Repeatable Assessment Workflow

A Practical Scan Sequence for Internal Assessments

A typical sequence used in professional internal assessments looks like this:

nmap -sn 10.10.10.0/24 -oG live_hosts.txt
nmap -sS -T4 -iL live_ips.txt -oA initial_scan
nmap -sS -p- -T4 -iL live_ips.txt -oA full_port_scan
nmap -sV -sC -iL live_ips.txt -oA service_scan
nmap --script vuln -iL priority_targets.txt -oA vuln_scan

This sequence moves from broad discovery to increasingly targeted and aggressive scanning, which keeps early scans fast while reserving more intensive checks for hosts that warrant closer attention.

Scheduling Regular Scans for Ongoing Visibility

Organizations that treat network scanning as a one-time event during an annual assessment miss the drift that happens as new systems get provisioned and configurations change. Scheduling recurring scans, even lightweight discovery and service detection passes, gives security teams ongoing visibility into what is actually running on the network rather than relying on outdated documentation.

Key Takeaways

Nmap remains a core tool for network visibility because it scales from a quick single-host check to a full enterprise-wide scan sequence without requiring a completely different toolset. The real skill lies in choosing the right scan type, timing, and script combination for the situation, then verifying results manually before treating them as fact. Getting comfortable with the full workflow, from host discovery through NSE scripting, turns Nmap from a basic port scanner into a genuine reconnaissance platform.

If your organization needs a thorough network assessment built on this kind of methodical scanning process, backed by manual verification and clear reporting, the team at Sagefox Cybersecurity can help map your environment and identify what actually needs attention.