Applications listen to various network ports. Open ports can pose a security risk because they can be a target by attackers. Recommended to close any unused ports. Nmap supports port scanning, and it can be used to determine opened ports. This tutorial shows how to scan specific ports on a host using Nmap.
The -p
option can be used to scan the specified ports. For example, to scan port 80 on the target host, run the following command:
nmap -p 80 192.168.0.123
Example a part of the output:
...
PORT STATE SERVICE
80/tcp open http
...
To scan multiple specific ports, use comma to separate them:
nmap -p 80,443 192.168.0.123
Output:
...
PORT STATE SERVICE
80/tcp open http
443/tcp closed https
...
A range of ports can be scanned as follows:
nmap -p 1-500 192.168.0.123
Output:
...
Not shown: 498 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
...
Leave a Comment
Cancel reply