Skip to content
Tutorials Center
My learning

Topics

Lesson 26 of 36 ยท Evasion, Timing and Ethics

Timing Templates and Performance Tuning

Learn Nmap timing templates, parallelism, retries, timeouts and rate limits, how to scan quickly without overloading a network, and how to estimate scan time.

How fast should a scan be? Too slow and a /16 network takes days. Too fast and you can overload a fragile device, lose packets and get wrong results, or set off every alarm. Nmap lets you control speed precisely. In this lesson you meet the six timing templates, the individual settings behind them and practical rules for choosing a speed that is both quick and kind to the network.

Timing is also an ethics topic: a scan is traffic that someone else's equipment must carry. Choosing a gentle speed on shared or old networks is part of responsible practice (see Legal and Ethical Scanning).

Commands are read-only examples; the runnable code is a Python stand-in that estimates scan duration and models retry behaviour.

The six templates

-T0 to -T5 (or by name: paranoid, sneaky, polite, normal, aggressive, insane) bundle many timing values:

Template Name Intended use
-T0 paranoid Extremely slow; one probe at a time, minutes apart. Used to slip under crude rate-based detection in authorised tests of defences.
-T1 sneaky Very slow; similar idea, less extreme.
-T2 polite Slows down to use less bandwidth and target resources. Good for fragile systems.
-T3 normal The default. Dynamic, reasonable on modern networks.
-T4 aggressive Fast; assumes a reliable, fast network. Common for lab and LAN work.
-T5 insane Very fast; assumes an extremely fast network, accepts missing results.

Most people use -T3 (just don't specify anything) or -T4 on a good local network. -T5 often produces wrong results because it gives up waiting for slow replies. -T0 and -T1 are only for specific tests, since a scan can then take days.

Terminal
# Example commands (read-only)
nmap -T4 192.0.2.0/24              # fast scan of a lab subnet
nmap -T2 192.0.2.50                # gentle scan of an old device
nmap --max-rate 100 192.0.2.0/24   # never more than 100 packets per second

What a template really sets

Templates change these underlying values, which you can set yourself:

Option Meaning
--min-rate, --max-rate Minimum and maximum packets per second
--min-parallelism, --max-parallelism Number of probes in flight at once
--min-hostgroup, --max-hostgroup How many hosts are scanned together
--initial-rtt-timeout, --min-rtt-timeout, --max-rtt-timeout How long to wait for a reply
--max-retries How many times to resend an unanswered probe
--scan-delay, --max-scan-delay Pause between probes to one host
--host-timeout Give up on a host after this long
--defeat-rst-ratelimit Treat rate-limited RST replies as closed (faster, less accurate)

For example, -T4 shortens the maximum delay between retransmissions and the initial timeout and allows more parallel probes than -T3.

flowchart LR
    A["Probe sent"] --> B{"Reply before<br/>RTT timeout?"}
    B -->|yes| C["Record state,<br/>adjust RTT estimate"]
    B -->|no| D{"Retries left?"}
    D -->|yes| A
    D -->|no| E["Mark filtered"]

Nmap adapts to the network: it measures round-trip times and sends the next probes accordingly. Timeouts and retries decide how long it waits.

Estimating scan time

A rough model: the time depends on the number of probes and on how fast they can be sent. A SYN scan of the default 1,000 ports of one host that replies quickly takes about a second. The estimator below shows how host count, port count, rate and retries combine. The figures are a model for planning, not a prediction of Nmap's exact behaviour.

Python Stand-in: estimate scan duration

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 table shows why scanning "all 65,535 ports on a whole subnet" is not a casual step, and why a firewall that drops packets (instead of rejecting them) makes a scan slow: every probe must time out.

Retries and accuracy

When Nmap does not hear back, the port might be filtered, or the probe or reply might simply have been lost. Retries distinguish the two, so lowering --max-retries speeds a scan but increases false "filtered" results on a busy network. The next model shows the effect with a lossy network.

Python Stand-in: packet loss and retries

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.

With 30% loss and no retries, many open ports are missed. This is why a "faster" template on a lossy link gives worse results: -T5 effectively trades accuracy for speed.

Practical rules

  1. Start gentle, then speed up. Run -T3 on a few hosts, watch the timing, then raise it on a known-good network.
  2. Use --max-rate as a safety belt. A hard cap protects old routers, firewalls and printers regardless of other settings.
  3. Limit what you scan. -p 22,80,443 or --top-ports 100 is much faster than all ports. -F scans the 100 most common.
  4. Scan in batches with --min-hostgroup/--max-hostgroup and --host-timeout 10m so one dead host cannot stall everything.
  5. Watch for dropped replies. If results change from run to run, lower the rate. Wrong data is worse than slow data.
  6. Use -v and the keyboard. Press Enter or d during a scan to see progress; add --stats-every 30s for periodic status lines.
  7. Skip what you do not need. -n disables reverse DNS (often the slowest part), and -Pn skips host discovery when you know hosts are up (host discovery is covered in the Host Discovery chapter).

Timing for stealth versus safety

Slow templates were designed to avoid simple rate-based intrusion detection. That is a legitimate need when you are testing whether your own defences notice reconnaissance, with the security team's knowledge. It is not a way to hide activity from the owner of a network you may not scan. Understanding how detection works from the defender's side is the subject of Detecting Scans in Logs.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Which template is the default?

    -T3 (normal) is used when no template is given. It adapts to the network and suits most modern networks.
  2. 2. Why can -T5 give wrong results?

    -T5 assumes a very fast, reliable network and uses short timeouts, so on real networks it can miss replies.
  3. 3. Which option puts a hard upper limit on the packets sent per second?

    --max-rate caps the sending speed regardless of the template, which protects fragile devices.
  4. 4. What is the effect of reducing --max-retries on a lossy network?

    Fewer retries means a lost packet is not resent, so Nmap may conclude a port is filtered when it was merely a lost packet.
  5. 5. Which option skips reverse DNS lookups and often saves time?

    -n disables reverse DNS resolution. -R forces it, and -Pn skips host discovery.

Summary

  • -T0 to -T5 bundle timing values; -T3 is the default, -T4 suits fast reliable networks, -T5 risks wrong results.
  • You can set rate, parallelism, timeouts and retries yourself; --max-rate is a good safety cap.
  • Speed trades against accuracy and network load, so choose gently on shared or old networks.
  • Slow scans in authorised tests help you check your own detection; they never replace permission.

Next: Firewalls and IDS Concepts