04-11-2011
Only if netmask is 255.255.255.0 (24 bits)
bash code:
#!/bin/bash
read -p "Enter beginning IP-addres: " host1
read -p "Enter ending IP-addres: " host2
SUBNET=${host1%.*}
netId1=${host1#$SUBNET.}
netId2=${host2#$SUBNET.}
for ((i=netId1; i<=netId2; i++)); do
ping -c 1 ${SUBNET}.$i
done
Last edited by frans; 04-11-2011 at 02:27 PM..
Reason: Forgot two dots in lines 5 & 6
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Alright, I have being checking out various posting here trying to hack together something for a friend
Needed:
A script that can run in cron doing:
ping of several hosts and notifying via email when they are unavailable.
I am not going to post my non working messes (I am a basic... (11 Replies)
Discussion started by: edkung
11 Replies
2. UNIX for Dummies Questions & Answers
I have Digital UNIX V4.0B (Rev. 564) on alpha machine.
I'm trying to acces network in subnet (192.168.1.x).
Ip on Alpha comp. is from 192.168.3.X subnet. My default gateway on this network is 192.168.3.1 and it working OK from other machines. This machine is visible from same subnet... (2 Replies)
Discussion started by: ermingut
2 Replies
3. IP Networking
Hi,
My project needs to migrate the existing Subnet (255.255.255.0) to a new subnet and change the ipaddresses (currently C class). How can I do that. I need some information.
John (0 Replies)
Discussion started by: johnmarsh
0 Replies
4. UNIX for Dummies Questions & Answers
Hello:
I have this script:
#!/bin/bash
#for loop
for ip in `cat ips`
do
ping $ip | grep "is alive">>pingtestlog
done
And its working properly with this input:
ericadm@amxcruas1> cat ips
10.196.60.4
10.196.61.210
10.196.62.73
10.196.61.152 (5 Replies)
Discussion started by: asenav1
5 Replies
5. Linux
Hello All,
We have added a windows host and its config files to Nagios master server and wanted to do a ping check alone at the moment however, the nagios master server identifies the host in its GUI and immediately disappears can anyone let me know the right approach to this one, We want to... (2 Replies)
Discussion started by: lovesaikrishna
2 Replies
6. Shell Programming and Scripting
HI,
I have a file serverlist in that all host names are placed.
i have written a small script
#./testping
#! /bin/bash
for i in `cat serverlist`
do
ping $i >> output.txt
done
so now it creates a file output.txt till here fine..
now each time i run this script the output file... (4 Replies)
Discussion started by: madhudeva
4 Replies
7. Solaris
Hi all,
New to this forum.
I have just been reading through a historical thread about some issues with IPMP.
Some tips from "Peasant" where very useful. Please see below
"Just couple of more hints regarding VM.
For VDS, use one VDS - one guest LDOM, don't put everything in primary-vds.... (9 Replies)
Discussion started by: selectstar
9 Replies
8. Shell Programming and Scripting
Bash script to subdivide a given subnet into a pre-defined number of smaller subnets. Show network/broadcast address, number of hosts and assign gateway.
For example:
Input:
./subnetter.sh 192.168.0.0/24 3 Output:
192.168.0.0/128 subnet 192.168.0.0 broadcast 192.168.0.127 gateway... (1 Reply)
Discussion started by: mail2rias
1 Replies
9. Shell Programming and Scripting
Bash script to subdivide a given subnet into a pre-defined number of smaller subnets. Show network/broadcast address, number of hosts and assign gateway.
For example:
Input:
./subnetter.sh 192.168.0.0/24 3 Output:
192.168.0.0/128 subnet 192.168.0.0 broadcast 192.168.0.127 gateway... (1 Reply)
Discussion started by: mail2rias
1 Replies
10. IP Networking
Running 3650 switch. I have this odd issue where I cannot get 4 new Centos 7 boxes pinging out on public IPs (nor pinging in), only gateway .1 and first public IP .2
This is what I see, which doesn't look normal. How do I fix this?
The server itself is configured fine (Centos 7)
# cat... (0 Replies)
Discussion started by: Bashed
0 Replies
ypset(8) System Manager's Manual ypset(8)
NAME
ypset - bind ypbind to a particular NIS server
SYNOPSIS
ypset [ -d domain ] [ -h hostname ] server
DESCRIPTION
In order to run ypset, ypbind must be initiated with the -ypset or -ypsetme options. See ypbind(8). ypset tells ypbind to get NIS ser-
vices for the specified domain from the ypserv(8) process running on server.
In cases where several hosts on the local net are supplying NIS services, it is possible for ypbind to rebind to another host even while
you attempt to find out if the ypset operation succeeded. For example, you can type:
example% ypset host1
example% ypwhich
host2
which can be confusing. This is a function of the NIS subsystem's attempt to know always a running NIS server, and occurs when host1 does
not respond to ypbind because it is not running ypserv (or is overloaded), and host2, running ypserv, gets the binding.
Server indicates the NIS server to bind to, and must be specified as a name or an IP address. This will work only if the node has a cur-
rent valid binding for the domain in question, and ypbind has been set to allow use of ypset. In most cases, server should be specified
as an IP address.
OPTIONS
-d domain
Specify a domain other than the default domain as returned by domainname(8).
-h hostname
Set the NIS binding on host hostname
instead of the local machine.
SEE ALSO
domainname(8), ypbind(8), ypcat(8), ypmatch(1), ypserv(8), yppoll(8), ypwhich(1)
AUTHOR
ypset is part of the yp-tools package, which was written by Thorsten Kukuk <kukuk@linux-nis.org>.
YP Tools 2.14 April 2010 ypset(8)