Skip to content
Tutorials Center
My learning

Topics

Lesson 9 of 36 ยท Scanning Basics

Verbosity, Reasons and Packet Tracing

See what Nmap is doing and why: -v and -d levels, --reason, --open, --packet-trace, progress and stats, with Python tools to decode reason codes.

When a result surprises you, the first question is "why does Nmap think that?". A handful of options let you watch the scan, see the reason behind each state, and even print every packet sent and received. Learning them early turns Nmap from a black box into a transparent tool, and it is the fastest way to understand the scan types you will meet next.

Output samples are invented and labelled. The Python editors decode and summarize text; no packets are sent.

Verbosity: -v and -vv

-v makes Nmap tell you more as it works. Open ports appear as soon as they are found instead of at the end, you see discovery and timing messages, and the report shows extra detail. Repeat it for more: -vv, -vvv. You can also press the v key during a running scan to increase verbosity (and V to decrease it).

TEXT
$ sudo nmap -v 192.0.2.10
Starting Nmap 7.9x ( https://nmap.org ) at 2026-11-12 11:00 UTC
Initiating Ping Scan at 11:00
Scanning 192.0.2.10 [4 ports]
Completed Ping Scan at 11:00, 0.01s elapsed (1 total hosts)
Initiating SYN Stealth Scan at 11:00
Scanning 192.0.2.10 [1000 ports]
Discovered open port 22/tcp on 192.0.2.10
Discovered open port 443/tcp on 192.0.2.10
Discovered open port 80/tcp on 192.0.2.10
Completed SYN Stealth Scan at 11:00, 1.20s elapsed (1000 total ports)
Nmap scan report for 192.0.2.10
...

Example output (shortened). Notice "Ping Scan" (host discovery) followed by "SYN Stealth Scan" (the default scan as root), and [4 ports] for the four discovery probes. This is the pipeline from Your First Scan made visible.

Debugging output: -d

-d, -d2 up to -d9 print internal details: timing decisions, retransmissions, response times. It is useful for performance tuning and for reporting bugs, but it is very noisy. Start with -v and --reason; reach for -d only when you need to know why a scan is slow.

Reasons: --reason

Add --reason and every port line gets a REASON column:

TEXT
$ sudo nmap --reason -p 22,23,25,3389 192.0.2.10
PORT     STATE    SERVICE REASON
22/tcp   open     ssh     syn-ack
23/tcp   closed   telnet  reset
25/tcp   filtered smtp    no-response
3389/tcp filtered ms-wbt-server admin-prohibited

Example output (invented host). The reason is the evidence for the state. Common ones:

Reason Meaning
syn-ack Reply to a SYN: open
reset A RST came back: closed
conn-refused Connect scan was refused: closed
no-response Nothing returned after retries: filtered (or open|filtered)
admin-prohibited ICMP "administratively prohibited": firewall rule
port-unreach ICMP port unreachable (UDP closed)
udp-response UDP reply: open
arp-response ARP answer: host up (local network)
echo-reply ICMP echo reply: host up
localhost-response You scanned your own machine

Seeing reset on all closed ports and no-response on the rest tells you the machine answers for itself yet a firewall hides the rest.

Showing only what matters: --open

--open prints only open (and possibly open) ports; closed and filtered ones disappear from the table. It makes large scans readable:

Terminal
nmap --open -p- 192.0.2.0/28

Use it with -v to still see summaries and timing information.

Watching every packet: --packet-trace

--packet-trace prints each packet Nmap sends and receives. It is the best learning tool there is:

TEXT
$ sudo nmap --packet-trace -p 80 -Pn 192.0.2.10
SENT (0.0300s) TCP 192.0.2.5:51721 > 192.0.2.10:80 S ttl=45 id=31337 iplen=44  seq=1099261012 win=1024 <mss 1460>
RCVD (0.0320s) TCP 192.0.2.10:80 > 192.0.2.5:51721 SA ttl=64 id=0 iplen=44  seq=3421990 win=64240 <mss 1460>

Example output; addresses are invented. Read it like this: Nmap sent a TCP packet with only the S (SYN) flag from a random source port to port 80; the target received and answered with SA (SYN+ACK), so the port is open. The ttl value of the reply hints at the OS family (64 is typical for Linux), a clue used in OS Detection.

Progress and statistics

A long scan can show its progress:

Terminal
nmap --stats-every 10s -p- 192.0.2.10    # a progress line every 10 seconds

Or press Enter during a scan to print the current status line (estimated percent done and time remaining). In scripts and pipelines, where nobody can press a key, rely on --stats-every.

Other helpful reporting options

  • --iflist: print network interfaces and routes Nmap sees, for debugging "wrong interface" problems.
  • -n: never resolve DNS names (faster); -R always resolve.
  • --max-retries, --host-timeout: control retransmission and give-up time (see Chapter 7).
  • --append-output, --resume file: continue an interrupted scan from a saved log.

A stand-in: decode reasons into plain English

Here is a lookup that turns --reason columns into explanations, and checks which states each reason can support.

Python Explain reason codes

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A stand-in: read a packet trace line

This function parses the SENT/RCVD lines and names the TCP flags, which is the skill you need to read --packet-trace output without memorizing letters.

Python Parse a --packet-trace line

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

(The program prints the TTL but does not guess an OS from it: TTL alone is weak evidence, and real OS detection uses many more signals.)

A debugging workflow

  1. Unexpected result? Re-run one port with --reason.
  2. Still unclear? Add --packet-trace on a single port and a single host.
  3. Compare the same command from another network position.
  4. If the scan is slow, use --stats-every and -d to see retransmissions.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which option shows the evidence for each port's state?

    --reason adds a REASON column such as syn-ack, reset or no-response.
  2. 2. What does --open do?

    It filters out closed and filtered ports from the output to keep it short.
  3. 3. In a --packet-trace, a RCVD line with flags SA after a SENT line with flag S means what?

    SYN then SYN+ACK is the start of a successful handshake: the port is open.
  4. 4. Which reason does a firewall sending an ICMP prohibited message typically produce?

    ICMP administratively prohibited produces the admin-prohibited reason and a filtered state.

Summary

  • -v shows progress and open ports as found; -d shows internals for tuning.
  • --reason explains each state; learn the common reason codes.
  • --open trims the table; --packet-trace shows every packet and is the best teacher.
  • Debug one port and one host at a time; compare vantage points.

Next: Host Discovery Overview