LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-04-2018, 01:16 AM   #1
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Rep: Reputation: 11
Post How to find all IP ranges via Nmap?


Hello.
In a local network with VLAN, How can I find all IP ranges?

Thank you.
 
Old 11-04-2018, 09:39 AM   #2
lougavulin
Member
 
Registered: Jul 2018
Distribution: Slackware,x86_64,current
Posts: 279

Rep: Reputation: 100Reputation: 100
Do you want all the IP address possible or all live hosts' IP ?
Because using nmap make me think the later...
 
Old 11-05-2018, 12:01 AM   #3
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by lougavulin View Post
Do you want all the IP address possible or all live hosts' IP ?
Because using nmap make me think the later...
I mean is not "Ping Sweep", suppose a local network and you like to find all IP address ranges that used in the network.
 
Old 11-05-2018, 12:08 AM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by hack3rcon View Post
I mean is not "Ping Sweep", suppose a local network and you like to find all IP address ranges that used in the network.
What do you mean by "use an address range"? For example, in this case:
Code:
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:77:b3:be brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.201/24 brd 192.168.1.255 scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe77:b3be/64 scope link
       valid_lft forever preferred_lft forever
you could say I "use" two address ranges, 127.0.0.0/8 and 192.168.1.0/24. Oh and let's not forget IPv6: ::1/128 and fe80::/64. So, four ranges.

Now, you can check IP addresses of devices on your network, but I don't see a way to check IP address ranges. While you can confirm that a device has address 192.168.1.201, to know the prefix it configures you would have to log on to it.
 
Old 11-05-2018, 06:02 AM   #5
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by hack3rcon View Post
I mean is not "Ping Sweep", suppose a local network and you like to find all IP address ranges that used in the network.
You ask your network admin, or look at the switch config.
You computer is only going to show you IP of whatever VLAN it is on.
 
Old 11-05-2018, 11:38 AM   #6
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,733

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
This:
Code:
nmap -v -sn 192.168.0.0/24 | grep -v 'host down'
where 192.168.0.0/24 is the IP range of your local network. Will show you connected hosts.
but review man nmap for other options.

You will need a target for an nmap scan...it doesn't "discover" IP ranges. See the man page for details.

Last edited by scasey; 11-05-2018 at 11:41 AM.
 
Old 11-05-2018, 02:24 PM   #7
lougavulin
Member
 
Registered: Jul 2018
Distribution: Slackware,x86_64,current
Posts: 279

Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by scasey View Post
where 192.168.0.0/24 is the IP range of your local network. Will show you connected hosts.
Will show you connected hosts with firewall which allow the respond. Desktop do not have to respond for instance.

Quote:
Originally Posted by scasey View Post
This:
Code:
nmap -v -sn 192.168.0.0/24 | grep -v 'host down'
If you want to exclude 'host down' results (with the grep), this is simpler :

Code:
nmap -sn 192.168.0.0/24
 
Old 11-06-2018, 12:27 AM   #8
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by berndbausch View Post
What do you mean by "use an address range"? For example, in this case:
Code:
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:77:b3:be brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.201/24 brd 192.168.1.255 scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe77:b3be/64 scope link
       valid_lft forever preferred_lft forever
you could say I "use" two address ranges, 127.0.0.0/8 and 192.168.1.0/24. Oh and let's not forget IPv6: ::1/128 and fe80::/64. So, four ranges.

Now, you can check IP addresses of devices on your network, but I don't see a way to check IP address ranges. While you can confirm that a device has address 192.168.1.201, to know the prefix it configures you would have to log on to it.
I mean is you work at a company that each floor has its own VLAN. Your floor IP address range is "192.168.X.X" but how you can find the other floors IP address ranges?
 
Old 11-06-2018, 01:28 AM   #9
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
If you can connect a PC to a VLAN, you can observe the traffic with a tool like tcpdump or wireshark and conclude what addresses are used.

You may get an address and the netmask or prefix from a DHCP server.

I don’t know if nmap has a function for detecting address ranges.
 
Old 11-06-2018, 06:41 AM   #10
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by berndbausch View Post
If you can connect a PC to a VLAN, you can observe the traffic with a tool like tcpdump or wireshark and conclude what addresses are used.

You may get an address and the netmask or prefix from a DHCP server.

I don’t know if nmap has a function for detecting address ranges.
Any other tool?
 
Old 11-06-2018, 10:02 AM   #11
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by hack3rcon View Post
I mean is you work at a company that each floor has its own VLAN. Your floor IP address range is "192.168.X.X" but how you can find the other floors IP address ranges?
You will need to monitor traffic at the router.
Am curious, is this an interview question? Why do you want to know this?
 
Old 11-06-2018, 05:47 PM   #12
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by hack3rcon View Post
Any other tool?
Probably, but rather than asking for any other tool, why don't you tell us what you expect from the tool, in addition to what tcpdump and a DHCP client can achieve?

Otherwise, people continue to throw out tools, and you just continue to reply "any other tool". What is the termination condition of this loop?
 
Old 11-08-2018, 06:58 AM   #13
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Ask your SysAdmin.
The biggest tool around.

What's in use, what's assigned and what responds.

Have fun.
 
1 members found this post helpful.
Old 11-12-2018, 04:21 AM   #14
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by berndbausch View Post
Probably, but rather than asking for any other tool, why don't you tell us what you expect from the tool, in addition to what tcpdump and a DHCP client can achieve?

Otherwise, people continue to throw out tools, and you just continue to reply "any other tool". What is the termination condition of this loop?
I'm in a new local network and I want to find all IP ranges that using here.
 
Old 11-12-2018, 11:35 AM   #15
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,733

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by hack3rcon View Post
I'm in a new local network and I want to find all IP ranges that using here.
+1 for asking your SysAdmin/IT department.
If it were my LAN, such hacking without asking would be grounds for dismissal. Just sayin'
 
1 members found this post helpful.
  


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
nmap - find open UDP ports loadedmind Red Hat 3 09-13-2013 04:42 AM
LXer: Learn how to use nmap, and nmap GUI, a great port scan tool LXer Syndicated Linux News 0 01-03-2008 09:10 AM
Strange nmap results when scanning IP Ranges NuxIT Linux - Security 2 01-19-2007 02:30 AM
can't find vert/horiz sync ranges! kanko Linux - Hardware 1 09-17-2006 05:57 AM
how to find zombies for idle scan using Nmap b0nd Linux - Networking 2 01-29-2006 05:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:54 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