How I Use Nmap
Nmap is the first tool I open on almost every engagement, and it's the first one I put in front of students. Before you can defend or attack a network, you need to know what's actually on it. Nmap answers three questions in order: which hosts are alive, which ports they have open, and what's listening behind those ports.
Start with host discovery
I never scan blind. On a fresh subnet I run a ping sweep first so I'm only spending time on machines that respond, instead of hammering dead addresses.
nmap -sn 10.0.0.0/24
The -sn flag means "no port scan" — just tell me who's home. This gives me a clean list of live hosts to focus on.
Then scan the hosts that answered
Once I have targets, I run a service and version scan with default scripts. This is the command I use most:
nmap -sC -sV -oA scan 10.0.0.5
Breaking it down: -sV detects the version of each service, -sC runs Nmap's safe default scripts, and -oA scan saves the output in all three formats (normal, greppable, and XML) using the base name scan. That last flag matters more than people expect — I want everything on disk so I can grep it later and drop the XML into a report.
Tip I give every student: always save your output. The scan you didn't record is a scan you have to run again, and on a client network you don't want to make noise twice.
Go deeper only when it's justified
A full port scan and OS detection is loud and slow, so I reserve it for hosts that look interesting:
nmap -p- -sV -O -oA full 10.0.0.5
-p- scans all 65,535 ports instead of the top 1,000, and -O attempts OS fingerprinting. I only do this when the quick scan hinted at something worth the extra time and noise.
How I read the results
- Open ports that shouldn't be exposed (RDP, SMB, database ports) go straight to the top of my notes.
- Version numbers get checked against known vulnerabilities — an old service is a lead, not a conclusion.
- Anything unexpected gets flagged for a manual look rather than trusted blindly.
Nmap doesn't exploit anything. It builds the map. Everything I do afterward is more accurate because I took the time to enumerate properly first.