> For the complete documentation index, see [llms.txt](https://docs.netmap.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.netmap.dev/how-to-guides/run-discovery.md). Agents can also search and read this documentation through its [MCP server](https://docs.netmap.dev/~gitbook/mcp).

# Run Discovery

Discovery runs nmap against private targets and presents detected devices for review before import. Running scans and reviewing results requires `discovery_manage`; applying or importing results into inventory also requires `topology_write`. NetMap does not silently overwrite inventory from an ad-hoc scan.

## Requirements And Safety

The all-in-one image includes nmap and grants the `netmap` user passwordless sudo for `/usr/bin/nmap`. MAC/ARP discovery requires host networking because ARP does not cross a Docker bridge. Only scan networks you own or are authorised to test. Public and special-purpose targets are rejected; administrator settings control confirmation thresholds and maximum scan size.

## Target Formats And Scan Modes

Targets may be a single IPv4/IPv6 address, CIDR, comma-separated addresses/ranges, or a private `start-end` range. NetMap preserves the entered range for display but normalises it to CIDR arguments before invoking nmap. **Ping sweep** discovers responsive hosts and reverse-DNS names without scanning ports. **Basic port detection** adds the configured lightweight port probe and takes longer.

Large ranges show an estimate before confirmation. Host-count limits, discovery rate limits, and `discovery_process_timeout_seconds` protect the scheduler and container. Reverse DNS runs after the sweep, in parallel and within its own time budget, so a subnet without reverse DNS no longer runs into the scan timeout. A scan that exceeds a configured maximum must be reduced rather than forced through the UI.

## Start A Scan

1. Choose **Scan** in the Topology toolbar, Inventory or Overview to open **Discover devices**.
2. Enter the target(s), choose ping sweep or basic port detection, and select an optional group and location.
3. Choose optional SNMP enrichment: a saved profile or manual community where supported. Never paste secrets into notes.
4. Confirm the estimate and choose **Start scan**.
5. Watch progress: the dialog shows how many addresses have been scanned and the elapsed time, then the results. The scan runs in the background, so you can close the dialog and it keeps running. Only one manual scan runs at a time; starting another while one is running shows that scan's progress instead. To stop a scan, select **Stop scan**: a queued scan is cancelled before it starts, a running one stops its nmap sweep, and no results are kept.
6. Review each detected row before importing.

The result identifies IP, reverse-DNS hostname, MAC/vendor when available, open-port data for port scans, and whether a row matches an existing device.

## MAC, Vendor, And SNMP Enrichment

ARP/MAC results require host networking. In bridge mode, discovery can still find IPs but MAC/vendor fields may be empty; enter them manually or rerun with host networking. SNMP can enrich supported network devices and may suggest ARP-derived fields. Saved profile credentials remain protected; preview proposed changes before applying them.

## Review And Import Behaviour

Existing-device matching uses available identity data such as IP/MAC. You can select **new devices only**, import selected rows, fill missing fields on existing records, or explicitly allow selected field overrides. Fill-missing is non-destructive; override can replace existing metadata and should be reviewed field by field. Skipped duplicates and validation failures remain visible in the result summary.

## Scheduled Discovery

Create a schedule with target, mode, interval, optional group/location, and a saved notification profile. Schedules can be edited, paused, run immediately, or deleted by users with write permission. A schedule whose target covers more than 256 addresses needs **Confirm large scan** ticked before it can be saved, the same as a manual scan. Scheduled runs create review-only observations rather than mutating inventory. See [Review Discovery Observations](https://docs.netmap.dev/how-to-guides/scheduled-discovery-observations.md) for apply/resolve workflows and Wi-Fi churn suppression.

## History And Troubleshooting

Discovery history records status, timestamps, target/mode, result counts, and errors for completed and failed scans. Retention follows the application's configured history policy.

| Symptom                                    | Likely cause                                                                | Fix                                                                                                                                                  |
| ------------------------------------------ | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| no MAC addresses                           | Docker bridge or missing raw-network capability                             | use `network_mode: host` and verify the image capabilities                                                                                           |
| "Public IP scanning is blocked by default" | part of the target lies outside the private, loopback and link-local ranges | keep every address inside `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `127.0.0.0/8`, `169.254.0.0/16`, `fc00::/7`, `fe80::/10` or `::1`         |
| empty result                               | target is unreachable or filtered                                           | verify routing and target format, then retry a small CIDR                                                                                            |
| scan times out                             | oversized range or slow probes                                              | reduce the range, use ping sweep, or increase the administrator timeout carefully                                                                    |
| `429`                                      | discovery rate limit                                                        | wait for the window to clear                                                                                                                         |
| `sudo`/nmap error                          | image or host dependency/capability issue                                   | read the scan error, which includes nmap's or sudo's own message, then inspect container logs and verify `/usr/bin/nmap` and the permitted sudo rule |
| hostname is missing                        | no PTR response within the lookup budget                                    | configure reverse DNS or treat the IP as the identity                                                                                                |

## API Equivalents

* `POST /api/v1/discovery/scans`
* `GET /api/v1/discovery/scans/{scan_id}`
* `GET /api/v1/discovery/scans`
* `POST /api/v1/discovery/schedules`
* `PATCH /api/v1/discovery/schedules/{schedule_id}`
* `POST /api/v1/discovery/schedules/{schedule_id}/run`

Related request model: `DiscoveryStart`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.netmap.dev/how-to-guides/run-discovery.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
