On Ubuntu 17.04 with libvirt 3.0.0

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 "virtual-mgt-5" with an interface which needs the dnsmasq DHCP server to get its IP address/subnet length, it remains inaccessible through its FQDN once the IP information is acquired.

The default values are used for each dnsmasq instance:

systemctl status libvirtd
● 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)
 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 may be a key=value in /etc/libvirt/qemu/networks/virtual-mgt-5.xml to enable this behavior, but I could not find it in the Network XML format.

The contents of the corresponding XML file are:

virsh net-edit virtual-mgt-5

<network ipv6='yes'>
  <forward mode='route'/>
  <bridge name='virbr5' stp='on' delay='0'/>
  <mac address='52:54:00:b9:ea:63'/>
  <domain name='actionmystique.net'/>
  <ip address='' netmask=''>
      <range start='' end=''/>
  <ip family='ipv6' address='fc21::1' prefix='64'>
      <range start='fc21::1' end='fc21::fffe'/>

Any suggestion?

1 Answer 1


Libvirt provides two 'nss' modules that can enable name resolution for guests. The 'libvirt' module resolves hostnames (defined in the network XML) to IP addrs. The 'libvirt-guest' module takes a slightly different approach, resolving the guest domain name, instead of hostname, to IP addresses. The latter means you don't need to add hostnames to the network XML - you can just virsh start myguest && ssh myguest


  • Make sure your user can access system's VMs, e.g. that virsh list works. This did not work for me, as Fedora does not set export LIBVIRT_DEFAULT_URI=qemu:///system. As I fixed that, virsh list listed the VM, and the libvirt/libvirt_guests entries in nsswitch.conf started working, i.e. ssh root@some_vm worked.
    – neingeist
    May 30, 2022 at 18:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .