skip to content

Host Discovery

Before touching ports, Nmap decides which hosts are alive with ICMP, TCP and ARP probes. Interviewers ask because a 'nothing found' result is often a live host that -Pn would have reached.

on this pageshow

questions

6

In Nmap 7.991, what does the -sn option do, and what does a host listed as up tell you?

level: juniorimportance: must knowfreq 48%

answer

  1. Stops after the first phase
  2. Older releases called it -sP
  3. Default probes still go out
  4. A verdict about the address
  5. Ports were never examined

basics

~20 s

-sn runs Nmap's host-discovery phase only and prints the hosts that answered a probe; no port scan follows. 'Up' means a discovery probe drew a reply. It says nothing about open ports, services or who owns the address.

solid answer

~40 s

`-sn` (called `-sP` in older releases) runs host discovery and stops: no port scan follows, and the output lists the hosts that answered a discovery probe. With no other discovery option it still sends the default probes, an ICMP echo request, a TCP SYN to port 443, a TCP ACK to port 80 and an ICMP timestamp request, and it uses ARP for targets on the local Ethernet segment. 'Up' is a host-discovery verdict, not a port result: a closed port's reset proves a host is there just as an open port does. A live host that drops every probe type you chose reads as down. Naming any probe-type option such as `-PS` or `-PE` replaces the default probes.

go deeper

for a junior

Recall that -sn is the host-discovery-only scan and that 'up' is not a port result. Be ready to say what it sends by default.

for a middle

Explain the default probe set and how an unprivileged run or a local segment changes it. Show that you read --reason rather than trusting the count.

for a senior

Treat up and down as inferences: name what a firewall, proxy ARP or a reset sent on behalf of an empty address does to them, and say what evidence you would add before correcting an inventory.

for a principal

Decide what a quarterly sweep may claim to the business: a list of answering addresses, with the probe set and vantage point recorded, never a complete asset list.

## What -sn does Nmap normally works in two phases. First it decides which targets are alive; then it port-scans only the ones it found. `-sn` keeps the first phase and drops the second, so the output is the list of hosts that answered a discovery probe and nothing about their ports. Older releases called the option `-sP`; Nmap 7.991 documents `-sn`. It is often called a ping scan or ping sweep, but it goes well beyond the `ping` tool, and traceroute or NSE host scripts can be requested alongside it. ## The probes it sends With no other discovery option, `-sn` uses the same defaults as a normal scan: - an ICMP echo request, a TCP SYN to port 443, a TCP ACK to port 80 and an ICMP timestamp request, for a privileged user and a routed IPv4 target - ARP (IPv4) or Neighbor Discovery (IPv6) for targets on the local Ethernet segment - a `connect()`-based SYN to ports 80 and 443 only, for an unprivileged Unix user - any explicit probe-type option (`-PE`, `-PS`, `-PA`, `-PU` and the like) replaces the default probes, although targets on the local segment are still found with ARP ## What 'up' tells you A host is listed as up when one probe drew an answer. Nmap does not mind which kind of answer: a reset from a closed port counts as much as a SYN/ACK from an open one. So: - **Up is not a port result.** No port was examined, and an up host may run no service at all. - **Up is not identity.** A router doing proxy ARP, or a firewall that sends resets for addresses it guards, can make empty addresses look occupied. - **Down is not empty.** It means none of the probes you chose was answered. For a single host Nmap prints a note suggesting `-Pn`. - **`--reason` names the evidence.** It shows the packet that decided each host, for example `echo-reply` or `arp-response`. ## Reading the output Each listed host gets a report block. With `--reason` the status line names the deciding packet and, for a reply that carries one, its TTL: ``` Nmap scan report for host1.example.internal (192.0.2.10) Host is up, received echo-reply ttl 63 (0.0021s latency). ``` Without `-v`, addresses that did not answer are simply not listed; with `-v` they appear marked `[host down]`. For an inventory, run with `-v` so that silent addresses are recorded as silent rather than absent, and keep the XML output so the run can be diffed against last quarter's. ## What it looks like to the receiving side Every address in the range receives the default probes in a short burst. A sweep is routine administration, but the recipient cannot tell an authorised sweep from an unauthorised one by the packets alone; the signed scope, the source address and the time window do that. The sweep is also one step more intrusive than a list scan, which is why it belongs inside the agreed scope and window. ## Beside its neighbours | Option | Sends packets to the targets? | Port scan afterwards? | |---|---|---| | `-sL` | No, only name lookups | No | | `-sn` | Yes, discovery probes | No | | no option | Yes, discovery probes | Yes, on hosts found up | | `-Pn` | No discovery probes (ARP still runs locally) | Yes, on every address | ## Using it in an audit 1. Put the range in the written scope first; a sweep sends packets to every address in it, so it needs the same authorisation as a port scan. 2. Run `-sn --reason` against the range and keep the XML output as the evidence. 3. Compare the result with the asset register, treating each difference as a question rather than an answer. 4. Chase gaps with different probe types or a different vantage point before reaching for `-Pn`. An administrator uses `-sn` to count live machines or watch server availability; the reference guide notes it is more reliable than pinging the broadcast address, because many hosts do not reply to broadcast queries. Everything it says is an inference from replies, so a clean count that matches the register proves less than it seems.

  • Why can the same -sn run report different hosts from the target's own LAN than from a routed network?
    On the local Ethernet segment Nmap finds hosts with ARP, which hosts do not filter the way they filter ICMP or TCP. From a routed network the ICMP and TCP probes cross firewalls and host filters, and any probe type they drop produces a 'down' for a live host.
  • Can -sn do more than list live hosts?
    Yes. The reference guide says traceroute and NSE host scripts can be requested with it, and any probe-type options can be combined with it. Without those it prints only the hosts that answered, with their reverse-DNS names when they have one.

  • -sn is passive and sends nothing to the targets
  • A host listed as up has open ports or services
  • Down means the address is unused or powered off
  • -sn is only an ICMP echo, the same as ping
  • -sn still port-scans the hosts it finds
