Quick shell script to convert ifcfg-ethX-rangeY to ifcfg-ethX:Y format:

for i in `ls ifcfg-eth1-range*`;
do
  . ./$i
  D1=`echo $IPADDR_START|cut -d. -f4`;
  D2=`echo $IPADDR_END|cut -d. -f4`;
  D=`expr $D2 - $D1`;
  echo $D;
  S=`echo $IPADDR_START|cut -d. -f1,2,3`;
  for j in `seq 0 $D`;
  do
    echo "DEVICE=eth1:`expr $j + $CLONENUM_START`
    BOOTPROTO=static
    ONBOOT=yes
    IPADDR=$S.`expr $D1 + $j`NETMASK=$NETMASK" > ifcfg-eth1:`expr $j + $CLONENUM_START`;
  done
done

Comments