Libvirt does indeed use DNSMasq to handle DHCP. If you're trying to do some advanced configs with DNSMasq, you need to make sure Libvirt is not interfering (removing the DHCP option from your config would work).
Your actual issue appears to be caused by the 'listen-address' statement. DNSMasq requires a valid IP address in the subnet you're trying to assign to. You should configure it to use an IP in the 192.168.122.0/24 range. If you don't do this, it won't actually be able to assign any IP addresses.
If a forwarder is configured, dnsmasq will forward all DNS queries that it has no explicit data for. This includes records for configured static DHCP clients that have no active lease, AAAA records unless IPv6 addresses are defined explicitly, and more.
There are several ways to avoid this:
Don't configure a forwarder
Simply omit the fowarder entries in the network definition. Probably not desirable, unless the virtual network is really isolated. This is the only possibility that libvirt currently supports (12/2014), AFAIK.
local domain in dnsmasq.conf
Configure the domain as "local" in dnsmasq:
domain=local.net,192.168.10.0/24
local=/local.net/
local=/10.168.192.in-addr.arpa/
In theory, this could be abbreviated as domain=local.net,192.168.10.0/24,local
, but a dnsmasq bug fixed only recently causes this to fail.
libvirt doesn't support this. In order to use this configuration, you need to set up the bridge manually in your OS and configure the libvirt network like this:
<network>
<name>local</name>
<forward mode='bridge'/>
<bridge name='br0'/>
</network>
You don't have to create a libvirt virtual network at all in this configuration, just use <interface 'type=bridge'>
in your VM definition files.
auth zone in dnsmasq.conf
The auth-zone
parameter has a similar effect to local
. However it has other implications that I don't claim to fully understand. I suppose this configuration would be desirable if names in the virtual network are supposed to be resolved from the outside.
domain=local.net
auth-zone=local.net
This setup isn't supported by libvirt either, so the same procedure for setting up the bridge must be applied as above.
Best Answer
In the libvirt >= 1.2.14, it is possible to query libvirt to ask for the IP addresses that have been assigned to a guest NIC, avoiding the need to setup static IP addresses. e.g.
I'm not sure if that's any use to you though, since you mention libvirt 0.10.0
If you have >= 1.2.10 there's a less direct way to get the info by querying the DHCP lease database
you then have to manually map the MAC address to the domain you're interested in - the 'domifaddr' command just does that mapping for you.
Prior to 1.2.10, there's no way to get this info via the libvirt API at all - you'd have to poke around in the dnsmasq leases file directly.