[libvirt] Making DHCP leases available to local DNS server through dnsmasq
Michal Privoznik
mprivozn at redhat.com
Fri Jun 16 08:49:48 UTC 2017
On 06/10/2017 08:53 PM, jean-christophe manciot wrote:
> 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 --leasefile-ro argument is added unconditionally, just like
--dhcp-script. If you want to do name translation, either have static IP
addresses and edit the hosts file, or use NSS module:
https://libvirt.org/nss.html
Michal
More information about the libvir-list
mailing list