Find All Live Hosts IP Addresses Connected on Network in Linux
Last Updated :
03 Nov, 2024
As network engineers or penetration testers, we need to find the live hosts on the networks. In today's guide, 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.
Installation
Now let's see how to install nmap on the different Linux distributions:
For Ubuntu/Debian/Kali Linux systems:
sudo apt-get install nmap
For Arch Linux:
sudo pacman -S nmap
For CentOS:
sudo yum install nmap
For Fedora:
sudo dnf install nmap

Syntax
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.
Key Options
The following are common options used with Nmap:
Option | Description |
---|
-sn | Disable port scan; only perform host discovery. |
---|
-sP | Similar to -sn, perform ping scan. |
---|
-p | Specify particular ports to scan. |
---|
-sV | Attempt to determine the version of services running. |
---|
Basic Command Example
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:
ifconfig
or
ip addr show

Here in this case the IP of the network is 192.1.1.0 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:
man nmap
and
nmap --help

This is how we can find the live host on our network.
To perform a ping scan, we will use the -sP option. This option is similar to -sn, but clearly shows that the scan is only checking which hosts are up in the specified range.
We are going to perform a ping scan with the following command:
nmap -sP 192.168.1.0/24
GFGIn the above output, the command sends ICMP echo requests to each host in the subnet. If a host responds, Nmap marks it as “up.” It's a quick way to find active devices on a network without scanning for open ports.
To determine what services are running and their versions on open ports, we will use the -sV option for service version detection:
nmap -sV 192.168.1.0/24
GFGIn the above output, we can see the command displays information about the service and its version.
To also scan specific ports such as SSH (port 22) and HTTP (port 80), we will simply use the -p option with the nmap command as shown in the following command:
nmap -p 22,80 192.168.1.1
GFGIn the above output, the command solely scans ports 22 and 80 of the specified host.
Conclusion
The Nmap command helps you to identify live hosts on a network is a straightforward process. By understanding how to use it, you can effectively map out the devices connected to the network.
Similar Reads
How to Hide IP and MAC Address using Anonym8 in Kali Linux ?
Anonym8 is a free and open-source tool for becoming anonymous on the Internet while testing the security of a web browser. Anonym8 uses IP-tables to create a Transparent Proxy through the Tor Network. Anonym8 can move the network of your Kali Linux operating system through the Tor Network. When you
2 min read
Command to Check IP address in linux
IP addresses are generally categorized into two groups: private and public. Private IPs are employed in local networks such as your home Wi-Fi or firm internet and comply with certain ranges such as 10.x.x.x, 172.16.x.x-172.31.x.x, and 192.168.x.x. Public IPs, however, are accessible globally and ca
7 min read
How to Find Your Local IP Address in Debian 11
The IP address is the specific number that identifies the devices on the network. This IP address will help the other devices to find and communicate with your device. When you connect your device to a a computer or phone to the local network such as your home and office network it immediately assig
4 min read
How to Check Network Connectivity in Linux | ping Command
Ensuring a stable and reliable internet connection is crucial for seamless navigation and efficient communication in the world of Linux. The "ping" command is a powerful tool that allows users to check the status of their internet connection and diagnose network-related issues. In this article, we w
7 min read
IP Rover - OSINT tool to get information of any IP address
IP Rover is a free and open-source tool available on GitHub. IP Rover is one of the famous tools to find information about an IP address and domain. It is used by security researchers and penetration testers in the early stages of penetration testing and reconnaissance. IP Rover is an (OSINT) which
2 min read
addresses Command in Linux with Examples
Finding a way of finding IP addresses is very important in the Linux system administration and the management of networks. Certainly, you will find a need for using it when troubleshooting problems you have with your network connectivity, or if you're configuring services on a network. The chapter g
4 min read
How to Assign an IP Address on a Linux Computer
IP address assignment in Linux is an important skill for network configuration management. Whether youâre setting up a server, setting up a local network, or simply servicing your system, understanding how to manually assign IP addresses can help ensure your devices communicate properly In this guid
4 min read
Manage Network Connections From the Linux Command Line with nmcli
Network connectivity is a critical aspect of modern computing, and Linux provides a robust command-line tool for managing network connections: nmcli. Network Manager Command-Line Interface (nmcli) is a powerful and versatile utility that allows users to control and configure network settings directl
5 min read
How to check Active Network Connections in Windows?
There could be instances where we need to check our current network connectivity or sometimes troubleshoot a particular connection. We can follow a few simple steps to check the active connections. We also have some predefined commands that when entered in command prompt give a detailed explanation
3 min read
Network configuration and troubleshooting commands in Linux
Computers are often connected to each other on a network. They send requests to each other in the form of packets that travel from the host to the destination. Linux provides various commands from network configuration and troubleshooting. Network Configuration and Troubleshooting Commands in Linux
5 min read