[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 389
  • Last Modified:

How can I check if any IP address is available within a IP range I select ?

How can I check with UNIX, if I can reach any IP address within the range of '12.123.*' ?
The original aim is, if a router can be reached. The above question could lead to an acceptable answer for me.
Thank you in advance for your answer.
Rene
0
reneleisibach
Asked:
reneleisibach
  • 7
  • 6
  • 3
  • +2
1 Solution
 
John HurstBusiness Consultant (Owner)Commented:
You have to ping the address to see if you can reach it.  "Reach it" means you can ping it. And so that is what you have to do.

You can run a scan with Nmap and that will probably make your job easier.

If these addresses are supplied by your ISP, they will have to tell you what IP addresses they allocated to you.
0
 
Neil RussellTechnical Development LeadCommented:
but of course ANY firewall can block ICMP ECHO responses so it may well be in use but you can not ping it.
0
 
John PopeIT ConsultantCommented:
Hi,

I guess you mean 12.123.n.n.  

With the main aim to reach the router, assuming the router has an IP address assigned and your UNIX server has an IP address assigned, are these on the same subnet? You can check this in a UNIX shell by using;

ipconfig -a

Open in new window


Do you know of other devices in between these two? Any switch or firewall, are there any security rules you have to adhere to - if so perhaps a network engineer can help with this (I am assuming much I know)

Anyway, you can check if an IP address is available by 'pinging' the address itself, again in a UNIX shell;

ping n.n.n.n

Where n.n.n.n is the IP address you want to check is available.

Cheers, JP.
0
Will You Be GDPR Compliant by 5/28/2018?

GDPR? That's a regulation for the European Union. But, if you collect data from customers or employees within the EU, then you need to know about GDPR and make sure your organization is compliant by May 2018. Check out our preparation checklist to make sure you're on track today!

 
Neil RussellTechnical Development LeadCommented:
If you were to run a port scan with nmap against 12.123.x.x two things of note....

1) It would take a long time to scan 65535 hosts
2) Your ISP might see this as an attempted hack attack from your network and disconnect you!

Can you explain what it is you are trying to do in more detail? Why would you want to find all routers in a /16 network?
0
 
reneleisibachAuthor Commented:
The IP addresses would be under the same subnet.
So it would any adress looking like: 12.123.n.n
0
 
John HurstBusiness Consultant (Owner)Commented:
So use Nmap and run a scan
0
 
reneleisibachAuthor Commented:
To Neilsr:
The original aim is, if a router can be reached.
0
 
Neil RussellTechnical Development LeadCommented:
Well as 12.123.x.x is not a privately owned IP Range and is I believe all inside the scope of addresses managed by AT&T in the US you may well find them knocking on your door if you port scan the full range.

You intend to snoop on every AT&T Customer to see if their router is accessible?
0
 
reneleisibachAuthor Commented:
To John Hurst:
What is neap?
0
 
reneleisibachAuthor Commented:
To Neilsr:
'12.123.n.n' is just a sample and not the real address. It's within a company network to check our routers.
0
 
Neil RussellTechnical Development LeadCommented:
OK but when asking questions be precise, give as much info as you can about your aim/goals and don't use real world IP's that you don't own.

If questioning about your own internal networks then say so and refer to xxx.xxx.xxx.xxx/24 or however big your internal range is.

This helps to get straight to an answer.

That said...
For your own use on an internal network I would recomend you go to  http://www.advanced-ip-scanner.com/
Simple, quick and detailed network analysis giving you what you need and more.

OR

http://angryip.org/
0
 
John HurstBusiness Consultant (Owner)Commented:
What is neap?  <-- It is Nmap. Typo on my part and I corrected it.  Nmap is a standard Linux / UNIX scanning tool.
0
 
Neil RussellTechnical Development LeadCommented:
Sorry, links were for windows tools and I remember now you wanted Unix scripts/tools.

If this is for an ongoing monitoring task, can I suguest you have a look at the scripts on http://linuxconfig.org/bash-scripts-to-scan-and-monitor-network

They utilise ping and one will even email you when the address is offline.  You could schedule these to run regularly.

On the other hand if your intention is to monitor properly what is alive and whats not, on your network then I would consider looking at installing something like PRTG on a PC and configuring that to watch over everything.
For up to 10 monitoring sensors it is free, after that, heres a price list :D
http://www.paessler.com/prtg/price_list
0
 
Neil RussellTechnical Development LeadCommented:
As an example of use with PRTG, if you have 10 or less routers to monitor, you can use the free version and have it show a dashboard on a screen of the state of all your routers, have it email to a list of individuals when a router goes offline AND again when it is back online.
We have the network monitor unlimited edition and monitor some 15000 sensors in total. You have visual, audio and email alerts to any event you want that happens on your network.
0
 
reneleisibachAuthor Commented:
@Neilsr:
Basically I can use your linux-link http://linuxconfig.org/bash-scripts-to-scan-and-monitor-network.
I think it would work. The script runs through, but I just recognized I cannot use ping within our network.
(There is no response.)
Telnet would be working. If only I could use telnet with the port 9999 in the script './bash_ping_scan.sh'.
How could I arrange it?
Rene
0
 
Neil RussellTechnical Development LeadCommented:
without knowing your exact unix variant and whats installed.... Try this at a prompt


$ (echo > /dev/tcp/xxx.xxx.xxx.xxx/9999) >/dev/null 2>&1 \
    && echo "It's up" || echo "It's down"

If the host xxx.xxx.xxx.xxx.xxx is listening on port 9999 then it should say "Its up" els say "Its down"

Try please in a bash shell
0
 
reneleisibachAuthor Commented:
@Neilsr:
I just replaced IP and Port, but this works just fine. Thank you.

$ (echo > /dev/tcp/xxx.xxx.xxx.xxx/9999) >/dev/null 2>&1 \
> && echo "It's up" || echo "It's down"
It's up
$

Open in new window


How can I integrate it in the script http://linuxconfig.org/bash-scripts-to-scan-and-monitor-network?
0
 
gheistCommented:
Ping scan of /16 should take couple of minutes on 1Mbit DSL line...
0

Featured Post

SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

  • 7
  • 6
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now