Nmap Interactive Learning Lab

Learn Nmap from Beginner to Advanced with Interactive Labs

Lessons

Command



        

Explanation

Example Output



        

Practice

Nmap Command Simulator

Current Lab Challenge

Lab Network Map

Real-World Nmap Labs

Practice how Nmap is used in real security situations by both security professionals and attackers.

Discover Devices on Your Network

Before scanning ports or services, security professionals first need to determine which devices actually exist on the network. This process is called host discovery. In corporate environments this helps detect unknown devices, rogue systems, or unauthorized IoT devices connected to the network.

Step 1 — Find Active Devices

sudo nmap -sn 192.168.1.0/24

What this command does

  • -sn → Disables port scanning and performs only host discovery.
  • 192.168.1.0/24 → Scans every IP in the subnet (192.168.1.1 – 192.168.1.254).
  • sudo → Required for certain low-level network operations like ARP scans.
Why this scan is important
  • Identify all active devices on the network.
  • Detect unauthorized devices connected to Wi-Fi or LAN.
  • Create a baseline inventory of network assets.
How Nmap detects hosts Nmap may use several techniques depending on network conditions:
  • ARP requests (most reliable on local networks)
  • ICMP echo requests (similar to ping)
  • TCP SYN probes
What to look for
  • Unknown IP addresses
  • Devices that should not exist on the network
  • Unexpected numbers of hosts
Real-World Security Use Security teams often run this scan during:
  • Network audits
  • Asset discovery
  • Incident response investigations

Step 2 — Deep Scan Device

sudo nmap -sV -p- 192.168.1.15

What this command does

  • -sV → Performs service version detection.
  • -p- → Scans all 65,535 TCP ports.
  • 192.168.1.15 → Target device discovered in the previous scan.
Why this scan is important Once a host is discovered, the next step is determining:
  • Which ports are open
  • Which services are running
  • Which software versions are installed
These details are essential for identifying **potential vulnerabilities**. What to look for
  • Unexpected open ports
  • Services running outdated software
  • Administrative services exposed (SSH, RDP)
Example Security Insight If port 22 (SSH) is open:
  • Check if SSH should be accessible.
  • Ensure strong authentication is configured.
If port 80 or 443 is open:
  • It likely hosts a web server.
  • Further testing may include web vulnerability scanning.
Security Perspective Attackers perform these scans to find entry points. Defenders perform them to detect vulnerabilities before attackers do.

Check Public Server Ports

Organizations frequently expose web services to the internet. This lab demonstrates how to quickly test whether important ports are accessible from an external perspective.

Quick Web Server Test

nmap -p 80 example.com

What this command does

  • -p 80 → Scans only port 80 (HTTP).
  • example.com → Target domain.
Why this scan is useful Web servers typically run on:
  • Port 80 → HTTP
  • Port 443 → HTTPS
Security analysts often perform quick checks to verify that a web service is reachable. Possible results
  • open → The service is reachable.
  • closed → The port exists but no service is listening.
  • filtered → A firewall is blocking the probe.
What to look for
  • Unexpected open ports
  • Services exposed that should be internal only
  • Misconfigured firewall rules
Security Example If a server accidentally exposes admin panels or internal services to the internet, attackers may gain access to sensitive systems.

Check Database Exposure

Databases should almost never be exposed directly to the internet. This lab checks whether common database ports are publicly accessible.

nmap -Pn -p 3306,5432,1433,27017 your-external-ip

What this command does

  • -Pn → Skips host discovery and assumes the host is online.
  • -p → Specifies which ports to scan.
Common database ports
  • 3306 → MySQL
  • 5432 → PostgreSQL
  • 1433 → Microsoft SQL Server
  • 27017 → MongoDB
Why this scan is important Exposed databases are one of the most common causes of **massive data breaches**. If these ports are open to the internet, attackers may attempt:
  • Password brute-force attacks
  • Data extraction
  • Remote database exploitation
What to look for
  • Ports showing open
  • Services responding unexpectedly
Ideal secure result Most organizations expect these ports to show:
  • filtered → blocked by firewall
  • closed → service not exposed

🏠 Home 🛡️ Pentest Lab 📻 Global Radio 🎧 Audio Books 🧾 Invoice Generator 🔳 QR Code Generator 🤖 Interview Pal 🎓 Courses 🍎 Catch the Emoji 🧱 Block Stack ℹ️ About ✉️ Contact