dnsmasq(as DHCP server) isn't working in KVM+libvirt envirmont

Posted by user2681054 on Server Fault See other posts from Server Fault or by user2681054
Published on 2014-05-21T06:24:23Z Indexed on 2014/05/27 3:30 UTC
Read the original article Hit count: 529

I'm using dnsmasq as DHCP server in VM environment. But It didn't working. I disabled basic DHCP feature in libvirt.

<network>
  <name>default</name>
  <uuid>84da0678-e56d-8fc2-6f8b-e8eba784849a</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <mac address='52:54:00:7B:64:0B'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
  </ip>
</network>

As you can see, I removed this tag!

<dhcp>
  <range start='192.168.122.2' end='192.168.122.254' />
</dhcp> 

And I installed dnsmasq in Host machine. During installation dnsmasq, there was an error message about 127.0.0.1.(dnsmasq: failed to create listening socket for 127.0.0.1) So I commented out listen-address option, and added dhcp-range/dhcp-option options, like this.

listen-address=127.0.0.1
dhcp-range=192.168.122.100,192.168.122.200,24h
dhcp-option=option:router,192.168.122.1

That's all I've done with dnsmasq. But guest VM couldn't get IP address from host which is dnsmasq server running.

After that , I installed isc-dhcp-server instead of dnsmasq.... and it works! But I still want to use dnsmasq instead of isc-dhcp-server. Are there any helping hands?

  • I disabled host machine's firewall.
  • I've heard that libvirt basically use dnsmasq. Is this the reason why I couldn't use dnsmasq in libvirt environment?

© Server Fault or respective owner

Related posts about dhcp

Related posts about kvm-virtualization