In this practical, we will use Nmap to scan a local network and a specific target machine. The goal is to:
This hands-on exercise will help you understand how to perform network reconnaissance and gather useful information for penetration testing, system administration, or network management.
Identify Your Local IP Range:
Scan the Entire Subnet:
nmap -sn 192.168.1.0/24Output:
$ nmap -sn 192.168.1.0/24
Starting Nmap 7.80 ( <https://nmap.org> ) at 2024-12-16 16:00 UTC
Nmap scan report for 192.168.1.1
Host is up (0.0012s latency).
Nmap scan report for 192.168.1.5
Host is up (0.0009s latency).
Nmap scan report for 192.168.1.10
Host is up (0.0015s latency).
Nmap scan report for 192.168.1.20
Host is up (0.0020s latency).
Nmap done: 256 IP addresses (4 hosts up) scanned in 3.12 seconds
Nmap detected that four devices are up in the 192.168.1.0/24 range: 192.168.1.1, 192.168.1.5, 192.168.1.10, and 192.168.1.20.
Now that we know there are live hosts on the network, let’s focus on scanning a specific target machine for open ports, services, and OS information. Let’s say the target machine has the IP address 192.168.1.5.
Basic Port Scan:
nmap 192.168.1.5$ nmap 192.168.1.5
Starting Nmap 7.80 ( <https://nmap.org> ) at 2024-12-16 16:05 UTC
Nmap scan report for 192.168.1.5
Host is up (0.0010s latency).
Not shown: 993 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp open ssl/https
3306/tcp open mysql
Nmap done: 1 IP address (1 host up) scanned in 2.74 seconds
Service Version Detection:
nmap -sV 192.168.1.5$ nmap -sV 192.168.1.5
Starting Nmap 7.80 ( <https://nmap.org> ) at 2024-12-16 16:10 UTC
Nmap scan report for 192.168.1.5
Host is up (0.0020s latency).
Not shown: 993 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
443/tcp open ssl/https Apache httpd 2.4.29 ((Ubuntu))
3306/tcp open mysql MySQL 5.7.31-0ubuntu0.18.04.1
Nmap done: 1 IP address (1 host up) scanned in 3.14 seconds