I have a script running that will start up an interface with a new IP.
If the script comes up with an IP that is already in use i am in trouble.
Is it possible that the script set up the new Ip, detects that this IP is already in use and then check the next one, until it finds an ip that works ?
B=192.168.1.
I=1
while [ "$I" != "256" ]
do
ifconfig eth0:1 $B.$I
# check here that IP is Ok !
let "I=I+1"
done
I cannot use DHCP.
for
loop:for I in {1..255}
then you won't have to increment the variable yourself.