Script to add multiple ips

#!/bin/bash
clear
a=51
for i in `seq 12 60 ` ;do
a=`expr $a + 1 `
path=/etc/sysconfig/network-scripts/ifcfg-eth0:$a

check=`ifconfig |grep "\<192.168.0.$i\>"`
if [ ! -f /etc/sysconfig/network-scripts/ifcfg-eth0:"$a" ]; then

if [ -z "$check" ]; then

cat >> $path << _eof_
DEVICE=eth0:$a
NETMASK=255.255.255.0
BOOTPROTO=static
IPADDR=192.168.253.$i
ONBOOT=yes
_eof_

echo -e "######## Added the IP aliases 192.168.0.$i ##############"
ifup eth0:$a
else
echo -e "The Ip address already exist"
fi
else
echo -e "The ip aliases $cf exist"
fi

done





this script will test the server name of each system

this script will test the server name of each system

#!/usr/bin/perl

use Net::Telnet ;

open ( IN,"/tmp/IDC_IPs") or die "cannot open file " ;

while ( $ip=<IN>) {

$t = new Net::Telnet ( Timeout=>3, Errmode=>'return', port =>'25' );

$t->open("$ip");

$output1 = $t->getline ;

$t->print("ehlo data");

($output2) = $t->getline ;

chomp($output2);

chomp($ip);

print "$ip $output2\n" ;

}

close IN ;

Other Articles

Enter your email address: