Security tools · Lesson 13 of 14

Nmap: scan your own network

A beginner’s Nmap guide: what port scanning is, when it’s legal, how to scan your own lab, and how to read open, closed and filtered results.

⏱ 18 min🎯 Beginner🧪 Hands-on practice🎬 Video

By the end, you’ll be able to…

  • Explain what a port scan does and why defenders use it
  • Run safe Nmap scans against your own machine and lab
  • Read Nmap output and decide what to do about open ports

Key words

Port scan
Checking which ports on a device accept connections.
Open
A program is listening on that port and answered.
Closed
The device answered, but nothing is listening on that port.
Filtered
No clear answer, usually because a firewall dropped the probe.
Service detection
Asking an open port what software and version is behind it (-sV).
Attack surface
Everything about a system that someone could try to interact with.
Read this first

Scanning networks you don’t own or don’t have written permission to test can be illegal, and it is against the rules at almost every school and workplace. In this lesson you scan your own computer, your own lab VMs, and scanme.nmap.org, a machine the Nmap project set up specifically so people can test scans against it. Read the rules on that page before using it.

What Nmap is for

Nmap (“Network Mapper”) is a free, open-source tool that discovers devices on a network and checks which ports they have open. Defenders use it to answer a simple but vital question: what am I actually exposing? You can’t protect a service you don’t know is running.

Install

  • Windows / macOS: installers on the official download page.
  • Ubuntu / Debian: sudo apt install nmap
  • Kali: already installed.

Scan 1: your own computer

nmap localhost

This checks the 1,000 most common ports on your own machine. Typical output:

Nmap scan report for localhost (127.0.0.1)
Host is up (0.00010s latency).
Not shown: 997 closed tcp ports (reset)
PORT     STATE SERVICE
22/tcp   open  ssh
631/tcp  open  ipp
5432/tcp open  postgresql

Do you recognise each one? Here: SSH (remote login), IPP (printing), PostgreSQL (a database). If you don’t use one, that’s a service worth turning off.

Scan 2: what software is listening?

nmap -sV localhost

-sV asks each open port what software and version it’s running. Outdated versions are worth updating.

Scan 3: find devices in your lab

If your VMs are on a host-only network such as 192.168.56.0/24:

nmap -sn 192.168.56.0/24     # -sn = just find which hosts are up, no port scan
nmap 192.168.56.101          # then scan one VM you own

The /24 means “all 256 addresses from 192.168.56.0 to 192.168.56.255”. Only use ranges that are entirely yours.

Reading port states

StateMeansWhat to do
openSomething is listening and answeredDo you need it? Is it updated? Is it limited by a firewall?
closedReachable, but nothing is listeningUsually fine
filteredA firewall is probably dropping probesOften expected and good

From scan to defence

A scan is only useful if it leads to action:

  1. List each open port and the service behind it.
  2. Ask: does this need to be reachable, and from where?
  3. Turn off what isn’t needed (systemctl disable --now <service>), update what is, and use a firewall to limit who can reach it.
  4. Scan again to confirm your change worked.

That loop of discover, decide, fix, verify is real defensive work.

🧪 Hands-on

Practice

Read this Nmap scan of a lab VM and answer the questions.

🎬 Watch

Video: Nmap Tutorial to Find Network Vulnerabilities

ToolsNmap Tutorial to Find Network VulnerabilitiesNetworkChuck · Watch on YouTube

Video by NetworkChuck, hosted on YouTube. It loads only when you press play.

✅ Check yourself

Quick quiz

Q1. Which target is always OK to scan for practice?
Q2. What does ‘filtered’ usually mean?
Q3. Your scan shows port 3389 (RDP) open on a laptop that never uses remote desktop. Best response?