Tuesday, May 16, 2017

How to Find Out Available IP Addresses in a Given Range

When assigning an IP address (IPv4) to a host statically, it may be possible that the chosen IP address is already in use and may cause a conflict after assigning it. On linux it is easy to find out the list of IPs that are in use in a given range at any point in time. Here's how:

First install the nmap utility, example installing this on a Fedora/RedHat server is shown below. Read more about it here.

~]# yum -y install nmap

Now do a PING SWEEP using the nmap to get the list of all hosts that are available/respond to a ping in the given IP range.

~]# nmap -sP 192.168.1.*
Nmap scan report for 192.168.1.1
Host is up (0.00049s latency).
MAC Address: 00:0C:29:44:63:73
Nmap scan report for 192.168.1.11
Host is up (0.00065s latency).
MAC Address: 00:50:56:A9:7F:19
Nmap scan report for 192.168.1.37
Host is up (0.00052s latency).
MAC Address: 00:50:56:A9:63:F9
Nmap scan report for 192.168.1.68
Host is up (0.00028s latency).

The above should return information about any host which uses an IP in the given range.

0 comments:

Post a Comment