Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Good question I figured it was just a matter of recreating the network after the changes to the network using virsh after you edited the xml file like it is with domains. But this appears to not be the case. As virsh net-dumpxml clearly shows that libvirt still has the original file cached. –  3dinfluence Jan 11 '10 at 3:42

4 Answers 4

@pefu's solution did it for CentOS 6.4 too!

Using net-edit in virsh 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!

share|improve this answer

The following procedure worked for me with libvirt Version: 0.7.5-5ubuntu27 on a Ubuntu 10.04.4 LTS host:

  virsh net-dumpxml default > default.xml

  $EDITOR default.xml

  virsh net-destroy default
  virsh net-define default.xml
  virsh net-start default

This also works for other networks beside the default network. Just replace the word default in the example with the name of the network.

share|improve this answer
    
I just tried this one. While the new network configuration did indeed take effect, all VMs lost network connectivity and needed to be rebooted. –  user1202136 Mar 5 at 10:37
    
@user1202136 : What kind of network configuration change did you perform? And what kind of VMs were you using? –  pefu Mar 6 at 7:40
    
I used Xen para-virtualized VMs. Regarding, network configuration change, I added a new static DHCP entry. –  user1202136 Mar 7 at 21:06
up vote 2 down vote accepted

After a diskussion on the Mailinglist I found out: this currently is not possible at all!

share|improve this answer

I think libvirt uses dnsmaq for its dhcp server. Maybe you could just restart dnsmasq and all would be well?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.