How to check status of port using NMap

NMap is a classic Swiss army knife for network operations. I recently had to check if a certain port on a LAN computer was open or not. This type of diagnostic is very easy to do with NMap.

  • NMap can be installed easily:
$ sudo apt install nmap
  • To check if port 9010 was open on the medusa computer:
$ nmap -p 9010 medusa

Starting Nmap 6.40 ( http://nmap.org ) at 2017-08-25 13:05 SGT
Nmap scan report for medusa (192.168.110.22)
Host is up (0.00035s latency).
PORT     STATE SERVICE
9010/tcp open  sdr

Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds

Turns out that the port 9010 was open.

  • To check port 9999 on medusa, which was actually closed:
$ nmap -p 9999 medusa

Starting Nmap 6.40 ( http://nmap.org ) at 2017-08-25 13:06 SGT
Nmap scan report for medusa (192.168.110.22)
Host is up (0.00030s latency).
PORT     STATE  SERVICE
9999/tcp closed unknown

Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds
  • To check the status of ports in the range on the medusa computer:
$ nmap -p 0-10 medusa

Starting Nmap 6.40 ( http://nmap.org ) at 2017-08-25 13:04 SGT
Nmap scan report for medusa (192.168.110.22)
Host is up (0.00027s latency).
PORT   STATE  SERVICE
0/tcp  closed unknown
1/tcp  closed tcpmux
2/tcp  closed compressnet
3/tcp  closed compressnet
4/tcp  closed unknown
5/tcp  closed unknown
6/tcp  closed unknown
7/tcp  closed echo
8/tcp  closed unknown
9/tcp  closed discard
10/tcp closed unknown

Nmap done: 1 IP address (1 host up) scanned in 0.08 seconds

Tried with: NMap 7.01 and Ubuntu 16.04

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s