Hi guys.
There is a problem that KVM dose not get IP. This is the scenario:
As you know KVM gets ip from dnsmasq and dhcp packets comes from br0 to dnsmasq. Now if the IP of br0 interface dose not exist in range of the lease dnsmasq gives kvm, dnsmasq dose not release the lease. read here
And also as you know there is a algorithm in startvm script which generates an IP for br0. Now the problem is that the generated IP sometimes is not in the range of KVM IP.
Look this is the code which generates IP for br0:
let "NEWCIDR=$CIDR-1"
#NEWNETMASK=`cidr2mask $NEWCIDR`
i=`atoi $IP`
let "i=$i^(1<<$CIDR)"
NEWIP=`itoa i`
And this little change fixes anything:
let "NEWCIDR=$CIDR-1"
#NEWNETMASK=`cidr2mask $NEWCIDR`
i=`atoi $IP`
let "i=$i^(1<<(32-$CIDR))"
NEWIP=`itoa i`
Hi guys. There is a problem that KVM dose not get IP. This is the scenario: As you know KVM gets ip from
dnsmasq
and dhcp packets comes from br0 to dnsmasq. Now if the IP of br0 interface dose not exist in range of the lease dnsmasq gives kvm, dnsmasq dose not release the lease. read hereAnd also as you know there is a algorithm in
startvm
script which generates an IP for br0. Now the problem is that the generated IP sometimes is not in the range of KVM IP.Look this is the code which generates IP for br0:
And this little change fixes anything:
Let me know if I am correct :)