Find Out All Live Hosts IP Addresses Connected on Network in Linux

There are plenty of network monitoring tools you can find in the Linux ecosystem, that can generate for you a summary of the total number of devices on a network including all their IP addresses and more.

However, sometimes what you actually need may be a simple command line tool that can provide you the same information by running a single command.

This tutorial will explain you how to find out all live hosts IP addresses connected to a given network. Here, we will use Nmap tool to find out all IP addresses of devices connected on a same network.

Suggested Read: 29 Examples of ‘Nmap’ Commands for System/Network Administration

The Nmap (short form for Network Mapper) is an open source, powerful and a very versatile command line tool for exploring networks, perform security scans, network audit and finding open ports on remote machine and so much more.

In case you do not have Nmap installed on your system, run the appropriate command below for your distribution to install it:

$ sudo yum install nmap         [On RedHat based systems]
$ sudo dnf install nmap         [On Fedora 22+ versions]
$ sudo apt-get install nmap     [On Debian/Ubuntu based systems]


Once you have
Nmap installed, the syntax for using it is:

$ nmap  [scan type...]  options  {target specification}

Where the argument {target specification}, can be replaced by hostnames, IP addresses, networks and so on.

Therefore to list the IP addresses of all hosts connected to a given network, first of all identify the network and its subnet mask using the ifconfig command or ip command like so:

$ ifconfig
OR
$ ip addr show
Find Network Details in Linux
Find Network Details in Linux

Next, run the Nmap command below:

$ nmap  -sn  10.42.0.0/24
Find All Live Hosts on Network
Find All Live Hosts on Network

In the command above:

  1. -sn – is the type of scan, which means a ping scan. By default, Nmap performs port scanning, but this scan will disable port scanning.
  2. 10.42.0.0/24 – is the target network, replace it with your actual network.

For a comprehensive usage information, make an effort to look into Nmap man page:

$ man nmap

Else, run Nmap without any options and arguments to view a summarized usage information:

$ nmap

In addition, for those interested in learning security scanning techniques in Linux, you can read through this practical guide to Nmap in Kali Linux.

Well, that’s it for now, remember to send us your questions or comments through the response form below. You can as well share with us other methods for listing the IP addresses of all devices connected to a given network.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

6 Comments

Leave a Reply
  1. This will work on IPv4 but not on an IPv6 network. a sub-net on IPv6 has 64 bits of address space in each sub-net. It would take a 1000 years for a fast computer to scan that IP range. I was hoping that there might be a reference to some Neighbor discovery tool to achieve this on an IPv6 network

    Reply
  2. Using nmap is an active scan, but that’s not necessary for this purpose. All hosts arp to identify themselves to other hosts on the network, so simply displaying the arp table will show you what you want, instantly.

    arp -n | grep -v “incomplete\|Flags” | sort -V

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.