LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-12-2024, 06:02 AM   #1
sag2662
Member
 
Registered: Sep 2022
Posts: 69

Rep: Reputation: 0
list all hosts and ips with in subnet


Hi all,

I wanted to list all hosts that are in network for ex: (192.168.100.24/24). I tried using nmap scan but it only lists the hosts which are up.Can we somehow lists all the hosts that are up and down.

I used the below

Code:
nmap -sn 192.168.100.24/24 -oG output
 
Old 03-12-2024, 06:55 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,901

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
no, how do you think that? If the host is down it is not connected to anywhere, does not belong to any network.
Do you think if I bring 20 RPi's into the room they should be listed as well?
 
Old 03-12-2024, 07:20 AM   #3
sag2662
Member
 
Registered: Sep 2022
Posts: 69

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pan64 View Post
no, how do you think that? If the host is down it is not connected to anywhere, does not belong to any network.
Do you think if I bring 20 RPi's into the room they should be listed as well?
Ofocurse not, atleast I wanted to lists all the hosts available with in the network. Any other tool that we can use

Last edited by sag2662; 03-12-2024 at 07:28 AM.
 
Old 03-12-2024, 07:47 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by sag2662 View Post
I wanted to lists all the hosts available with in the network.
192.168.0.1 all the way through to 192.168.100.254 are available.

Quote:
Originally Posted by sag2662 View Post
Any other tool that we can use
Go back to your firewall logs and look for any traffic within that address space. Of course that won't list any internal traffic.

Quote:
Originally Posted by sag2662 View Post
Any other tool that we can use
Use your body to go turn on all the hosts and then do a ping scan. Of course that only works if ICMP isn't blocked by the host at firewall level.

Quote:
Originally Posted by sag2662 View Post
Any other tool that we can use
Compare the output of nmap, ping sweeps, etc. with your reference list of known authorized assets and see which are missing.
 
Old 03-12-2024, 08:56 AM   #5
sag2662
Member
 
Registered: Sep 2022
Posts: 69

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TenTenths View Post
192.168.0.1 all the way through to 192.168.100.254 are available.

Go back to your firewall logs and look for any traffic within that address space. Of course that won't list any internal traffic.

Use your body to go turn on all the hosts and then do a ping scan. Of course that only works if ICMP isn't blocked by the host at firewall level.

Compare the output of nmap, ping sweeps, etc. with your reference list of known authorized assets and see which are missing.
Unfortunately dont have access to firewall logs, I meant hosts available means ( Ipaddress is registered and dns configured ).
 
Old 03-12-2024, 10:33 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,901

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
Again, you cannot collect any information about hosts which are unavailable, down. Cannot read their configuration. They may or may not connect to the network. Also you may change DHCP, firewall, ... to enable/disable their access to that network.
 
Old 03-12-2024, 11:33 AM   #7
rclark
Member
 
Registered: Jul 2008
Location: Montana USA
Distribution: KUbuntu, Fedora (KDE), PI OS
Posts: 485

Rep: Reputation: 180Reputation: 180
Quote:
nmap only lists the hosts which are up.
That is correct operation. There is no way a program can 'know' which devices are not on the network (device network down, kernel faulted, or powered off). Just not doable. Like holding an un-powered RPI in your hand and expecting the network that it is there in the room. Not going to find it!

Only way i know is to get an initial list of all the devices that are on the network and then when you run nmap, you can compare that list against the known list. Normally though you should have a good idea what is not on the network because whatever its function is is no longer available which points you to the device.
 
1 members found this post helpful.
Old 03-12-2024, 10:45 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Quote:
Ipaddress is registered and dns configured
Look in your DNS server ...
 
1 members found this post helpful.
Old 03-13-2024, 12:57 PM   #9
sag2662
Member
 
Registered: Sep 2022
Posts: 69

Original Poster
Rep: Reputation: 0
Thanks for the suggestions.
 
Old 03-13-2024, 07:32 PM   #10
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,804

Rep: Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203Reputation: 1203
DNS is not list-able, so
Code:
getent hosts
won't work with DNS.
But you can try the bash command
Code:
getent hosts 192.168.100.{0..255}

Last edited by MadeInGermany; 03-13-2024 at 07:36 PM.
 
1 members found this post helpful.
Old 05-01-2024, 10:49 AM   #11
murugesandins
Member
 
Registered: Apr 2024
Location: Bangalore Karnataka India
Distribution: CYGWIN_NT
Posts: 61

Rep: Reputation: 0
Quote:
Originally Posted by MadeInGermany View Post
DNS is not list-able, so
Code:
getent hosts
won't work with DNS.
But you can try the bash command
Code:
getent hosts 192.168.100.{0..255}

Applicable at windows also(output at my localhost)
Code:
$ /usr/bin/getent.exe hosts 103.244.124.{0..100} | /usr/bin/tail -n 10
103.244.124.91  DOP-103-244.sify.net
103.244.124.92  DOP-103-244.sify.net
103.244.124.93  DOP-103-244.sify.net
103.244.124.94  DOP-103-244.sify.net
103.244.124.95  DOP-103-244.sify.net
103.244.124.96  DOP-103-244.sify.net
103.244.124.97  DOP-103-244.sify.net
103.244.124.98  DOP-103-244.sify.net
103.244.124.99  DOP-103-244.sify.net
103.244.124.100 DOP-103-244.sify.net
$ /usr/bin/getent.exe hosts 103.244.124.{0..100} | /usr/bin/head -n 10
103.244.124.0   DOP-103-244.sify.net
103.244.124.1   DOP-103-244.sify.net
103.244.124.2   DOP-103-244.sify.net
103.244.124.3   DOP-103-244.sify.net
103.244.124.4   DOP-103-244.sify.net
103.244.124.5   DOP-103-244.sify.net
103.244.124.6   DOP-103-244.sify.net
103.244.124.7   DOP-103-244.sify.net
103.244.124.8   DOP-103-244.sify.net
103.244.124.9   DOP-103-244.sify.net
 
Old 05-01-2024, 12:15 PM   #12
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,660

Rep: Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708
You might use a network monitoring application running in a host on a span port and building historical data about any node that comes up on your subnet. It will ONLY detect nodes that have been turned on and on the subnet DURING ITS RUN-TIMES, so you will get a list going forward but no backward historical data.

I have used NAGIOS and ZABBIX in enterprise environments, but I suspect for a small network something smaller should serve better. Something based upon ipscanner, nmap, or other application level tools might be leveraged here.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to allow my private network hosts to communicate with iot hosts on different subnet?s bthoven Linux - Networking 1 10-16-2019 02:18 PM
iptables blocking all ips except US & US Amazon. Can't log dropped IPs. mcginlej Linux - Networking 3 10-08-2013 12:18 PM
[SOLVED] VLAN with 2 Router and 2 Subnet - Is device in different subnet works? velusawme Linux - Networking 2 07-23-2011 10:16 AM
discover all hosts in ipv6 subnet and their addresses ineya Linux - Networking 5 12-13-2008 05:21 AM
ping broadcast doesn't yield reply from all alive hosts on my subnet?? rs_vijay Linux - Networking 3 07-06-2007 08:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration