Sponsored Content
Top Forums Shell Programming and Scripting Shell script to ping a range of IPs Post 302364351 by tannu on Thursday 22nd of October 2009 08:15:59 PM
Old 10-22-2009
Shell script to ping a range of IPs

Hi

Can someone give me a shell script that can ping a range of IPs and return IPs which are not pingable.

Range for example say 192.168.0.1 to 192.168.0.50 and whichever are not pingable then return the IP.

Thanks for your help
 

10 More Discussions You Might Find Interesting

1. Red Hat

Which IPs from the range are assigned to DHCP enabled clients

Hi All dhcpd.conf has a range of IPs sa for example( 192.168.1.201 192.168.1.220) So this is the range of IP addresses the server will issue to DHCP enabled PC clients booting up on the network How do i know which IPs are being used or which IPs from the range are assigned to dhcp enabled... (11 Replies)
Discussion started by: tannu
11 Replies

2. Shell Programming and Scripting

perl return ips after successful ping

Hi, I have this script in ksh, what it does is loop every ip in the nodes_nso and produced another variable up_nodes_nso of only ip's that are up. nodes_nso=$(cat /var/tmp/nodes.txt) echo "ICMP Tests:" up_nodes_nso="" for ip in ${nodes_nso} ; do ping ${ip} 3 > /dev/null if ; then ... (1 Reply)
Discussion started by: borderblaster
1 Replies

3. Shell Programming and Scripting

shell script for ping

hi anyone, i want shell script for ping command. any one post here............ (10 Replies)
Discussion started by: rameshreddy.ema
10 Replies

4. Shell Programming and Scripting

Shell Script for ping, Linux

I woul like to create a script in order to make a ping to a server and save in a variable a 1 if respond or a 0 if it doesnt. Then with that I could make a graffic of the server, for how long it is up.:b: So far I have this: if ; then #if the ip respond the ping shows online echo... (3 Replies)
Discussion started by: jsebastiang0
3 Replies

5. Shell Programming and Scripting

Perl : ping for multiple IPs not working

I have written perl ping program to ping list of IPs one by one and print the status.But each and every time it is showing the status as Pass for all IPs even though the IP is wrong. multipleip.pl use Net::Ping; $p = Net::Ping->new(); $ifile="inventory.txt"; ... (2 Replies)
Discussion started by: scriptscript
2 Replies

6. Shell Programming and Scripting

Ping shell script - need urgent help

Hi friends, i have a file contains IP address like below cat file.txt 10.223.20.1 10.223.20.2 10.223.20.3 10.223.20.4 10.223.10.5 . . . like this Now i want to make a script which gives output whether each ip is pinging or not... the result will be like this 10.223.20.1 up... (9 Replies)
Discussion started by: siva kumar
9 Replies

7. Shell Programming and Scripting

Checking range of ips

Given a range of IPs similar to this: "212.63.183.19","212.63.183.19","3560945427","3560945427","CN","China" "217.7.143.0","217.7.143.0","3641151232","3641151232","CN","China" "218.0.0.0","218.31.255.255","3657433088","3659530239","CN","China"... (13 Replies)
Discussion started by: SkySmart
13 Replies

8. Shell Programming and Scripting

Help with shell script filtering IPs

Hello gentlemen. I would like to create a shell script (no perl or python please) to generate a list with those rules. Let's suppose I've this text file: a@A:soss(z)1.1.1.1 Opt!o:2.1.9.55 Azxk<ji>rC211.111.9.0-251.11.34.9 d=211.9.1.3 O.Oox 2.1.2.4-51.9.1.33... (6 Replies)
Discussion started by: accolito
6 Replies

9. Shell Programming and Scripting

Help with shell script - filter txt file full of ips

Hello again gentlemen. I would like to make a shell script to 'optimize' a plain text full of IPs. Let's suppose to have this text file: 1.192.63.253-1.192.63.253 1.0.234.46/32 1.1.128.0/17 1.116.0.0/14 1.177.1.157-1.177.1.157 1.23.22.19 1.192.61.0-1.192.61.99 8.6.6.6 I want to... (2 Replies)
Discussion started by: accolito
2 Replies

10. UNIX for Beginners Questions & Answers

Ping certain range of ip address

hey guys, In my program i am giving an initial ip & end ip. i just want to check every ip in that range is pingable or not echo "Enter the initial ip:" read inip echo "Enter the end ip:" read endip for (( i=0; i<=$endip; i++ )) do if ping -c 4 $inip then echo "pingable" else echo... (5 Replies)
Discussion started by: Meeran Rizvi
5 Replies
Geo::IPfree(3pm)					User Contributed Perl Documentation					  Geo::IPfree(3pm)

NAME
Geo::IPfree - Look up the country of an IPv4 address SYNOPSIS
use Geo::IPfree; my $geo = Geo::IPfree->new; my( $code1, $name1 ) = $geo->LookUp( '200.176.3.142' ); # use memory to speed things up $geo->Faster; # lookup by hostname my( $code2, $name2, $ip2 ) = $geo->LookUp( 'www.cnn.com' ); DESCRIPTION
Geo::IPfree is a Perl module that determines the originating country of an arbitrary IPv4 address. It uses a local file-based database to provide basic geolocation services. An updated version of the database can be obtained by visiting the Webnet77 website: http://software77.net/geo-ip/ <http://software77.net/geo-ip/>. METHODS
new( [$db] ) Creates a new Geo::IPfree instance. Optionally, a database filename may be passed in to load a custom data set rather than the version shipped with the module. LoadDB( $filename ) Load a specific database to use to look up the IP addresses. LookUp( $ip | $hostname ) Given an IP address or a hostname, this function returns three things: o The ISO 3166 country code (2 chars) o The country name o The IP address resolved NB: In order to use the location services on a hostname, you will need to have an internet connection to resolve a host to an IP address. If you pass a private IP address (for example 192.168.0.1), you'll get back a country code of ZZ, and country name of "Reserved for private IP addresses". Clean_Cache( ) Clears any cached lookup data. Faster( ) Make the LookUp() faster, which is good if you're going to be calling Lookup() many times. This will load the entire DB into memory and read from there, not from disk (good way for slow disk or network disks), but use more memory. The module "Memoize" will be enabled for some internal functions too. Note that if you call Lookup() many times, you'll end up using a lot of memory anyway, so you'll be better off using a lot of memory from the start by calling Faster(), and getting an improvement for all calls. nslookup( $host, [$last_lookup] ) Attempts to resolve a hostname to an IP address. If it fails on the first pass it will attempt to resolve the same hostname with 'www.' prepended. $last_lookup is used to supress this behavior. ip2nb( $ip ) Encodes $ip into a numerical representation. nb2ip( $number ) Decodes $number back to an IP address. dec2baseX( $number ) Converts a base 10 (decimal) number to base 86. baseX2dec( $number ) Converts a base 86 number to base 10 (decimal). VARS
$GeoIP->{db} The database file in use. $GeoIP->{handler} The database file handler. $GeoIP->{dbfile} The database file path. $GeoIP->{cache} BOOLEAN Set/tell if the cache of LookUp() is on. If it's on it will cache the last 1000 queries. Default: 1 The cache is good when you are parsing a list of IPs, generally a web log. If in the log you have many lines with the same IP, GEO::IPfree won't have to make a full search for each query, it will cache the last 1000 different IPs. After each 1000 IPs the cache is cleaned to restart it. Note that the Lookup make the query without the last IP number (xxx.xxx.xxx.0), then the cache for the IP 192.168.0.1 will be the same for 192.168.0.2 (they are the same query, 192.168.0.0). DB FORMAT
The data file has a list of IP ranges & countries, for example, from 200.128.0.0 to 200.103.255.255 the IPs are from BR. To make a fast access to the DB the format tries to use less bytes per input (block). The file was in ASCII and in blocks of 7 bytes: XXnnnnn XX -> the country code (BR,US...) nnnnn -> the IP range using a base of 85 digits (not in dec or hex to get space). See CPAN for updates of the DB... NOTES
The file ipscountry.dat is a dedicated format for Geo::IPfree. To convert it see the tool "ipct2txt.pl" in the "misc" directoy. The module looks for "ipscountry.dat" in the following locations: o /usr/local/share o /usr/local/share/GeoIPfree o through @INC (as well as all @INC directories plus "/Geo") o from the same location that IPfree.pm was loaded SEE ALSO
o http://software77.net/geo-ip/ AUTHOR
Graciliano M. P. <gm@virtuasites.com.br> MAINTAINER
Brian Cassidy <bricas@cpan.org> THANK YOU
Thanks to Laurent Destailleur (author of AWStats) that tested it on many OS and fixed bugs for them, like the not portable sysread, and asked for some speed improvement. COPYRIGHT &; LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-14 Geo::IPfree(3pm)
All times are GMT -4. The time now is 11:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy