This guide explains how to install NMAP and use it to scan your server for open ports.
NMAP (Network Mapper) is a powerful open-source tool used to discover hosts and services on a computer network. It is widely used for security auditing and network troubleshooting.
Let us follow the steps:
- To install NMAP on various platforms:
- On Ubuntu/Debian:
sudo apt update sudo apt install nmap
- On CentOS/RHEL:
sudo yum install nmap
- On Fedora:
sudo dnf install nmap
- On macOS (using Homebrew):
brew install nmap
- To confirm installation, execute the following command:
nmap –version
- On Ubuntu/Debian:
- To scan the server’s IP for open TCP ports, run the following command:
nmap your-server-ip
Example:
nmap 192.168.1.10
You will see a list of open ports and their associated services.
- To target specific port ranges for scanning, use the following:
nmap -p 1-1000 your-server-ip
And, also, you can limit the scan to commonly used ports:
nmap -F your-server-ip
- Scan UDP Ports using the following command: UDP scans take longer and need elevated privileges:
sudo nmap -sU your-server-ip
- Use service and version detection to determine which services and versions are running on open ports:
nmap -sV your-server-ip
- Finally, save scan results to a file:
nmap -oN output.txt your-server-ip
Security Note: Regularly scanning your server helps identify unauthorised open ports and prevent potential vulnerabilities. Make sure you have permission before scanning external IPs or servers.
NMAP is a valuable tool for monitoring server security and discovering exposed services. By routinely scanning your server, you can better manage risks and ensure only essential ports are accessible. Hope this was useful to you.
Need more control over email traffic? Learn How to add additional SMTP ports