Find All Live Hosts IP Addresses Connected on Network in Linux
As network engineers or penetration testers, we need to find the live hosts on the networks. Today we are going to see how to find live hosts on the network. We are going to use the nmap tool to find the live hosts on the network.
Nmap (network mapper) is an open-source command-line tool for network exploration and security auditing. Nmap is used to scan the networks using the raw IP packets. In this article, we are using the nmap to find live hosts on the network.
Now let’s see how to install nmap on the different Linux Distros:
For Ubuntu/Debian/Kali Linux systems:
sudo apt-get install nmap
For Arch Linux:
sudo pacman -S nmap
sudo yum install nmap
sudo dnf install nmap
Now we have installed the nmap on the system. The syntax for nmap use is:
nmap <scan type...> options <target>
Here, scan type are the option provided by the nmap. And the target is the IP address or hostname of the network.
Now to find a live host first we need to find the IP address and the subnet mask of the target that means we need to find the IP address and its subnet mask of our network. We can find the IP address by following commands:
ip addr show
Here in this case the IP of the network is 220.127.116.11 and the subnet mask is 255.255. 255.0 i.e. /24. Now we are going to use the following command of nmap to find the live host on our network.
Here -sn is an option: This option tells the nmap to do not scan port after host discovery of a live host. By default, the Nmap scans all ports on the discovered host.
192.168.1.0/24 is a target: We are going to scan the live host on this target.
nmap -sn 192.168.1.0/24
In the above output, we can see there are two live hosts. To know more about we can use man command or help command like to follow
This is how we can find the live host on our network.