Tools and labs
Nmap for Beginners: Scanning Your Own Home Lab, Legally and Safely
Nmap is the classic network scanner, used by defenders and penetration testers to see which devices and services are on a network. Here is how to learn it the right way: on your own lab, with clear rules.
Legal note first
Only test systems you own or have permission for. In India, accessing or scanning computer systems without the owner's permission can attract action under the Information Technology Act, 2000, and also breaks most internet providers' and cloud providers' terms. "I was just learning" is not a defence. The official Nmap book has a whole chapter on legal issues for this reason.
Safe places to practise:
- Your own home lab VMs on a host only network (setup guide).
scanme.nmap.org, which the Nmap project explicitly allows for light testing, as described on that page.- CTF and training platforms that provide targets and permission.
Install and check
Nmap is available for Linux, Windows and macOS from nmap.org, and comes pre installed on Kali Linux. Check it works:
nmap --version
In the examples below, 192.168.56.0/24 is a typical VirtualBox host only lab network, and 192.168.56.101 is your vulnerable target VM. Replace them with your own lab addresses.
Step 1: Host discovery
Find which machines are up in your lab network without scanning ports:
nmap -sn 192.168.56.0/24
You should see your own VMs. If you see unexpected devices, double check you are on the lab network and not your home WiFi range.
Step 2: Port scanning
A basic scan of the most common 1,000 TCP ports:
nmap 192.168.56.101
More options for your lab:
nmap -p 1-65535 192.168.56.101 # all TCP ports, slower
nmap -p 22,80,443 192.168.56.101 # specific ports
sudo nmap -sS 192.168.56.101 # SYN scan, needs admin rights
sudo nmap -sU --top-ports 20 192.168.56.101 # top UDP ports, slow
Port states:
- open: a service is listening and responding.
- closed: the host replied, but nothing is listening on that port.
- filtered: no clear reply, often because a firewall is dropping packets.
Step 3: Service and version detection
Knowing a port is open is useful. Knowing what runs there is better:
nmap -sV 192.168.56.101
nmap -sV -sC 192.168.56.101 # also run default safe scripts
nmap -O 192.168.56.101 # guess the operating system (admin rights)
-sC runs the default set of Nmap Scripting Engine scripts, which gather extra information. On your lab target, compare the versions nmap reports with what you installed. Outdated versions are where vulnerabilities often hide, which connects to our post on patching.
Save and read your results
nmap -sV -oN scan.txt 192.168.56.101 # normal text output
nmap -sV -oA labscan 192.168.56.101 # all formats: text, XML, grepable
Write a short summary for each scan in your lab notebook: target, command, open ports, services, versions, and what you would fix if this were a real server. That summary is portfolio material.
Look at it from the defender side
This is the step most beginners skip. While you scan:
- Run Wireshark on the lab network and watch the SYN packets. See our Wireshark guide.
- On the target, check logs, for example web server access logs, or
sudo journalctl -fon Linux. - Try a slower timing option such as
-T2and notice how it changes what defenders see.
Understanding how scans look in logs is exactly what SOC analysts need. You are learning both sides at once.
Where to go next
After the basics, learn about firewalls on your target (turn on ufw and scan again), read the official Nmap reference guide section by section, and practise on CTF targets. Keep the golden rule forever: no permission, no scan.
Frequently asked questions
Can I scan my own home WiFi router? Scanning devices you own on your own network is generally fine, and a good way to check for open services. Avoid scanning devices that belong to family members or neighbours without asking.
Is nmap a hacking tool? It is a network discovery and auditing tool used widely by system administrators and defenders. Like any tool, the permission and purpose decide whether its use is legitimate.
Why are all my ports filtered? A firewall is probably dropping packets. In your lab, check the target's firewall settings and remember that filtered results are also useful information.
Educational content, not legal advice. Check official sources before you rely on it. If you have lost money, call 1930 now. Terms