Every network service listens on a numbered port. A port scan asks each port whether anything answers, and lists what is open and what service is behind it. Open does not mean broken: it means something is listening. Whether that matters depends on what.
The target is plugged in. What is it offering to the network?
A computer can run many services at once, and each listens on its own port, a numbered door. Port 22 is ssh, 80 is web pages, 21 is ftp and 23 is telnet. A port scan knocks on each door and records which ones open. nmap is the standard tool. This is the same idea as Names and addresses in Security and privacy: the address finds the computer, the port picks the service.
Make your prediction first. Help opens once you've locked it in.
Was your prediction right?
Scan the target with nmap target. Which ports are open?
Use the board. This ticks when you get there.
Now try it yourself.
Sam reads the scan. Click the line where it first goes wrong.
Scan only the ssh port on the target: nmap -p 22 target.
Use the board. This ticks when you get there.
Find every computer on the lab network with nmap -sn 10.0.0.0/24.
Use the board. This ticks when you get there.
Scan Kali itself: nmap localhost. What is listening?
Use the board. This ticks when you get there.
Then: cat scan1.txt to check it saved. You will scan again after the fixes and compare.
Before a hint: what kind of stuck is this? Try a strategy first
A scan prints to the screen. How do you keep it?
Use > after a command to save its output in a file.
nmap target > scan1.txt
Scan the target and save the result in a file called scan1.txt.
Use the board. This ticks when you get there.
Lesson done. You've finished every step you need.
Every network service listens on a numbered port. A port scan asks each port whether anything answers, and lists what is open and what service is behind it. Open does not mean broken: it means something is listening. Whether that matters depends on what. About 40 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
Try the boards yourself.
The gate (read first). This course teaches security as audit and defence: you scan, read and fix a lab computer your class owns. The pretend Kali and target in the lessons are safe anywhere. The real-lab version is different, so it needs your sign-off before anyone starts: school policy and IT's agreement, a written lab agreement every student signs (lab-rules.txt on the board is a model), and a lab that is cut off from every other network: a Pi running Kali and a second Pi or a virtual machine as the target, joined by one switch or one ethernet cable, with no router and no internet. Download the Kali image and any tools once, at home or at IT's request. Scan only the target named on the lab sheet. This course does not teach breaking into anything: it stops at find, understand and fix. It relaxes the 'defensive only' rule of the other courses only in that the real lab uses real scanning tools on a computer the class owns.
Simplifications: the pretend nmap supports -sn, -sV (next lesson) and -p, and scans only the target, Kali itself and the lab range. It shows open and filtered only. A real nmap has many more options and is very noisy on a real network: that is why the lab is isolated.
Real lab, if you run one: Kali Linux has a Raspberry Pi image (Pi 4 or Pi 5; the Pi 5 wants its 27 W supply); flash it with Raspberry Pi Imager or the Kali image instructions and boot it with a screen and keyboard, or ssh in. The target can be a second Pi (an older Raspberry Pi OS with a few extra services) or a purpose-made practice target your IT team approves. Start from the same state every time: re-flash, or snapshot a virtual machine. nmap is already on Kali. Give each pair a printed lab sheet naming the target's address, the one account they may use and what they are allowed to change.
Other options: netstat or ss -tln (run on the target) list its own open ports, the defender's view of the same thing; masscan and others scan faster, with the same permission rules.
Open versus broken. Students expect red alarms; a scan only reports what is listening.
Stretch: Find out what the 1000 'most common ports' are and why a default scan only checks those.
Support: A card of ports: 21 ftp, 22 ssh, 23 telnet, 80 web.
Links: Security and privacy › Names and addresses; Networks; next: Old versions and plain text.