I want to use libvirt network NAT configuration.

libvirt says https://wiki.libvirt.org/page/Virtual_network_%22default%22_has_not_been_started:

"1) If you're not actually using dnsmasq on the physical machine to serve DHCP for the physical network, you should just disable dnsmasq completely"

that corresponds to my context, so I stop and disable dnsmasq in the host system.

in qemu system:

virsh # net-edit default



<forward mode='nat'>


<port start='1024' end='65535'/>



<bridge name='virbr0' stp='on' delay='0'/>

<mac address='52:54:00:06:86:de'/>

<domain name='circus.net'/>

<ip address='' netmask=''>


<range start='' end=''/>




I start default network:

virsh # net-start default
Network default started

virsh # net-list
Name State Autostart Persistent
default active no yes

I start guests S0 and S1

virsh # start S0
Domain S0 started

virsh # start S1
Domain S1 started

virsh # list
Id Name State
1 S0 running
2 S1 running

but DHCP does not seem to work:

virsh # net-dhcp-leases default
Expiry Time MAC address Protocol IP address Hostname Client ID or DUID

on the host machine:

ping: S1: Name or service not known

what I have tried:

in virt-manager

hostnamectl set-hostname server1
hostnamectl set-hostname server0

virsh # shutdown S0
virsh # shutdown S1
virsh # net-destroy default

on the host:

tcpdump -i virbr0

in qemu:

virsh # net-start default
virsh # start S0
virsh # start S1

tcpdump does not see anything coming to virbr0

my question is: how to have DHCP working in this case?

additional questions:

1.it is said, in libvirt, nat conf should work out ot the box (default conf), nothing to do. what does 'out of the box' mean exactly? both S1 and S0 here have,by default, FQDN set to localhost.localdomain , so how libvirt DHCP make the distinction between S0 & S1?

2.If I want to customize my dnsmasq config (for instance, sthg like log-facility=/var/log/dnsmasq.log), where is the conf file? not in /etc/dnsmasq.conf or in /etc/dnsmasq.d/anyname.conf as dnsmasq does not work on the host?

  • What do you mean that you "stop and disable dnsmasq in the host system" ? Exactly what did you do? Aug 25, 2020 at 2:08

1 Answer 1


I had the same issue on a Debian system and am posting a solution in case it helps, or if anyone can improve on it that would be great :)

Host-to-guest connectivity works after adding the following to the guest domain XML file:

<interface type='bridge'>
  <source bridge='virbr0'/>
  <model type='virtio'/>

That created a previously unseen network interface in the guest system. Then I ran dhclient on the interface inside the guest VM and it got a 192.168.122.x address with ports accessible to the host system.

  • For whatever reason RTL8139 driver / device type was used in my case. Most of the time, when having random network issues, switching to virtio driver helps. Sep 15, 2021 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.