Scan a Network with Nmap
root
Jun 11 2026
What You'll Learn
How to use Nmap — the industry-standard network scanner — to discover devices and open ports.
⚠️ Important: Only scan networks and systems you own or have explicit permission to test. Unauthorized scanning is illegal.
Prerequisites
- A computer on a local network (home or lab)
- Admin/root privileges
Step 1 — Install Nmap
macOS:
brew install nmap
Ubuntu/Debian:
sudo apt update && sudo apt install nmap -y
Windows: Download the installer from nmap.org
Step 2 — Find Your Network Range
# macOS / Linux — find your IP address
ifconfig | grep "inet "
# Windows
ipconfig
If your IP is 192.168.1.45, your network range is likely 192.168.1.0/24.
Step 3 — Run Your First Scan
# Discover all live devices on your network
nmap -sn 192.168.1.0/24
This "ping scan" shows which hosts are online without probing ports.
Step 4 — Scan Open Ports on a Device
# Replace with a target IP from the previous scan
nmap 192.168.1.1
Understanding the output:
| Column | Meaning |
|---|---|
PORT |
Port number and protocol |
STATE |
open / closed / filtered |
SERVICE |
What service typically runs here |
Step 5 — A More Detailed Scan
# Detect OS and service versions (requires root/admin)
sudo nmap -A 192.168.1.1
Well done!
You've performed your first network reconnaissance — a core skill in both offensive and defensive security.
root
Just share your knowledge!