In Nmap 7.991, what does the -sn option do, and what does a host listed as up tell you?
answer
- Stops after the first phase
- Older releases called it -sP
- Default probes still go out
- A verdict about the address
- 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
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.
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.
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.
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