Lab Solution
Step 1: Open the lab link to access the Kali Linux terminal instance
Step 2: Identify the target IP address
Before we begin performing a port scan with Nmap, we will need to identify the target IP address.
We can identify the target IP address by running the following command:
Command
ip a
As shown in the following screenshot, identify the IP address associated with the eth1 interface, this is the Kali Linux IP. The target IP address is always the next IP in the subnet.
So if the Kali Linux IP is 192.57.232.2 the target IP will be 192.57.232.3.
Note: In your case, the target IP address will be different, ensure you replace the IP of the target system in your lab environment with the IP address outlined below.
We can ping the target IP to verify that it is active, this can be done by running the following command:
Command
ping 192.57.232.3
As shown in the following screenshot, the host is online and is reachable from our Kali Linux system.
Step 3: Port scanning with Nmap
To begin with, we can perform an Nmap port scan on the entire TCP port range (65,535 ports) to identify all the open ports on the target system. This can be done by running the following command:
Command
nmap 192.57.232.3 -T4 -p-
As shown in the following screenshot, target system does not have any open TCP ports.
Given that the target system does not have any TCP ports open, we can perform a UDP port scan do discover any open UDP ports on the target system.
This can be done by running the following command:
Command
nmap 192.57.232.3 -T4 -sU
As shown in the following screenshot, the Nmap scan reveals that the target system only has one UDP port open (port 161) that is typically used by the SNMP service.
Step 4: Service detection with Nmap
Now that we have identified the open UDP port on the target, we can learn more about the service running on the open port by performing a service detection and script scan with Nmap.
This can be done by running the following command:
Command
nmap 192.57.232.3 -T4 -sU -p 161 -A
As shown in the following screenshot, the Nmap service detection scan confirms that an SNMP server is running on port 161, the scan also enumerates information from the SNMP server.
Go through the results produced by the aforementioned Nmap scan to learn more about the target system.
Conclusion
In this lab, we explored the process of performing port scanning and service detection with Nmap.