Skip to content
Tutorials Center
My learning

Topics

Lesson 13 of 36 ยท Host Discovery

List Scan and DNS Resolution

Use the Nmap list scan and DNS options: reverse lookups, -n and -R, custom DNS servers, --system-dns, and a Python reverse-pointer helper to preview targets.

Names are friendlier than numbers, and the name of a host often says what it does: db01, vpn-gw, printer-3rd-floor. Nmap can translate between names and addresses, and the list scan (-sL) uses this to show you the targets without sending a single packet to them. DNS also has a cost: lookups slow scans and, more importantly, reveal your activity to your DNS server. This lesson covers both sides.

Commands are read-only. A list scan is the safest scan there is, but it still asks your DNS resolver questions, so do not list targets you are not permitted to look up. The Python editors compute names in memory without DNS.

What the list scan does

-sL expands the target specification, resolves each address to a name (reverse DNS) and prints a list. No host discovery, no port probes:

Terminal
nmap -sL 192.0.2.0/29
TEXT
Starting Nmap 7.9x ( https://nmap.org ) at 2026-11-12 12:00 UTC
Nmap scan report for 192.0.2.0
Nmap scan report for gateway.example.net (192.0.2.1)
Nmap scan report for web01.example.net (192.0.2.2)
Nmap scan report for 192.0.2.3
Nmap scan report for db01.example.net (192.0.2.4)
Nmap scan report for 192.0.2.5
Nmap scan report for 192.0.2.6
Nmap scan report for 192.0.2.7
Nmap done: 8 IP addresses (0 hosts up) scanned in 0.12 seconds

Example output (invented names). Addresses without a reverse record just show the number. The summary says 0 hosts up because nothing was probed. A list scan is the sanity check before a big scan: you see the exact addresses and the names, which often reveals a mistake in the prefix or an unexpected owner.

You can also use a list scan on a name list to resolve forward names:

Terminal
nmap -sL web01.example.net mail.example.net

Forward and reverse DNS

  • Forward lookup (A / AAAA records): name to address. Nmap does this when you give it a name.
  • Reverse lookup (PTR records): address to name. Nmap does this by default for hosts that are up.

Reverse records live under special names. The address 192.0.2.4 is looked up as 4.2.0.192.in-addr.arpa. (octets reversed). For IPv6 the name is the nibbles reversed under ip6.arpa.

Controlling DNS

By default Nmap resolves names of hosts that respond. You can change that:

Option Effect
-n Never do reverse DNS. Faster, and avoids leaking targets to your resolver
-R Always do reverse DNS, even for hosts that are down
--dns-servers a,b Use these resolvers instead of the system ones
--system-dns Use the operating system's resolver (slower, but honors local config such as /etc/hosts)
--resolve-all If a name has several addresses, scan all of them
--unique Scan each IP only once even if named multiple times

For big sweeps, -n is the single easiest speed-up: DNS lookups of thousands of silent addresses can take longer than the probing itself.

Terminal
sudo nmap -sn -n 192.0.2.0/24            # fast sweep, no names
nmap -R -sL 192.0.2.0/24                 # try names for every address
nmap --dns-servers 192.0.2.53 -sL 192.0.2.0/24

Why DNS matters for security work

  1. Privacy. A reverse lookup of every address in a range sends the whole range to your DNS server and to anything upstream. In sensitive tests, use -n or a dedicated resolver.
  2. Information. Names reveal roles, locations and technology (jenkins, vpn, dev-db). Defenders should check that their reverse records do not leak more than they should.
  3. Inventory. A list scan across your own ranges produces a table of names for documentation and for spotting forgotten systems: addresses with names nobody recognizes.
  4. Accuracy. Reverse DNS is not proof of identity: anyone who controls a reverse zone can set any name. Treat names as hints.

DNS and your scan

-sL List targets. No probes sent.
-n No DNS. Fast and quiet.
-R Always resolve.
--dns-servers Choose the resolver.

DNS is a trade between convenience and speed.

1 / 2

A stand-in: build reverse DNS names

The reverse name is just the address reversed with a suffix. Python's ipaddress module computes it, for IPv4 and IPv6. This is what Nmap asks the DNS server.

Python Reverse pointer names

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.

For IPv6 the name is long: one nibble (hex digit) per label, reversed. You rarely type these by hand, but seeing them explains why a missing PTR zone is so common for IPv6.

A stand-in: simulate a list scan

This program expands a CIDR block, looks each address up in an invented "DNS table", and prints a list scan report in Nmap's style. It also flags an address with a suspicious name for follow-up.

Python Simulated list scan with names

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.

This pattern (list, then review) is a cheap way to catch forgotten test machines before an attacker does. Reading Nmap Output shows how to save such a list in files.

Putting it together: a discovery plan

  1. Preview targets with -sL (check count and names).
  2. Sweep with -sn -n for speed; add probes for firewalled segments (Discovery Probes).
  3. Save the live host list (-oG or -oX).
  4. Port-scan only the live hosts, with names turned on only when you need them.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Does nmap -sL send probes to the target hosts?

    The list scan resolves names and prints targets; it sends no packets to the targets.
  2. 2. How do you speed up a large sweep by disabling reverse DNS?

    -n never resolves names; -R always does.
  3. 3. What is the reverse DNS name of 192.0.2.4?

    The octets are reversed and the suffix in-addr.arpa is added.
  4. 4. Why is a hostname from reverse DNS not proof of a host's identity?

    PTR records are set by the network owner, so treat them as hints, not proof.

Summary

  • -sL lists and resolves targets without probing them: a safe preview and an inventory tool.
  • -n disables reverse DNS (fast, private); -R forces it; --dns-servers chooses resolvers.
  • Reverse DNS uses reversed octets under in-addr.arpa; IPv6 uses ip6.arpa.
  • Names leak information and are hints, not proof of identity.
  • Plan discovery as: list, sweep, save, then port scan the live hosts.

Next: SYN and Connect Scans