El mié., 7 oct. 2020 a las 2:22, Michael Catanzaro (<mcatanzaro@gnome.org>) escribió:

Hm, I'm not quite sure how this is intended to work. This is for
resolving VM hostnames into IP addresses? How exactly does it work
prior to systemd-resolved? E.g. lets say I have a libvirt VM named
"f33", should it be possible to resolve that name somehow from the host
system?

Can you do what you want using
https://www.freedesktop.org/wiki/Software/systemd/resolved/ ? Maybe
SetLinkDNS for the bridge interface? But you would also need to call
SetLinkDomains to ensure queries for a particular domain go to the
bridge interface (otherwise, nothing will). You could theoretically,
for instance, claim a .libvirt domain, then resolve "f33.libvirt" to
the VM's IP?

 My use case is, I have the bridge 'laptop-lab' created with libvirt:

<network>
  <name>laptop-lab</name>
  <uuid>23997a64-b242-4a32-8ef6-4e0c36e16598</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='laptop-lab' stp='on' delay='0'/>
  <mac address='52:54:00:8d:77:d9'/>
  <domain name='laptop.lab' localOnly='yes'/>
  <ip address='192.168.100.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.100.128' end='192.168.100.254'/>
    </dhcp>
  </ip>
</network>

Previously, I used dns=dnsmasq in NetworkManager to indicate that the domain 'laptop.lab' resolves through this dnsmasq instance:

/etc/NetworkManager/conf.d/00-use-dnsmasq.conf:

[main]
dns=dnsmasq

/etc/NetworkManager/dnsmasq.d/laptop_lab.conf:

server=/laptop.lab/192.168.100.1

I'd like to do something similar in systemd-resolved, and indeed this works fine:

# resolvectl dns laptop-lab 192.168.100.1
# resolvectl domain laptop-lab laptop.lab

But this configuration is lost after a reboot, and the configuration file is not expressive enough to indicate a dns and domain on a link. A way to do this automatically would be greatly appreciated, but I guess it doesn't exist at the moment.