#!/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
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
No comments:
Post a Comment