Disabling DHCP on a LibVirt setup

So you have this libvirt setup and you want to have a dhcp server on the virtual machines you are playing with , or you want to have all static IP's.

Libvirt uses dnsmasq to provide dhcp services etc and when you generate a config from the gui it will look like

  1. <network>
  2. <name>piponet</name>
  3. <uuid>e87d3bf1-a2e7-96ca-e131-7ae51ac033f9</uuid>
  4. <bridge name='virbr2' stp='on' delay='0' />
  5. <ip address='192.168.100.1' netmask='255.255.255.0'>
  6. <dhcp>
  7. <range start='192.168.100.128' end='192.168.100.254' />
  8. </dhcp>
  9. </ip>
  10. </network>

If you fully remove the dhcp section, then restart libvirt you'll notice dnsmasq running with no dhcpd on that subnet so you'll have full control again :)

  1. <network>
  2. <name>piponet</name>
  3. <uuid>e87d3bf1-a2e7-96ca-e131-7ae51ac033f9</uuid>
  4. <bridge name='virbr2' stp='on' delay='0' />
  5. <ip address='192.168.100.1' netmask='255.255.255.0'>
  6. </ip>
  7. </network>

Comments

Serge van Ginderachter's picture

#1 Serge van Ginderachter : Or you could install the latest virt-manager 0.8.1

.. which support disabling dhcp :-)