Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-35879

Integrate support for resolvectl in virtual network startup

    • libvirt-10.3.0-1.el9
    • sst_virtualization_networking
    • ssg_virtualization
    • 16
    • 3
    • Dev ack
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • All
    • 10.1.0
    • None

      Libvirt ships an "NSS" module which can be used to enable applications on the host to connect to guests based on a name that's matching the guest name. This is great, but has some limitations

      • The libvirt-nss RPM needs to be installed, and nsswitch.conf updated
      • Not all applications use glibc's resolver pipeline, some directly do DNS queries
      • The NSS module does not respond to fully qualified names

      On machines, running systemd-resolved it is possible to have an alternative integration

      Consider a virtual network with a domain name set, and some static hostnames set

       

        <bridge name="virbr0" stp="on" delay="0"/>
        <domain name="default.com"/>
        <ip address="192.168.122.1" netmask="255.255.255.0">
          <dhcp>
          ...
            <host mac="52:54:00:fb:8b:d7" name="fedora38" ip="192.168.122.32"/>
            <host mac="52:54:00:ea:2a:33" name="fedora40" ip="192.168.122.17"/>
          </dhcp>
        </ip>

      Inside the guest VMs, 'fedora38', 'fedora38.default.com' both resolve as hostnames, thanks to the guest using dnsmasq from the host.

      On the host OS  we can achieve parity with this with two commands

      $ resolvectl domain virbr0 default.com
      $ resolvectl dns virbr0 192.168.122.1

      At which point the host ought to be able to resolve DNS names for guests in the same way that guests themselves do.

      Libvirt ought to be able to detect presence of systemd-resolved, and if so invoke resolvectl to register our local dnsmasq as the service for that NIC.

              jdenemar@redhat.com Jiri Denemark
              rhn-engineering-berrange Daniel Berrangé
              Haijiao Zhao
              Jiri Denemark Jiri Denemark
              Yanqiu Zhang Yanqiu Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: