[libvirt] Making DHCP leases available to local DNS server through dnsmasq

jean-christophe manciot actionmystique at gmail.com
Sat Jun 10 18:53:16 UTC 2017


Hello everyone,

I have multiple virtual networks defined on my Server:
# virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     yes           yes
...
 virtual-mgt-5        active     yes           yes
 ...

When a VM is started on one of them with an interface which needs the
dnsmasq DHCP server to get its IP address/len, it remains inaccessible with
the FQDN once the IP information is acquired.

The default values are used for each dnsmasq instance:
● libvirtd.service - Virtualization daemon
   Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor
preset: enabled)
   Active: active (running) since Sat 2017-06-10 19:48:58 CEST; 3ms ago
     Docs: man:libvirtd(8)
           http://libvirt.org
 Main PID: 25365 (libvirtd)
    Tasks: 35 (limit: 4915)
   Memory: 27.1M
      CPU: 28ms
   CGroup: /system.slice/libvirtd.service
           ├─22262 /usr/sbin/dnsmasq
--conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro
--dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
           ├─22263 /usr/sbin/dnsmasq
--conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro
--dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
...
           ├─24061 /usr/sbin/dnsmasq
--conf-file=/var/lib/libvirt/dnsmasq/virtual-mgt-5.conf --leasefile-ro
--dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
           ├─24062 /usr/sbin/dnsmasq
--conf-file=/var/lib/libvirt/dnsmasq/virtual-mgt-5.conf --leasefile-ro
--dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
...
           ├─25365 /usr/sbin/libvirtd
           └─25384 /usr/sbin/dnsmasq --help

I wonder whether the option "--leasefile-ro" gets in the way or not: there
must be a key=value in /etc/libvirt/qemu/networks/<virtual_network>.xml to
enable this behavior, but could not find it in the Network XML format
<https://libvirt.org/formatnetwork.html>.

The contents of my XML file are:
<network ipv6='yes'>
  <name>virtual-mgt-5</name>
  <uuid>193ac2c9-13fc-44a6-83f8-477790f1f470</uuid>
  <forward mode='route'/>
  <bridge name='virbr5' stp='on' delay='0'/>
  <mac address='52:54:00:b9:ea:63'/>
  <domain name='actionmystique.net'/>
  <ip address='172.21.0.1' netmask='255.255.0.0'>
    <dhcp>
      <range start='172.21.0.1' end='172.21.255.254'/>
    </dhcp>
  </ip>
  <ip family='ipv6' address='fc21::1' prefix='64'>
    <dhcp>
      <range start='fc21::1' end='fc21::fffe'/>
    </dhcp>
  </ip>
</network>

Any suggestion?
-- 
Jean-Christophe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170610/ce28f240/attachment-0001.htm>


More information about the libvir-list mailing list