Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
Step by step
- Permission first — scan only systems you own or have written permission to test. Tell the network/security team; some IDS will alert.
- Which hosts are up (line 1) — a ping scan, no ports. Cloud hosts often block ping: use
-Pn(treat all as up) for them. - Common ports with versions (line 2) —
-sVasks each open port what runs there (5432/tcp open postgresql PostgreSQL DB 16.x). - All 65,535 TCP ports (line 3) —
-sS(SYN scan, needs root) is fast;-oAsaves normal, XML and grepable output for later comparison. - UDP — slower, but DNS, SNMP and NTP live there:
nmap -sU --top-ports 50 10.10.0.21(root). - Read the states —
open(a service answers),closed(host answers, no service),filtered(firewall drops; no answer). From outside, everything except your public services should befiltered. - Scan from two places — inside the network (what a hacked machine sees) and from the internet (what the world sees). The difference is your firewall.
- Compare over time — run the same scan weekly and diff:
ndiff scans/db01-2026-11-13.xml scans/db01-2026-11-20.xmlA new open port is a change someone must explain.
- TLS and more — scripts check certificates and ciphers:
nmap --script ssl-enum-ciphers,ssl-cert -p 443 www.example.com.
Check that it worked
The scan lists each host with its open ports and services; after closing an unwanted port (firewall or service stop) the next scan shows it filtered or closed; ndiff shows the change.
Common problems
| Problem | Cause | Fix |
|---|---|---|
Host seems down | Ping blocked. | Add -Pn. |
| Scan takes hours | All ports on many hosts with slow timing. | Top ports first; -T4; scan in parts. |
All ports filtered | A firewall drops everything from your source. | Scan from inside, or allow your scanner's IP. |
-sS refused | Needs root. | Run with sudo, or use -sT (connect scan). |
Version shows tcpwrapped | Service closes the connection at once. | Normal for some protected services; check on the host with ss -ltnp. |
| Security team alarm | Unannounced scan. | Announce scans; use a fixed scanner IP and time. |
Go further
- Command pages: nmap, ss.
- Next how-tos: Test if a remote port is open, Find which process uses a port, Check the TLS settings of a website, Write firewall rules with nftables.
- Learn it: Host security services — Nmap. Full guide: Nmap.
1What is the difference between closed and filtered in Nmap?
Closed means the host answered but no service listens; filtered means no answer came back, usually because a firewall dropped the probe.
2Why scan from inside and from outside?
Inside shows what an attacker on a hacked machine sees; outside shows what the whole internet sees.