El mié., 7 oct. 2020 a las 10:35, Petr Menšík (<pemensik@redhat.com>) escribió:


On 10/7/20 6:44 AM, Pavel Zhukov wrote:
>
> I don't think it's a good idea.
> dnsmasq is not dns resolver but acts as DHCP and DNS server. It provides
> VMs with IP
> address/lease and create corresponding dns record for it. In case of
> resolved ip addresses and dns records must be managed either manually
> or... with dnsmasq.

That is not true. Any query sent to @192.168.122.1 would get reply. I
use for example unbound on localhost and all my machines use .vm. domain
suffix. rhel7.vm. is machine with rhel7. Dnsmasq manages automatically
lease names of all its dhcp clients, it works as dynamic DNS connected
with DHCP just out of the box.

I've created a libvirt hook to do the integration I was looking for. This works for me:

/etc/libvirt/hooks/network.d/laptop-lab.sh

#!/bin/bash
set -o nounset

object="$1"
operation="$2"
suboperation="$3"
extra="$4"

if [ "$object" == "laptop-lab" ]; then
    if [ "$operation" == "started" ] && [ "$suboperation" == "begin" ]; then
        /usr/bin/resolvectl dns laptop-lab 192.168.100.1
        /usr/bin/resolvectl domain laptop-lab laptop.lab
        /usr/bin/resolvectl dnssec laptop-lab no
    fi
fi