Solved

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

Posted on 2014-10-21
18
200 Views
Last Modified: 2015-04-22
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
Comment
Question by:reneleisibach
  • 7
  • 6
  • 3
  • +2
18 Comments
 
LVL 90

Expert Comment

by:John Hurst
ID: 40394396
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
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40394418
but of course ANY firewall can block ICMP ECHO responses so it may well be in use but you can not ping it.
0
 
LVL 4

Expert Comment

by:popesy
ID: 40394420
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
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40394445
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
 

Author Comment

by:reneleisibach
ID: 40394449
The IP addresses would be under the same subnet.
So it would any adress looking like: 12.123.n.n
0
 
LVL 90

Expert Comment

by:John Hurst
ID: 40394456
So use Nmap and run a scan
0
 

Author Comment

by:reneleisibach
ID: 40394459
To Neilsr:
The original aim is, if a router can be reached.
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40394465
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
 

Author Comment

by:reneleisibach
ID: 40394467
To John Hurst:
What is neap?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:reneleisibach
ID: 40394475
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
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40394489
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
 
LVL 90

Expert Comment

by:John Hurst
ID: 40394501
What is neap?  <-- It is Nmap. Typo on my part and I corrected it.  Nmap is a standard Linux / UNIX scanning tool.
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40394530
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
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40394542
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
 

Author Comment

by:reneleisibach
ID: 40394739
@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
 
LVL 37

Accepted Solution

by:
Neil Russell earned 500 total points
ID: 40394770
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
 

Author Comment

by:reneleisibach
ID: 40396292
@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
 
LVL 61

Expert Comment

by:gheist
ID: 40529562
Ping scan of /16 should take couple of minutes on 1Mbit DSL line...
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Managing 24/7 IT Operations is a hands-on job and indeed a difficult one. Over the years I have found some simple tips and techniques to increase the efficiency of the overall operations. The core concept has always been on continuous improvement; a…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now