I'm using libvirt and kvm to virtualize my server. I configured libvirt to start a dhcp-server on the bridge-network-interface to give the vm's their ips. Every VM's gets always the same ip based on its mac, this is configured like this:
<dhcp>
<range start='10.1.1.2' end='10.1.1.254' />
<host mac='54:52:00:21:01:ba' name='virstvm' ip='10.1.1.10' />
<host mac='00:16:36:2d:71:f9' name='secvm' ip='10.1.1.20' />
</dhcp>
The problem: Whenever I add a new host to the dhcp section I have to restart libvirt-bin which restarts all my vm's. This cant be the solution because it means a downtime every time I add a new Server. Is there a solution?
The added net-update command in virsh should allow an dhcp-host update without restarting the virtual network (I have not tested it yet).
man virsh:
The following procedure worked for me with libvirt Version: 0.7.5-5ubuntu27 on a Ubuntu 10.04.4 LTS host:
This also works for other networks beside the default network. Just replace the word default in the example with the name of the network.
@pefu's solution did it for CentOS 6.4 too!
Using
net-edit
invirsh
did not update the XML file at/var/lib/libvirt/network/default.xml
nor did it change the state of the running network config.Re-running
net-edit
showed the edited version even after a reboot but it just was not loaded!Exporting it to real XML file, editing and reloading it works!
I think libvirt uses dnsmaq for its dhcp server. Maybe you could just restart dnsmasq and all would be well?
After a diskussion on the Mailinglist I found out: this currently is not possible at all!