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
reneleisibachAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JohnBusiness 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
Get Certified for a Job in Cybersecurity

Want an exciting career in an emerging field? Earn your MS in Cybersecurity and get certified in ethical hacking or computer forensic investigation. WGU’s MSCSIA degree program was designed to meet the most recent U.S. Department of Homeland Security (DHS) and NSA guidelines.  

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
JohnBusiness 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
JohnBusiness 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.