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
<name>default</name>
<uuid>b6ef8506-d4c7-4bba-9fe7-8f971ea87d10</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:06:86:de'/>
<domain name='circus.net'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.10'/>
</dhcp>
</ip>
</network>
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?