Exercise: Scanning the Network with Nmap
Discovering Devices and Services
1 Purpose
This exercise introduces you to nmap, one of the most powerful and widely-used tools for network discovery and security auditing. As an IT technician, you can use nmap to quickly create a map of your network, identify what devices are connected, and see what services (e.g., web servers, file shares) they are offering. This is an invaluable skill for both network management and security analysis.
2 What You’ll Accomplish
By the end of this exercise, you will be able to:
- Install
nmapon a Fedora system. - Perform a simple ping scan to discover live hosts on your network.
- Conduct a port scan on a specific host to identify open ports and services.
- Interpret basic
nmapoutput.
This exercise maps to the following program and course learning outcomes:
- Program Learning Outcomes (PLOs):
- 6. Maintain environment: Using
nmapto audit and understand the devices on your network is a key maintenance and security task.
- 6. Maintain environment: Using
- Course Learning Outcomes (CLOs):
- 3. Troubleshoot hardware and basic network components:
nmapcan help you verify if a device is online and if its services are accessible, which is critical for troubleshooting.
- 3. Troubleshoot hardware and basic network components:
This exercise develops the following skills, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.
| Learning Objective | O*NET KSAs | Technologies Used |
|---|---|---|
| Discover live hosts on a local network. | Knowledge: Telecommunications, Security and Government Skills: Systems Analysis |
nmap |
| Identify open ports and services on a host. | Knowledge: Telecommunications, Security and Government Abilities: Problem Sensitivity |
Port Scanning |
3 Prerequisites
This exercise requires a running Fedora 42 virtual machine with internet access and a user account with sudo privileges. You should also have the IP address of your default gateway from the previous exercise.
4 Step-by-Step Guide
Open a terminal window in your Fedora VM to begin.
4.1 Step 1: Install nmap
nmap is a powerful tool and is not installed by default on Fedora.
Run the following command to install the package:
sudo dnf install -y nmap
4.2 Step 2: Find Your Physical Network Range
Before you can scan, you need to reliably identify your primary network—the one that connects to the internet. A modern Linux system can have many virtual interfaces (for Docker, VMs, etc.), so just grabbing the first IP address you see can be misleading. The best way to find your physical network is to find which one your default gateway (router) is on.
First, find your default gateway’s IP address using the
ip routecommand.ip routeLook for the line starting with
default via. Let’s say it showsdefault via 192.168.1.1. This means your router is at192.168.1.1, and your physical network is the192.168.1.xrange.Now, let’s get a cleaner list of your IP addresses. Use the
ipcommand with the-br(brief) and-c(color) flags.ip -br -c addrLook at the output. Find the interface that has an IP address matching the network range from your default gateway. For example, if your gateway was
192.168.1.1, you are looking for the line that shows an address like192.168.1.150/24. This is your target network range for the scan.
In your student notebook, write down your network range in CIDR notation (e.g., 192.168.1.0/24).
4.3 Step 3: Perform a Ping Scan
A ping scan (-sn) is a simple scan that just discovers which hosts on the network are online and responsive. It does not scan their ports. This is a great first step to map out a network.
Run
nmapwith the-snflag on your network range.# Replace with your network range from Step 2 sudo nmap -sn 192.168.1.0/24Note: Using
sudowith nmap often allows for more advanced and accurate scanning techniques.Analyze the output.
nmapwill list every IP address that responded, telling you how many hosts are “up”. You should see your own computer, your default gateway (router), and potentially other devices on the network.
In your notebook, list at least two IP addresses that nmap found on your network.
4.4 Step 4: Perform a Service Scan on Your Router
Now you will perform a more detailed scan on a single target: your default gateway. This scan will probe the most common ports to see which services are open.
Run
nmapwith no flags, just the IP address of your default gateway.# Replace with your gateway's IP address sudo nmap 192.168.1.1Analyze the output. This time,
nmapwill show a table of “PORT”, “STATE”, and “SERVICE”.- PORT: The port number (e.g., 80, 443).
- STATE:
open,closed, orfiltered.openmeans a service is listening. - SERVICE: The common name for the service on that port (e.g.,
http,https).
You will likely see port 80 (HTTP) or 443 (HTTPS) open, which corresponds to the router’s web-based administration interface.
In your notebook, list two open ports that nmap found on your default gateway and the service name for each.
4.5 Step 5: Identify the Router’s Manufacturer
When your computer communicates with a device on the local network (like your router), it uses the Address Resolution Protocol (ARP) to find the device’s physical MAC address. Your system keeps a cache of these IP-to-MAC address mappings. You can view this cache to find the MAC address of your router, which can tell you who made it.
Run the
ip neigh showcommand to view your system’s neighbor (ARP) table.ip neigh showFind the line that starts with your router’s IP address. The long hexadecimal number on that line is the router’s MAC address. It will look something like
00:1a:2b:3c:4d:5e.The first half of a MAC address is the Organizationally Unique Identifier (OUI), which identifies the manufacturer. Copy the MAC address from your terminal.
Open a web browser and navigate to the Wireshark OUI Lookup Tool: https://www.wireshark.org/tools/oui-lookup.html
Paste the MAC address into the search box and click “Find”. The tool will tell you the manufacturer of the network hardware (e.g., “NETGEAR,” “Cisco,” “TP-Link”).
In your notebook, write down the manufacturer of your default gateway.
5 Reflect and Review
Now that you have completed this exercise, reflect on your experience in your Microsoft Teams Student Notebook:
- 3 pieces of information you can discover with
nmap. - 2 different types of scans you performed.
- 1 question you still have about how port scanning works.
Answer these questions in your notebook to solidify your understanding:
- What
nmapflag would you use if you only want to discover which hosts are online, without scanning their ports? - What does it mean if
nmapreports a port’s state as “open”? - You want to scan your entire local network, which has an IP range of
192.168.10.1to192.168.10.254. How would you write this range in CIDR notation fornmap? - Why is
nmapa useful tool for both network administrators and security professionals?