open as a page

In Nmap 7.991 with no host discovery option given, which probes does Nmap send to each target, and when do they differ?

level: middleimportance: must knowfreq 34%

basics

~20 s

A privileged run against a routed IPv4 target sends an ICMP echo request, a TCP SYN to 443, a TCP ACK to 80 and an ICMP timestamp request. Local Ethernet targets use ARP; an unprivileged user sends connect() SYNs to 80 and 443.

open as a page

An authorised Nmap sweep of a /22 finds far fewer hosts than the asset register lists; how do you use --reason and the discovery options to find out why?

level: seniorimportance: should knowfreq 22%

basics

~20 s

'Down' only means no probe was answered. Re-run with --reason, check known-live hosts to see which probe types get through, then add suitable probe types or scan from inside the segment before reaching for -Pn.

open as a page

What does Nmap's -Pn option change in a scan of a /22, and why is it an expensive fix for hosts that read as down?

level: seniorimportance: should knowfreq 27%

basics

~20 s

-Pn skips host discovery and treats every address as up, so the requested scans run against all 1,024 addresses of a /22, empty ones included. It costs time and noise and fills the report with phantom hosts; fix the probe set first.

open as a page

What does Nmap's list scan -sL send to the targets, and why run it before an authorised sweep?

level: middleimportance: nice to knowfreq 15%

basics

~20 s

-sL sends no packets to the target hosts: it expands the target specification and, by default, reverse-resolves each address through DNS. The names and the total let you confirm the scope is the intended network before any probe is sent.

open as a page

Which Nmap discovery run sends each address an ICMP echo, a TCP SYN to 443, a TCP ACK to 80 and an ICMP timestamp request, and what can a firewall admin conclude from it?

level: seniorimportance: nice to knowfreq 17%

basics

~20 s

A privileged Nmap run with no discovery option, or -sn, equal to -PE -PS443 -PA80 -PP. The admin can conclude a host-discovery sweep came from that source, not who ran it, whether it was authorised or what follows.

open as a page