Finding IP addresses of devices in your network using port scan

I was  trying to find the IP address of a device which was connected to the network and had secured the IP address using DHCP.

The easiest way to check was to look for the DHCP Server logs, but since that was not possible I did a port scan. Here are the simple steps on Ubuntu.

This will only work if you know that the particular PC has certain services running such as SSH, only then will this step work as you can search for devices with a particular port open.

First insall nmap, which is a port scanning utility. You can either use Ubuntu Software Software or type apt-get install nmap

Now go to Applications-Accessories-Terminal and type this.

nmap -v -p22 192.168.1.1-255  | grep open

This showed me all devices where port 22 was open.

-p = Port

22 = Port number, 22 is for ssh, 80 for http and so on. 

No spaces between -p and the port number.

If you don’t know which port to scan, this command will give you a list of services and port numbers:  cat /etc/services

192.168.1.1-255 is the range of IP addresses so this will scan all IPs  from 192.168.1.1 to 192.168.1.255

Note: This may show more than one device if there are other devices with similar ports open, so you would need to know which one you are looking for.

Leave a Reply