#!/bin/bash
ifile=/etc/network/interfaces
echo -n “Insert IPstart:”
read ipstart
echo -n “Insert IPend:”
read ipend
echo -n “Insert Gateway:”
read gw
#echo -n “Insert Subnet: ”
#read subnet
echo -n “Insert Netmask: ”
read net
echo -n “Insert aliast to start: ”
read alifirstIp=`echo “${ipstart%.*}”`
lastIpStart=`echo “${ipstart##*.}”`
lastIpEnd=`echo “${ipend##*.}”`
dif=`echo $(($lastIpEnd-$lastIpStart))`ip=$lastIpStart
for ((i=$ali;i<=$ali+$dif;i++)){
echo "auto eth0:$i" >>$ifile
echo “iface eth0:$i inet static” >>$ifile
echo “address $firstIp.$ip” >>$ifile
echo “network $subnet” >>$ifile
echo “netmask $net” >>$ifile
echo “gateway $gw” >> $ifile
echo ” ” >> $ifile
let ip++
}
Related posts:



Leave a Reply